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_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... | |
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 *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 *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_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... | |
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 peforms 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 strucutre 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 funciton. The cy_stc_smif_context_t context structure returned from Cy_SMIF_Init is passed as a parameter to this function.
base | The address of the slave-slot device register to initialize. |
blockConfig | The configuration structure array that configures the SMIF memory device to be mapped into the PSoC memory map. cy_stc_smif_mem_config_t |
context | This 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. |
void Cy_SMIF_MemDeInit | ( | SMIF_Type * | base | ) |
This function de-initializes all slave slots of the memory device to their default values.
base | Holds the base address of the SMIF block registers. |
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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
context | This 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. |
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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
status | The status register value returned by the external memory. |
command | The command required to read the status/configuration register. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
status | The status to write into the status register. |
command | The command to write into the status/configuration register. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
sectorAddr | The sector address to erase. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
addr | The address to program. |
writeBuff | The 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(). |
size | The size of data to program. The user must ensure that the data size does not exceed the page size. |
cmdCompleteCb | The callback function to call after the transfer completion. NULL interpreted as no callback. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memDevice | The device to which the command is sent. |
addr | The address to read. |
readBuff | The 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(). |
size | The size of data to read. |
cmdCompleteCb | The callback function to call after the transfer completion. NULL interpreted as no callback. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
device | The device structure instance declared by the user. This is where the detected parameters are stored and returned. |
slaveSelect | The slave select line for the device. |
dataSelect | The data line selection options for a slave device. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memConfig | The memory device configuration. |
timeoutUs | The timeout value in microseconds to apply while polling the memory. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memConfig | The memory device configuration. |
isQuadEnabled | This 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. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memConfig | The memory device configuration. |
timeoutUs | The timeout value in microseconds to apply while polling the memory. |
context | This 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_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 * | 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.
base | Holds the base address of the SMIF block registers. |
memConfig | The memory device configuration. |
address | The address to read data from. |
rxBuffer | The buffer for storing the read data. |
length | The size of data to read. |
context | This 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_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 * | 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.
base | Holds the base address of the SMIF block registers. |
memConfig | The memory device configuration. |
address | The address to write data at. |
txBuffer | The buffer holding the data to write in the external memory. |
length | The size of data to write. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memConfig | The memory device configuration. |
address | The address of the block to be erased. The address should be aligned with the start address of the sector. |
length | The size of data to erase. The length should be equal to the sum of all sectors length to be erased. |
context | This 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_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.
base | Holds the base address of the SMIF block registers. |
memConfig | The memory device configuration. |
context | This 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_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.
memDevice | The memory device configuration. |
regionInfo | Places a hybrid region configuration structure that contains the region specific parameters. See cy_stc_smif_hybrid_region_info_t for reference. |
address | The address for which a region is searched. |