PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

API Reference | Functions
Low Level Functions
PDL API Reference » SMIF (Serial Memory Interface) » Functions

## General Description

The SMIF interface can be used to transmit different types of commands.

Each command has different phases: command, dummy cycles, and transmit and receive data which require separate APIs.

During the time that Slave Select line is active (LOW) the clock signal (CLK) is toggled while command information is first transferred on the data (IO) signals from the master to the slave. The clock continues to toggle during any period required for information access in the slave. The clock continues to toggle during the transfer of read data from the slave to the master or write data from the master to the slave. When the master has transferred the desired amount of data, the master drives the Slave Select line inactive (HIGH). Basic flow for read/write commands using Cy_SMIF_TransmitCommand, Cy_SMIF_TransmitData, Cy_SMIF_ReceiveData and Cy_SMIF_SendDummyCycles with a Quad SPI interface.

The sequence of the PDL functions required in a read or write transaction is: Cy_SMIF_TransmitCommand() -> Cy_SMIF_SendDummyCycles() -> Cy_SMIF_ReceiveData() / Cy_SMIF_TransmitData() -> Cy_SMIF_BusyCheck(). The address is sent as part of the Cy_SMIF_TransmitCommand() function. No separate function call is required.

## API Reference
| Low Power Callback
| The driver supports SysPm callback for Deep Sleep and Hibernate transition.

## Functions
cy_en_smif_status_t | Cy_SMIF_Init (SMIF_Type *base, cy_stc_smif_config_t const *config, uint32_t timeout, cy_stc_smif_context_t *context)
| This function initializes the SMIF block as a communication block. More...
cy_en_smif_status_t | Cy_SMIF_DllConfig (volatile SMIF_Type *base, cy_stc_smif_config_t const *config, cy_stc_smif_context_t *context)
| This function configures the DLL for use, per the SMIF configuration structure parameters. More...
void | Cy_SMIF_DeInit (SMIF_Type *base)
| This function de-initializes the SMIF block to default values. More...
void | Cy_SMIF_SetDataSelect (SMIF_Type *base, cy_en_smif_slave_select_t slaveSelect, cy_en_smif_data_select_t dataSelect)
| This function configures the data select option for a specific slave. More...
void | Cy_SMIF_SetMode (SMIF_Type *base, cy_en_smif_mode_t mode)
| Sets the mode of operation for the SMIF. More...
cy_en_smif_mode_t | Cy_SMIF_GetMode (SMIF_Type const *base)
| Reads the mode of operation for the SMIF. More...
cy_en_smif_status_t | Cy_SMIF_TransmitCommand (SMIF_Type *base, uint8_t cmd, cy_en_smif_txfr_width_t cmdTxfrWidth, uint8_t const cmdParam[], uint32_t paramSize, cy_en_smif_txfr_width_t paramTxfrWidth, cy_en_smif_slave_select_t slaveSelect, uint32_t completeTxfr, cy_stc_smif_context_t const *context)
| This function transmits a command byte followed by a parameter which is typically an address field. More...
cy_en_smif_status_t | Cy_SMIF_TransmitData (SMIF_Type *base, uint8_t const *txBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_smif_event_cb_t TxCompleteCb, cy_stc_smif_context_t *context)
| This function is used to transmit data using the SMIF interface. More...
cy_en_smif_status_t | Cy_SMIF_TransmitDataBlocking (SMIF_Type *base, uint8_t const *txBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_stc_smif_context_t const *context)
| This function implements the transmit data phase in the memory command. More...
cy_en_smif_status_t | Cy_SMIF_ReceiveData (SMIF_Type *base, uint8_t *rxBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_smif_event_cb_t RxCompleteCb, cy_stc_smif_context_t *context)
| This function implements the receive data phase in the memory command. More...
cy_en_smif_status_t | Cy_SMIF_ReceiveDataBlocking (SMIF_Type *base, uint8_t *rxBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_stc_smif_context_t const *context)
| This function implements the receive data phase in the memory command. More...
cy_en_smif_status_t | Cy_SMIF_SendDummyCycles (SMIF_Type *base, uint32_t cycles)
| This function sends dummy-clock cycles. More...
cy_en_smif_txfr_status_t | Cy_SMIF_GetTransferStatus (SMIF_Type const *base, cy_stc_smif_context_t const *context)
| This function provides the status of the transfer. More...
void | Cy_SMIF_Enable (SMIF_Type *base, cy_stc_smif_context_t *context)
| Enables the operation of the SMIF block. More...
cy_en_smif_status_t | Cy_SMIF_TransmitCommand_Ext (SMIF_Type *base, uint16_t cmd, bool isCommand2byte, cy_en_smif_txfr_width_t cmdTxfrWidth, cy_en_smif_data_rate_t cmdDataRate, uint8_t const cmdParam[], uint32_t paramSize, cy_en_smif_txfr_width_t paramTxfrWidth, cy_en_smif_data_rate_t paramDataRate, cy_en_smif_slave_select_t slaveSelect, uint32_t completeTxfr, cy_stc_smif_context_t const *context)
| This function transmits a command byte followed by a parameter which is typically an address field. More...
cy_en_smif_status_t | Cy_SMIF_TransmitData_Ext (SMIF_Type *base, uint8_t const *txBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_en_smif_data_rate_t dataDataRate, cy_smif_event_cb_t TxCmpltCb, cy_stc_smif_context_t *context)
| This function is used to transmit data using the SMIF interface. More...
cy_en_smif_status_t | Cy_SMIF_TransmitDataBlocking_Ext (SMIF_Type *base, uint8_t const *txBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_en_smif_data_rate_t dataDataRate, cy_stc_smif_context_t const *context)
| This function implements the transmit data phase in the memory command. More...
cy_en_smif_status_t | Cy_SMIF_ReceiveData_Ext (SMIF_Type *base, uint8_t *rxBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_en_smif_data_rate_t dataRate, cy_smif_event_cb_t RxCmpltCb, cy_stc_smif_context_t *context)
| This function implements the receive data phase in the memory command. More...
cy_en_smif_status_t | Cy_SMIF_ReceiveDataBlocking_Ext (SMIF_Type *base, uint8_t *rxBuffer, uint32_t size, cy_en_smif_txfr_width_t transferWidth, cy_en_smif_data_rate_t dataRate, cy_stc_smif_context_t const *context)
| This function implements the receive data phase in the memory command. More...
cy_en_smif_status_t | Cy_SMIF_SendDummyCycles_Ext (SMIF_Type *base, cy_en_smif_txfr_width_t transferWidth, cy_en_smif_data_rate_t dataRate, uint32_t cycles)
| This function sends dummy-clock cycles. More...
cy_en_smif_status_t | Cy_SMIF_SendDummyCycles_With_RWDS (SMIF_Type *base, bool read_rwds, bool refresh_indicator, uint32_t cycles)
| This function sends dummy-clock cycles and observes additional input data signal RWDS. More...
void | Cy_SMIF_DeviceTransfer_SetMergeTimeout (SMIF_Type *base, cy_en_smif_slave_select_t slave, cy_en_smif_merge_timeout_t timeout)
| This function enables merging continuous transfers over XIP so that the overhead of transferring command and address will not be there for reading consecutive addresses. More...
void | Cy_SMIF_DeviceTransfer_ClearMergeTimeout (SMIF_Type *base, cy_en_smif_slave_select_t slave)
| This function disables continuous transfer merging. More...
cy_en_smif_status_t | Cy_SMIF_Set_DelayTapSel (SMIF_Type *base, uint8_t tapSel)
| This function sets delay tap number for the SMIF master clock which is common for all memory devices connected. More...
uint8_t | Cy_SMIF_Get_DelayTapSel (SMIF_Type *base)
| This function returns delay tap number which has been set for the SMIF. More...
cy_en_smif_status_t | Cy_SMIF_Set_Sdl_DelayTapSel (SMIF_CORE_DEVICE_Type *smif_device_base, uint8_t tapSel)
| This function sets the SDL (slave clock) delay tap number for the SMIF (common for all its devices). More...
__STATIC_INLINE bool | Cy_SMIF_IsEnabled (SMIF_Type *base)
| Checks whether the SMIF block is enabled. More...
__STATIC_INLINE void | Cy_SMIF_Disable (SMIF_Type *base)
| Disables the operation of the SMIF block. More...
__STATIC_INLINE void | Cy_SMIF_SetInterruptMask (SMIF_Type *base, uint32_t interrupt)
| This function is used to set an interrupt mask for the SMIF Interrupt. More...
__STATIC_INLINE uint32_t | Cy_SMIF_GetInterruptMask (SMIF_Type const *base)
| This function is used to read an interrupt mask for the SMIF Interrupt. More...
__STATIC_INLINE uint32_t | Cy_SMIF_GetInterruptStatusMasked (SMIF_Type const *base)
| This function is used to read an active masked interrupt. More...
__STATIC_INLINE uint32_t | Cy_SMIF_GetInterruptStatus (SMIF_Type const *base)
| This function is used to read an active interrupt. More...
__STATIC_INLINE void | Cy_SMIF_SetInterrupt (SMIF_Type *base, uint32_t interrupt)
| This function is used to set an interrupt source. More...
__STATIC_INLINE void | Cy_SMIF_ClearInterrupt (SMIF_Type *base, uint32_t interrupt)
| This function is used to clear an interrupt source. More...
__STATIC_INLINE void | Cy_SMIF_SetTxFifoTriggerLevel (SMIF_Type *base, uint32_t level)
| This function is used to set a trigger level for the TX FIFO. More...
__STATIC_INLINE void | Cy_SMIF_SetRxFifoTriggerLevel (SMIF_Type *base, uint32_t level)
| This function is used to set a trigger level for the RX FIFO. More...
__STATIC_INLINE uint32_t | Cy_SMIF_GetCmdFifoStatus (SMIF_Type const *base)
| This function is used to read the status of the CMD FIFO. More...
__STATIC_INLINE uint32_t | Cy_SMIF_GetTxFifoStatus (SMIF_Type const *base)
| This function is used to read the status of the TX FIFO. More...
__STATIC_INLINE uint32_t | Cy_SMIF_GetRxFifoStatus (SMIF_Type const *base)
| This function is used to read the status of the RX FIFO. More...
cy_en_smif_status_t | Cy_SMIF_Encrypt (SMIF_Type *base, uint32_t address, uint8_t data[], uint32_t size, cy_stc_smif_context_t const *context)
| Uses the Encryption engine to create an encrypted result when the input, key and data arrays are provided. More...
__STATIC_INLINE bool | Cy_SMIF_BusyCheck (SMIF_Type const *base)
| This function provides the status of the IP block (False - not busy, True - busy). More...
__STATIC_INLINE void | Cy_SMIF_Interrupt (SMIF_Type *base, cy_stc_smif_context_t *context)
| The Interrupt Service Routine for the SMIF. More...
cy_en_smif_status_t | Cy_SMIF_CacheEnable (SMIF_Type *base, cy_en_smif_cache_t cacheType)
| This function is used to enable the fast cache, the slow cache or both. More...
cy_en_smif_status_t | Cy_SMIF_CacheDisable (SMIF_Type *base, cy_en_smif_cache_t cacheType)
| This function is used to disable the fast cache, the slow cache or both. More...
cy_en_smif_status_t | Cy_SMIF_CachePrefetchingEnable (SMIF_Type *base, cy_en_smif_cache_t cacheType)
| This function is used to enable pre-fetching for the fast cache, the slow cache or both. More...
cy_en_smif_status_t | Cy_SMIF_CachePrefetchingDisable (SMIF_Type *base, cy_en_smif_cache_t cacheType)
| This function is used to disable pre-fetching for the fast cache, the slow cache or both. More...
cy_en_smif_status_t | Cy_SMIF_CacheInvalidate (SMIF_Type *base, cy_en_smif_cache_t cacheType)
| This function is used to invalidate/clear the fast cache, the slow cache or both. More...
void | Cy_SMIF_SetCryptoKey (SMIF_Type *base, uint32_t *key)
| Sets the AES-128 encryption key into SMIF crypto registers. More...
void | Cy_SMIF_SetCryptoIV (SMIF_Type *base, uint32_t *nonce)
| Sets the 96 bit initialization vector (nonce) into SMIF crypto registers. More...
cy_en_smif_status_t | Cy_SMIF_SetCryptoEnable (SMIF_Type *base, cy_en_smif_slave_select_t slaveId)
| Enables SMIF encryption. More...
cy_en_smif_status_t | Cy_SMIF_SetCryptoDisable (SMIF_Type *base, cy_en_smif_slave_select_t slaveId)
| Disables SMIF encryption. More...
cy_en_smif_status_t | Cy_SMIF_IsCryptoEnabled (SMIF_Type *base, cy_en_smif_slave_select_t slaveId, bool *crypto_status)
| Checks the status of encryption for the selected slave device. More...
cy_en_smif_status_t | Cy_SMIF_SetCryptoKeyRegion (SMIF_Type *base, uint8_t crypto_region_index, cy_stc_smif_crypto_region_config_t *region_config)
| Configures a crypto region with specified start address, size and keys. More...
cy_en_smif_status_t | Cy_SMIF_SetCryptoSubRegionDisable (SMIF_Type *base, uint8_t crypto_region_index, uint8_t mask)
| Disable sub regions within crypto region. More...
cy_en_smif_status_t | Cy_SMIF_ConvertSlaveSlotToIndex (cy_en_smif_slave_select_t ss, uint32_t *device_idx)
| Converts Slave Select enum to the device index. More...
cy_en_smif_status_t | Cy_SMIF_SetRxCaptureMode (SMIF_Type *base, cy_en_smif_capture_mode_t mode, cy_en_smif_slave_select_t slaveId)
| This function sets the Rx Capture mode setting for SMIF IP block instance. More...
bool | Cy_SMIF_IsBridgeOn (SMIF_Base_Type *base)
cy_en_smif_status_t | Cy_SMIF_Bridge_Enable (SMIF_Base_Type *base, bool enable)
cy_en_smif_status_t | Cy_SMIF_SetMasterDLP (SMIF_Type *base, uint16 dlp, uint8_t size)
| This function sets the data learning pattern. More...
uint16_t | Cy_SMIF_GetMasterDLP (SMIF_Type *base)
| This function gets the data learning pattern configured. More...
uint8_t | Cy_SMIF_GetMasterDLPSize (SMIF_Type *base)
| This function gets the data learning pattern size configured. More...
uint8_t | Cy_SMIF_GetTapNumCapturedCorrectDLP (SMIF_Type *base, uint8_t bit)
| This function gets number of delay taps used for specified data line. More...
uint32_t | CY_SMIF_GetDelayTapsNumber (volatile void *base)
| This function returns tap number which the SMIF IP has. More...
cy_en_smif_status_t | Cy_SMIF_InitCache (SMIF_CACHE_BLOCK_Type *base, const cy_stc_smif_cache_config_t *cache_config)
| This function initializes SMIF internal CACHE with user provided configuration cy_stc_smif_cache_config_t. More...
cy_en_smif_status_t | Cy_SMIF_Clean_All_Cache (SMIF_CACHE_BLOCK_Type *base)
| This function cleans complete SMIF internal CACHE. More...
cy_en_smif_status_t | Cy_SMIF_Invalidate_All_Cache (SMIF_CACHE_BLOCK_Type *base)
| This function invalidates complete SMIF internal CACHE. More...
cy_en_smif_status_t | Cy_SMIF_Clean_And_Invalidate_All_Cache (SMIF_CACHE_BLOCK_Type *base)
| This function cleans and invalidates complete SMIF internal CACHE. More...
cy_en_smif_status_t | Cy_SMIF_Clean_Cache_by_Addr (SMIF_CACHE_BLOCK_Type *base, bool is_secure_view, uint32_t address, uint32_t size)
| This function cleans cache using the address and size specified by user. More...
cy_en_smif_status_t | Cy_SMIF_Invalidate_Cache_by_Addr (SMIF_CACHE_BLOCK_Type *base, bool is_secure_view, uint32_t address, uint32_t size)
| This function invalidates cache using the address and size specified by user. More...
cy_en_smif_status_t | Cy_SMIF_Clean_And_Invalidate_Cache_by_Addr (SMIF_CACHE_BLOCK_Type *base, bool is_secure_view, uint32_t address, uint32_t size)
| This function cleans and invalidates cache using the address and size specified by user. More...
cy_en_smif_status_t | Cy_SMIF_IsCacheEnabled (SMIF_CACHE_BLOCK_Type *base, bool *cache_status)
| This function checks whether Cache is enabled or not. More...

