Functions | |
void | Cy_Flashc_MainWriteEnable (void) |
Enable writing to main flash. More... | |
void | Cy_Flashc_MainWriteDisable (void) |
Disable writing to main flash Disables writing to main flash. More... | |
void | Cy_Flashc_WorkWriteEnable (void) |
Enable writing work flash Work Flash embedded operations are enabled. More... | |
void | Cy_Flashc_WorkWriteDisable (void) |
Disable writing work flash Work Flash embedded operations are blocked. More... | |
void | Cy_Flashc_WorkECCEnable (void) |
Enables ECC for work flash ECC checking/reporting on FLASH work interface is enabled. More... | |
void | Cy_Flashc_WorkECCDisable (void) |
Disables ECC for work flash ECC checking/reporting on FLASH work interface is disabled. More... | |
void | Cy_Flashc_MainECCEnable (void) |
Enables ECC for main flash ECC checking/reporting on FLASH main interface is enabled. More... | |
void | Cy_Flashc_MainECCDisable (void) |
Disables ECC for main flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_Program_WorkFlash (const cy_stc_flash_programrow_config_t *config) |
This function writes an array data to work flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_Program (const cy_stc_flash_programrow_config_t *config, cy_en_flash_driver_blocking_t block) |
This function writes an array of data to flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_Checksum (const cy_stc_flash_checksum_config_t *config, uint32_t *checksumPtr) |
Returns a checksum value of the specified flash row. More... | |
cy_en_flashdrv_status_t | Cy_Flash_EraseSuspend (void) |
This function suspends an ongoing erase operation. More... | |
cy_en_flashdrv_status_t | Cy_Flash_EraseResume (const cy_stc_flash_eraseresume_config_t *config) |
This function calls to resume a suspended erase operation. More... | |
cy_en_flashdrv_status_t | Cy_Flash_BlankCheck (const cy_stc_flash_blankcheck_config_t *config, cy_en_flash_driver_blocking_t block) |
This function performs blank check on the addressed work FLASH. More... | |
cy_en_flashdrv_status_t | Cy_Flash_OperationStatus (void) |
Checks the status of the Flash Operation, and returns it. More... | |
cy_en_flashdrv_status_t | Cy_Flashc_InjectECC (cy_en_region_t region, uint32_t address, uint8_t parity) |
This function enables ECC injection and sets the address where a parity will be injected and the parity value. More... | |
void | Cy_Flashc_InjectECC_Disable (cy_en_region_t region) |
This function disables ECC injection for the region specified. More... | |
cy_en_flashdrv_status_t | Cy_Flash_EraseRow (uint32_t rowAddr) |
This function erases a single row of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_StartEraseRow (uint32_t rowAddr) |
Starts erasing a single row of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_EraseSubsector (uint32_t subSectorAddr) |
This function erases an 8-row subsector of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_StartEraseSubsector (uint32_t subSectorAddr) |
Starts erasing an 8-row subsector of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_WriteRow (uint32_t rowAddr, const uint32_t *data) |
This function writes an array of data to a single row of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_StartProgram (uint32_t rowAddr, const uint32_t *data) |
Starts writing an array of data to a single row of flash. More... | |
uint32_t | Cy_Flash_GetExternalStatus (void) |
This function handles the case where a module such as security image captures a system call from this driver and reports its own status or error code, for example protection violation. More... | |
void | Cy_Flash_InitExt (cy_stc_flash_notify_t *ipcWaitMessageAddr) |
Initiates all needed prerequisites to support flash erase/write. More... | |
void | Cy_Flashc_SetWorkBankMode (cy_en_bankmode_t mode) |
Sets bank mode for work flash. More... | |
cy_en_bankmode_t | Cy_Flashc_GetWorkBankMode (void) |
Gets current bank mode for work flash. More... | |
void | Cy_Flashc_SetMainBankMode (cy_en_bankmode_t mode) |
Sets bank mode for main flash. More... | |
cy_en_bankmode_t | Cy_Flashc_GetMainBankMode (void) |
Gets current bank mode for main flash. More... | |
void | Cy_Flashc_SetMain_Flash_Mapping (cy_en_maptype_t mapping) |
Sets mapping for main flash region. More... | |
void | Cy_Flashc_SetWork_Flash_Mapping (cy_en_maptype_t mapping) |
Sets mapping for work flash region. More... | |
cy_en_flashdrv_status_t | Cy_Flash_IsOperationComplete (void) |
Reports a successful operation result, reason of failure or busy status ( CY_FLASH_DRV_OPCODE_BUSY ). More... | |
cy_en_flashdrv_status_t | Cy_Flash_StartWrite (uint32_t rowAddr, const uint32_t *data) |
Starts programming the flash row with the input data. More... | |
cy_en_flashdrv_status_t | Cy_Flash_StartEraseSector (uint32_t sectorAddr) |
Starts erasing a sector of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_ProgramRow (uint32_t rowAddr, const uint32_t *data) |
This function writes an array of data to a single row of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_EraseSector (uint32_t sectorAddr) |
This function erases a sector of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_CalculateHash (const uint32_t *data, uint32_t numberOfBytes, uint32_t *hashPtr) |
Returns a hash value of the specified region of flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_RowChecksum (uint32_t rowAddr, uint32_t *checksumPtr) |
Returns a checksum value of the specified flash row. More... | |
void | Cy_Flash_Init (void) |
Initiates all needed prerequisites to support flash erase/write. More... | |
void Cy_Flashc_MainWriteEnable | ( | void | ) |
Enable writing to main flash.
Enables writing to main flash.
Enable writing to main flash.
void Cy_Flashc_MainWriteDisable | ( | void | ) |
Disable writing to main flash Disables writing to main flash.
Disable writing to main flash Disables writing to main flash.
void Cy_Flashc_WorkWriteEnable | ( | void | ) |
Enable writing work flash Work Flash embedded operations are enabled.
Enable writing work flash Work Flash embedded operations are enabled.
void Cy_Flashc_WorkWriteDisable | ( | void | ) |
Disable writing work flash Work Flash embedded operations are blocked.
Disable writing work flash Work Flash embedded operations are blocked.
void Cy_Flashc_WorkECCEnable | ( | void | ) |
Enables ECC for work flash ECC checking/reporting on FLASH work interface is enabled.
Correctable or non-correctable faults are reported by enabling ECC.
Enables ECC for work flash ECC checking/reporting on FLASH work interface is enabled.
void Cy_Flashc_WorkECCDisable | ( | void | ) |
Disables ECC for work flash ECC checking/reporting on FLASH work interface is disabled.
No correctable or non-correctable faults are reported by disabling ECC.
Disables ECC for work flash ECC checking/reporting on FLASH work interface is disabled.
void Cy_Flashc_MainECCEnable | ( | void | ) |
Enables ECC for main flash ECC checking/reporting on FLASH main interface is enabled.
Correctable or non-correctable faults are reported by enabling ECC.
Enables ECC for main flash ECC checking/reporting on FLASH main interface is enabled.
void Cy_Flashc_MainECCDisable | ( | void | ) |
Disables ECC for main flash.
ECC checking/reporting on FLASH main interface is disabled. No correctable or non-correctable faults are reported by disabling ECC.
cy_en_flashdrv_status_t Cy_Flash_Program_WorkFlash | ( | const cy_stc_flash_programrow_config_t * | config | ) |
This function writes an array data to work flash.
Reports success or or a reason for failure. User should only pass work flash address else it will return an error. This function executes in blocking mode only.
Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash. User firmware should not enter the hibernate mode until flash Write is complete. The Flash operation is allowed in Sleep and Deep-sleep modes. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
config | configuration of this function. This parameter is defined by the cy_stc_flash_programrow_config_t in Structures macro. |
Reports success or or a reason for failure. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash. User firmware should not enter the hibernate mode until flash Write is complete. The Flash operation is allowed in Sleep and Deep-sleep modes. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
config configuration of this function. This parameter is defined by the cy_stc_flash_programrow_config_t in group_flash_srom_config_structure macro.
Returns the status of the Flash operation (see cy_en_flashdrv_status_t).
Note: row or page is same and of the size 512 bytes
cy_en_flashdrv_status_t Cy_Flash_Program | ( | const cy_stc_flash_programrow_config_t * | config, |
cy_en_flash_driver_blocking_t | block | ||
) |
This function writes an array of data to flash.
Reports success or or a reason for failure. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash. User firmware should not enter the hibernate mode until flash Write is complete. The Flash operation is allowed in Sleep and Deep-sleep modes. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
config | configuration of this function. This parameter is defined by the cy_stc_flash_programrow_config_t in Structures macro. |
block | specifies if the function to execute in blocking or non blocking mode. |
Reports success or or a reason for failure. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash. User firmware should not enter the hibernate mode until flash Write is complete. The Flash operation is allowed in Sleep and Deep-sleep modes. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
config configuration of this function. This parameter is defined by the cy_stc_flash_programrow_config_t in group_flash_srom_config_structure macro.
Returns the status of the Flash operation (see cy_en_flashdrv_status_t).
Note: row or page is same and of the size 512 bytes
cy_en_flashdrv_status_t Cy_Flash_Checksum | ( | const cy_stc_flash_checksum_config_t * | config, |
uint32_t * | checksumPtr | ||
) |
Returns a checksum value of the specified flash row.
supports only blocking mode for now.
config | configuration of this function. This parameter is defined by the cy_stc_flash_checksum_config_t in cy_stc_flash_checksum_config_t macro. |
checksumPtr | The pointer to the address where checksum is to be stored |
checksumPtr The pointer to the address where checksum is to be stored
Returns the status of the Flash operation.
Note:row or page is same and of the size 512 bytes
cy_en_flashdrv_status_t Cy_Flash_EraseSuspend | ( | void | ) |
This function suspends an ongoing erase operation.
User should not read from a sector which is suspended from an erase operation. Cy_Flash_ProgramRow function will return error if invoked on suspended sector. This function cannot be called on SFLASH. Reports success or a reason for failure. Does not return until the Erase operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash. This function supports only blocking mode for now.
User should not read from a sector which is suspended from an erase operation. Cy_Flash_ProgramRow function will return error if invoked on suspended sector. This function cannot be called on SFLASH. Reports success or a reason for failure. Does not return until the Erase operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash. This function supports only blocking mode for now.
Returns the status of the Flash operation (see cy_en_flashdrv_status_t).
cy_en_flashdrv_status_t Cy_Flash_EraseResume | ( | const cy_stc_flash_eraseresume_config_t * | config | ) |
This function calls to resume a suspended erase operation.
Reports success or a reason for failure. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash.
config | configuration of this function. This parameter is defined by the cy_stc_flash_eraseresume_config_t in Structures macro. |
Reports success or a reason for failure. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash.
config configuration of this function. This parameter is defined by the cy_stc_flash_eraseresume_config_t in group_flash_srom_config_structure macro.
Returns the status of the Flash operation (see cy_en_flashdrv_status_t).
cy_en_flashdrv_status_t Cy_Flash_BlankCheck | ( | const cy_stc_flash_blankcheck_config_t * | config, |
cy_en_flash_driver_blocking_t | block | ||
) |
This function performs blank check on the addressed work FLASH.
Reports success or a reason for failure. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is operating flash.
config | configuration of this function. This parameter is defined by the cy_stc_flash_blankcheck_config_t in Structures macro. |
block | specifies if the function to execute in blocking or non blocking mode. |
config configuration of this function. This parameter is defined by the cy_stc_flash_blankcheck_config_t in group_flash_srom_config_structure macro.
Returns the status of the Flash operation (see cy_en_flashdrv_status_t).
cy_en_flashdrv_status_t Cy_Flash_OperationStatus | ( | void | ) |
Checks the status of the Flash Operation, and returns it.
cy_en_flashdrv_status_t Cy_Flashc_InjectECC | ( | cy_en_region_t | region, |
uint32_t | address, | ||
uint8_t | parity | ||
) |
This function enables ECC injection and sets the address where a parity will be injected and the parity value.
Reports success or a reason for failure.
region | An indicator which region (Code/Work/Cache) ECC parity will be injected to. This parameter is defined by the cy_en_region_t in Macros macro. |
address | The address where ECC parity will be injected. |
parity | The parity value which will be injected. |
Reports success or a reason for failure.
region An indicator which region (Code/Work/Cache) ECC parity will be injected to. This parameter is defined by the cy_en_region_t in group_flash_macro macro.
address The address where ECC parity will be injected.
parity The parity value which will be injected.
Returns the status of the Flash operation (see cy_en_flashdrv_status_t).
void Cy_Flashc_InjectECC_Disable | ( | cy_en_region_t | region | ) |
This function disables ECC injection for the region specified.
region | : ECC injection is disabled for this region (Code/Work/Cache). This parameter is defined by the cy_en_region_t in Macros macro. |
cy_en_flashdrv_status_t Cy_Flash_EraseRow | ( | uint32_t | rowAddr | ) |
This function erases a single row of flash.
Reports success or a reason for failure. Does not return until the Write operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash or erasing the row. User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase is complete. The Flash operation is allowed in Sleep mode. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
rowAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash write operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
cy_en_flashdrv_status_t Cy_Flash_StartEraseRow | ( | uint32_t | rowAddr | ) |
Starts erasing a single row of flash.
Returns immediately and reports a successful start or reason for failure. Reports a CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked by another process. User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase is complete. The Flash operation is allowed in Sleep mode. During the flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
rowAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash erase operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
cy_en_flashdrv_status_t Cy_Flash_EraseSubsector | ( | uint32_t | subSectorAddr | ) |
This function erases an 8-row subsector of flash.
Reports success or a reason for failure. Does not return until the Write operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash or erasing the row. User firmware should not enter the Hibernate or Deep-Sleep mode until flash Erase is complete. The Flash operation is allowed in Sleep mode. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
subSectorAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash write operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
cy_en_flashdrv_status_t Cy_Flash_StartEraseSubsector | ( | uint32_t | subSectorAddr | ) |
Starts erasing an 8-row subsector of flash.
Returns immediately and reports a successful start or reason for failure. Reports a CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked by another process. User firmware should not enter the Hibernate or Deep-Sleep mode until flash Erase is complete. The Flash operation is allowed in Sleep mode. During the flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
subSectorAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash erase operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
cy_en_flashdrv_status_t Cy_Flash_WriteRow | ( | uint32_t | rowAddr, |
const uint32_t * | data | ||
) |
This function writes an array of data to a single row of flash.
This is done in three steps - pre-program, erase and then program flash row with the input data. Reports success or a reason for failure. Does not return until the Write operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash. User firmware should not enter the Hibernate or Deep-sleep mode until flash Write is complete. The Flash operation is allowed in Sleep mode. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
rowAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash write operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
data | The pointer to the data which has to be written to flash. The size of the data array must be equal to the flash row size. The flash row size for the selected device is defined by the CY_FLASH_SIZEOF_ROW macro. Refer to the device datasheet for the details. |
cy_en_flashdrv_status_t Cy_Flash_StartProgram | ( | uint32_t | rowAddr, |
const uint32_t * | data | ||
) |
Starts writing an array of data to a single row of flash.
Returns immediately and reports a successful start or reason for failure. Reports a CY_FLASH_DRV_IPC_BUSY error if another process is writing to flash. The user firmware should not enter Hibernate or Deep-Sleep mode until flash Program is complete. The Flash operation is allowed in Sleep mode. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
Before calling this function, the target flash region must be erased by the StartEraseRow/EraseRow function.
Data to be programmed must be located in the SRAM memory region.
rowAddr | The address of the flash row number. The Read-while-Write violation occurs when the Flash Write operation is performing. Refer to the device datasheet for the details. The address must match the row start address. |
data | The pointer to the data to be written to flash. The size of the data array must be equal to the flash row size. The flash row size for the selected device is defined by the CY_FLASH_SIZEOF_ROW macro. Refer to the device datasheet for the details. |
uint32_t Cy_Flash_GetExternalStatus | ( | void | ) |
This function handles the case where a module such as security image captures a system call from this driver and reports its own status or error code, for example protection violation.
In that case, a function from this driver returns an unknown error (see cy_en_flashdrv_status_t). After receipt of an unknown error, the user may call this function to get the status of the capturing module.
The user is responsible for parsing the content of the returned value and casting it to the appropriate enumeration.
void Cy_Flash_InitExt | ( | cy_stc_flash_notify_t * | ipcWaitMessageAddr | ) |
Initiates all needed prerequisites to support flash erase/write.
Should be called from each core. Defines the address of the message structure.
Requires a call to Cy_IPC_Sema_Init(), Cy_IPC_Pipe_Config() and Cy_IPC_Pipe_Init() functions before use.
This function is called in the Cy_Flash_Init() function - see the Cy_Flash_Init usage considerations.
void Cy_Flashc_SetWorkBankMode | ( | cy_en_bankmode_t | mode | ) |
Sets bank mode for work flash.
mode | bank mode to be set |
cy_en_bankmode_t Cy_Flashc_GetWorkBankMode | ( | void | ) |
Gets current bank mode for work flash.
void Cy_Flashc_SetMainBankMode | ( | cy_en_bankmode_t | mode | ) |
Sets bank mode for main flash.
mode | bank mode to be set |
cy_en_bankmode_t Cy_Flashc_GetMainBankMode | ( | void | ) |
Gets current bank mode for main flash.
void Cy_Flashc_SetMain_Flash_Mapping | ( | cy_en_maptype_t | mapping | ) |
Sets mapping for main flash region.
Applicable only in Dual Bank mode of Main flash region
mapping | mapping to be set |
void Cy_Flashc_SetWork_Flash_Mapping | ( | cy_en_maptype_t | mapping | ) |
Sets mapping for work flash region.
Applicable only in Dual Bank mode of Work flash region
mapping | mapping to be set |
cy_en_flashdrv_status_t Cy_Flash_IsOperationComplete | ( | void | ) |
Reports a successful operation result, reason of failure or busy status ( CY_FLASH_DRV_OPCODE_BUSY ).
Reports a successful operation result, reason of failure or busy status ( CY_FLASH_DRV_OPCODE_BUSY ).
cy_en_flashdrv_status_t Cy_Flash_StartWrite | ( | uint32_t | rowAddr, |
const uint32_t * | data | ||
) |
Starts programming the flash row with the input data.
Returns immediately and reports a successful start or reason for failure. Reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash. User firmware should not enter the Hibernate or Deep-Sleep mode until flash Write is complete. The Flash operation is allowed in Sleep mode. During the flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
rowAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash write operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
data | The pointer to the data to be written to flash. The size of the data array must be equal to the flash row size. The flash row size for the selected device is defined by the CY_FLASH_SIZEOF_ROW macro. Refer to the device datasheet for the details. For CAT1C devices this data pointer needs to point to 32 byte aligned data. |
Returns immediately and reports a successful start or reason for failure. Reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash. User firmware should not enter the Hibernate or Deep-Sleep mode until flash Write is complete. The Flash operation is allowed in Sleep mode. During the flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
rowAddr Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash write operation is performing. Refer to the device datasheet for the details. Address must match row start address.
data The pointer to the data to be written to flash. The size of the data array must be equal to the flash row size. The flash row size for the selected device is defined by the CY_FLASH_SIZEOF_ROW macro. Refer to the device datasheet for the details.
Returns the status of the Flash operation, see cy_en_flashdrv_status_t.
cy_en_flashdrv_status_t Cy_Flash_StartEraseSector | ( | uint32_t | sectorAddr | ) |
Starts erasing a sector of flash.
Returns immediately and reports a successful start or reason for failure. Reports a CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked by another process. User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase is complete. The Flash operation is allowed in Sleep mode. During the flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
sectorAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash erase operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
Returns immediately and reports a successful start or reason for failure. Reports a CY_FLASH_DRV_IPC_BUSY error in the case when IPC structure is locked by another process. User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase is complete. The Flash operation is allowed in Sleep mode. During the flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, the low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes. Before reading data from previously programmed/erased flash rows, the user must clear the flash cache with the Cy_SysLib_ClearFlashCacheAndBuffer() function.
cy_en_flashdrv_status_t Cy_Flash_ProgramRow | ( | uint32_t | rowAddr, |
const uint32_t * | data | ||
) |
This function writes an array of data to a single row of flash.
Reports success or a reason for failure. Does not return until the Program operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash. User firmware should not enter the Hibernate or Deep-sleep mode until flash Write is complete. The Flash operation is allowed in Sleep mode. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
Before calling this function, the target flash region must be erased by the StartErase/EraseRow function.
Data to be programmed must be located in the SRAM memory region.
rowAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash write operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
data | The pointer to the data which has to be written to flash. The size of the data array must be equal to the flash row size. The flash row size for the selected device is defined by the CY_FLASH_SIZEOF_ROW macro. Refer to the device datasheet for the details. For CAT1C devices this data pointer needs to point to 32 byte aligned data. |
Reports success or a reason for failure. Does not return until the Program operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash. User firmware should not enter the Hibernate or Deep-sleep mode until flash Write is complete. The Flash operation is allowed in Sleep mode. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
Before calling this function, the target flash region must be erased by the StartErase/EraseRow function.
Data to be programmed must be located in the SRAM memory region.
cy_en_flashdrv_status_t Cy_Flash_EraseSector | ( | uint32_t | sectorAddr | ) |
This function erases a sector of flash.
Reports success or a reason for failure. Does not return until the Erase operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash or erasing the row. User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase is complete. The Flash operation is allowed in Sleep mode. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
sectorAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash write operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
Reports success or a reason for failure. Does not return until the Erase operation is complete. Returns immediately and reports a CY_FLASH_DRV_IPC_BUSY error in the case when another process is writing to flash or erasing the row. User firmware should not enter the Hibernate or Deep Sleep mode until flash Erase is complete. The Flash operation is allowed in Sleep mode. During the Flash operation, the device should not be reset, including the XRES pin, a software reset, and watchdog reset sources. Also, low-voltage detect circuits should be configured to generate an interrupt instead of a reset. Otherwise, portions of flash may undergo unexpected changes.
sectorAddr | Address of the flash row number. The Read-while-Write violation occurs when the flash read operation is initiated in the same flash sector where the flash write operation is performing. Refer to the device datasheet for the details. Address must match row start address. |
cy_en_flashdrv_status_t Cy_Flash_CalculateHash | ( | const uint32_t * | data, |
uint32_t | numberOfBytes, | ||
uint32_t * | hashPtr | ||
) |
Returns a hash value of the specified region of flash.
data | Start the data address. |
numberOfBytes | The hash value is calculated for the number of bytes after the start data address (0 - 1 byte, 1- 2 bytes etc). |
hashPtr | The pointer to the address where hash is to be stored |
cy_en_flashdrv_status_t Cy_Flash_RowChecksum | ( | uint32_t | rowAddr, |
uint32_t * | checksumPtr | ||
) |
Returns a checksum value of the specified flash row.
rowAddr | The address of the flash row. |
checksumPtr | The pointer to the address where checksum is to be stored |
rowAddr The address of the flash row.
checksumPtr The pointer to the address where checksum is to be stored
Returns the status of the Flash operation.
void Cy_Flash_Init | ( | void | ) |
Initiates all needed prerequisites to support flash erase/write.
Should be called from each core.
Requires a call to Cy_IPC_Sema_Init(), Cy_IPC_Pipe_Config() and Cy_IPC_Pipe_Init() functions before use for CAT1A devices.
This function is called in the SystemInit() function, for proper flash write and erase operations. If the default startup file is not used, or the function SystemInit() is not called in your project, ensure to perform the following steps before any flash or EmEEPROM write/erase operations:
Should be called from each core.
This function is called in the SystemInit() function, for proper flash write and erase operations. If the default startup file is not used, or the function SystemInit() is not called in your project, ensure to perform the following steps before any flash or EmEEPROM write/erase operations: