PSOC E8XXGP Device Support Library

General Description

Functions

cy_en_smif_status_t Cy_SMIF_MemInit (SMIF_Type *base, cy_stc_smif_block_config_t const *blockConfig, cy_stc_smif_context_t *context)
 This function initializes the slots of the memory device in the SMIF configuration. More...
 
void Cy_SMIF_MemDeInit (SMIF_Type *base)
 This function de-initializes all slave slots of the memory device to their default values. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdWriteEnable (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
 This function sends the Write Enable command to the memory device. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdWriteDisable (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
 This function sends a Write Disable command to the memory device. More...
 
bool Cy_SMIF_MemIsBusy (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
 This function checks if the status of the memory device is busy. More...
 
cy_en_smif_status_t Cy_SMIF_MemQuadEnable (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
 This function enables the memory device for the quad mode of operation. More...
 
cy_en_smif_status_t Cy_SMIF_MemOctalEnable (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_en_smif_data_rate_t dataRate, cy_stc_smif_context_t const *context)
 This function enables the memory device for the octal mode of operation. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdReadStatus (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, uint8_t *status, uint8_t command, cy_stc_smif_context_t const *context)
 This function reads the status register. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdWriteStatus (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, void const *status, uint8_t command, cy_stc_smif_context_t const *context)
 This function writes the status register. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdChipErase (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
 This function performs a chip erase of the external memory. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdSectorErase (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, uint8_t const *sectorAddr, cy_stc_smif_context_t const *context)
 This function performs a block Erase of the external memory. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdProgram (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, uint8_t const *addr, uint8_t const *writeBuff, uint32_t size, cy_smif_event_cb_t cmdCompleteCb, cy_stc_smif_context_t *context)
 This function performs the Program operation. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdRead (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, uint8_t const *addr, uint8_t *readBuff, uint32_t size, cy_smif_event_cb_t cmdCompleteCb, cy_stc_smif_context_t *context)
 This function performs the Read operation. More...
 
cy_en_smif_status_t Cy_SMIF_MemSfdpDetect (SMIF_Type *base, cy_stc_smif_mem_device_cfg_t *device, cy_en_smif_slave_select_t slaveSelect, cy_en_smif_data_select_t dataSelect, cy_stc_smif_context_t *context)
 This function detects the device signature for SFDP devices. More...
 
void Cy_SMIF_Reset_Memory (SMIF_Type *base, cy_en_smif_slave_select_t slaveSelect)
 This function is the weak implementation for resetting the memory. More...
 
cy_en_smif_status_t Cy_SMIF_MemInitSfdpMode (SMIF_Type *base, const cy_stc_smif_mem_config_t *memCfg, cy_en_smif_txfr_width_t maxdataWidth, cy_en_smif_qer_t qer_id, cy_stc_smif_context_t *context)
 This function can be used for any preferred data width based command instruction set from SFDP Buffer. More...
 
cy_en_smif_status_t Cy_SMIF_MemIsReady (SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t timeoutUs, cy_stc_smif_context_t const *context)
 Polls the memory device to check whether it is ready to accept new commands or not until either it is ready or the retries have exceeded the limit. More...
 
cy_en_smif_status_t Cy_SMIF_MemIsQuadEnabled (SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, bool *isQuadEnabled, cy_stc_smif_context_t const *context)
 Checks whether the QE (Quad Enable) bit is set or not in the configuration register of the memory. More...
 
cy_en_smif_status_t Cy_SMIF_MemEnableQuadMode (SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t timeoutUs, cy_stc_smif_context_t const *context)
 Sets the QE (QUAD Enable) bit in the external memory configuration register to enable quad SPI mode. More...
 
cy_en_smif_status_t Cy_SMIF_MemRead (SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t address, uint8_t rxBuffer[], uint32_t length, cy_stc_smif_context_t const *context)
 Reads data from the external memory and blocks until the read transfer is complete or a timeout occurs. More...
 
cy_en_smif_status_t Cy_SMIF_MemWrite (SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t address, uint8_t const txBuffer[], uint32_t length, cy_stc_smif_context_t const *context)
 This function writes data to the external memory. More...
 
cy_en_smif_status_t Cy_SMIF_MemEraseSector (SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t address, uint32_t length, cy_stc_smif_context_t const *context)
 Erases a block/sector of the external memory. More...
 
cy_en_smif_status_t Cy_SMIF_MemEraseSectorStrict (SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t address, uint32_t length, cy_stc_smif_context_t const *context)
 Erases a block/sector of the external memory. More...
 
cy_en_smif_status_t Cy_SMIF_MemEraseChip (SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, cy_stc_smif_context_t const *context)
 Erases the entire chip of the external memory. More...
 
cy_en_smif_status_t Cy_SMIF_MemLocateHybridRegion (cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_hybrid_region_info_t **regionInfo, uint32_t address)
 This function locates the region structure by the address which belongs to it. More...
 
void Cy_SMIF_SetReadyPollingDelay (uint16_t pollTimeoutUs, cy_stc_smif_context_t *context)
 This function sets the polling delay in micro seconds to check memory device availability. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdPowerDown (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
 This function sends a Power-down command to the selected memory device in Single SPI mode. More...
 
cy_en_smif_status_t Cy_SMIF_MemCmdReleasePowerDown (SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
 This function sends a Release Power-down command to the selected memory device in Single SPI mode. More...
 
void Cy_SMIF_MemEnableFWCalibration (SMIF_Type *base, cy_en_smif_slave_select_t slave)
 This function enables Firmware Calibration mode for the device. More...
 
void Cy_SMIF_MemDisableFWCalibration (SMIF_Type *base, cy_en_smif_slave_select_t slave)
 This function disables Firmware Calibration mode for the device. More...
 
cy_en_smif_status_t Cy_SMIF_SetSelectedDelayTapSel (SMIF_Type *base, cy_en_smif_slave_select_t slave, cy_en_smif_mem_data_line_t data_line, uint8_t tapSel)
 This function sets delay tap for a particular data line. More...
 
uint8_t Cy_SMIF_GetSelectedDelayTapSel (SMIF_Type *base, cy_en_smif_slave_select_t slave, cy_en_smif_mem_data_line_t data_line)
 This function gets delay tap set for a particular data line. More...
 
cy_en_smif_status_t Cy_SMIF_MemGetSDLTap (SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, uint8_t *posTap, uint8_t *negTap)
 This function retrieves the Slave Delay Line (SDL) Tap in use. More...
 
cy_en_smif_status_t Cy_SMIF_MemSetSDLTap (SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, uint8_t posTap, uint8_t negTap)
 This function sets the Slave Delay Line (SDL) tap ranging from 0 to 15. More...
 
cy_en_smif_status_t Cy_SMIF_MemCalibrateSDL (SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, uint32_t calibrationDataOffsetAddress, cy_stc_smif_context_t *context)
 This function takes an offset address as input to perform read/write test and assign best possible Slave Delay Line (SDL) tap. More...
 
cy_en_smif_status_t Cy_SMIF_HyperBus_InitDevice (SMIF_Type *base, const cy_stc_smif_mem_config_t *memCfg, cy_stc_smif_context_t *context)
 This function sets up SMIF registers for hyper bus memory. More...
 
cy_en_smif_status_t Cy_SMIF_HyperBus_CalibrateDelay (SMIF_Type *base, cy_stc_smif_mem_config_t *memConfig, uint8_t dummyCycles, uint32_t calibrationDataOffsetAddress, cy_stc_smif_context_t *context)
 This function reads the calibration data pattern in the Hyper memory for every delay tap of the currently selected delay line and records whether it matches the reference pattern. More...
 
cy_en_smif_status_t Cy_SMIF_HyperBus_Read (SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, cy_en_hb_burst_type_t burstType, uint32_t readAddress, uint32_t sizeInHalfWord, uint16_t buf[], uint32_t dummyCycles, bool doubleLat, bool isblockingMode, cy_stc_smif_context_t *context)
 This function reads data from hyper bus memory in MMIO mode. More...
 
cy_en_smif_status_t Cy_SMIF_HyperBus_Write (SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, cy_en_hb_burst_type_t burstType, uint32_t writeAddress, uint32_t sizeInHalfWord, uint16_t buf[], cy_en_smif_hb_dev_type_t hbDevType, uint32_t dummyCycles, bool isblockingMode, cy_stc_smif_context_t *context)
 This function writes data into hyper bus memory in MMIO mode. More...
 
cy_en_smif_status_t Cy_SMIF_HyperBus_MMIO_Write (SMIF_Type *base, cy_en_smif_slave_select_t slave, cy_en_hb_burst_type_t burstType, uint32_t writeAddress, uint32_t sizeInHalfWord, uint16_t buf[], cy_en_smif_hb_dev_type_t hbDevType, uint32_t dummyCycle, bool isblockingMode, cy_stc_smif_context_t *context)
 This function writes data into hyper bus memory in MMIO mode. More...
 
cy_en_smif_status_t CY_SMIF_HyperBus_ReadStatus (SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, uint16_t *regStatus, cy_stc_smif_context_t *context)
 This function reads the flash status register bits. More...
 
cy_en_smif_status_t CY_SMIF_HyperBus_ClearStatus (SMIF_Type *base, cy_stc_smif_mem_config_t *memConfig, cy_stc_smif_context_t *context)
 This function clears the flash status register bits. More...
 
cy_en_smif_status_t Cy_SMIF_HyperBus_EraseSector (SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, uint32_t offset, cy_stc_smif_context_t *context)
 This function Erases the data in the given sector. More...
 
cy_en_smif_status_t Cy_SMIF_HyperBus_EraseChip (SMIF_Type *base, cy_stc_smif_mem_config_t *memConfig, cy_stc_smif_context_t *context)
 This function Erases the data in the entire flash memory. More...
 

Function Documentation

◆ Cy_SMIF_MemInit()

cy_en_smif_status_t Cy_SMIF_MemInit ( SMIF_Type *  base,
cy_stc_smif_block_config_t const *  blockConfig,
cy_stc_smif_context_t context 
)

This function initializes the slots of the memory device in the SMIF configuration.

This function must be called when a memory device is required to be used in memory-mapped (XIP) mode. This function can also be called instead of calling Cy_SMIF_MemSfdpDetect when SFDP auto-discovery is enabled. Note that this function performs SFDP on all the external memories whereas Cy_SMIF_MemSfdpDetect performs it only on one memory that is specified through the arguments. This function configures the SMIF device slot registers with the configuration from cy_stc_smif_mem_config_t structure which is a member of the cy_stc_smif_block_config_t structure. If SFDP discovery is enabled in the configuration structure through autoDetectSfdp field, this function calls Cy_SMIF_MemSfdpDetect function for each memory, fills the structures with the discovered parameters, and configures the SMIF device slot registers accordingly. Cy_SMIF_Init must have been called prior to calling this function. The cy_stc_smif_context_t context structure returned from Cy_SMIF_Init is passed as a parameter to this function.

Note
4-byte addressing mode is set when the memory device supports 3- or 4-byte addressing mode.
Parameters
baseThe address of the slave-slot device register to initialize.
blockConfigThe configuration structure array that configures the SMIF memory device to be mapped into the PSoC memory map. cy_stc_smif_mem_config_t
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The memory slot initialization status.

◆ Cy_SMIF_MemDeInit()

void Cy_SMIF_MemDeInit ( SMIF_Type *  base)

This function de-initializes all slave slots of the memory device to their default values.

Parameters
baseHolds the base address of the SMIF block registers.

◆ Cy_SMIF_MemCmdWriteEnable()

cy_en_smif_status_t Cy_SMIF_MemCmdWriteEnable ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
cy_stc_smif_context_t const *  context 
)

This function sends the Write Enable command to the memory device.

Note
This function uses the low-level Cy_SMIF_TransmitCommand() API. The Cy_SMIF_TransmitCommand() API works in a blocking mode. In the dual quad mode, this API is called for each memory.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command transmission.

◆ Cy_SMIF_MemCmdWriteDisable()

cy_en_smif_status_t Cy_SMIF_MemCmdWriteDisable ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
cy_stc_smif_context_t const *  context 
)

This function sends a Write Disable command to the memory device.

Note
This function uses the low-level Cy_SMIF_TransmitCommand() API. Cy_SMIF_TransmitCommand() API works in a blocking mode. In the dual quad mode this API should be called for each memory.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command transmission.

◆ Cy_SMIF_MemIsBusy()

bool Cy_SMIF_MemIsBusy ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
cy_stc_smif_context_t const *  context 
)

This function checks if the status of the memory device is busy.

This is done by reading the status register and the corresponding bit (stsRegBusyMask). This function is a blocking function until the status register from the memory is read.

Note
In the dual quad mode, this API is called for each memory.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the memory device.
  • True - The device is busy or a timeout occurs.
  • False - The device is not busy.
Note
Check Rules for SMIF Block Usage for any usage restriction

◆ Cy_SMIF_MemQuadEnable()

cy_en_smif_status_t Cy_SMIF_MemQuadEnable ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
cy_stc_smif_context_t const *  context 
)

This function enables the memory device for the quad mode of operation.

This command must be executed before sending quad SPI commands to the memory device.

Note
In the dual quad mode, this API is called for each memory.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command.
Note
Check Rules for SMIF Block Usage for any usage restriction

◆ Cy_SMIF_MemOctalEnable()

cy_en_smif_status_t Cy_SMIF_MemOctalEnable ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
cy_en_smif_data_rate_t  dataRate,
cy_stc_smif_context_t const *  context 
)

This function enables the memory device for the octal mode of operation.

This command must be executed before sending octal SPI commands to the memory device.

Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
dataRateSpecifies the data rate to enable (SDR/DDR).
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command.
Note
Check Rules for SMIF Block Usage for any usage restriction
/*
* mem octal enable is to use all the eight I/Os during communication.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
Cy_SMIF_MemInit(SMIF, &smifBlockConfig, &smifContext);
/* This function enables the memory device for the octal mode of operation.
* This command must be executed before sending octal SPI commands to the
* memory device.
*/
if (CY_SMIF_SUCCESS != Cy_SMIF_MemOctalEnable(SMIF, smifBlockConfig.memConfig[0], CY_SMIF_DDR, &SMIF_context))
{
/* Insert error handling */
}
The SMIF internal context data.
Definition: cy_smif.h:994
@ CY_SMIF_DDR
The SMIF Double Data Rate (DDR)
Definition: cy_smif.h:792
@ CY_SMIF_SUCCESS
Successful SMIF operation.
Definition: cy_smif.h:684
cy_en_smif_status_t Cy_SMIF_MemInit(SMIF_Type *base, cy_stc_smif_block_config_t const *blockConfig, cy_stc_smif_context_t *context)
This function initializes the slots of the memory device in the SMIF configuration.
Definition: cy_smif_memslot.c:101
cy_en_smif_status_t Cy_SMIF_MemOctalEnable(SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_en_smif_data_rate_t dataRate, cy_stc_smif_context_t const *context)
This function enables the memory device for the octal mode of operation.
Definition: cy_smif_memslot.c:614

◆ Cy_SMIF_MemCmdReadStatus()

cy_en_smif_status_t Cy_SMIF_MemCmdReadStatus ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
uint8_t *  status,
uint8_t  command,
cy_stc_smif_context_t const *  context 
)

This function reads the status register.

This function is a blocking function, it will block the execution flow until the status register is read.

Note
This function uses the low-level Cy_SMIF_TransmitCommand() API. the Cy_SMIF_TransmitCommand() API works in a blocking mode. In the dual quad mode, this API is called for each memory.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
statusThe status register value returned by the external memory.
commandThe command required to read the status/configuration register.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command reception.
Note
Check Rules for SMIF Block Usage for any usage restriction

◆ Cy_SMIF_MemCmdWriteStatus()

cy_en_smif_status_t Cy_SMIF_MemCmdWriteStatus ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
void const *  status,
uint8_t  command,
cy_stc_smif_context_t const *  context 
)