## Function Documentation

## ◆ Cy_SMIF_Init()

cy_en_smif_status_t Cy_SMIF_Init | ( | SMIF_Type * | base,
|  | cy_stc_smif_config_t const * | config,
|  | uint32_t | timeout,
|  | cy_stc_smif_context_t * | context
| ) |  |

This function initializes the SMIF block as a communication block.

The user must ensure that the SMIF interrupt is disabled while this function is called. Enabling the interrupts can lead to triggering in the middle of the initialization operation, which can lead to erroneous initialization.

As parameters, this function takes the SMIF register base address and a context structure along with the configuration needed for the SMIF block, stored in a config.

Parameters

  base | Holds the base address of the SMIF block registers.
  config | Passes a configuration structure that configures the SMIF block for operation.
  timeout | A timeout in microseconds for blocking APIs in use.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Note
  Make sure that the interrupts are initialized and disabled.

Returns
  - CY_SMIF_BAD_PARAM
  - CY_SMIF_SUCCESS

## ◆ Cy_SMIF_DllConfig()

cy_en_smif_status_t Cy_SMIF_DllConfig | ( | volatile SMIF_Type * | base,
|  | cy_stc_smif_config_t const * | config,
|  | cy_stc_smif_context_t * | context
| ) |  |

This function configures the DLL for use, per the SMIF configuration structure parameters.

Parameters

  base | Holds the base address of the SMIF block registers.
  config | Passes a configuration structure that configures the SMIF block for operation, here specifically it is used to configure the DLL.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  - CY_SMIF_BAD_PARAM
  - CY_SMIF_SUCCESS

Note
  The SMIF must be disabled before calling the function. Call Cy_SMIF_Disable

## ◆ Cy_SMIF_DeInit()

void Cy_SMIF_DeInit | ( | SMIF_Type * | base | ) |

This function de-initializes the SMIF block to default values.

Parameters

  base | Holds the base address of the SMIF block registers.

Note
  The SMIF must be disabled before calling the function. Call Cy_SMIF_Disable

## ◆ Cy_SMIF_SetDataSelect()

void Cy_SMIF_SetDataSelect | ( | SMIF_Type * | base,
|  | cy_en_smif_slave_select_t | slaveSelect,
|  | cy_en_smif_data_select_t | dataSelect
| ) |  |

This function configures the data select option for a specific slave.

The selection provides pre-set combinations for connecting the SMIF data lines to the GPIOs.

Parameters

  base | Holds the base address of the SMIF block registers.
  slaveSelect | The slave device ID. This number is either CY_SMIF_SLAVE_SELECT_0 or CY_SMIF_SLAVE_SELECT_1 or CY_SMIF_SLAVE_SELECT_2 or CY_SMIF_SLAVE_SELECT_3 (cy_en_smif_slave_select_t). It defines the slave select line to be used during the transmission.
  dataSelect | This parameter selects the data select option. cy_en_smif_data_select_t

## ◆ Cy_SMIF_SetMode()

void Cy_SMIF_SetMode | ( | SMIF_Type * | base,
|  | cy_en_smif_mode_t | mode
| ) |  |

Sets the mode of operation for the SMIF.

The mode of operation can be the XIP mode where the slave devices are mapped as memories and are directly accessed from the PSoC register map. In the MMIO mode, the SMIF block acts as a simple SPI engine. MMIO mode and XIP modes are mutually exclusive. SMIF IP Version 3 and above support MMIO mode transactions even when XIP mode is enabled. However, user has to ensure that XIP transaction is not issued during an ongoing MMIO transaction. Rather wait for MMIO transaction to complete since few MMIO operations make external flash busy and it cannot respond to XIP read transaction.

Note
  With SMIF V1 IP, Interrupt and triggers are not working in XIP mode, see TRM for details

Parameters

  base | Holds the base address of the SMIF block registers.
  mode | The mode of the SMIF operation.

## ◆ Cy_SMIF_GetMode()

cy_en_smif_mode_t Cy_SMIF_GetMode | ( | SMIF_Type const * | base | ) |

Reads the mode of operation for the SMIF.

The mode of operation can be the XIP mode where the slave devices are mapped as memories and are directly accessed from the PSoC register map. In the MMIO mode, the SMIF block acts as a simple SPI engine.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  The mode of SMIF operation (see cy_en_smif_mode_t).

## ◆ Cy_SMIF_TransmitCommand()

cy_en_smif_status_t Cy_SMIF_TransmitCommand | ( | SMIF_Type * | base,
|  | uint8_t | cmd,
|  | cy_en_smif_txfr_width_t | cmdTxfrWidth,
|  | uint8_t const | cmdParam[],
|  | uint32_t | paramSize,
|  | cy_en_smif_txfr_width_t | paramTxfrWidth,
|  | cy_en_smif_slave_select_t | slaveSelect,
|  | uint32_t | completeTxfr,
|  | cy_stc_smif_context_t const * | context
| ) |  |

This function transmits a command byte followed by a parameter which is typically an address field.

The transfer is implemented using the TX FIFO. This function also asserts the slave select line. A command to a memory device generally starts with a command byte transmission. This function sets up the slave lines for the rest of the command structure. The Cy_SMIF_TransmitCommand is called before Cy_SMIF_TransmitData or Cy_SMIF_ReceiveData is called. When enabled, the completeTxfr parameter in the function will de-assert the slave select line at the end of the function execution.

Note
  This function blocks until all the command and associated parameters have been transmitted over the SMIF block or timeout expire.

Parameters

  base | Holds the base address of the SMIF block registers.
  cmd | The command byte to be transmitted.
  cmdTxfrWidth | The width of command byte transfer cy_en_smif_txfr_width_t.
  cmdParam | This is the pointer to an array that has bytes to be transmitted after the command byte. Typically, this field has the address bytes associated with the memory command.
  paramSize | The size of the cmdParam array.
  paramTxfrWidth | The width of parameter transfer cy_en_smif_txfr_width_t.
  slaveSelect | Denotes the number of the slave device to which the transfer is made. (0, 1, 2 or 4 - the bit defines which slave to enable) Two-bit enable is possible only for the double quad SPI mode.
  completeTxfr | Specifies if the slave select line must be de-asserted after transferring the last byte in the parameter array. Typically, this field is set to 0 when this function succeed through Cy_SMIF_TransmitData or Cy_SMIF_ReceiveData.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of the command transmit.
  - CY_SMIF_SUCCESS
  - CY_SMIF_EXCEED_TIMEOUT

Note
  Check Rules for SMIF Block Usage for any usage restriction

## ◆ Cy_SMIF_TransmitData()

cy_en_smif_status_t Cy_SMIF_TransmitData | ( | SMIF_Type * | base,
|  | uint8_t const * | txBuffer,
|  | uint32_t | size,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_smif_event_cb_t | TxCompleteCb,
|  | cy_stc_smif_context_t * | context
| ) |  |

This function is used to transmit data using the SMIF interface.

This function uses the TX Data FIFO to implement the transmit functionality. The function sets up an interrupt to trigger the TX Data FIFO and uses that interrupt to fill the TX Data FIFO until all the data is transmitted. At the end of the transmission, the TxCompleteCb is executed.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand where the slave select is selected. The slave is de-asserted at the end of a transmit. The function triggers the transfer and the transfer itself utilizes the interrupt for FIFO operations in the background. Thus, frequent interrupts will be executed after this function is triggered. Since this API is non-blocking and sets up the interrupt to act on the data FIFO, ensure there will be no another instance of the function called before the current instance has completed execution.

Parameters

  base | Holds the base address of the SMIF block registers.
  txBuffer | The pointer to the data to be transferred. If this pointer is a NULL, then the function does not enable the interrupt. This use case is typically used when the FIFO is handled outside the interrupt and is managed in either a polling-based code or a DMA. The user would handle the FIFO management in a DMA or a polling-based code.

Note
  If the user provides a NULL pointer in this function and does not handle the FIFO transaction, this could either stall or timeout the operation. The transfer statuses returned by Cy_SMIF_GetTransferStatus are no longer valid.

Parameters

  size | The size of txBuffer. Must be > 0 and not greater than 65536.
  transferWidth | The width of transfer cy_en_smif_txfr_width_t.
  TxCompleteCb | The callback executed at the end of a transmission. NULL interpreted as no callback.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of a transmission.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL

## ◆ Cy_SMIF_TransmitDataBlocking()

