Device Firmware Update (DFU) Middleware Library 5.1
Memory Operations

General Description

DFU functions for memory operations These IO functions have to be re-implemented in the user's code.

Functions

cy_en_dfu_status_t Cy_DFU_ReadData (uint32_t address, uint32_t length, uint32_t ctl, cy_stc_dfu_params_t *params)
 This function must be implemented in the user's code. More...
 
cy_en_dfu_status_t Cy_DFU_WriteData (uint32_t address, uint32_t length, uint32_t ctl, cy_stc_dfu_params_t *params)
 This function must be implemented in the user's code. More...
 

Function Documentation

◆ Cy_DFU_ReadData()

cy_en_dfu_status_t Cy_DFU_ReadData ( uint32_t  address,
uint32_t  length,
uint32_t  ctl,
cy_stc_dfu_params_t params 
)

This function must be implemented in the user's code.

Reads buffer from flash, QSPI flash, or any other external memory type with custom pre and post read commands.

Parameters
addressThe address from where to read data, must be aligned to a flash row, QSPI flash page, etc.
lengthThe length in bytes of data to read, must be multiple of a flash row, QSPI flash page, etc.
ctlAdditional features of the read function:
  • CY_DFU_IOCTL_READ - Only read.
  • CY_DFU_IOCTL_COMPARE - Compare the data in the buffer with the data in memory.
  • CY_DFU_IOCTL_BHP - Decrypt data before comparing the buffer with memory, if the DFU Host provided encrypted data.
paramsThe pointer to a DFU parameters structure. See cy_stc_dfu_params_t .
Returns
See cy_en_dfu_status_t
  • CY_DFU_SUCCESS - If successful.
  • CY_DFU_ERROR_LENGTH if The length value is invalid.
  • CY_DFU_ERROR_ADDRESS if The address is invalid.

◆ Cy_DFU_WriteData()

cy_en_dfu_status_t Cy_DFU_WriteData ( uint32_t  address,
uint32_t  length,
uint32_t  ctl,
cy_stc_dfu_params_t params 
)

This function must be implemented in the user's code.

Writes the buffer to flash, QSPI flash, or any other external memory type with custom pre and post write commands.

Parameters
addressThe address to write data to, must be aligned to a flash row, QSPI flash page, etc.
lengthThe length in bytes of data to be written, must be multiple of a flash row, QSPI flash page, etc.
ctlAdditional features of the write function:
  • CY_DFU_IOCTL_WRITE - Only write.
  • CY_DFU_IOCTL_ERASE - Erase the sector, the sector size can be bigger than the size of the page to write.
  • CY_DFU_IOCTL_BHP - Decrypt data before writing to memory, if the DFU Host provided encrypted data.
paramsThe pointer to a DFU parameters structure. See cy_stc_dfu_params_t .
Returns
See cy_en_dfu_status_t.
  • CY_DFU_SUCCESS - If successful.
  • CY_DFU_ERROR_LENGTH if The length value is invalid.
  • CY_DFU_ERROR_ADDRESS if The address is invalid.