This function writes the status register.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Note
This function uses the low-level Cy_SMIF_TransmitCommand() API. The Cy_SMIF_TransmitCommand() API works in a blocking mode. In the dual quad mode, this API is called for each memory.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
statusThe status to write into the status register.
commandThe command to write into the status/configuration register.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command transmission.

◆ Cy_SMIF_MemCmdChipErase()

cy_en_smif_status_t Cy_SMIF_MemCmdChipErase ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
cy_stc_smif_context_t const *  context 
)

This function performs a chip erase of the external memory.

The Write Enable command is called before this API.

Note
This function uses the low-level Cy_SMIF_TransmitCommand() API. Cy_SMIF_TransmitCommand() API works in a blocking mode. In the dual quad mode, this API is called for each memory.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command transmission.

◆ Cy_SMIF_MemCmdSectorErase()

cy_en_smif_status_t Cy_SMIF_MemCmdSectorErase ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
uint8_t const *  sectorAddr,
cy_stc_smif_context_t const *  context 
)

This function performs a block Erase of the external memory.

The Write Enable command is called before this API.

Note
This function uses the low-level Cy_SMIF_TransmitCommand() API. The Cy_SMIF_TransmitCommand() API works in a blocking mode. In the dual quad mode, this API is called for each memory.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
sectorAddrThe sector address to erase.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command transmission.

◆ Cy_SMIF_MemCmdProgram()

cy_en_smif_status_t Cy_SMIF_MemCmdProgram ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
uint8_t const *  addr,
uint8_t const *  writeBuff,
uint32_t  size,
cy_smif_event_cb_t  cmdCompleteCb,
cy_stc_smif_context_t context 
)

This function performs the Program operation.

Note
This function uses the Cy_SMIF_TransmitCommand() API. The Cy_SMIF_TransmitCommand() API works in the blocking mode. In the dual quad mode, this API works with both types of memory simultaneously.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
addrThe address to program.
writeBuffThe pointer to the data to program. 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. 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 Cy_SMIF_TransmitData().
sizeThe size of data to program. The user must ensure that the data size does not exceed the page size.
cmdCompleteCbThe callback function to call after the transfer completion. NULL interpreted as no callback.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of a transmission.

◆ Cy_SMIF_MemCmdRead()

cy_en_smif_status_t Cy_SMIF_MemCmdRead ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
uint8_t const *  addr,
uint8_t *  readBuff,
uint32_t  size,
cy_smif_event_cb_t  cmdCompleteCb,
cy_stc_smif_context_t context 
)

This function performs the Read operation.

Note
This function uses the Cy_SMIF_TransmitCommand() API. The Cy_SMIF_TransmitCommand() API works in the blocking mode. In the dual quad mode, this API works with both types of memory simultaneously.
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
addrThe address to read.
readBuffThe pointer to the variable where the read 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. 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 Cy_SMIF_TransmitData().
sizeThe size of data to read.
cmdCompleteCbThe callback function to call after the transfer completion. NULL interpreted as no callback.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the transmission.
Note
Check Rules for SMIF Block Usage for any usage restriction

◆ Cy_SMIF_MemSfdpDetect()

cy_en_smif_status_t Cy_SMIF_MemSfdpDetect ( SMIF_Type *  base,
cy_stc_smif_mem_device_cfg_t device,
cy_en_smif_slave_select_t  slaveSelect,
cy_en_smif_data_select_t  dataSelect,
cy_stc_smif_context_t context 
)

This function detects the device signature for SFDP devices.

Refer to the SFDP spec (JESD216B) for details. The function asks the device using an SPI and then populates the relevant parameters for cy_stc_smif_mem_device_cfg_t.

Note
This function is a blocking function and blocks until the structure data is read and returned. This function uses Cy_SMIF_TransmitCommand() If there is no support for SFDP in the memory device, the API returns an error condition. The function requires:
The SFDP detect takes into account the types of the SPI supported by the memory device and also the dataSelect option selected to choose which SPI mode (SPI, DSPI, QSPI, OSPI) to load into the structures. The algorithm prefers OSPI>QSPI>DSPI>SPI, provided there is support for it in the memory device and the dataSelect selected by the user. Similarly for data rate, DDR is preferred over SDR if the memory part supports.
4-byte addressing mode is set when the memory device supports 3- or 4-byte addressing mode.
When the Erase command is not found the width of the command transfer (cmdWidth) is set to CY_SMIF_WIDTH_NA. When the Program command is not found for 4 byte addressing mode the Program command instruction is set for 1S-1S-1S Protocol mode and 3-byte addressing mode.
Parameters
baseHolds the base address of the SMIF block registers.
deviceThe device structure instance declared by the user. This is where the detected parameters are stored and returned.
slaveSelectThe slave select line for the device.
dataSelectThe data line selection options for a slave device.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the transmission.