cy_en_smif_status_t Cy_SMIF_TransmitDataBlocking | ( | SMIF_Type * | base,
|  | uint8_t const * | txBuffer,
|  | uint32_t | size,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_stc_smif_context_t const * | context
| ) |  |

This function implements the transmit data phase in the memory command.

The data is transmitted using the Tx Data FIFO and the TX_COUNT command. This function blocks until completion. The function does not use the interrupts and will use CPU to monitor the FIFO status and move data accordingly. The function returns only on completion.

Note
  Since this API is blocking, ensure that other transfers finished and it will not be called during non-blocking transfer.

Parameters

  base | Holds the base address of the SMIF block registers.
  txBuffer | The pointer to the data to be transferred. If this pointer is a NULL, then the function does not fill TX_FIFO. The user would handle the FIFO management in a DMA or a polling-based code.

Note
  If the user provides a NULL pointer in this function and does not handle the FIFO transaction, this could either stall or timeout the operation. The transfer statuses returned by Cy_SMIF_GetTransferStatus are no longer valid.

Parameters

  size | The size of txBuffer. Must be > 0 and not greater than 65536.
  transferWidth | The width of transfer cy_en_smif_txfr_width_t.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of a transmission.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_EXCEED_TIMEOUT
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_ReceiveData()

cy_en_smif_status_t Cy_SMIF_ReceiveData | ( | SMIF_Type * | base,
|  | uint8_t * | rxBuffer,
|  | uint32_t | size,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_smif_event_cb_t | RxCompleteCb,
|  | cy_stc_smif_context_t * | context
| ) |  |

This function implements the receive data phase in the memory command.

The data is received into the RX Data FIFO using the RX_COUNT command. This function sets up the interrupt to trigger on the RX Data FIFO level, and the data is fetched from the RX Data FIFO to the rxBuffer as it gets filled. This function does not block until completion. The completion will trigger the call back function.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand. The slave select is de-asserted at the end of the receive. The function triggers the transfer and the transfer itself utilizes the interrupt for FIFO operations in the background. Thus, frequent interrupts will be executed after this function is triggered. This API is non-blocking and sets up the interrupt to act on the data FIFO, ensure there will be no another instance of the function called before the current instance has completed execution.

Parameters

  base | Holds the base address of the SMIF block registers.
  rxBuffer | The pointer to the variable where the receive data is stored. If this pointer is a NULL, then the function does not enable the interrupt. This use case is typically used when the FIFO is handled outside the interrupt and is managed in either a polling-based code or a DMA. The user would handle the FIFO management in a DMA or a polling-based code.

Note
  If the user provides a NULL pointer in this function and does not handle the FIFO transaction, this could either stall or timeout the operation. The transfer statuses returned by Cy_SMIF_GetTransferStatus are no longer valid.

Parameters

  size | The size of data to be received. Must be > 0 and not greater than 65536.
  transferWidth | The width of transfer cy_en_smif_txfr_width_t.
  RxCompleteCb | The callback executed at the end of a reception. NULL interpreted as no callback.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of a reception.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_BAD_PARAM

Note
  Check Rules for SMIF Block Usage for any usage restriction

## ◆ Cy_SMIF_ReceiveDataBlocking()

cy_en_smif_status_t Cy_SMIF_ReceiveDataBlocking | ( | SMIF_Type * | base,
|  | uint8_t * | rxBuffer,
|  | uint32_t | size,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_stc_smif_context_t const * | context
| ) |  |

This function implements the receive data phase in the memory command.

The data is received into the RX Data FIFO using the RX_COUNT command. This function blocks until completion. The function does not use the interrupts and will use CPU to monitor the FIFO status and move data accordingly. The function returns only on completion.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand. The slave select is de-asserted at the end of the receive. Ensure there is no another transfers.

Parameters

  base | Holds the base address of the SMIF block registers.
  rxBuffer | The pointer to the variable where the receive data is stored. If this pointer is a NULL, then the function does not enable the interrupt. This use case is typically used when the FIFO is handled outside the interrupt and is managed in either a polling-based code or a DMA. The user would handle the FIFO management in a DMA or a polling-based code.

Note
  If the user provides a NULL pointer in this function and does not handle the FIFO transaction, this could either stall or timeout the operation. The transfer statuses returned by Cy_SMIF_GetTransferStatus are no longer valid.

Parameters

  size | The size of data to be received. Must be > 0 and not greater than 65536.
  transferWidth | The width of transfer cy_en_smif_txfr_width_t.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of a reception.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_EXCEED_TIMEOUT
  - CY_SMIF_BAD_PARAM

Note
  Check Rules for SMIF Block Usage for any usage restriction

## ◆ Cy_SMIF_SendDummyCycles()

cy_en_smif_status_t Cy_SMIF_SendDummyCycles | ( | SMIF_Type * | base,
|  | uint32_t | cycles
| ) |  |

This function sends dummy-clock cycles.

The data lines are tri-stated during the dummy cycles.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand.

Parameters

  base | Holds the base address of the SMIF block registers.
  cycles | The number of dummy cycles. Must be > 0 and not greater than 65536.

Returns
  A status of dummy cycles sending.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_GetTransferStatus()

cy_en_smif_txfr_status_t Cy_SMIF_GetTransferStatus | ( | SMIF_Type const * | base,
|  | cy_stc_smif_context_t const * | context
| ) |  |

This function provides the status of the transfer.

This function is used to poll for the status of the TransmitData or receiveData function. When this function is called to determine the status of ongoing Cy_SMIF_ReceiveData() or Cy_SMIF_TransmitData(), the returned status is only valid if the functions passed a non-NULL buffer to transmit or receive respectively. If the pointer passed to Cy_SMIF_ReceiveData() or Cy_SMIF_TransmitData() is a NULL, then the code/DMA outside this driver will take care of the transfer and the Cy_GetTxfrStatus() will return an erroneous result.

Parameters

  base | Holds the base address of the SMIF block registers.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  Returns the transfer status. cy_en_smif_txfr_status_t

## ◆ Cy_SMIF_Enable()

void Cy_SMIF_Enable | ( | SMIF_Type * | base,
|  | cy_stc_smif_context_t * | context
| ) |  |

Enables the operation of the SMIF block.

Note
  This function only enables the SMIF IP. The interrupts associated with the SMIF will need to be separately enabled using the interrupt driver.

Parameters

  base | Holds the base address of the SMIF block registers.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

## ◆ Cy_SMIF_TransmitCommand_Ext()

cy_en_smif_status_t Cy_SMIF_TransmitCommand_Ext | ( | SMIF_Type * | base,
|  | uint16_t | cmd,
|  | bool | isCommand2byte,
|  | cy_en_smif_txfr_width_t | cmdTxfrWidth,
|  | cy_en_smif_data_rate_t | cmdDataRate,
|  | uint8_t const | cmdParam[],
|  | uint32_t | paramSize,
|  | cy_en_smif_txfr_width_t | paramTxfrWidth,
|  | cy_en_smif_data_rate_t | paramDataRate,
|  | cy_en_smif_slave_select_t | slaveSelect,
|  | uint32_t | completeTxfr,
|  | cy_stc_smif_context_t const * | context
| ) |  |

This function transmits a command byte followed by a parameter which is typically an address field.

The transfer is implemented using the TX FIFO. This function also asserts the slave select line. A command to a memory device generally starts with a command byte transmission. This function sets up the slave lines for the rest of the command structure. The Cy_SMIF_TransmitCommand_Ext is called before Cy_SMIF_TransmitData_Ext or Cy_SMIF_ReceiveData_Ext is called. When enabled, the completeTxfr parameter in the function will de-assert the slave select line at the end of the function execution.

Note
  This function blocks until all the command and associated parameters have been transmitted over the SMIF block or timeout expire.

Parameters

  base | Holds the base address of the SMIF block registers.
  cmd | The command byte to be transmitted.
  isCommand2byte | isCommand2byte
  cmdTxfrWidth | The width of command byte transfer cy_en_smif_txfr_width_t.
  cmdDataRate | cmdDataRate
  cmdParam | This is the pointer to an array that has bytes to be transmitted after the command byte. Typically, this field has the address bytes associated with the memory command.
  paramSize | The size of the cmdParam array.
  paramTxfrWidth | The width of parameter transfer cy_en_smif_txfr_width_t.
  paramDataRate | paramDataRate
  slaveSelect | Denotes the number of the slave device to which the transfer is made. (0, 1, 2 or 4 - the bit defines which slave to enable) Two-bit enable is possible only for the Double Quad SPI mode.
  completeTxfr | Specifies if the slave select line must be de-asserted after transferring the last byte in the parameter array. Typically, this field is set to 0 when this function succeed through Cy_SMIF_TransmitData_Ext or Cy_SMIF_ReceiveData_Ext.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of the command transmit.
  - CY_SMIF_SUCCESS
  - CY_SMIF_EXCEED_TIMEOUT

## ◆ Cy_SMIF_TransmitData_Ext()

cy_en_smif_status_t Cy_SMIF_TransmitData_Ext | ( | SMIF_Type * | base,
|  | uint8_t const * | txBuffer,
|  | uint32_t | size,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_en_smif_data_rate_t | dataDataRate,
|  | cy_smif_event_cb_t | TxCmpltCb,
|  | cy_stc_smif_context_t * | context
| ) |  |

This function is used to transmit data using the SMIF interface.

This function uses the TX Data FIFO to implement the transmit functionality. The function sets up an interrupt to trigger the TX Data FIFO and uses that interrupt to fill the TX Data FIFO until all the data is transmitted. At the end of the transmission, the TxCmpltCb is executed.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand_Ext where the slave select is selected. The slave is de-asserted at the end of a transmit. The function triggers the transfer and the transfer itself utilizes the interrupt for FIFO operations in the background. Thus, frequent interrupts will be executed after this function is triggered. Since this API is non-blocking and sets up the interrupt to act on the data FIFO, ensure there will be no another instance of the function called before the current instance has completed execution.

Parameters

  base | Holds the base address of the SMIF block registers.
  txBuffer | The pointer to the data to be transferred. If this pointer is a NULL, then the function does not enable the interrupt. This use case is typically used when the FIFO is handled outside the interrupt and is managed in either a polling-based code or a DMA. The user would handle the FIFO management in a DMA or a polling-based code.

Note
  If the user provides a NULL pointer in this function and does not handle the FIFO transaction, this could either stall or timeout the operation. The transfer statuses returned by Cy_SMIF_GetTransferStatus are no longer valid.

Parameters

  size | The size of txBuffer. Must be > 0 and not greater than 65536.
  transferWidth | The width of transfer cy_en_smif_txfr_width_t.
  dataDataRate | dataDataRate
  TxCmpltCb | The callback executed at the end of a transmission. NULL interpreted as no callback.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of a transmission.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL

## ◆ Cy_SMIF_TransmitDataBlocking_Ext()

cy_en_smif_status_t Cy_SMIF_TransmitDataBlocking_Ext | ( | SMIF_Type * | base,
|  | uint8_t const * | txBuffer,
|  | uint32_t | size,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_en_smif_data_rate_t | dataDataRate,
|  | cy_stc_smif_context_t const * | context
| ) |  |

This function implements the transmit data phase in the memory command.

The data is transmitted using the Tx Data FIFO and the TX_COUNT command. This function blocks until completion. The function does not use the interrupts and will use CPU to monitor the FIFO status and move data accordingly. The function returns only on completion.

Note
  Since this API is blocking, ensure that other transfers finished and it will not be called during non-blocking transfer.

Parameters

  base | Holds the base address of the SMIF block registers.
  txBuffer | The pointer to the data to be transferred. If this pointer is a NULL, then the function does not fill TX_FIFO. The user would handle the FIFO management in a DMA or a polling-based code.

Note
  If the user provides a NULL pointer in this function and does not handle the FIFO transaction, this could either stall or timeout the operation. The transfer statuses returned by Cy_SMIF_GetTransferStatus are no longer valid.

Parameters

  size | The size of txBuffer. Must be > 0 and not greater than 65536.
  transferWidth | The width of transfer cy_en_smif_txfr_width_t.
  dataDataRate | dataDataRate
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of a transmission.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_EXCEED_TIMEOUT
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_ReceiveData_Ext()

cy_en_smif_status_t Cy_SMIF_ReceiveData_Ext | ( | SMIF_Type * | base,
|  | uint8_t * | rxBuffer,
|  | uint32_t | size,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_en_smif_data_rate_t | dataRate,
|  | cy_smif_event_cb_t | RxCmpltCb,
|  | cy_stc_smif_context_t * | context
| ) |  |

