Functions | |
cy_en_flashdrv_status_t | Cy_Flash_WriteRow (uint32_t rowAddr, const uint32_t *data) |
Erases a row of Flash or Supervisory Flash and programs it with the new data. More... | |
cy_en_flashdrv_status_t | Cy_Flash_StartWrite (uint32_t rowAddr, const uint32_t *data) |
Initiates a write to a row of Flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_ResumeWrite (void) |
The non-blocking write row API Cy_Flash_StartWrite() requires that this function be called 3 times to complete the write. More... | |
cy_en_flashdrv_status_t | Cy_Flash_IsOperationComplete (void) |
Returns the current status of the Flash write operation. More... | |
cy_en_flashdrv_status_t | Cy_Flash_RowChecksum (uint32_t rowAddr, uint32_t *checksumPtr) |
Returns a checksum value of the specified Flash or Supervisory Flash row. More... | |
cy_en_flashdrv_status_t | Cy_Flash_SetProtection (const uint32_t bitField) |
Controls protection against the program/erase operation of the flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_GetProtectionStatus (uint32_t *statusPtr) |
Gets the flash protection status of the specified flash. More... | |
cy_en_flashdrv_status_t | Cy_Flash_SetupEccInjection (const uint32_t address, const uint8_t parity) |
Set CPUSS_FLASHC_ECC_CTL register to setup ECC error injection. More... | |
void | Cy_Flash_EnableEccInjection (void) |
Set CPUSS_FLASH_CTL register to enable ECC injection. More... | |
void | Cy_Flash_DisableEccInjection (void) |
Set CPUSS_FLASH_CTL register to disable ECC injection. More... | |
bool | Cy_Flash_IsEccInjectionEnabled (void) |
Check whether the ECC error injection of data flash is enabled. More... | |
cy_en_flashdrv_status_t Cy_Flash_WriteRow | ( | uint32_t | rowAddr, |
const uint32_t * | data | ||
) |
Erases a row of Flash or Supervisory Flash and programs it with the new data.
Does not return until the write operation is complete. Refer to the device datasheet for the details.
This API will automatically enable IMO and modify the clock settings for the device. Writing to Flash requires 48 MHz IMO and changes be made to the HFCLK settings. The configuration is restored before returning. HFCLK will have several frequency changes during the operation of this API between a minimum frequency of the current IMO frequency divided by 8 and a maximum frequency of 12 MHz. This will impact the operation of most of the hardware in the device.
rowAddr | Address of the Flash or Supervisory Flash row to which the data needs to be written. The address shall be aligned to the beginning of the row. |
data | Array of bytes to write. The size of the array must be equal to the Flash row size defined by CY_FLASH_SIZEOF_ROW. |
cy_en_flashdrv_status_t Cy_Flash_StartWrite | ( | uint32_t | rowAddr, |
const uint32_t * | data | ||
) |
Initiates a write to a row of Flash.
A call to this API is non-blocking. Use Cy_Flash_ResumeWrite() to resume Flash writes and Cy_Flash_IsOperationComplete() to ascertain status of the write operation. Supervisory Flash does not support non-blocking write.
This API will automatically enable IMO and modify the clock settings for the device. Writing to Flash requires 48 MHz IMO and changes be made to the HFCLK settings. The configuration is restored to original configuration by calling Cy_Flash_IsOperationComplete(). HFCLK will have several frequency changes during the operation of these API between a minimum frequency of the current IMO frequency divided by 8 and a maximum frequency of 12 MHz. This will impact the operation of most of the hardware in the device.
This API will automatically enable IMO and modify the clock settings for the device. Writing to Flash requires 48 MHz IMO and changes be made to the HFCLK settings. The configuration is restored to original configuration by calling Cy_Flash_IsOperationComplete(). HFCLK will have several frequency changes during the operation of this API and Cy_Flash_IsOperationComplete() API between a minimum frequency of the current IMO frequency divided by 8 and a maximum frequency of 12 MHz. This will impact the operation of most of the hardware in the device.
The devices require HFCLK to be sourced by 48 MHz IMO during Flash write. The IMO must be enabled before calling this function. This API will modify IMO configuration; it can be later restored to original configuration by calling Cy_Flash_IsOperationComplete().
The non-blocking write row API Cy_Flash_StartWrite() requires Cy_Flash_ResumeWrite() to be called 3 times to complete the write. This can be done by configuring SPCIF interrupt and placing a call to this API.
For Cortex-M0+ based devices, if the user wants to keep the vector table in Flash when performing non-blocking Flash write then they need to make sure the vector table is placed in the Flash macro which is not getting programmed by configuring the VTOR register.
rowAddr | Address of the Flash row to which the data needs to be written. The address shall be aligned to the beginning of the row. Supervisory Flash is not supported. |
data | Array of bytes to write. The size of the 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_ResumeWrite | ( | void | ) |
The non-blocking write row API Cy_Flash_StartWrite() requires that this function be called 3 times to complete the write.
This can be done by configuring SPCIF interrupt and placing a call to this API.
It is advised not to prolong calling this API for more than 25 ms.
cy_en_flashdrv_status_t Cy_Flash_IsOperationComplete | ( | void | ) |
Returns the current status of the Flash write operation.
Calling this API before starting a non-blocking write row operation using the Cy_Flash_StartWrite API will cause improper operation.
cy_en_flashdrv_status_t Cy_Flash_RowChecksum | ( | uint32_t | rowAddr, |
uint32_t * | checksumPtr | ||
) |
Returns a checksum value of the specified Flash or Supervisory Flash row.
rowAddr | The address of the row. The address shall be aligned to the beginning of the row. |
checksumPtr | The pointer to the address where checksum is to be stored. |
cy_en_flashdrv_status_t Cy_Flash_SetProtection | ( | const uint32_t | bitField | ) |
Controls protection against the program/erase operation of the flash.
bitField | Bitfield value that specify the protection setting of Flash macros. |
cy_en_flashdrv_status_t Cy_Flash_GetProtectionStatus | ( | uint32_t * | statusPtr | ) |
Gets the flash protection status of the specified flash.
statusPtr | The pointer to the area to store the protection status. |
cy_en_flashdrv_status_t Cy_Flash_SetupEccInjection | ( | const uint32_t | address, |
const uint8_t | parity | ||
) |
Set CPUSS_FLASHC_ECC_CTL register to setup ECC error injection.
[in] | address | Specifies the address where an ECC error will be injected. |
[in] | parity | Specifies the parity, which will be injected to the word address. |
void Cy_Flash_EnableEccInjection | ( | void | ) |
Set CPUSS_FLASH_CTL register to enable ECC injection.
void Cy_Flash_DisableEccInjection | ( | void | ) |
Set CPUSS_FLASH_CTL register to disable ECC injection.
bool Cy_Flash_IsEccInjectionEnabled | ( | void | ) |
Check whether the ECC error injection of data flash is enabled.