◆ Cy_SMIF_Reset_Memory()

void Cy_SMIF_Reset_Memory ( SMIF_Type *  base,
cy_en_smif_slave_select_t  slaveSelect 
)

This function is the weak implementation for resetting the memory.

Parameters
baseHolds the base address of the SMIF block registers.
slaveSelectDenotes the number of the slave device to which reset has to be applied for.

◆ Cy_SMIF_MemInitSfdpMode()

cy_en_smif_status_t Cy_SMIF_MemInitSfdpMode ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memCfg,
cy_en_smif_txfr_width_t  maxdataWidth,
cy_en_smif_qer_t  qer_id,
cy_stc_smif_context_t context 
)

This function can be used for any preferred data width based command instruction set from SFDP Buffer.

Parameters
baseHolds the base address of the SMIF block registers.
memCfgThe memory configuration structure that configures the SMIF memory device to map into the device memory map. cy_stc_smif_mem_config_t
maxdataWidthmaximum data width available on physical interface.
qer_idQuad enable requirement ID specifically used for SFDP 1.0 compliant devices where Quad mode is available for use, but SFDP basic flash parameter table does not specify quad mode enable instruction. In other cases, this can be passed as CY_SMIF_SFDP_QER_0.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the transmission.
/* Map memory device to memory map */
Cy_SMIF_Memslot_Init(SMIF, (cy_stc_smif_block_config_t *) &smifBlockConfig, &smifContext);
/* Even after SFDP enumeration QE command is not initialized */
/* So, it should be 1.0 device */
if ((smifMemConfigs[0]->deviceCfg->readStsRegQeCmd->command == 0) || /* 0 - if configurator generated code */
(smifMemConfigs[0]->deviceCfg->readStsRegQeCmd->command == CY_SMIF_NO_COMMAND_OR_MODE)) /* 0xFF's if SFDP enumerated */
{
Cy_SMIF_MemInitSfdpMode(SMIF, smifMemConfigs[0], CY_SMIF_WIDTH_QUAD, CY_SMIF_SFDP_QER_1,&smifContext);
}
This SMIF memory configuration structure is used to store the memory configuration for the memory mod...
Definition: cy_smif_memslot.h:810
@ CY_SMIF_SFDP_QER_1
Bit 1 of Status Register 2 - Write uses 2 bytes using 01h.
Definition: cy_smif.h:770
@ CY_SMIF_WIDTH_QUAD
Quad SPI mode.
Definition: cy_smif.h:512
#define CY_SMIF_NO_COMMAND_OR_MODE
No command or mode present.
Definition: cy_smif_memslot.h:203
cy_en_smif_status_t Cy_SMIF_MemInitSfdpMode(SMIF_Type *base, const cy_stc_smif_mem_config_t *memCfg, cy_en_smif_txfr_width_t maxdataWidth, cy_en_smif_qer_t qer_id, cy_stc_smif_context_t *context)
This function can be used for any preferred data width based command instruction set from SFDP Buffer...
Definition: cy_smif_sfdp.c:2422

◆ Cy_SMIF_MemIsReady()

cy_en_smif_status_t Cy_SMIF_MemIsReady ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memConfig,
uint32_t  timeoutUs,
cy_stc_smif_context_t const *  context 
)

Polls the memory device to check whether it is ready to accept new commands or not until either it is ready or the retries have exceeded the limit.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe memory device configuration.
timeoutUsThe timeout value in microseconds to apply while polling the memory.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status of the operation. CY_SMIF_SUCCESS - Memory is ready to accept new commands. CY_SMIF_EXCEED_TIMEOUT - Memory is busy.
Function Usage
/* Scenario: Wait until the erase operation is completed.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
#define TIMEOUT (10000UL) /* 10 msec timeout */
/* Wait until the erase operation is completed or a timeout occurs */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemIsReady(SMIF, smifBlockConfig.memConfig[0], TIMEOUT, &SMIF_context))
{
/* Insert error handling */
}
cy_en_smif_status_t Cy_SMIF_MemIsReady(SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t timeoutUs, cy_stc_smif_context_t const *context)
Polls the memory device to check whether it is ready to accept new commands or not until either it is...
Definition: cy_smif_memslot.c:1327

◆ Cy_SMIF_MemIsQuadEnabled()

cy_en_smif_status_t Cy_SMIF_MemIsQuadEnabled ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memConfig,
bool *  isQuadEnabled,
cy_stc_smif_context_t const *  context 
)

Checks whether the QE (Quad Enable) bit is set or not in the configuration register of the memory.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe memory device configuration.
isQuadEnabledThis parameter is updated to indicate whether quad mode is enabled (true) or not (false). The value is valid only when the function returns CY_SMIF_SUCCESS.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status of the operation. See cy_en_smif_status_t.
Function Usage
/* Scenario: Check whether Quad mode (1-1-4 or 1-4-4 modes) is enabled. If Quad mode is disabled,
* then enable it to use all the four I/Os during communication.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
/* Timeout in microseconds to apply while polling the memory for its ready status after quad
* enable command has been sent out. Quad enable is a non-volatile write.
*/
#define QUAD_ENABLE_TIMEOUT (5000UL) /* 5 milliseconds */
bool isQuadEnabled = false;
/* Check whether Quad mode is enabled */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemIsQuadEnabled(SMIF, smifBlockConfig.memConfig[0], &isQuadEnabled, &SMIF_context))
{
/* Insert error handling */
}
if (!isQuadEnabled)
{
/* Enable Quad Mode */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemEnableQuadMode(SMIF, smifBlockConfig.memConfig[0], QUAD_ENABLE_TIMEOUT, &SMIF_context))
{
/* Insert error handling */
}
}
cy_en_smif_status_t Cy_SMIF_MemEnableQuadMode(SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t timeoutUs, cy_stc_smif_context_t const *context)
Sets the QE (QUAD Enable) bit in the external memory configuration register to enable quad SPI mode.
Definition: cy_smif_memslot.c:1489
cy_en_smif_status_t Cy_SMIF_MemIsQuadEnabled(SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, bool *isQuadEnabled, cy_stc_smif_context_t const *context)
Checks whether the QE (Quad Enable) bit is set or not in the configuration register of the memory.
Definition: cy_smif_memslot.c:1437

◆ Cy_SMIF_MemEnableQuadMode()

cy_en_smif_status_t Cy_SMIF_MemEnableQuadMode ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memConfig,
uint32_t  timeoutUs,
cy_stc_smif_context_t const *  context 
)

Sets the QE (QUAD Enable) bit in the external memory configuration register to enable quad SPI mode.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe memory device configuration.
timeoutUsThe timeout value in microseconds to apply while polling the memory.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status of the operation. See cy_en_smif_status_t.
Function Usage
See Cy_SMIF_MemIsQuadEnabled usage.

◆ Cy_SMIF_MemRead()

cy_en_smif_status_t Cy_SMIF_MemRead ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memConfig,
uint32_t  address,
uint8_t  rxBuffer[],
uint32_t  length,
cy_stc_smif_context_t const *  context 
)

Reads data from the external memory and blocks until the read transfer is complete or a timeout occurs.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe memory device configuration.
addressThe address to read data from.
rxBufferThe buffer for storing the read data. In case of Octal DDR, address must be an even address.
lengthThe size of data to read.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status of the operation. See cy_en_smif_status_t.
Function Usage
/* Scenario: Read 64 bytes of data from the external memory into the rxBuffer array.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
#define READ_PACKET_SIZE (64U) /* Data Buffer size */
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
uint32_t extMemAddress = 0x00UL; /* Address = 0x00000000 (4 bytes) */
uint8_t rxBuffer[READ_PACKET_SIZE];
/* Read data from the external memory */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemRead(SMIF, smifBlockConfig.memConfig[0], extMemAddress, rxBuffer, READ_PACKET_SIZE, &SMIF_context))
{
/* Insert error handling */
}
cy_en_smif_status_t Cy_SMIF_MemRead(SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t address, uint8_t rxBuffer[], uint32_t length, cy_stc_smif_context_t const *context)
Reads data from the external memory and blocks until the read transfer is complete or a timeout occur...
Definition: cy_smif_memslot.c:1549

◆ Cy_SMIF_MemWrite()

cy_en_smif_status_t Cy_SMIF_MemWrite ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memConfig,
uint32_t  address,
uint8_t const  txBuffer[],
uint32_t  length,
cy_stc_smif_context_t const *  context 
)

This function writes data to the external memory.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe memory device configuration.
addressThe address to write data at. In case of Octal DDR, address must be an even address.
txBufferThe buffer holding the data to write in the external memory.
lengthThe size of data to write.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status of the operation. See cy_en_smif_status_t.
Function Usage
/* Scenario: Write 64 bytes of data from the txBuffer array into the external memory.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
#define WRITE_PACKET_SIZE (64U) /* Data Buffer size */
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
uint32_t extMemAddress = 0x00UL; /* Address = 0x00000000 */
uint8_t txBuffer[WRITE_PACKET_SIZE] = {0};
/* Write data into the external memory */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemWrite(SMIF, smifBlockConfig.memConfig[0], extMemAddress, txBuffer, WRITE_PACKET_SIZE, &SMIF_context))
{
/* Insert error handling */
}
cy_en_smif_status_t Cy_SMIF_MemWrite(SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t address, uint8_t const txBuffer[], uint32_t length, cy_stc_smif_context_t const *context)
This function writes data to the external memory.
Definition: cy_smif_memslot.c:1688

◆ Cy_SMIF_MemEraseSector()

cy_en_smif_status_t Cy_SMIF_MemEraseSector ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memConfig,
uint32_t  address,
uint32_t  length,
cy_stc_smif_context_t const *  context 
)

Erases a block/sector of the external memory.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe memory device configuration.
addressThe address of the block to be erased. The address will be aligned to the start address of the sector in which address is located.
lengthThe length of data to erase. The length will be aligned to the sector boundary where end address is located. If length exceeds memory size API returns CY_SMIF_BAD_PARAM without performing erase operation.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status of the operation. See cy_en_smif_status_t.
Note
Memories like hybrid have sectors of different sizes.
Check the address and length parameters before calling this function.
Function Usage
/* Scenario: Erase one sector of the external memory.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
uint32_t extMemAddress = 0x00UL; /* Address = 0x00000000 */
uint32_t length = smifBlockConfig.memConfig[0]->deviceCfg->eraseSize; /* The sector size */
/* Erase a sector of the external memory */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemEraseSector(SMIF, smifBlockConfig.memConfig[0], extMemAddress, length, &SMIF_context))
{
/* Insert error handling */
}
cy_en_smif_status_t Cy_SMIF_MemEraseSector(SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t address, uint32_t length, cy_stc_smif_context_t const *context)
Erases a block/sector of the external memory.
Definition: cy_smif_memslot.c:1833

◆ Cy_SMIF_MemEraseSectorStrict()

cy_en_smif_status_t Cy_SMIF_MemEraseSectorStrict ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memConfig,
uint32_t  address,
uint32_t  length,
cy_stc_smif_context_t const *  context 
)

Erases a block/sector of the external memory.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe memory device configuration.
addressThe address of the block to be erased. The address needs to be aligned with the start address of the sector.Otherwise, API returns CY_SMIF_BAD_PARAM without performing erase operation.
lengthThe size of data to erase. The length needs to be equal to the sum of all sectors length to be erased. Otherwise, API returns CY_SMIF_BAD_PARAM without performing erase operation.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status of the operation. See cy_en_smif_status_t.
Note
Memories like hybrid have sectors of different sizes.
Check the address and length parameters before calling this function.
Function Usage
/* Scenario: Erase one sector of the external memory.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
uint32_t extMemAddress = 0x00UL; /* Address = 0x00000000 */
uint32_t length = smifBlockConfig.memConfig[0]->deviceCfg->eraseSize; /* The sector size */
/* Erase a sector of the external memory */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemEraseSectorStrict(SMIF, smifBlockConfig.memConfig[0], extMemAddress, length, &SMIF_context))
{
/* Insert error handling */
}
cy_en_smif_status_t Cy_SMIF_MemEraseSectorStrict(SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, uint32_t address, uint32_t length, cy_stc_smif_context_t const *context)
Erases a block/sector of the external memory.
Definition: cy_smif_memslot.c:2034

◆ Cy_SMIF_MemEraseChip()

cy_en_smif_status_t Cy_SMIF_MemEraseChip ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memConfig,
cy_stc_smif_context_t const *  context 
)

Erases the entire chip of the external memory.

This is a blocking function, it will block the execution flow until the command transmission is completed.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe memory device configuration.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
The status of the operation. See cy_en_smif_status_t.
Function Usage
/* Scenario: Erase the entire chip.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
/* Erase the entire chip */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemEraseChip(SMIF, smifBlockConfig.memConfig[0], &SMIF_context))
{
/* Insert error handling */
}
cy_en_smif_status_t Cy_SMIF_MemEraseChip(SMIF_Type *base, cy_stc_smif_mem_config_t const *memConfig, cy_stc_smif_context_t const *context)
Erases the entire chip of the external memory.
Definition: cy_smif_memslot.c:2193

◆ Cy_SMIF_MemLocateHybridRegion()

cy_en_smif_status_t Cy_SMIF_MemLocateHybridRegion ( cy_stc_smif_mem_config_t const *  memDevice,
cy_stc_smif_hybrid_region_info_t **  regionInfo,
uint32_t  address 
)

This function locates the region structure by the address which belongs to it.

Note
This function is valid for the memories with hybrid sectors.
Parameters
memDeviceThe memory device configuration.
regionInfoPlaces a hybrid region configuration structure that contains the region specific parameters. See cy_stc_smif_hybrid_region_info_t for reference.
addressThe address for which a region is searched.
Returns
A status of the region location.
Function Usage
/* Scenario: Get the erase size for a specific region.
* Erase one sector of the external memory.
* The SMIF/QSPI configuration tool generates the smifBlockConfig structure
* needed for the memslot level API usage.
*/
cy_stc_smif_hybrid_region_info_t *currentRegionInfo = NULL; /* The pointer to the structure
* which defines the region
* we are searching for.*/
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global
*/
uint32_t regionAddress = 0x00UL; /* The address for which a region is searched */
/* Update the currentRegion with a pointer to the region the address belongs to */
Cy_SMIF_MemLocateHybridRegion(smifBlockConfig.memConfig[0], &currentRegionInfo, regionAddress);
/* Populate the erase size and erase time from the region structure */
uint32_t regionEraseSize = currentRegionInfo->eraseSize;
/* Erase a sector of the external memory */
if (CY_SMIF_SUCCESS != Cy_SMIF_MemEraseSector(SMIF, smifBlockConfig.memConfig[0], regionAddress, regionEraseSize, &SMIF_context))
{
/* Insert error handling */
}
uint32_t eraseSize
This specifies the size of one sector.
Definition: cy_smif_memslot.h:580
This structure specifies data used for memory with hybrid sectors.
Definition: cy_smif_memslot.h:576
cy_en_smif_status_t Cy_SMIF_MemLocateHybridRegion(cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_hybrid_region_info_t **regionInfo, uint32_t address)
This function locates the region structure by the address which belongs to it.
Definition: cy_smif_memslot.c:1232

◆ Cy_SMIF_SetReadyPollingDelay()

void Cy_SMIF_SetReadyPollingDelay ( uint16_t  pollTimeoutUs,
cy_stc_smif_context_t context 
)

This function sets the polling delay in micro seconds to check memory device availability.

By default polling delay is set to 0.

Parameters
pollTimeoutUsSpecifies the polling timeout value in micro seconds.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.

◆ Cy_SMIF_MemCmdPowerDown()

cy_en_smif_status_t Cy_SMIF_MemCmdPowerDown ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
cy_stc_smif_context_t const *  context 
)

This function sends a Power-down command to the selected memory device in Single SPI mode.

Please note that, once Cy_SMIF_MemCmdPowerDown is issued, external memory will not respond to any other command except Cy_SMIF_MemCmdReleasePowerDown.

Note
This function uses the low-level Cy_SMIF_TransmitCommand() API. Cy_SMIF_TransmitCommand() API works in a blocking mode. In the dual quad mode this API should be called for each memory.
While there is no standardized opcode to power down, many devices use 0xB9 (CY_SMIF_POWER_DOWN_CMD) and this function uses that command internally. If a memory device uses a different opcode for power-down mode, this function cannot support that device and users must implement a custom solution using Cy_SMIF_TransmitCommand
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command transmission.
/* This function sends a Power-down command to the selected memory device in Single SPI mode.*/
Cy_SMIF_MemCmdPowerDown(SMIF, &memSs0, &smifContext);
/* This function sends a Release Power-down command to the selected memory device in Single SPI mode. */
Cy_SMIF_MemCmdReleasePowerDown(SMIF, &memSs0, &smifContext);
@ CY_SMIF_NORMAL
Command mode (MMIO mode).
Definition: cy_smif.h:570
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_en_smif_status_t Cy_SMIF_MemCmdPowerDown(SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
This function sends a Power-down command to the selected memory device in Single SPI mode.
Definition: cy_smif_memslot.c:2258
cy_en_smif_status_t Cy_SMIF_MemCmdReleasePowerDown(SMIF_Type *base, cy_stc_smif_mem_config_t const *memDevice, cy_stc_smif_context_t const *context)
This function sends a Release Power-down command to the selected memory device in Single SPI mode.
Definition: cy_smif_memslot.c:2312

◆ Cy_SMIF_MemCmdReleasePowerDown()

cy_en_smif_status_t Cy_SMIF_MemCmdReleasePowerDown ( SMIF_Type *  base,
cy_stc_smif_mem_config_t const *  memDevice,
cy_stc_smif_context_t const *  context 
)

This function sends a Release Power-down command to the selected memory device in Single SPI mode.

Note
This function uses the low-level Cy_SMIF_TransmitCommand() API. Cy_SMIF_TransmitCommand() API works in a blocking mode. In the dual quad mode this API should be called for each memory.
While there is no standardized opcode to release power down, many devices use 0xAB (CY_SMIF_RELEASE_POWER_DOWN_CMD) and this function uses that command internally. If a memory device uses a different opcode for releasing from power-down mode, this function cannot support that device and users must implement a custom solution using Cy_SMIF_TransmitCommand
Parameters
baseHolds the base address of the SMIF block registers.
memDeviceThe device to which the command is sent.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command transmission.
/* This function sends a Power-down command to the selected memory device in Single SPI mode.*/
Cy_SMIF_MemCmdPowerDown(SMIF, &memSs0, &smifContext);
/* This function sends a Release Power-down command to the selected memory device in Single SPI mode. */
Cy_SMIF_MemCmdReleasePowerDown(SMIF, &memSs0, &smifContext);

◆ Cy_SMIF_MemEnableFWCalibration()

void Cy_SMIF_MemEnableFWCalibration ( SMIF_Type *  base,
cy_en_smif_slave_select_t  slave 
)

This function enables Firmware Calibration mode for the device.

Once firmware calibration mode is enabled, user can add delay taps for selected data line using Cy_SMIF_GetSelectedDelayTapSel

Parameters
baseHolds the base address of the SMIF block registers.
slaveHolds the slave select line for which delay tap setting should be applied for.

◆ Cy_SMIF_MemDisableFWCalibration()

void Cy_SMIF_MemDisableFWCalibration ( SMIF_Type *  base,
cy_en_smif_slave_select_t  slave 
)

This function disables Firmware Calibration mode for the device.

Parameters
baseHolds the base address of the SMIF block registers.
slaveHolds the slave select line for which delay tap setting should be applied for.

◆ Cy_SMIF_SetSelectedDelayTapSel()

cy_en_smif_status_t Cy_SMIF_SetSelectedDelayTapSel ( SMIF_Type *  base,
cy_en_smif_slave_select_t  slave,
cy_en_smif_mem_data_line_t  data_line,
uint8_t  tapSel 
)

This function sets delay tap for a particular data line.

Cy_SMIF_MemEnableFWCalibration should be called to get this setting into effect.

Parameters
baseHolds the base address of the SMIF block registers.
slaveHolds the slave select line for which delay tap setting should be applied for.
data_lineHolds the data line for which delay tap setting should be applied for.
tapSeltap selection value (0-15) where lower nibble indicates the delay tap setting for positive clock phase and higher nibble indicates the setting for negative clock phase delay tap selection.
Returns
cy_en_smif_status_t CY_SMIF_SUCCESS - If delay tap is set. CY_SMIF_BAD_PARAM - If user tries to set delay tap without enabling FW Calibration mode.

◆ Cy_SMIF_GetSelectedDelayTapSel()

uint8_t Cy_SMIF_GetSelectedDelayTapSel ( SMIF_Type *  base,
cy_en_smif_slave_select_t  slave,
cy_en_smif_mem_data_line_t  data_line 
)

This function gets delay tap set for a particular data line.

Parameters
baseHolds the base address of the SMIF block registers.
slaveHolds the slave select line for which delay tap setting should be retrieved.
data_lineHolds the data line for which delay tap setting should be retrieved.
Returns
uint8_t tap selection value where lower nibble indicates the delay tap setting for positive clock phase and higher nibble indicates the setting for negative clock phase delay tap selection.

◆ Cy_SMIF_MemGetSDLTap()

cy_en_smif_status_t Cy_SMIF_MemGetSDLTap ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memConfig,
uint8_t *  posTap,
uint8_t *  negTap 
)