This function implements the receive data phase in the memory command.

The data is received into the RX Data FIFO using the RX_COUNT command. This function sets up the interrupt to trigger on the RX Data FIFO level, and the data is fetched from the RX Data FIFO to the rxBuffer as it gets filled. This function does not block until completion. The completion will trigger the call back function.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand. The slave select is de-asserted at the end of the receive. The function triggers the transfer and the transfer itself utilizes the interrupt for FIFO operations in the background. Thus, frequent interrupts will be executed after this function is triggered. This API is non-blocking and sets up the interrupt to act on the data FIFO, ensure there will be no another instance of the function called before the current instance has completed execution.

Parameters

  base | Holds the base address of the SMIF block registers.
  rxBuffer | The pointer to the variable where the receive data is stored. If this pointer is a NULL, then the function does not enable the interrupt. This use case is typically used when the FIFO is handled outside the interrupt and is managed in either a polling-based code or a DMA. The user would handle the FIFO management in a DMA or a polling-based code.

Note
  If the user provides a NULL pointer in this function and does not handle the FIFO transaction, this could either stall or timeout the operation. The transfer statuses returned by Cy_SMIF_GetTransferStatus are no longer valid.

Parameters

  size | The size of data to be received. Must be > 0 and not greater than 65536.
  transferWidth | The width of transfer cy_en_smif_txfr_width_t.
  dataRate | dataRate
  RxCmpltCb | The callback executed at the end of a reception. NULL interpreted as no callback.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of a reception.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_BAD_PARAM

Note
  Check Rules for SMIF Block Usage for any usage restriction

## ◆ Cy_SMIF_ReceiveDataBlocking_Ext()

cy_en_smif_status_t Cy_SMIF_ReceiveDataBlocking_Ext | ( | SMIF_Type * | base,
|  | uint8_t * | rxBuffer,
|  | uint32_t | size,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_en_smif_data_rate_t | dataRate,
|  | cy_stc_smif_context_t const * | context
| ) |  |

This function implements the receive data phase in the memory command.

The data is received into the RX Data FIFO using the RX_COUNT command. This function blocks until completion. The function does not use the interrupts and will use CPU to monitor the FIFO status and move data accordingly. The function returns only on completion.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand. The slave select is de-asserted at the end of the receive. Ensure there is no another transfers.

Parameters

  base | Holds the base address of the SMIF block registers.
  rxBuffer | The pointer to the variable where the receive data is stored. If this pointer is a NULL, then the function does not enable the interrupt. This use case is typically used when the FIFO is handled outside the interrupt and is managed in either a polling-based code or a DMA. The user would handle the FIFO management in a DMA or a polling-based code.

Note
  If the user provides a NULL pointer in this function and does not handle the FIFO transaction, this could either stall or timeout the operation. The transfer statuses returned by Cy_SMIF_GetTransferStatus are no longer valid.

Parameters

  size | The size of data to be received. Must be > 0 and not greater than 65536.
  transferWidth | The width of transfer cy_en_smif_txfr_width_t.
  dataRate | dataRate
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of a reception.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_EXCEED_TIMEOUT
  - CY_SMIF_BAD_PARAM

Note
  Check Rules for SMIF Block Usage for any usage restriction

## ◆ Cy_SMIF_SendDummyCycles_Ext()

cy_en_smif_status_t Cy_SMIF_SendDummyCycles_Ext | ( | SMIF_Type * | base,
|  | cy_en_smif_txfr_width_t | transferWidth,
|  | cy_en_smif_data_rate_t | dataRate,
|  | uint32_t | cycles
| ) |  |

This function sends dummy-clock cycles.

The data lines are tri-stated during the dummy cycles.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand.

Parameters

  base | Holds the base address of the SMIF block registers.
  transferWidth |
  dataRate |
  cycles | The number of dummy cycles. Must be > 0 and not greater than 65536.

Returns
  A status of dummy cycles sending.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_SendDummyCycles_With_RWDS()

cy_en_smif_status_t Cy_SMIF_SendDummyCycles_With_RWDS | ( | SMIF_Type * | base,
|  | bool | read_rwds,
|  | bool | refresh_indicator,
|  | uint32_t | cycles
| ) |  |

This function sends dummy-clock cycles and observes additional input data signal RWDS.

The data lines are tri-stated during the dummy cycles.

Note
  This function is to be preceded by Cy_SMIF_TransmitCommand_Ext.

Parameters

  base | Holds the base address of the SMIF block registers.
  read_rwds | Indicates whether it is read/write transaction. "true" in case of read. "false" in case of write.
  refresh_indicator | Dummy cycles are doubled when RWDS refresh indicator is high during CA cycle. (HyperRAM variable latency mode)
  cycles | The number of dummy cycles. Must be > 0 and not greater than 65536.

Returns
  A status of dummy cycles sending.
  - CY_SMIF_SUCCESS
  - CY_SMIF_CMD_FIFO_FULL
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_DeviceTransfer_SetMergeTimeout()

void Cy_SMIF_DeviceTransfer_SetMergeTimeout | ( | SMIF_Type * | base,
|  | cy_en_smif_slave_select_t | slave,
|  | cy_en_smif_merge_timeout_t | timeout
| ) |  |

This function enables merging continuous transfers over XIP so that the overhead of transferring command and address will not be there for reading consecutive addresses.

User can specify a timeout value to specify how long the device would be selected waiting for next incremental address read.

Parameters

  base | Holds the base address of the SMIF block registers.
  slave | Holds the slave select line for which merge should be enabled.
  timeout | (see cy_en_smif_merge_timeout_t)

Note
  External memory should also support this mode of transfer.

cy_en_smif_slave_select_t slaveSelect = CY_SMIF_SLAVE_SELECT_0;
Cy_SMIF_SetMode(SMIF, CY_SMIF_MEMORY);
Cy_SMIF_CacheEnable(SMIF, CY_SMIF_CACHE_BOTH);
Cy_SMIF_CachePrefetchingEnable(SMIF, CY_SMIF_CACHE_BOTH);
// If more than 1 cycle merge time accepted, there will be long CS# low duration when burst reading.
// It may cause error because Low/High ratio of CLK should be around 50/50 during reading because of Memory device restriction.
Cy_SMIF_DeviceTransfer_SetMergeTimeout(SMIF, slaveSelect,CY_SMIF_MERGE_TIMEOUT_1_CYCLE);
volatile CY_SMIF_FLASHDATA* pHyperFlashBaseAddr = (CY_SMIF_FLASHDATA*)(CY_XIP_BASE);
Cy_SMIF_DeviceTransfer_ClearMergeTimeout(SMIF, slaveSelect);
Cy_SMIF_CacheInvalidate(SMIF, CY_SMIF_CACHE_BOTH);
Cy_SMIF_CacheDisable(SMIF, CY_SMIF_CACHE_BOTH);
(void)pHyperFlashBaseAddr;
cy_en_smif_slave_select_t
cy_en_smif_slave_select_t
The SMIF slave select definitions for the driver API.
Definition: cy_smif.h:730
CY_SMIF_MEMORY
@ CY_SMIF_MEMORY
XIP (eXecute In Place) mode.
Definition: cy_smif.h:574
CY_SMIF_SLAVE_SELECT_0
@ CY_SMIF_SLAVE_SELECT_0
The SMIF slave select 0
Definition: cy_smif.h:731
CY_SMIF_CACHE_BOTH
@ CY_SMIF_CACHE_BOTH
The SMIF both caches.
Definition: cy_smif.h:764
Cy_SMIF_CachePrefetchingEnable
cy_en_smif_status_t Cy_SMIF_CachePrefetchingEnable(SMIF_Type *base, cy_en_smif_cache_t cacheType)
This function is used to enable pre-fetching for the fast cache, the slow cache or both.
Definition: cy_smif.c:2256
Cy_SMIF_DeviceTransfer_SetMergeTimeout
void Cy_SMIF_DeviceTransfer_SetMergeTimeout(SMIF_Type *base, cy_en_smif_slave_select_t slave, cy_en_smif_merge_timeout_t timeout)
This function enables merging continuous transfers over XIP so that the overhead of transferring comm...
Definition: cy_smif.c:2641
Cy_SMIF_CacheEnable
cy_en_smif_status_t Cy_SMIF_CacheEnable(SMIF_Type *base, cy_en_smif_cache_t cacheType)
This function is used to enable the fast cache, the slow cache or both.
Definition: cy_smif.c:2171
Cy_SMIF_DeviceTransfer_ClearMergeTimeout
void Cy_SMIF_DeviceTransfer_ClearMergeTimeout(SMIF_Type *base, cy_en_smif_slave_select_t slave)
This function disables continuous transfer merging.
Definition: cy_smif.c:2670
Cy_SMIF_CacheInvalidate
cy_en_smif_status_t Cy_SMIF_CacheInvalidate(SMIF_Type *base, cy_en_smif_cache_t cacheType)
This function is used to invalidate/clear the fast cache, the slow cache or both.
Definition: cy_smif.c:2342
Cy_SMIF_SetMode
void Cy_SMIF_SetMode(SMIF_Type *base, cy_en_smif_mode_t mode)
Sets the mode of operation for the SMIF.
Definition: cy_smif.c:354
Cy_SMIF_CacheDisable
cy_en_smif_status_t Cy_SMIF_CacheDisable(SMIF_Type *base, cy_en_smif_cache_t cacheType)
This function is used to disable the fast cache, the slow cache or both.
Definition: cy_smif.c:2213
CY_SMIF_FLASHDATA
uint32_t CY_SMIF_FLASHDATA
HyperBus Flash Data Type.
Definition: cy_smif_memslot.h:447

## ◆ Cy_SMIF_DeviceTransfer_ClearMergeTimeout()

void Cy_SMIF_DeviceTransfer_ClearMergeTimeout | ( | SMIF_Type * | base,
|  | cy_en_smif_slave_select_t | slave
| ) |  |

This function disables continuous transfer merging.

Parameters

  base | Holds the base address of the SMIF block registers.
  slave | Holds the slave select line for which merge should be disabled.

Note
  External memory should also support this mode of transfer.

cy_en_smif_slave_select_t slaveSelect = CY_SMIF_SLAVE_SELECT_0;
Cy_SMIF_SetMode(SMIF, CY_SMIF_MEMORY);
Cy_SMIF_CacheEnable(SMIF, CY_SMIF_CACHE_BOTH);
Cy_SMIF_CachePrefetchingEnable(SMIF, CY_SMIF_CACHE_BOTH);
// If more than 1 cycle merge time accepted, there will be long CS# low duration when burst reading.
// It may cause error because Low/High ratio of CLK should be around 50/50 during reading because of Memory device restriction.
Cy_SMIF_DeviceTransfer_SetMergeTimeout(SMIF, slaveSelect,CY_SMIF_MERGE_TIMEOUT_1_CYCLE);
volatile CY_SMIF_FLASHDATA* pHyperFlashBaseAddr = (CY_SMIF_FLASHDATA*)(CY_XIP_BASE);
Cy_SMIF_DeviceTransfer_ClearMergeTimeout(SMIF, slaveSelect);
Cy_SMIF_CacheInvalidate(SMIF, CY_SMIF_CACHE_BOTH);
Cy_SMIF_CacheDisable(SMIF, CY_SMIF_CACHE_BOTH);
(void)pHyperFlashBaseAddr;

## ◆ Cy_SMIF_Set_DelayTapSel()

cy_en_smif_status_t Cy_SMIF_Set_DelayTapSel | ( | SMIF_Type * | base,
|  | uint8_t | tapSel
| ) |  |

This function sets delay tap number for the SMIF master clock which is common for all memory devices connected.

Parameters

  base | Holds the base address of the SMIF block or SMIF_DEVICE block registers.
  tapSel | delay tap selection to be set

Returns
  status (see cy_en_smif_status_t).

uint8_t tapSel_set = 8U;
if (CY_SMIF_SUCCESS == Cy_SMIF_Set_DelayTapSel(SMIF, tapSel))
{
uint8_t tap_sel_get = Cy_SMIF_Get_DelayTapSel(SMIF);
if(tap_sel_get != tapSel_set)
{
/* Insert error handling */
}
}
else
{
/* Insert error handling */
}
CY_SMIF_SUCCESS
@ CY_SMIF_SUCCESS
Successful SMIF operation.
Definition: cy_smif.h:687
Cy_SMIF_Set_DelayTapSel
cy_en_smif_status_t Cy_SMIF_Set_DelayTapSel(SMIF_Type *base, uint8_t tapSel)
This function sets delay tap number for the SMIF master clock which is common for all memory devices ...
Definition: cy_smif.c:2927
Cy_SMIF_Get_DelayTapSel
uint8_t Cy_SMIF_Get_DelayTapSel(SMIF_Type *base)
This function returns delay tap number which has been set for the SMIF.
Definition: cy_smif.c:2953

## ◆ Cy_SMIF_Get_DelayTapSel()

uint8_t Cy_SMIF_Get_DelayTapSel | ( | SMIF_Type * | base | ) |

This function returns delay tap number which has been set for the SMIF.

Parameters

  base | Holds the base address of the SMIF block or SMIF_DEVICE block registers.

Returns
  read tap selection

uint8_t tapSel_set = 8U;
if (CY_SMIF_SUCCESS == Cy_SMIF_Set_DelayTapSel(SMIF, tapSel))
{
uint8_t tap_sel_get = Cy_SMIF_Get_DelayTapSel(SMIF);
if(tap_sel_get != tapSel_set)
{
/* Insert error handling */
}
}
else
{
/* Insert error handling */
}

## ◆ Cy_SMIF_Set_Sdl_DelayTapSel()

cy_en_smif_status_t Cy_SMIF_Set_Sdl_DelayTapSel | ( | SMIF_CORE_DEVICE_Type * | smif_device_base,
|  | uint8_t | tapSel
| ) |  |

This function sets the SDL (slave clock) delay tap number for the SMIF (common for all its devices).

It sets both the positive and negative taps to the same value.

Parameters

  smif_device_base | Holds the base address of the SMIF_DEVICE block registers.
  tapSel | positive and negative delay tap selection to be set

Returns
  status (see cy_en_smif_status_t).

## ◆ Cy_SMIF_IsEnabled()

__STATIC_INLINE bool Cy_SMIF_IsEnabled | ( | SMIF_Type * | base | ) |

Checks whether the SMIF block is enabled.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  True if the block is enabled, false otherwise

## ◆ Cy_SMIF_Disable()

__STATIC_INLINE void Cy_SMIF_Disable | ( | SMIF_Type * | base | ) |

Disables the operation of the SMIF block.

The SMIF block can be disabled only when it is not in the active state. Use the Cy_SMIF_BusyCheck() API to check it before calling this API. Make sure the clock supplied to SMIF block is also disabled before calling this API using Cy_SysClk_ClkHfDisable

Parameters

  base | Holds the base address of the SMIF block registers.

## ◆ Cy_SMIF_SetInterruptMask()

__STATIC_INLINE void Cy_SMIF_SetInterruptMask | ( | SMIF_Type * | base,
|  | uint32_t | interrupt
| ) |  |

This function is used to set an interrupt mask for the SMIF Interrupt.

Parameters

  base | Holds the base address of the SMIF block registers.
  interrupt | This is the mask for different source options that can be masked. See Interrupt Macros for possible values.

## ◆ Cy_SMIF_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_SMIF_GetInterruptMask | ( | SMIF_Type const * | base | ) |

This function is used to read an interrupt mask for the SMIF Interrupt.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Returns the mask set for the SMIF interrupt.

## ◆ Cy_SMIF_GetInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_SMIF_GetInterruptStatusMasked | ( | SMIF_Type const * | base | ) |

This function is used to read an active masked interrupt.

This function can be used in the interrupt service-routine to find which source triggered the interrupt.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Returns a word with bits set at positions corresponding to the interrupts triggered in the system.

## ◆ Cy_SMIF_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_SMIF_GetInterruptStatus | ( | SMIF_Type const * | base | ) |

This function is used to read an active interrupt.

This status is the unmasked result, so will also show interrupts that will not generate active interrupts.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Returns a word with bits set at positions corresponding to the interrupts triggered in the system.

## ◆ Cy_SMIF_SetInterrupt()

__STATIC_INLINE void Cy_SMIF_SetInterrupt | ( | SMIF_Type * | base,
|  | uint32_t | interrupt
| ) |  |

This function is used to set an interrupt source.

This function can be used to activate interrupts through the software.

Note
  Interrupt sources set using this interrupt will generate interrupts only if they are not masked.

Parameters

  base | Holds the base address of the SMIF block registers.
  interrupt | An encoded integer with a bit set corresponding to the interrupt to be triggered. See Interrupt Macros for possible values.

## ◆ Cy_SMIF_ClearInterrupt()

__STATIC_INLINE void Cy_SMIF_ClearInterrupt | ( | SMIF_Type * | base,
|  | uint32_t | interrupt
| ) |  |

This function is used to clear an interrupt source.

This function can be used in the user code to clear all pending interrupts.

Parameters

  base | Holds the base address of the SMIF block registers.
  interrupt | An encoded integer with a bit set corresponding to the interrupt that must be cleared. See Interrupt Macros for possible values.

## ◆ Cy_SMIF_SetTxFifoTriggerLevel()

__STATIC_INLINE void Cy_SMIF_SetTxFifoTriggerLevel | ( | SMIF_Type * | base,
|  | uint32_t | level
| ) |  |

This function is used to set a trigger level for the TX FIFO.

This value must be an integer between 0 and 7. For the normal mode only. The triggering is active when TX_DATA_FIFO_STATUS <= level.

Parameters

  base | Holds the base address of the SMIF block registers.
  level | The trigger level to set (0-8).

## ◆ Cy_SMIF_SetRxFifoTriggerLevel()

__STATIC_INLINE void Cy_SMIF_SetRxFifoTriggerLevel | ( | SMIF_Type * | base,
|  | uint32_t | level
| ) |  |

This function is used to set a trigger level for the RX FIFO.

This value must be an integer between 0 and 7. For the normal mode only. The triggering is active when RX_DATA_FIFOSTATUS > level.

Parameters

  base | Holds the base address of the SMIF block registers.
  level | The trigger level to set(0-8).

## ◆ Cy_SMIF_GetCmdFifoStatus()

__STATIC_INLINE uint32_t Cy_SMIF_GetCmdFifoStatus | ( | SMIF_Type const * | base | ) |

This function is used to read the status of the CMD FIFO.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Returns the number of the entries in the CMD FIFO.

## ◆ Cy_SMIF_GetTxFifoStatus()

__STATIC_INLINE uint32_t Cy_SMIF_GetTxFifoStatus | ( | SMIF_Type const * | base | ) |

This function is used to read the status of the TX FIFO.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Returns the number of the entries in the TX FIFO.

## ◆ Cy_SMIF_GetRxFifoStatus()

__STATIC_INLINE uint32_t Cy_SMIF_GetRxFifoStatus | ( | SMIF_Type const * | base | ) |

This function is used to read the status of the RX FIFO.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Returns the number of the entries in the RX FIFO.

## ◆ Cy_SMIF_Encrypt()

cy_en_smif_status_t Cy_SMIF_Encrypt | ( | SMIF_Type * | base,
|  | uint32_t | address,
|  | uint8_t | data[],
|  | uint32_t | size,
|  | cy_stc_smif_context_t const * | context
| ) |  |

Uses the Encryption engine to create an encrypted result when the input, key and data arrays are provided.

The AES-128 encryption of the address with the key, fetching the result and XOR with the data array are all done in the function. The operational scheme is the following: data = XOR(AES128(address, key), data) Decryption is done using the input data-array identically to the encryption. In the XIP mode, encryption and decryption are done without calling this function. The operational scheme in the XIP mode is the same. The address parameter in the XIP mode equals the actual address in the PSoC memory map. The SMIF encryption engine is designed for code storage. For data storage, the encryption key can be changed. For sensitive data, the Crypto block is used.

Note
  The API does not have access to the encryption key. The key must be placed in the register using Cy_SMIF_SetCryptoKey() before calling this API. The crypto routine that can access the key storage area is recommended. This crypto routine is typically a protection context 0 function.
  This is a blocking API. The API waits for encryption completion. Will exit if a timeout is set (not equal to 0) and expired.

Parameters

  base | Holds the base address of the SMIF block registers.
  address | The address that gets encrypted is a masked 16-byte block address. The 32-bit address with the last 4 bits masked is placed as the last 4 bytes in the 128-bit input. The rest of the higher bit for the 128 bits are padded zeros by default. PA[127:0]: PA[3:0] = 0 PA[7:4] = ADDR[7:4]. PA[15:8] = ADDR[15:8]. PA[23:16] = ADDR[23:16]. PA[31:24] = ADDR[31:24]. The other twelve of the sixteen plain text address bytes of PA[127:0] are "0" by default. User can initialize PA[127:32] with Cy_SMIF_SetCryptoIV().
  data | This is the location where the input data-array is passed while the function is called. This array gets populated with the result after encryption is completed.
  size | Provides a size of the array.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Returns
  A status of the command transmit.
  - CY_SMIF_SUCCESS
  - CY_SMIF_EXCEED_TIMEOUT
  - CY_SMIF_BAD_PARAM

Function Usage
  /* Scenario: Encrypt data in the txBuffer[] before writing data into the memory at the address=0x2000. */
  cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
  * It must be global
  */
  #define MEMTEST_AES_KEY_SIZE (16U) /* The AES key length */
  #define INIT_VECTOR_SIZE (12U) /* Initialization vector length */
  #define PACKET_SIZE (32U) /* The memory Read/Write packet */
  /* Data to encrypt */
  uint8_t txBuffer[PACKET_SIZE] = {1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U,
  9U, 10U, 11U, 12U, 13U, 14U, 15U, 16U,
  17U, 18U, 19U, 20U, 21U, 22U, 23U, 24U,
  25U, 26U, 27U, 28U, 29U, 30U, 31U, 32U};
  uint32_t address = 0x2000UL; /* The address to write data to */
  /* The AES key.
  * Writing of the AES key should be from secure area of the code
  */
  uint8_t key[MEMTEST_AES_KEY_SIZE] = {0x54U, 0x68U, 0x61U, 0x74U, 0x73U, 0x20U, 0x6DU, 0x79U,
  0x20U, 0x4BU, 0x75U, 0x6EU, 0x67U, 0x20U, 0x46U, 0x75U};
  uint8_t init_vector[INIT_VECTOR_SIZE] = {0x1FU, 0x34U, 0x65U, 0x94U, 0x73U, 0x24U, 0x1DU, 0x89U,
  0x25U, 0x4AU, 0x77U, 0x4DU};
  /* Set the crypto key. */
  Cy_SMIF_SetCryptoKey(SMIF, (uint32_t *)key);
  /* Set Initialization Vector */
  Cy_SMIF_SetCryptoIV(SMIF, (uint32_t *)init_vector);
  /* Encrypt data in txBuffer */
  if (CY_SMIF_SUCCESS != Cy_SMIF_Encrypt(SMIF, address, txBuffer, sizeof(txBuffer), &SMIF_context))
  {
  /* Insert error handling */
  }
  /* The second call of Cy_SMIF_Encrypt() decrypts data in txBuffer */
  if (CY_SMIF_SUCCESS != Cy_SMIF_Encrypt(SMIF, address, txBuffer, sizeof(txBuffer), &SMIF_context))
  {
  /* Insert error handling */
  }
  cy_stc_smif_context_t
  The SMIF internal context data.
  Definition: cy_smif.h:997
  Cy_SMIF_SetCryptoKey
  void Cy_SMIF_SetCryptoKey(SMIF_Type *base, uint32_t *key)
  Sets the AES-128 encryption key into SMIF crypto registers.
  Definition: cy_smif.c:1742
  Cy_SMIF_Encrypt
  cy_en_smif_status_t Cy_SMIF_Encrypt(SMIF_Type *base, uint32_t address, uint8_t data[], uint32_t size, cy_stc_smif_context_t const *context)
  Uses the Encryption engine to create an encrypted result when the input, key and data arrays are prov...
  Definition: cy_smif.c:2089
  Cy_SMIF_SetCryptoIV
  void Cy_SMIF_SetCryptoIV(SMIF_Type *base, uint32_t *nonce)
  Sets the 96 bit initialization vector (nonce) into SMIF crypto registers.
  Definition: cy_smif.c:1763

## ◆ Cy_SMIF_BusyCheck()

__STATIC_INLINE bool Cy_SMIF_BusyCheck | ( | SMIF_Type const * | base | ) |