This function retrieves the Slave Delay Line (SDL) Tap in use.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe device for which SDL tap value has to be retrieved.
posTapReturns positive delay tap value set.
negTapReturns negative delay tap value set.
Returns
A status of the command transmission.

◆ Cy_SMIF_MemSetSDLTap()

cy_en_smif_status_t Cy_SMIF_MemSetSDLTap ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memConfig,
uint8_t  posTap,
uint8_t  negTap 
)

This function sets the Slave Delay Line (SDL) tap ranging from 0 to 15.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe device for which SDL tap value has to be set.
posTapPositive delay tap value to be set.
negTapNegative delay tap value to be set.

modify anything in this structure.

Returns
A status of the command transmission.

◆ Cy_SMIF_MemCalibrateSDL()

cy_en_smif_status_t Cy_SMIF_MemCalibrateSDL ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memConfig,
uint32_t  calibrationDataOffsetAddress,
cy_stc_smif_context_t context 
)

This function takes an offset address as input to perform read/write test and assign best possible Slave Delay Line (SDL) tap.

In case of flash memory, the sector where the address falls in would be erased to perform write operation of calibration pattern.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigThe device to which calibration of SDL tap
calibrationDataOffsetAddressOffset address in the memory to which calibration pattern would be written and read back to identify the best possible SDL tap.
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
A status of the command transmission.

◆ Cy_SMIF_HyperBus_InitDevice()

cy_en_smif_status_t Cy_SMIF_HyperBus_InitDevice ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memCfg,
cy_stc_smif_context_t context 
)

This function sets up SMIF registers for hyper bus memory.

Parameters
deviceHolds the base address of the SMIF Device registers.
memCfgConfiguration to be applied to the SMIF device cy_stc_smif_mem_config_t
contextThis is the pointer to the context structure cy_stc_smif_context_t allocated by the user. The structure is used during the SMIF operation for internal configuration and data retention. The user must not modify anything in this structure.
Returns
uint8_t readBuf[SIZE_IN_BYTES];
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global */
{
.dummyCycles = 16,
.hbDevType = CY_SMIF_HB_FLASH,
};
cy_stc_smif_mem_config_t S26HL512T_SlaveSlot_0 =
{
/* Determines the slot number where the memory device is placed. */
/* Flags. */
.flags = CY_SMIF_FLAG_SMIF_REV_3 | CY_SMIF_FLAG_WR_EN | CY_SMIF_FLAG_CRYPTO_EN | CY_SMIF_FLAG_MERGE_ENABLE | CY_SMIF_FLAG_MEMORY_MAPPED,
/* The data-line selection options for a slave device. */
.dataSelect = CY_SMIF_DATA_SEL0,
/* The base address the memory slave is mapped to in the PSoC memory map.
Valid when the memory-mapped mode is enabled. */
.baseAddress = 0x60000000U,
/* The size allocated in the PSoC memory map, for the memory slave device.
The size is allocated from the base address. Valid when the memory mapped mode is enabled. */
.memMappedSize = 0x10000U,
/* If this memory device is one of the devices in the dual quad SPI configuration.
Valid when the memory mapped mode is enabled. */
.dualQuadSlots = 0,
/* The configuration of the device. */
//.deviceCfg = &deviceCfg_S26HL512T_SlaveSlot_0,
.mergeTimeout = CY_SMIF_MERGE_TIMEOUT_256_CYCLES,
.hbdeviceCfg = &smifDevHBFlashCfg,
};
cy_stc_smif_mem_config_t* smifMemConfigs[CY_SMIF_DEVICE_NUM] = {
&S26HL512T_SlaveSlot_0
};
cy_stc_smif_block_config_t smif_Block_Config =
{
/* The number of SMIF memories defined. */
.memCount = CY_SMIF_DEVICE_NUM,
/* The pointer to the array of memory config structures of size memCount. */
.memConfig = (cy_stc_smif_mem_config_t**)smifMemConfigs,
/* The version of the SMIF driver. */
.majorVersion = CY_SMIF_DRV_VERSION_MAJOR,
/* The version of the SMIF driver. */
.minorVersion = CY_SMIF_DRV_VERSION_MINOR
};
const cy_stc_smif_config_t SMIF_config =
{
.mode = (uint32_t)CY_SMIF_NORMAL,
.deselectDelay = 0,
.blockEvent = (uint32_t)CY_SMIF_BUS_ERROR,
.delayTapEnable = CY_SMIF_DELAY_TAP_ENABLE,
.delayLineSelect = CY_SMIF_4_SEL_PER_TAP,
};
SMIF_Status = Cy_SMIF_Init(SMIF, &SMIF_config, TIMEOUT_1_MS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Cy_SMIF_SetDataSelect(SMIF, smifMemConfigs[0]->slaveSelect, smifMemConfigs[0]->dataSelect);
Cy_SMIF_Enable(SMIF, &SMIF_context);
SMIF_Status = Cy_SMIF_Memslot_Init(SMIF, (cy_stc_smif_block_config_t *) &smif_Block_Config, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#if (CY_IP_MXSMIF_VERSION == 2U || CY_IP_MXSMIF_VERSION == 4U)
SMIF_Status = Cy_SMIF_HyperBus_CalibrateDelay(SMIF, smifMemConfigs[0],smifDevHBFlashCfg.dummyCycles, TST_ADDRESS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#endif
/********* Erase Test Sector *******/
Cy_SMIF_HyperBus_EraseSector(SMIF,smifMemConfigs[0],TST_ADDRESS,&SMIF_context);
/********* Write to Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Write(SMIF,
smifMemConfigs[0],
TST_ADDRESS, // address
32, // size in half word
(uint16_t*)&programData[0],
smifDevHBFlashCfg.dummyCycles,
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
/********* Read from Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Read(SMIF,
smifMemConfigs[0],
(TST_ADDRESS), // address
SIZE_IN_HWORD, // size in half word
(uint16_t*)readBuf,
smifDevHBFlashCfg.dummyCycles,
false, // Double initial latency
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
cy_en_smif_slave_select_t slaveSelect
Determines the slave select where the memory device is placed.
Definition: cy_smif_memslot.h:769
cy_en_smif_hb_rd_cmd_t xipReadCmd
read command value cy_en_smif_hb_rd_cmd_t
Definition: cy_smif_memslot.h:700
uint32_t dummyCycles
dummy Cycles based on Frequency of operation
Definition: cy_smif_memslot.h:709
uint32_t memCount
The number of SMIF memory defined
Definition: cy_smif_memslot.h:811
@ CY_SMIF_HB_READ_CONTINUOUS_BURST
bit 47 = 1: read, bit 45 = 1: continuous burst
Definition: cy_smif_memslot.h:604
@ CY_SMIF_HB_CONTINUOUS_BURST
output data in a sequential manner across page boundaries
Definition: cy_smif_memslot.h:677
@ CY_SMIF_HB_FLASH
Hyper bus FLASH.
Definition: cy_smif_memslot.h:617
@ CY_SMIF_HB_WRITE_CONTINUOUS_BURST
bit 47 = 0: write, bit 45 = 1: continuous burst
Definition: cy_smif_memslot.h:611
@ CY_SMIF_DEVICE_128M_BYTE
for 128M size device
Definition: cy_smif_memslot.h:631
HyperBus device configuration structure.
Definition: cy_smif_memslot.h:699
This SMIF memory configuration structure is used to store the memory configuration for the memory mod...
Definition: cy_smif_memslot.h:767
uint32_t mode
Specifies the mode of operation cy_en_smif_mode_t.
Definition: cy_smif.h:961
The SMIF configuration structure.
Definition: cy_smif.h:960
cy_en_smif_status_t
The SMIF API return values.
Definition: cy_smif.h:683
@ CY_SMIF_DELAY_TAP_ENABLE
The SMIF Delay tap enable.
Definition: cy_smif.h:663
@ CY_SMIF_SEL_INVERTED_SPHB_RWDS_CLK
The SMIF internal inverted clock.
Definition: cy_smif.h:751
@ CY_SMIF_DATA_SEL0
smif.spi_data[0] = DATA0, smif.spi_data[1] = DATA1, ..., smif.spi_data[7] = DATA7.
Definition: cy_smif.h:549
@ CY_SMIF_BAD_PARAM
The SMIF API received the wrong parameter.
Definition: cy_smif.h:692
@ CY_SMIF_4_SEL_PER_TAP
4 cells per tap providing: granularity of max.
Definition: cy_smif.h:537
@ CY_SMIF_SLAVE_SELECT_0
The SMIF slave select 0
Definition: cy_smif.h:728
@ CY_SMIF_BUS_ERROR
Generates a bus error.
Definition: cy_smif.h:521
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
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_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
#define CY_SMIF_FLAG_SMIF_REV_3
Enables IP version 3 features such as octal SPI/DDR mode/ 2 byte addressing.
Definition: cy_smif_memslot.h:101
#define CY_SMIF_FLAG_MEMORY_MAPPED
Determines if the device is memory-mapped.
Definition: cy_smif_memslot.h:92
#define CY_SMIF_FLAG_MERGE_ENABLE
Continuous transfer merge enable.
Definition: cy_smif_memslot.h:106
#define CY_SMIF_DRV_VERSION_MAJOR
The driver major version.
Definition: cy_smif.h:321
#define CY_SMIF_DRV_VERSION_MINOR
The driver minor version.
Definition: cy_smif.h:324
cy_en_smif_status_t Cy_SMIF_HyperBus_Write(SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, cy_en_hb_burst_type_t burstType, uint32_t writeAddress, uint32_t sizeInHalfWord, uint16_t buf[], cy_en_smif_hb_dev_type_t hbDevType, uint32_t dummyCycles, bool isblockingMode, cy_stc_smif_context_t *context)
This function writes data into hyper bus memory in MMIO mode.
Definition: cy_smif_hb_flash.c:382
cy_en_smif_status_t Cy_SMIF_HyperBus_EraseSector(SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, uint32_t offset, cy_stc_smif_context_t *context)
This function Erases the data in the given sector.
Definition: cy_smif_hb_flash.c:569
cy_en_smif_status_t Cy_SMIF_HyperBus_Read(SMIF_Type *base, const cy_stc_smif_mem_config_t *memConfig, cy_en_hb_burst_type_t burstType, uint32_t readAddress, uint32_t sizeInHalfWord, uint16_t buf[], uint32_t dummyCycles, bool doubleLat, bool isblockingMode, cy_stc_smif_context_t *context)
This function reads data from hyper bus memory in MMIO mode.
Definition: cy_smif_hb_flash.c:314
cy_en_smif_status_t Cy_SMIF_HyperBus_CalibrateDelay(SMIF_Type *base, cy_stc_smif_mem_config_t *memConfig, uint8_t dummyCycles, uint32_t calibrationDataOffsetAddress, cy_stc_smif_context_t *context)
This function reads the calibration data pattern in the Hyper memory for every delay tap of the curre...
Definition: cy_smif_hb_flash.c:262

This function sets up SMIF registers for hyper bus memory.

base: Holds the base address of the SMIF base registers.

memCfg: Configuration to be applied to the SMIF device cy_stc_smif_mem_config_t

◆ Cy_SMIF_HyperBus_CalibrateDelay()

cy_en_smif_status_t Cy_SMIF_HyperBus_CalibrateDelay ( SMIF_Type *  base,
cy_stc_smif_mem_config_t memConfig,
uint8_t  dummyCycles,
uint32_t  calibrationDataOffsetAddress,
cy_stc_smif_context_t context 
)

This function reads the calibration data pattern in the Hyper memory for every delay tap of the currently selected delay line and records whether it matches the reference pattern.

After all taps have been scanned, it determines the center tap of the longest sequence of matches and applies this tap.

Note
Function assumes that any SMIF has the same number of delay taps
This API is deprecated, instead please use Cy_SMIF_MemCalibrateSDL API
Parameters
baseHolds the base address of the SMIF Device registers.
memConfigSMIF memory configuration structure for memory mode of operation.
dummyCyclesDummy Cycles based on Frequency of operation
calibrationDataOffsetAddressAddress offset of the calibration data from the device's XIP base address
contextCurrent SMIF driver context
Returns
cy_en_smif_status_t
uint8_t readBuf[SIZE_IN_BYTES];
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global */
{
.dummyCycles = 16,
.hbDevType = CY_SMIF_HB_FLASH,
};
cy_stc_smif_mem_config_t S26HL512T_SlaveSlot_0 =
{
/* Determines the slot number where the memory device is placed. */
/* Flags. */
.flags = CY_SMIF_FLAG_SMIF_REV_3 | CY_SMIF_FLAG_WR_EN | CY_SMIF_FLAG_CRYPTO_EN | CY_SMIF_FLAG_MERGE_ENABLE | CY_SMIF_FLAG_MEMORY_MAPPED,
/* The data-line selection options for a slave device. */
.dataSelect = CY_SMIF_DATA_SEL0,
/* The base address the memory slave is mapped to in the PSoC memory map.
Valid when the memory-mapped mode is enabled. */
.baseAddress = 0x60000000U,
/* The size allocated in the PSoC memory map, for the memory slave device.
The size is allocated from the base address. Valid when the memory mapped mode is enabled. */
.memMappedSize = 0x10000U,
/* If this memory device is one of the devices in the dual quad SPI configuration.
Valid when the memory mapped mode is enabled. */
.dualQuadSlots = 0,
/* The configuration of the device. */
//.deviceCfg = &deviceCfg_S26HL512T_SlaveSlot_0,
.mergeTimeout = CY_SMIF_MERGE_TIMEOUT_256_CYCLES,
.hbdeviceCfg = &smifDevHBFlashCfg,
};
cy_stc_smif_mem_config_t* smifMemConfigs[CY_SMIF_DEVICE_NUM] = {
&S26HL512T_SlaveSlot_0
};
cy_stc_smif_block_config_t smif_Block_Config =
{
/* The number of SMIF memories defined. */
.memCount = CY_SMIF_DEVICE_NUM,
/* The pointer to the array of memory config structures of size memCount. */
.memConfig = (cy_stc_smif_mem_config_t**)smifMemConfigs,
/* The version of the SMIF driver. */
.majorVersion = CY_SMIF_DRV_VERSION_MAJOR,
/* The version of the SMIF driver. */
.minorVersion = CY_SMIF_DRV_VERSION_MINOR
};
const cy_stc_smif_config_t SMIF_config =
{
.mode = (uint32_t)CY_SMIF_NORMAL,
.deselectDelay = 0,
.blockEvent = (uint32_t)CY_SMIF_BUS_ERROR,
.delayTapEnable = CY_SMIF_DELAY_TAP_ENABLE,
.delayLineSelect = CY_SMIF_4_SEL_PER_TAP,
};
SMIF_Status = Cy_SMIF_Init(SMIF, &SMIF_config, TIMEOUT_1_MS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Cy_SMIF_SetDataSelect(SMIF, smifMemConfigs[0]->slaveSelect, smifMemConfigs[0]->dataSelect);
Cy_SMIF_Enable(SMIF, &SMIF_context);
SMIF_Status = Cy_SMIF_Memslot_Init(SMIF, (cy_stc_smif_block_config_t *) &smif_Block_Config, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#if (CY_IP_MXSMIF_VERSION == 2U || CY_IP_MXSMIF_VERSION == 4U)
SMIF_Status = Cy_SMIF_HyperBus_CalibrateDelay(SMIF, smifMemConfigs[0],smifDevHBFlashCfg.dummyCycles, TST_ADDRESS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#endif
/********* Erase Test Sector *******/
Cy_SMIF_HyperBus_EraseSector(SMIF,smifMemConfigs[0],TST_ADDRESS,&SMIF_context);
/********* Write to Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Write(SMIF,
smifMemConfigs[0],
TST_ADDRESS, // address
32, // size in half word
(uint16_t*)&programData[0],
smifDevHBFlashCfg.dummyCycles,
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
/********* Read from Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Read(SMIF,
smifMemConfigs[0],
(TST_ADDRESS), // address
SIZE_IN_HWORD, // size in half word
(uint16_t*)readBuf,
smifDevHBFlashCfg.dummyCycles,
false, // Double initial latency
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}

After all taps have been scanned, it determines the center tap of the longest sequence of matches and applies this tap.

Note
Function assumes that any SMIF has the same number of delay taps
This API is deprecated, instead please use Cy_SMIF_MemCalibrateSDL

◆ Cy_SMIF_HyperBus_Read()

cy_en_smif_status_t Cy_SMIF_HyperBus_Read ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memConfig,
cy_en_hb_burst_type_t  burstType,
uint32_t  readAddress,
uint32_t  sizeInHalfWord,
uint16_t  buf[],
uint32_t  dummyCycles,
bool  doubleLat,
bool  isblockingMode,
cy_stc_smif_context_t context 
)

This function reads data from hyper bus memory in MMIO mode.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
burstTypeSpecifies wrapped or continuous burst. en_hb_bust_type_t
readAddressSpecifies address of external device to be read.
sizeInHalfWordSpecifies memory size to be read. Note hyper bus memory have 16bit data per each address.
bufPointer to buffer where read data to be stored
dummyCyclesDummy Cycles based on Frequency of operation
doubleLatdouble initial latency or single initial latency
isblockingModeBlocking mode or not. if this is true, process waits for the read finished in this function. unless, the process does not wait and exit function.
contextPasses a configuration structure that contains the transfer parameters of the SMIF block.
Returns
cy_en_smif_status_t
uint8_t readBuf[SIZE_IN_BYTES];
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global */
{
.dummyCycles = 16,
.hbDevType = CY_SMIF_HB_FLASH,
};
cy_stc_smif_mem_config_t S26HL512T_SlaveSlot_0 =
{
/* Determines the slot number where the memory device is placed. */
/* Flags. */
.flags = CY_SMIF_FLAG_SMIF_REV_3 | CY_SMIF_FLAG_WR_EN | CY_SMIF_FLAG_CRYPTO_EN | CY_SMIF_FLAG_MERGE_ENABLE | CY_SMIF_FLAG_MEMORY_MAPPED,
/* The data-line selection options for a slave device. */
.dataSelect = CY_SMIF_DATA_SEL0,
/* The base address the memory slave is mapped to in the PSoC memory map.
Valid when the memory-mapped mode is enabled. */
.baseAddress = 0x60000000U,
/* The size allocated in the PSoC memory map, for the memory slave device.
The size is allocated from the base address. Valid when the memory mapped mode is enabled. */
.memMappedSize = 0x10000U,
/* If this memory device is one of the devices in the dual quad SPI configuration.
Valid when the memory mapped mode is enabled. */
.dualQuadSlots = 0,
/* The configuration of the device. */
//.deviceCfg = &deviceCfg_S26HL512T_SlaveSlot_0,
.mergeTimeout = CY_SMIF_MERGE_TIMEOUT_256_CYCLES,
.hbdeviceCfg = &smifDevHBFlashCfg,
};
cy_stc_smif_mem_config_t* smifMemConfigs[CY_SMIF_DEVICE_NUM] = {
&S26HL512T_SlaveSlot_0
};
cy_stc_smif_block_config_t smif_Block_Config =
{
/* The number of SMIF memories defined. */
.memCount = CY_SMIF_DEVICE_NUM,
/* The pointer to the array of memory config structures of size memCount. */
.memConfig = (cy_stc_smif_mem_config_t**)smifMemConfigs,
/* The version of the SMIF driver. */
.majorVersion = CY_SMIF_DRV_VERSION_MAJOR,
/* The version of the SMIF driver. */
.minorVersion = CY_SMIF_DRV_VERSION_MINOR
};
const cy_stc_smif_config_t SMIF_config =
{
.mode = (uint32_t)CY_SMIF_NORMAL,
.deselectDelay = 0,
.blockEvent = (uint32_t)CY_SMIF_BUS_ERROR,
.delayTapEnable = CY_SMIF_DELAY_TAP_ENABLE,
.delayLineSelect = CY_SMIF_4_SEL_PER_TAP,
};
SMIF_Status = Cy_SMIF_Init(SMIF, &SMIF_config, TIMEOUT_1_MS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Cy_SMIF_SetDataSelect(SMIF, smifMemConfigs[0]->slaveSelect, smifMemConfigs[0]->dataSelect);
Cy_SMIF_Enable(SMIF, &SMIF_context);
SMIF_Status = Cy_SMIF_Memslot_Init(SMIF, (cy_stc_smif_block_config_t *) &smif_Block_Config, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#if (CY_IP_MXSMIF_VERSION == 2U || CY_IP_MXSMIF_VERSION == 4U)
SMIF_Status = Cy_SMIF_HyperBus_CalibrateDelay(SMIF, smifMemConfigs[0],smifDevHBFlashCfg.dummyCycles, TST_ADDRESS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#endif
/********* Erase Test Sector *******/
Cy_SMIF_HyperBus_EraseSector(SMIF,smifMemConfigs[0],TST_ADDRESS,&SMIF_context);
/********* Write to Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Write(SMIF,
smifMemConfigs[0],
TST_ADDRESS, // address
32, // size in half word
(uint16_t*)&programData[0],
smifDevHBFlashCfg.dummyCycles,
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
/********* Read from Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Read(SMIF,
smifMemConfigs[0],
(TST_ADDRESS), // address
SIZE_IN_HWORD, // size in half word
(uint16_t*)readBuf,
smifDevHBFlashCfg.dummyCycles,
false, // Double initial latency
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
burstTypeSpecifies wrapped or continuous burst. en_hb_bust_type_t
readAddressSpecifies address of external device to be read.
sizeInHalfWordSpecifies memory size to be read. Note hyper bus memory have 16bit data per each address.
bufPointer to buffer where read data to be stored
dummyCyclesNumber of dummy cycles required before actual read data.
doubleLatdouble initial latency or single initial latency
isblockingModeBlocking mode or not. if this is true, process waits for the read finished in this function. unless, the process does not wait and exit function.
contextPasses a configuration structure that contains the transfer parameters of the SMIF block.
Returns
cy_en_smif_status_t

◆ Cy_SMIF_HyperBus_Write()

cy_en_smif_status_t Cy_SMIF_HyperBus_Write ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memConfig,
cy_en_hb_burst_type_t  burstType,
uint32_t  writeAddress,
uint32_t  sizeInHalfWord,
uint16_t  buf[],
cy_en_smif_hb_dev_type_t  hbDevType,
uint32_t  dummyCycles,
bool  isblockingMode,
cy_stc_smif_context_t context 
)

This function writes data into hyper bus memory in MMIO mode.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
burstTypeSpecifies wrapped or continuous burst. en_hb_bust_type_t
writeAddressSpecifies address of external device to be write.
sizeInHalfWordSpecifies memory size to be read. Note hyper bus memory have 16bit data per each address.
bufPointer to buffer where read data to be stored
hbDevTypeSpecifies hyper bus type. FLASH or SRAM. cy_en_smif_hb_dev_type_t
dummyCyclesDummy Cycles based on Frequency of operation.
isblockingModeBlocking mode or not. if this is true, process waits for the read finished in this function. unless, the process does not wait and exit function.
contextPasses a configuration structure that contains the transfer parameters of the SMIF block.
Returns
cy_en_smif_status_t
uint8_t readBuf[SIZE_IN_BYTES];
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global */
{
.dummyCycles = 16,
.hbDevType = CY_SMIF_HB_FLASH,
};
cy_stc_smif_mem_config_t S26HL512T_SlaveSlot_0 =
{
/* Determines the slot number where the memory device is placed. */
/* Flags. */
.flags = CY_SMIF_FLAG_SMIF_REV_3 | CY_SMIF_FLAG_WR_EN | CY_SMIF_FLAG_CRYPTO_EN | CY_SMIF_FLAG_MERGE_ENABLE | CY_SMIF_FLAG_MEMORY_MAPPED,
/* The data-line selection options for a slave device. */
.dataSelect = CY_SMIF_DATA_SEL0,
/* The base address the memory slave is mapped to in the PSoC memory map.
Valid when the memory-mapped mode is enabled. */
.baseAddress = 0x60000000U,
/* The size allocated in the PSoC memory map, for the memory slave device.
The size is allocated from the base address. Valid when the memory mapped mode is enabled. */
.memMappedSize = 0x10000U,
/* If this memory device is one of the devices in the dual quad SPI configuration.
Valid when the memory mapped mode is enabled. */
.dualQuadSlots = 0,
/* The configuration of the device. */
//.deviceCfg = &deviceCfg_S26HL512T_SlaveSlot_0,
.mergeTimeout = CY_SMIF_MERGE_TIMEOUT_256_CYCLES,
.hbdeviceCfg = &smifDevHBFlashCfg,
};
cy_stc_smif_mem_config_t* smifMemConfigs[CY_SMIF_DEVICE_NUM] = {
&S26HL512T_SlaveSlot_0
};
cy_stc_smif_block_config_t smif_Block_Config =
{
/* The number of SMIF memories defined. */
.memCount = CY_SMIF_DEVICE_NUM,
/* The pointer to the array of memory config structures of size memCount. */
.memConfig = (cy_stc_smif_mem_config_t**)smifMemConfigs,
/* The version of the SMIF driver. */
.majorVersion = CY_SMIF_DRV_VERSION_MAJOR,
/* The version of the SMIF driver. */
.minorVersion = CY_SMIF_DRV_VERSION_MINOR
};
const cy_stc_smif_config_t SMIF_config =
{
.mode = (uint32_t)CY_SMIF_NORMAL,
.deselectDelay = 0,
.blockEvent = (uint32_t)CY_SMIF_BUS_ERROR,
.delayTapEnable = CY_SMIF_DELAY_TAP_ENABLE,
.delayLineSelect = CY_SMIF_4_SEL_PER_TAP,
};
SMIF_Status = Cy_SMIF_Init(SMIF, &SMIF_config, TIMEOUT_1_MS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Cy_SMIF_SetDataSelect(SMIF, smifMemConfigs[0]->slaveSelect, smifMemConfigs[0]->dataSelect);
Cy_SMIF_Enable(SMIF, &SMIF_context);
SMIF_Status = Cy_SMIF_Memslot_Init(SMIF, (cy_stc_smif_block_config_t *) &smif_Block_Config, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#if (CY_IP_MXSMIF_VERSION == 2U || CY_IP_MXSMIF_VERSION == 4U)
SMIF_Status = Cy_SMIF_HyperBus_CalibrateDelay(SMIF, smifMemConfigs[0],smifDevHBFlashCfg.dummyCycles, TST_ADDRESS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#endif
/********* Erase Test Sector *******/
Cy_SMIF_HyperBus_EraseSector(SMIF,smifMemConfigs[0],TST_ADDRESS,&SMIF_context);
/********* Write to Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Write(SMIF,
smifMemConfigs[0],
TST_ADDRESS, // address
32, // size in half word
(uint16_t*)&programData[0],
smifDevHBFlashCfg.dummyCycles,
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
/********* Read from Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Read(SMIF,
smifMemConfigs[0],
(TST_ADDRESS), // address
SIZE_IN_HWORD, // size in half word
(uint16_t*)readBuf,
smifDevHBFlashCfg.dummyCycles,
false, // Double initial latency
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Parameters
baseHolds the base address of the SMIF block registers.
memconfig
  • SMIF memory configuration structure for memory mode of operation.
burstTypeSpecifies wrapped or continuous burst. en_hb_bust_type_t
writeAddressSpecifies address of external device to be write.
sizeInHalfWordSpecifies memory size to be read. Note hyper bus memory have 16bit data per each address.
bufPointer to buffer where read data to be stored
hbDevTypeSpecifies hyper bus type. FLASH or SRAM. cy_en_smif_hb_dev_type_t
dummyCyclesNumber of dummyCycles to be inserted before write operation.
isblockingModeBlocking mode or not. if this is true, process waits for the read finished in this function. unless, the process does not wait and exit function.
contextPasses a configuration structure that contains the transfer parameters of the SMIF block.
Returns
cy_en_smif_status_t

◆ Cy_SMIF_HyperBus_MMIO_Write()

cy_en_smif_status_t Cy_SMIF_HyperBus_MMIO_Write ( SMIF_Type *  base,
cy_en_smif_slave_select_t  slave,
cy_en_hb_burst_type_t  burstType,
uint32_t  writeAddress,
uint32_t  sizeInHalfWord,
uint16_t  buf[],
cy_en_smif_hb_dev_type_t  hbDevType,
uint32_t  dummyCycle,
bool  isblockingMode,
cy_stc_smif_context_t context 
)

This function writes data into hyper bus memory in MMIO mode.

Parameters
baseHolds the base address of the SMIF block registers.
slaveSpecifies slave of external device to be read. cy_en_smif_slave_select_t
burstTypeSpecifies wrapped or continuous burst. en_hb_bust_type_t
writeAddressSpecifies address of external device to be write.
sizeInHalfWordSpecifies memory size to be read. Note hyper bus memory have 16bit data per each address.
bufPointer to buffer where read data to be stored
hbDevTypeSpecifies hyper bus type. FLASH or SRAM. cy_en_smif_hb_dev_type_t
dummyCyclesDummy Cycles based on Frequency of operation.
isblockingModeBlocking mode or not. if this is true, process waits for the read finished in this function. unless, the process does not wait and exit function.
contextPasses a configuration structure that contains the transfer parameters of the SMIF block.
Returns
cy_en_smif_status_t
uint8_t readBuf[SIZE_IN_BYTES];
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global */
{
.dummyCycles = 16,
.hbDevType = CY_SMIF_HB_FLASH,
};
cy_stc_smif_mem_config_t S26HL512T_SlaveSlot_0 =
{
/* Determines the slot number where the memory device is placed. */
/* Flags. */
.flags = CY_SMIF_FLAG_SMIF_REV_3 | CY_SMIF_FLAG_WR_EN | CY_SMIF_FLAG_CRYPTO_EN | CY_SMIF_FLAG_MERGE_ENABLE | CY_SMIF_FLAG_MEMORY_MAPPED,
/* The data-line selection options for a slave device. */
.dataSelect = CY_SMIF_DATA_SEL0,
/* The base address the memory slave is mapped to in the PSoC memory map.
Valid when the memory-mapped mode is enabled. */
.baseAddress = 0x60000000U,
/* The size allocated in the PSoC memory map, for the memory slave device.
The size is allocated from the base address. Valid when the memory mapped mode is enabled. */
.memMappedSize = 0x10000U,
/* If this memory device is one of the devices in the dual quad SPI configuration.
Valid when the memory mapped mode is enabled. */
.dualQuadSlots = 0,
/* The configuration of the device. */
//.deviceCfg = &deviceCfg_S26HL512T_SlaveSlot_0,
.mergeTimeout = CY_SMIF_MERGE_TIMEOUT_256_CYCLES,
.hbdeviceCfg = &smifDevHBFlashCfg,
};
cy_stc_smif_mem_config_t* smifMemConfigs[CY_SMIF_DEVICE_NUM] = {
&S26HL512T_SlaveSlot_0
};
cy_stc_smif_block_config_t smif_Block_Config =
{
/* The number of SMIF memories defined. */
.memCount = CY_SMIF_DEVICE_NUM,
/* The pointer to the array of memory config structures of size memCount. */
.memConfig = (cy_stc_smif_mem_config_t**)smifMemConfigs,
/* The version of the SMIF driver. */
.majorVersion = CY_SMIF_DRV_VERSION_MAJOR,
/* The version of the SMIF driver. */
.minorVersion = CY_SMIF_DRV_VERSION_MINOR
};
const cy_stc_smif_config_t SMIF_config =
{
.mode = (uint32_t)CY_SMIF_NORMAL,
.deselectDelay = 0,
.blockEvent = (uint32_t)CY_SMIF_BUS_ERROR,
.delayTapEnable = CY_SMIF_DELAY_TAP_ENABLE,
.delayLineSelect = CY_SMIF_4_SEL_PER_TAP,
};
SMIF_Status = Cy_SMIF_Init(SMIF, &SMIF_config, TIMEOUT_1_MS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Cy_SMIF_SetDataSelect(SMIF, smifMemConfigs[0]->slaveSelect, smifMemConfigs[0]->dataSelect);
Cy_SMIF_Enable(SMIF, &SMIF_context);
SMIF_Status = Cy_SMIF_Memslot_Init(SMIF, (cy_stc_smif_block_config_t *) &smif_Block_Config, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#if (CY_IP_MXSMIF_VERSION == 2U || CY_IP_MXSMIF_VERSION == 4U)
SMIF_Status = Cy_SMIF_HyperBus_CalibrateDelay(SMIF, smifMemConfigs[0],smifDevHBFlashCfg.dummyCycles, TST_ADDRESS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#endif
/********* Erase Test Sector *******/
Cy_SMIF_HyperBus_EraseSector(SMIF,smifMemConfigs[0],TST_ADDRESS,&SMIF_context);
/********* Write to Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Write(SMIF,
smifMemConfigs[0],
TST_ADDRESS, // address
32, // size in half word
(uint16_t*)&programData[0],
smifDevHBFlashCfg.dummyCycles,
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
/********* Read from Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Read(SMIF,
smifMemConfigs[0],
(TST_ADDRESS), // address
SIZE_IN_HWORD, // size in half word
(uint16_t*)readBuf,
smifDevHBFlashCfg.dummyCycles,
false, // Double initial latency
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Parameters
baseHolds the base address of the SMIF block registers.
slaveSpecifies slave of external device to be read. cy_en_smif_slave_select_t
burstTypeSpecifies wrapped or continuous burst. en_hb_bust_type_t
readAddressSpecifies address of external device to be read.
sizeInHalfWordSpecifies memory size to be read. Note hyper bus memory have 16bit data per each address.
bufPointer to buffer where read data to be stored
hbDevTypeSpecifies hyper bus type. FLASH or SRAM. cy_en_smif_hb_dev_type_t
lcCodeLatency code. This value should be set also to the hyper bus device.
isblockingModeBlocking mode or not. if this is true, process waits for the read finished in this function. unless, the process does not wait and exit function.
contextPasses a configuration structure that contains the transfer parameters of the SMIF block.
Returns
cy_en_smif_status_t

◆ CY_SMIF_HyperBus_ReadStatus()

cy_en_smif_status_t CY_SMIF_HyperBus_ReadStatus ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memConfig,
uint16_t *  regStatus,
cy_stc_smif_context_t context 
)

This function reads the flash status register bits.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
regStatusoutput status register value.
Returns
cy_en_smif_status_t
Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
regStatusoutput status register value.

◆ CY_SMIF_HyperBus_ClearStatus()

cy_en_smif_status_t CY_SMIF_HyperBus_ClearStatus ( SMIF_Type *  base,
cy_stc_smif_mem_config_t memConfig,
cy_stc_smif_context_t context 
)

This function clears the flash status register bits.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
Returns
cy_en_smif_status_t
Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.

◆ Cy_SMIF_HyperBus_EraseSector()

cy_en_smif_status_t Cy_SMIF_HyperBus_EraseSector ( SMIF_Type *  base,
const cy_stc_smif_mem_config_t memConfig,
uint32_t  offset,
cy_stc_smif_context_t context 
)

This function Erases the data in the given sector.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
offsetoffset of the sector to be erased.
Returns
cy_en_smif_status_t
uint8_t readBuf[SIZE_IN_BYTES];
cy_stc_smif_context_t SMIF_context = {0}; /* This is a shared context structure.
* It must be global */
{
.dummyCycles = 16,
.hbDevType = CY_SMIF_HB_FLASH,
};
cy_stc_smif_mem_config_t S26HL512T_SlaveSlot_0 =
{
/* Determines the slot number where the memory device is placed. */
/* Flags. */
.flags = CY_SMIF_FLAG_SMIF_REV_3 | CY_SMIF_FLAG_WR_EN | CY_SMIF_FLAG_CRYPTO_EN | CY_SMIF_FLAG_MERGE_ENABLE | CY_SMIF_FLAG_MEMORY_MAPPED,
/* The data-line selection options for a slave device. */
.dataSelect = CY_SMIF_DATA_SEL0,
/* The base address the memory slave is mapped to in the PSoC memory map.
Valid when the memory-mapped mode is enabled. */
.baseAddress = 0x60000000U,
/* The size allocated in the PSoC memory map, for the memory slave device.
The size is allocated from the base address. Valid when the memory mapped mode is enabled. */
.memMappedSize = 0x10000U,
/* If this memory device is one of the devices in the dual quad SPI configuration.
Valid when the memory mapped mode is enabled. */
.dualQuadSlots = 0,
/* The configuration of the device. */
//.deviceCfg = &deviceCfg_S26HL512T_SlaveSlot_0,
.mergeTimeout = CY_SMIF_MERGE_TIMEOUT_256_CYCLES,
.hbdeviceCfg = &smifDevHBFlashCfg,
};
cy_stc_smif_mem_config_t* smifMemConfigs[CY_SMIF_DEVICE_NUM] = {
&S26HL512T_SlaveSlot_0
};
cy_stc_smif_block_config_t smif_Block_Config =
{
/* The number of SMIF memories defined. */
.memCount = CY_SMIF_DEVICE_NUM,
/* The pointer to the array of memory config structures of size memCount. */
.memConfig = (cy_stc_smif_mem_config_t**)smifMemConfigs,
/* The version of the SMIF driver. */
.majorVersion = CY_SMIF_DRV_VERSION_MAJOR,
/* The version of the SMIF driver. */
.minorVersion = CY_SMIF_DRV_VERSION_MINOR
};
const cy_stc_smif_config_t SMIF_config =
{
.mode = (uint32_t)CY_SMIF_NORMAL,
.deselectDelay = 0,
.blockEvent = (uint32_t)CY_SMIF_BUS_ERROR,
.delayTapEnable = CY_SMIF_DELAY_TAP_ENABLE,
.delayLineSelect = CY_SMIF_4_SEL_PER_TAP,
};
SMIF_Status = Cy_SMIF_Init(SMIF, &SMIF_config, TIMEOUT_1_MS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Cy_SMIF_SetDataSelect(SMIF, smifMemConfigs[0]->slaveSelect, smifMemConfigs[0]->dataSelect);
Cy_SMIF_Enable(SMIF, &SMIF_context);
SMIF_Status = Cy_SMIF_Memslot_Init(SMIF, (cy_stc_smif_block_config_t *) &smif_Block_Config, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#if (CY_IP_MXSMIF_VERSION == 2U || CY_IP_MXSMIF_VERSION == 4U)
SMIF_Status = Cy_SMIF_HyperBus_CalibrateDelay(SMIF, smifMemConfigs[0],smifDevHBFlashCfg.dummyCycles, TST_ADDRESS, &SMIF_context);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
#endif
/********* Erase Test Sector *******/
Cy_SMIF_HyperBus_EraseSector(SMIF,smifMemConfigs[0],TST_ADDRESS,&SMIF_context);
/********* Write to Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Write(SMIF,
smifMemConfigs[0],
TST_ADDRESS, // address
32, // size in half word
(uint16_t*)&programData[0],
smifDevHBFlashCfg.dummyCycles,
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
/********* Read from Test Sector *******/
SMIF_Status = Cy_SMIF_HyperBus_Read(SMIF,
smifMemConfigs[0],
(TST_ADDRESS), // address
SIZE_IN_HWORD, // size in half word
(uint16_t*)readBuf,
smifDevHBFlashCfg.dummyCycles,
false, // Double initial latency
true, // Blocking mode
&SMIF_context
);
if(SMIF_Status == CY_SMIF_SUCCESS)
{
/*Handle Error */
}
Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
offsetoffset of the sector to be erased.

◆ Cy_SMIF_HyperBus_EraseChip()

cy_en_smif_status_t Cy_SMIF_HyperBus_EraseChip ( SMIF_Type *  base,
cy_stc_smif_mem_config_t memConfig,
cy_stc_smif_context_t context 
)

This function Erases the data in the entire flash memory.

Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.
Returns
cy_en_smif_status_t
Parameters
baseHolds the base address of the SMIF block registers.
memConfigSMIF memory configuration structure for memory mode of operation.