This function provides the status of the IP block (False - not busy, True - busy).

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Returns an IP block status.

## ◆ Cy_SMIF_Interrupt()

__STATIC_INLINE void Cy_SMIF_Interrupt | ( | SMIF_Type * | base,
|  | cy_stc_smif_context_t * | context
| ) |  |

The Interrupt Service Routine for the SMIF.

The interrupt code will be responsible for the FIFO operations on FIFO interrupts during ongoing transfers. The user must place a call to this interrupt function in the interrupt routine corresponding to the interrupt attached to the SMIF. If the user does not do this, will break: the functionality of all the API functions in the SMIF driver that use SMIF interrupts to affect transfers.

Parameters

  base | Holds the base address of the SMIF block registers.
  context | Passes a configuration structure that contains the transfer parameters of the SMIF block.

Global Variables
  - context->txBufferAddress - The pointer to the data to be transferred.
  - context->txBufferSize - The size of txBuffer.
  - context->txBufferCounter - The number of data entries left to be transferred.

All the Global variables described above are used when the Software Buffer is used.

## ◆ Cy_SMIF_CacheEnable()

cy_en_smif_status_t Cy_SMIF_CacheEnable | ( | SMIF_Type * | base,
|  | cy_en_smif_cache_t | cacheType
| ) |  |

This function is used to enable the fast cache, the slow cache or both.

Parameters

  base | Holds the base address of the SMIF block registers.
  cacheType | Holds the type of the cache to be modified. cy_en_smif_cache_t

Returns
  A status of function completion.
  - CY_SMIF_SUCCESS
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_CacheDisable()

cy_en_smif_status_t Cy_SMIF_CacheDisable | ( | SMIF_Type * | base,
|  | cy_en_smif_cache_t | cacheType
| ) |  |

This function is used to disable the fast cache, the slow cache or both.

Parameters

  base | Holds the base address of the SMIF block registers.
  cacheType | Holds the type of the cache to be modified. cy_en_smif_cache_t

Returns
  A status of function completion.
  - CY_SMIF_SUCCESS
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_CachePrefetchingEnable()

cy_en_smif_status_t Cy_SMIF_CachePrefetchingEnable | ( | SMIF_Type * | base,
|  | cy_en_smif_cache_t | cacheType
| ) |  |

This function is used to enable pre-fetching for the fast cache, the slow cache or both.

Parameters

  base | Holds the base address of the SMIF block registers.
  cacheType | Holds the type of the cache to be modified. cy_en_smif_cache_t

Returns
  A status of function completion.
  - CY_SMIF_SUCCESS
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_CachePrefetchingDisable()

cy_en_smif_status_t Cy_SMIF_CachePrefetchingDisable | ( | SMIF_Type * | base,
|  | cy_en_smif_cache_t | cacheType
| ) |  |

This function is used to disable pre-fetching for the fast cache, the slow cache or both.

Parameters

  base | Holds the base address of the SMIF block registers.
  cacheType | Holds the type of the cache to be modified. cy_en_smif_cache_t

Returns
  A status of function completion.
  - CY_SMIF_SUCCESS
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_CacheInvalidate()

cy_en_smif_status_t Cy_SMIF_CacheInvalidate | ( | SMIF_Type * | base,
|  | cy_en_smif_cache_t | cacheType
| ) |  |

This function is used to invalidate/clear the fast cache, the slow cache or both.

Parameters

  base | Holds the base address of the SMIF block registers.
  cacheType | Holds the type of the cache to be modified. cy_en_smif_cache_t

Returns
  A status of function completion.
  - CY_SMIF_SUCCESS
  - CY_SMIF_BAD_PARAM

## ◆ Cy_SMIF_SetCryptoKey()

void Cy_SMIF_SetCryptoKey | ( | SMIF_Type * | base,
|  | uint32_t * | key
| ) |  |

Sets the AES-128 encryption key into SMIF crypto registers.

Parameters

  base | Holds the base address of the SMIF block registers.
  key | An array containing 128 bit crypto key: uint32_t key[4]. The least significant word first.

## ◆ Cy_SMIF_SetCryptoIV()

void Cy_SMIF_SetCryptoIV | ( | SMIF_Type * | base,
|  | uint32_t * | nonce
| ) |  |

Sets the 96 bit initialization vector (nonce) into SMIF crypto registers.

Parameters

  base | Holds the base address of the SMIF block registers.
  nonce | An array containing 96 bit initialization vector (nonce)

## ◆ Cy_SMIF_SetCryptoEnable()

cy_en_smif_status_t Cy_SMIF_SetCryptoEnable | ( | SMIF_Type * | base,
|  | cy_en_smif_slave_select_t | slaveId
| ) |  |

Enables SMIF encryption.

Parameters

  base | Holds the base address of the SMIF block registers.
  slaveId | slave select line to indicate the device on which encryption should be enabled.

Returns
  cy_en_smif_status_t.

Note
  Please ensure cache is disabled using Cy_SMIF_CacheDisable or invalidated using Cy_SMIF_CacheInvalidate or any other system level cache to be cleared so that the next read/execute from flash operation results in correct data.

## ◆ Cy_SMIF_SetCryptoDisable()

cy_en_smif_status_t Cy_SMIF_SetCryptoDisable | ( | SMIF_Type * | base,
|  | cy_en_smif_slave_select_t | slaveId
| ) |  |

Disables SMIF encryption.

Parameters

  base | Holds the base address of the SMIF block registers.
  slaveId | slave select line to indicate the device on which encryption should be disabled.

Returns
  cy_en_smif_status_t.

Note
  Please ensure cache is disabled using Cy_SMIF_CacheDisable or invalidated using Cy_SMIF_CacheInvalidate or any other system level cache to be cleared so that the next read/execute from flash operation results in correct data.

## ◆ Cy_SMIF_IsCryptoEnabled()

cy_en_smif_status_t Cy_SMIF_IsCryptoEnabled | ( | SMIF_Type * | base,
|  | cy_en_smif_slave_select_t | slaveId,
|  | bool * | crypto_status
| ) |  |

Checks the status of encryption for the selected slave device.

Parameters

  base | Holds the base address of the SMIF block registers.
  slaveId | slave select line to indicate the device on which encryption should be disabled.
  crypto_status | Holds the status of encryption.

Returns
  CY_SMIF_SUCCESS if we are able get the Cache status otherwise returns CY_SMIF_BAD_PARAM.

## ◆ Cy_SMIF_SetCryptoKeyRegion()

cy_en_smif_status_t Cy_SMIF_SetCryptoKeyRegion | ( | SMIF_Type * | base,
|  | uint8_t | crypto_region_index,
|  | cy_stc_smif_crypto_region_config_t * | region_config
| ) |  |

Configures a crypto region with specified start address, size and keys.

Parameters

  base | Holds the base address of the SMIF block registers.
  crypto_region_index | Crypto region index for which sub region disable mask has to be applied. Region index starts from 0, 1, 2, ... upto (SMIF_CRYPTO_KEY_NR - 1).
  region_config | Crypto region configuration structure.

Returns
  - CY_SMIF_SUCCESS
  - CY_SMIF_BAD_PARAM

Function Usage
  /* Scenario: Encrypt data in the txBuffer[] before writing data into the memory at the address=0x2000. */
  cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
  * It must be global
  */
  #define MEMTEST_AES_KEY_SIZE (16U) /* The AES key length */
  #define INIT_VECTOR_SIZE (12U) /* Initialization vector length */
  #define PACKET_SIZE (32U) /* The memory Read/Write packet */
  /* Data to encrypt */
  uint8_t txBuffer[PACKET_SIZE] = {1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U,
  9U, 10U, 11U, 12U, 13U, 14U, 15U, 16U,
  17U, 18U, 19U, 20U, 21U, 22U, 23U, 24U,
  25U, 26U, 27U, 28U, 29U, 30U, 31U, 32U};
  uint32_t address = 0x2000UL; /* The address to write data to */
  /* The AES key.
  * Writing of the AES key should be from secure area of the code
  */
  uint8_t key[MEMTEST_AES_KEY_SIZE] = {0x54U, 0x68U, 0x61U, 0x74U, 0x73U, 0x20U, 0x6DU, 0x79U,
  0x20U, 0x4BU, 0x75U, 0x6EU, 0x67U, 0x20U, 0x46U, 0x75U};
  uint8_t init_vector[INIT_VECTOR_SIZE] = {0x1FU, 0x34U, 0x65U, 0x94U, 0x73U, 0x24U, 0x1DU, 0x89U,
  0x25U, 0x4AU, 0x77U, 0x4DU};
  /* Set the crypto key. */
  Cy_SMIF_SetCryptoKey(SMIF, (uint32_t *)key);
  /* Set Initialization Vector */
  Cy_SMIF_SetCryptoIV(SMIF, (uint32_t *)init_vector);
  /* Encrypt data in txBuffer */
  if (CY_SMIF_SUCCESS != Cy_SMIF_Encrypt(SMIF, address, txBuffer, sizeof(txBuffer), &SMIF_context))
  {
  /* Insert error handling */
  }
  /* The second call of Cy_SMIF_Encrypt() decrypts data in txBuffer */
  if (CY_SMIF_SUCCESS != Cy_SMIF_Encrypt(SMIF, address, txBuffer, sizeof(txBuffer), &SMIF_context))
  {
  /* Insert error handling */
  }

## ◆ Cy_SMIF_SetCryptoSubRegionDisable()

cy_en_smif_status_t Cy_SMIF_SetCryptoSubRegionDisable | ( | SMIF_Type * | base,
|  | uint8_t | crypto_region_index,
|  | uint8_t | mask
| ) |  |

Disable sub regions within crypto region.

Each crypto region is further divided into 8 equal sub regions and user can disable on the fly encryption/decryption by setting "1" for that specific region using mask. For example, if a 1 MB region is specified for a crypto region then the 8 subregions will be 128 KB. If mask is set with "0" then cryptography will be performed on that subregion

Parameters

  base | Holds the base address of the SMIF block registers.
  crypto_region_index | Crypto region index for which sub region disable mask has to be applied.
  mask | 8-bit mask to disable individual sub-region within a crypto region

Returns
  cy_en_smif_status_t.

## ◆ Cy_SMIF_ConvertSlaveSlotToIndex()

cy_en_smif_status_t Cy_SMIF_ConvertSlaveSlotToIndex | ( | cy_en_smif_slave_select_t | ss,
|  | uint32_t * | device_idx
| ) |  |

Converts Slave Select enum to the device index.

Parameters

  ss | Slave Select enum.
  device_idx | A pointer to device index to be returned.

Returns
  cy_en_smif_status_t.

## ◆ Cy_SMIF_SetRxCaptureMode()

cy_en_smif_status_t Cy_SMIF_SetRxCaptureMode | ( | SMIF_Type * | base,
|  | cy_en_smif_capture_mode_t | mode,
|  | cy_en_smif_slave_select_t | slaveId
| ) |  |

This function sets the Rx Capture mode setting for SMIF IP block instance.

Parameters

  base | Holds the base address of the SMIF block registers.
  mode | Rx Capture mode cy_en_smif_capture_mode_t
  slaveId | Slave ID for which RX Capture configuration has to be updated.

/* Scenario: Using an external flash which supports DLP (Data Learning Pattern). */
#define S25HS512T_DLP_PATTERN (0U)
#define S25HS512T_DLP_SIZE (8U)
#define TIMEOUT_1_S (1000U)
cy_en_smif_status_t status = CY_SMIF_BAD_PARAM;
cy_stc_smif_context_t SMIFContext;
uint16_t dlp_size = 0U;
uint16_t dlp_pattern = 0U;
/* SMIF configuration parameters */
cy_stc_smif_config_t tst_smifConfig =
{
.mode = CY_SMIF_NORMAL, /* Mode of operation */
.deselectDelay = DESELECT_DELAY, /* Minimum duration of SPI deselection */
.rxClockSel = CY_SMIF_SEL_INVERTED_INTERNAL_CLK, /* Clock source for the receiver clock. This field is not used in SMIF IP version 5 */
.blockEvent = CY_SMIF_BUS_ERROR /* What happens when there is a read
* to an empty RX FIFO or write to a full TX FIFO
*/
};
cy_en_smif_status_t SMIF_Status = CY_SMIF_BAD_PARAM;
SMIF_Status = Cy_SMIF_Init(SMIF, &tst_smifConfig, TIMEOUT_1_MS, &SMIFContext);
if (SMIF_Status == CY_SMIF_SUCCESS)
{
/* Set Data Select */
Cy_SMIF_SetDataSelect(SMIF, CY_SMIF_SLAVE_SELECT_0, CY_SMIF_DATA_SEL0);
/* Set RX Capture mode to Normal SPI with Data Learning Pattern */
Cy_SMIF_SetRxCaptureMode(SMIF, CY_SMIF_SEL_NORMAL_SPI_WITH_DLP, CY_SMIF_SLAVE_SELECT_0);
/* Set Master DLP */
SMIF_Status = Cy_SMIF_SetMasterDLP(SMIF, S25HS512T_DLP_PATTERN, S25HS512T_DLP_SIZE);
if (SMIF_Status == CY_SMIF_SUCCESS)
{
/* Optional : To retrieve the DLP settings used by SMIF */
/* Get Master DLP Size */
dlp_size = Cy_SMIF_GetMasterDLPSize(SMIF);
/* Get Master DLP Pattern */
dlp_pattern = Cy_SMIF_GetMasterDLP(SMIF);
}
/* Enable SMIF */
Cy_SMIF_Enable(SMIF, &SMIFContext);
}
/* The following void casts are to eliminate unused-variable warnings at compile-time*/
(void)status;
(void)dlp_size;
(void)dlp_pattern;
/* Perform Memory slot Initialization and Read operation should use DLP in latency cycles duration */
cy_stc_smif_config_t::mode
uint32_t mode
Specifies the mode of operation cy_en_smif_mode_t.
Definition: cy_smif.h:964
cy_stc_smif_config_t
The SMIF configuration structure.
Definition: cy_smif.h:963
cy_en_smif_status_t
cy_en_smif_status_t
The SMIF API return values.
Definition: cy_smif.h:686
CY_SMIF_SEL_NORMAL_SPI_WITH_DLP
@ CY_SMIF_SEL_NORMAL_SPI_WITH_DLP
Normal SPI with DLP (Data Learning Pattern).
Definition: cy_smif.h:741
CY_SMIF_NORMAL
@ CY_SMIF_NORMAL
Command mode (MMIO mode).
Definition: cy_smif.h:573
CY_SMIF_SEL_INVERTED_INTERNAL_CLK
@ CY_SMIF_SEL_INVERTED_INTERNAL_CLK
The SMIF internal inverted clock.
Definition: cy_smif.h:753
CY_SMIF_DATA_SEL0
@ CY_SMIF_DATA_SEL0
smif.spi_data[0] = DATA0, smif.spi_data[1] = DATA1, ..., smif.spi_data[7] = DATA7.
Definition: cy_smif.h:552
CY_SMIF_BAD_PARAM
@ CY_SMIF_BAD_PARAM
The SMIF API received the wrong parameter.
Definition: cy_smif.h:695
CY_SMIF_BUS_ERROR
@ CY_SMIF_BUS_ERROR
Generates a bus error.
Definition: cy_smif.h:524
Cy_SMIF_SetDataSelect
void Cy_SMIF_SetDataSelect(SMIF_Type *base, cy_en_smif_slave_select_t slaveSelect, cy_en_smif_data_select_t dataSelect)
This function configures the data select option for a specific slave.
Definition: cy_smif.c:420
Cy_SMIF_GetMasterDLPSize
uint8_t Cy_SMIF_GetMasterDLPSize(SMIF_Type *base)
This function gets the data learning pattern size configured.
Definition: cy_smif.c:2544
Cy_SMIF_SetRxCaptureMode
cy_en_smif_status_t Cy_SMIF_SetRxCaptureMode(SMIF_Type *base, cy_en_smif_capture_mode_t mode, cy_en_smif_slave_select_t slaveId)
This function sets the Rx Capture mode setting for SMIF IP block instance.
Definition: cy_smif.c:2441
Cy_SMIF_GetMasterDLP
uint16_t Cy_SMIF_GetMasterDLP(SMIF_Type *base)
This function gets the data learning pattern configured.
Definition: cy_smif.c:2527
Cy_SMIF_Enable
void Cy_SMIF_Enable(SMIF_Type *base, cy_stc_smif_context_t *context)
Enables the operation of the SMIF block.
Definition: cy_smif.c:921
Cy_SMIF_SetMasterDLP
cy_en_smif_status_t Cy_SMIF_SetMasterDLP(SMIF_Type *base, uint16 dlp, uint8_t size)
This function sets the data learning pattern.
Definition: cy_smif.c:2490
Cy_SMIF_Init
cy_en_smif_status_t Cy_SMIF_Init(SMIF_Type *base, cy_stc_smif_config_t const *config, uint32_t timeout, cy_stc_smif_context_t *context)
This function initializes the SMIF block as a communication block.
Definition: cy_smif.c:75

## ◆ Cy_SMIF_SetMasterDLP()

cy_en_smif_status_t Cy_SMIF_SetMasterDLP | ( | SMIF_Type * | base,
|  | uint16 | dlp,
|  | uint8_t | size
| ) |  |

This function sets the data learning pattern.

Parameters

  base | Holds the base address of the SMIF block registers.
  dlp | data learning pattern (maximum 16-bit)
  size | pattern size (allowed range 1 to 16 bits)

Returns
  status of configuration.
  - CY_SMIF_SUCCESS
  - CY_SMIF_BAD_PARAM

/* Scenario: Using an external flash which supports DLP (Data Learning Pattern). */
#define S25HS512T_DLP_PATTERN (0U)
#define S25HS512T_DLP_SIZE (8U)
#define TIMEOUT_1_S (1000U)
cy_en_smif_status_t status = CY_SMIF_BAD_PARAM;
cy_stc_smif_context_t SMIFContext;
uint16_t dlp_size = 0U;
uint16_t dlp_pattern = 0U;
/* SMIF configuration parameters */
cy_stc_smif_config_t tst_smifConfig =
{
.mode = CY_SMIF_NORMAL, /* Mode of operation */
.deselectDelay = DESELECT_DELAY, /* Minimum duration of SPI deselection */
.rxClockSel = CY_SMIF_SEL_INVERTED_INTERNAL_CLK, /* Clock source for the receiver clock. This field is not used in SMIF IP version 5 */
.blockEvent = CY_SMIF_BUS_ERROR /* What happens when there is a read
* to an empty RX FIFO or write to a full TX FIFO
*/
};
cy_en_smif_status_t SMIF_Status = CY_SMIF_BAD_PARAM;
SMIF_Status = Cy_SMIF_Init(SMIF, &tst_smifConfig, TIMEOUT_1_MS, &SMIFContext);
if (SMIF_Status == CY_SMIF_SUCCESS)
{
/* Set Data Select */
Cy_SMIF_SetDataSelect(SMIF, CY_SMIF_SLAVE_SELECT_0, CY_SMIF_DATA_SEL0);
/* Set RX Capture mode to Normal SPI with Data Learning Pattern */
Cy_SMIF_SetRxCaptureMode(SMIF, CY_SMIF_SEL_NORMAL_SPI_WITH_DLP, CY_SMIF_SLAVE_SELECT_0);
/* Set Master DLP */
SMIF_Status = Cy_SMIF_SetMasterDLP(SMIF, S25HS512T_DLP_PATTERN, S25HS512T_DLP_SIZE);
if (SMIF_Status == CY_SMIF_SUCCESS)
{
/* Optional : To retrieve the DLP settings used by SMIF */
/* Get Master DLP Size */
dlp_size = Cy_SMIF_GetMasterDLPSize(SMIF);
/* Get Master DLP Pattern */
dlp_pattern = Cy_SMIF_GetMasterDLP(SMIF);
}
/* Enable SMIF */
Cy_SMIF_Enable(SMIF, &SMIFContext);
}
/* The following void casts are to eliminate unused-variable warnings at compile-time*/
(void)status;
(void)dlp_size;
(void)dlp_pattern;
/* Perform Memory slot Initialization and Read operation should use DLP in latency cycles duration */

## ◆ Cy_SMIF_GetMasterDLP()

uint16_t Cy_SMIF_GetMasterDLP | ( | SMIF_Type * | base | ) |

This function gets the data learning pattern configured.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Data learning pattern configured

/* Scenario: Using an external flash which supports DLP (Data Learning Pattern). */
#define S25HS512T_DLP_PATTERN (0U)
#define S25HS512T_DLP_SIZE (8U)
#define TIMEOUT_1_S (1000U)
cy_en_smif_status_t status = CY_SMIF_BAD_PARAM;
cy_stc_smif_context_t SMIFContext;
uint16_t dlp_size = 0U;
uint16_t dlp_pattern = 0U;
/* SMIF configuration parameters */
cy_stc_smif_config_t tst_smifConfig =
{
.mode = CY_SMIF_NORMAL, /* Mode of operation */
.deselectDelay = DESELECT_DELAY, /* Minimum duration of SPI deselection */
.rxClockSel = CY_SMIF_SEL_INVERTED_INTERNAL_CLK, /* Clock source for the receiver clock. This field is not used in SMIF IP version 5 */
.blockEvent = CY_SMIF_BUS_ERROR /* What happens when there is a read
* to an empty RX FIFO or write to a full TX FIFO
*/
};
cy_en_smif_status_t SMIF_Status = CY_SMIF_BAD_PARAM;
SMIF_Status = Cy_SMIF_Init(SMIF, &tst_smifConfig, TIMEOUT_1_MS, &SMIFContext);
if (SMIF_Status == CY_SMIF_SUCCESS)
{
/* Set Data Select */
Cy_SMIF_SetDataSelect(SMIF, CY_SMIF_SLAVE_SELECT_0, CY_SMIF_DATA_SEL0);
/* Set RX Capture mode to Normal SPI with Data Learning Pattern */
Cy_SMIF_SetRxCaptureMode(SMIF, CY_SMIF_SEL_NORMAL_SPI_WITH_DLP, CY_SMIF_SLAVE_SELECT_0);
/* Set Master DLP */
SMIF_Status = Cy_SMIF_SetMasterDLP(SMIF, S25HS512T_DLP_PATTERN, S25HS512T_DLP_SIZE);
if (SMIF_Status == CY_SMIF_SUCCESS)
{
/* Optional : To retrieve the DLP settings used by SMIF */
/* Get Master DLP Size */
dlp_size = Cy_SMIF_GetMasterDLPSize(SMIF);
/* Get Master DLP Pattern */
dlp_pattern = Cy_SMIF_GetMasterDLP(SMIF);
}
/* Enable SMIF */
Cy_SMIF_Enable(SMIF, &SMIFContext);
}
/* The following void casts are to eliminate unused-variable warnings at compile-time*/
(void)status;
(void)dlp_size;
(void)dlp_pattern;
/* Perform Memory slot Initialization and Read operation should use DLP in latency cycles duration */

## ◆ Cy_SMIF_GetMasterDLPSize()

uint8_t Cy_SMIF_GetMasterDLPSize | ( | SMIF_Type * | base | ) |

This function gets the data learning pattern size configured.

Parameters

  base | Holds the base address of the SMIF block registers.

Returns
  Data learning pattern size configured.

/* Scenario: Using an external flash which supports DLP (Data Learning Pattern). */
#define S25HS512T_DLP_PATTERN (0U)
#define S25HS512T_DLP_SIZE (8U)
#define TIMEOUT_1_S (1000U)
cy_en_smif_status_t status = CY_SMIF_BAD_PARAM;
cy_stc_smif_context_t SMIFContext;
uint16_t dlp_size = 0U;
uint16_t dlp_pattern = 0U;
/* SMIF configuration parameters */
cy_stc_smif_config_t tst_smifConfig =
{
.mode = CY_SMIF_NORMAL, /* Mode of operation */
.deselectDelay = DESELECT_DELAY, /* Minimum duration of SPI deselection */
.rxClockSel = CY_SMIF_SEL_INVERTED_INTERNAL_CLK, /* Clock source for the receiver clock. This field is not used in SMIF IP version 5 */
.blockEvent = CY_SMIF_BUS_ERROR /* What happens when there is a read
* to an empty RX FIFO or write to a full TX FIFO
*/
};
cy_en_smif_status_t SMIF_Status = CY_SMIF_BAD_PARAM;
SMIF_Status = Cy_SMIF_Init(SMIF, &tst_smifConfig, TIMEOUT_1_MS, &SMIFContext);
if (SMIF_Status == CY_SMIF_SUCCESS)
{
/* Set Data Select */
Cy_SMIF_SetDataSelect(SMIF, CY_SMIF_SLAVE_SELECT_0, CY_SMIF_DATA_SEL0);
/* Set RX Capture mode to Normal SPI with Data Learning Pattern */
Cy_SMIF_SetRxCaptureMode(SMIF, CY_SMIF_SEL_NORMAL_SPI_WITH_DLP, CY_SMIF_SLAVE_SELECT_0);
/* Set Master DLP */
SMIF_Status = Cy_SMIF_SetMasterDLP(SMIF, S25HS512T_DLP_PATTERN, S25HS512T_DLP_SIZE);
if (SMIF_Status == CY_SMIF_SUCCESS)
{
/* Optional : To retrieve the DLP settings used by SMIF */
/* Get Master DLP Size */
dlp_size = Cy_SMIF_GetMasterDLPSize(SMIF);
/* Get Master DLP Pattern */
dlp_pattern = Cy_SMIF_GetMasterDLP(SMIF);
}
/* Enable SMIF */
Cy_SMIF_Enable(SMIF, &SMIFContext);
}
/* The following void casts are to eliminate unused-variable warnings at compile-time*/
(void)status;
(void)dlp_size;
(void)dlp_pattern;
/* Perform Memory slot Initialization and Read operation should use DLP in latency cycles duration */

## ◆ Cy_SMIF_GetTapNumCapturedCorrectDLP()

uint8_t Cy_SMIF_GetTapNumCapturedCorrectDLP | ( | SMIF_Type * | base,
|  | uint8_t | bit
| ) |  |

This function gets number of delay taps used for specified data line.

Parameters

  base | Holds the base address of the SMIF block registers.
  bit | DLP Tap selection for the bit position mapped as per Cy_SMIF_SetDataSelect.

Returns
  Data learning pattern configured

uint8_t delaytap_bit0, delaytap_bit1, delaytap_bit2, delaytap_bit3;
delaytap_bit0 = Cy_SMIF_GetTapNumCapturedCorrectDLP(SMIF, 0U);
delaytap_bit1 = Cy_SMIF_GetTapNumCapturedCorrectDLP(SMIF, 0U);
delaytap_bit2 = Cy_SMIF_GetTapNumCapturedCorrectDLP(SMIF, 0U);
delaytap_bit3 = Cy_SMIF_GetTapNumCapturedCorrectDLP(SMIF, 0U);
Cy_SMIF_GetTapNumCapturedCorrectDLP
uint8_t Cy_SMIF_GetTapNumCapturedCorrectDLP(SMIF_Type *base, uint8_t bit)
This function gets number of delay taps used for specified data line.
Definition: cy_smif.c:2564

## ◆ CY_SMIF_GetDelayTapsNumber()

uint32_t CY_SMIF_GetDelayTapsNumber | ( | volatile void * | base | ) |

This function returns tap number which the SMIF IP has.

User can input both SMIF DEVICE block address and SMIF block address

Parameters

  base | Base address of the SMIF block or the SMIF DEVICE block.

Returns
  Delay tap Number of the SMIF IP

## ◆ Cy_SMIF_InitCache()

cy_en_smif_status_t Cy_SMIF_InitCache | ( | SMIF_CACHE_BLOCK_Type * | base,
|  | const cy_stc_smif_cache_config_t * | cache_config
| ) |  |

This function initializes SMIF internal CACHE with user provided configuration cy_stc_smif_cache_config_t.

Parameters

  base | Holds the base address of the SMIF block.
  cache_config | Contains the configuration information to configure SMIF internal Cache.

Returns
  Returns result of CACHE configuration.

cy_en_smif_status_t SMIF_Status = CY_SMIF_BAD_PARAM;
/* SMIF configuration parameters */
cy_stc_smif_config_t tst_smifConfig =
{
.mode = CY_SMIF_NORMAL, /* Mode of operation */
.deselectDelay = DESELECT_DELAY, /* Minimum duration of SPI deselection */
.rxClockSel = CY_SMIF_SEL_INVERTED_INTERNAL_CLK, /* Clock source for the receiver clock. This field is not used in SMIF IP version 5 */
.blockEvent = CY_SMIF_BUS_ERROR /* What happens when there is a read
* to an empty RX FIFO or write to a full TX FIFO
*/
};
/* SMIF Cache Region configuration. Upto 4 regions can be configured with different CACHE attributes. Make sure they do not overlap */
cy_stc_smif_cache_region_t cache_region_0 =
{
.enabled = true,
.start_address = 0x60000000,
.end_address = 0x60400000,
.cache_attributes = CY_SMIF_CACHEABLE_WB_RWA
};
cy_stc_smif_cache_config_t cache_config =
{
.enabled = true,
.cache_retention_on = true,
};
memcpy(&cache_config.cache_region_0, &cache_region_0, sizeof(cache_region_0));
SMIF_Status = Cy_SMIF_Init(SMIF, &tst_smifConfig, TIMEOUT_1_MS, &smifContext);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/* Initialize CACHE */
Cy_SMIF_InitCache(SMIF0_CACHE_BLOCK, &cache_config);
Cy_SMIF_Enable(SMIF, &smifContext);
}
cy_stc_smif_cache_config_t::enabled
bool enabled
Enable/Disable SMIF Internal CACHE.
Definition: cy_smif.h:1054
cy_stc_smif_cache_region_t::enabled
bool enabled
Enable/Disable CACHE Region.
Definition: cy_smif.h:1045
cy_stc_smif_cache_config_t::cache_region_0
cy_stc_smif_cache_region_t cache_region_0
CACHE region 0 configuration.
Definition: cy_smif.h:1056
cy_stc_smif_cache_config_t
Specifies SMIF cache configuration.
Definition: cy_smif.h:1053
cy_stc_smif_cache_region_t
Specifies SMIF cache region configuration.
Definition: cy_smif.h:1044
CY_SMIF_CACHEABLE_WB_RWA
@ CY_SMIF_CACHEABLE_WB_RWA
Cacheable, Write Back, Read & Write Allocate.
Definition: cy_smif.h:923
Cy_SMIF_InitCache
cy_en_smif_status_t Cy_SMIF_InitCache(SMIF_CACHE_BLOCK_Type *base, const cy_stc_smif_cache_config_t *cache_config)
This function initializes SMIF internal CACHE with user provided configuration cy_stc_smif_cache_conf...
Definition: cy_smif.c:2974

## ◆ Cy_SMIF_Clean_All_Cache()

cy_en_smif_status_t Cy_SMIF_Clean_All_Cache | ( | SMIF_CACHE_BLOCK_Type * | base | ) |

This function cleans complete SMIF internal CACHE.

This is a blocking call and returns with the status of CACHE clean operation.

Parameters

  base | Holds the base address of the SMIF block.

Returns
  Returns result of CACHE clean operation.

## ◆ Cy_SMIF_Invalidate_All_Cache()

cy_en_smif_status_t Cy_SMIF_Invalidate_All_Cache | ( | SMIF_CACHE_BLOCK_Type * | base | ) |

This function invalidates complete SMIF internal CACHE.

This is a blocking call and returns with the status of CACHE invalidate operation.

Parameters

  base | Holds the base address of the SMIF block.

Returns
  Returns result of CACHE invalidate operation.

## ◆ Cy_SMIF_Clean_And_Invalidate_All_Cache()

cy_en_smif_status_t Cy_SMIF_Clean_And_Invalidate_All_Cache | ( | SMIF_CACHE_BLOCK_Type * | base | ) |

This function cleans and invalidates complete SMIF internal CACHE.

This is a blocking call and returns with the status of CACHE invalidate and clean operation.

Parameters

  base | Holds the base address of the SMIF block.

Returns
  Returns result of CACHE clean and invalidate operation.

## ◆ Cy_SMIF_Clean_Cache_by_Addr()

cy_en_smif_status_t Cy_SMIF_Clean_Cache_by_Addr | ( | SMIF_CACHE_BLOCK_Type * | base,
|  | bool | is_secure_view,
|  | uint32_t | address,
|  | uint32_t | size
| ) |  |

This function cleans cache using the address and size specified by user.

This is a blocking call and returns with the status of CACHE clean operation. Size must be specified in multiples of CACHE line size (32 bytes).

Note
  This API is Secure Aware. On devices with ARM TrustZone enabled, it is safe to call on a Secure hardware resource from a Non-Secure CPU state. The involved PPC regions are SMIF<inst>_CORE_MAIN, SMIF<inst>_CORE_CRYPTO, SMIF<inst>_CORE_MAIN2, and SMIF<inst>_CORE_DEVICE. These four regions must have the same security state.
  Ensure that the address is DCache aligned when calling from a non-secured Core onto a secured hardware resource. This is only relevent for cross-core calls, not calls between security contexts on the same core.

Parameters

  base | Holds the base address of the SMIF block.
  is_secure_view | Specifies the view on which cache operation has to be performed. In non-secure world this parameter is ignored and defaulted to non-secure view cache operation.
  address | start address from which cache operation should be performed.
  size | size in multiples of CACHE line size CY_SMIF_CACHE_LINE_SIZE_IN_BYTES.

Returns
  Returns result of CACHE clean operation.

## ◆ Cy_SMIF_Invalidate_Cache_by_Addr()

cy_en_smif_status_t Cy_SMIF_Invalidate_Cache_by_Addr | ( | SMIF_CACHE_BLOCK_Type * | base,
|  | bool | is_secure_view,
|  | uint32_t | address,
|  | uint32_t | size
| ) |  |

This function invalidates cache using the address and size specified by user.

This is a blocking call and returns with the status of CACHE invalidate operation. Size must be specified in multiples of CACHE line size (32 bytes).

Note
  This API is Secure Aware. On devices with ARM TrustZone enabled, it is safe to call on a Secure hardware resource from a Non-Secure CPU state The involved PPC regions are SMIF<inst>_CORE_MAIN, SMIF<inst>_CORE_CRYPTO, SMIF<inst>_CORE_MAIN2, and SMIF<inst>_CORE_DEVICE. These four regions must have the same security state.
  Ensure that the address is DCache aligned when calling from a non-secured Core onto a secured hardware resource. This is only relevent for cross-core calls, not calls between security contexts on the same core.

Parameters

  base | Holds the base address of the SMIF block.
  is_secure_view | Specifies the view on which cache operation has to be performed. In non-secure world this parameter is ignored and defaulted to non-secure view cache operation.
  address | start address from which cache operation should be performed.
  size | size in multiples of CACHE line size CY_SMIF_CACHE_LINE_SIZE_IN_BYTES.

Returns
  Returns result of CACHE invalidate operation.

## ◆ Cy_SMIF_Clean_And_Invalidate_Cache_by_Addr()

cy_en_smif_status_t Cy_SMIF_Clean_And_Invalidate_Cache_by_Addr | ( | SMIF_CACHE_BLOCK_Type * | base,
|  | bool | is_secure_view,
|  | uint32_t | address,
|  | uint32_t | size
| ) |  |

This function cleans and invalidates cache using the address and size specified by user.

This is a blocking call and returns with the status of CACHE operation. Size must be specified in multiples of CACHE line size (32 bytes).

Note
  This API is Secure Aware. On devices with ARM TrustZone enabled, it is safe to call on a Secure hardware resource from a Non-Secure CPU state. The involved PPC regions are SMIF<inst>_CORE_MAIN, SMIF<inst>_CORE_CRYPTO, SMIF<inst>_CORE_MAIN2, and SMIF<inst>_CORE_DEVICE. These four regions must have the same security state.
  Ensure that the address is DCache aligned when calling from a non-secured Core onto a secured hardware resource. This is only relevent for cross-core calls, not calls between security contexts on the same core.

Parameters

  base | Holds the base address of the SMIF block.
  is_secure_view | Specifies the view on which cache operation has to be performed. In non-secure world this parameter is ignored and defaulted to non-secure view cache operation.
  address | start address from which cache operation should be performed.
  size | size in multiples of CACHE line size CY_SMIF_CACHE_LINE_SIZE_IN_BYTES.

Returns
  Returns result of CACHE operation.

## ◆ Cy_SMIF_IsCacheEnabled()

cy_en_smif_status_t Cy_SMIF_IsCacheEnabled | ( | SMIF_CACHE_BLOCK_Type * | base,
|  | bool * | cache_status
| ) |  |

This function checks whether Cache is enabled or not.

Parameters

  base | Holds the base address of the SMIF block.
  cache_status | Holds the Cache status

Returns
  CY_SMIF_SUCCESS if we are able get the Cache status otherwise returns CY_SMIF_BAD_PARAM.