42 #define IOT_FLASH_SUCCESS ( 0 ) 43 #define IOT_FLASH_INVALID_VALUE ( 1 ) 44 #define IOT_FLASH_WRITE_FAILED ( 2 ) 45 #define IOT_FLASH_READ_FAILED ( 3 ) 46 #define IOT_FLASH_ERASE_FAILED ( 4 ) 47 #define IOT_FLASH_DEVICE_BUSY ( 5 ) 48 #define IOT_FLASH_CTRL_OP_FAILED ( 6 ) 49 #define IOT_FLASH_FUNCTION_NOT_SUPPORTED ( 7 ) 86 typedef struct IotFlashInfo
102 typedef struct IotFlashWriteProtectConfig
112 typedef enum IotFlashIoctlRequest
130 struct IotFlashDescriptor;
208 void * pvUserContext );
230 void *
const pvBuffer );
294 uint32_t ulStartAddress,
335 uint8_t *
const pvBuffer,
357 uint8_t *
const pvBuffer,
386 uint8_t *
const pvBuffer,
414 uint8_t *
const pvBuffer,
Definition: iot_flash.h:79
uint32_t ulLockSupportSize
Definition: iot_flash.h:92
uint32_t ulBlockSize
Definition: iot_flash.h:89
Definition: iot_flash.h:59
Definition: iot_flash.h:120
Definition: iot_flash.h:80
uint32_t ulPageSize
Definition: iot_flash.h:91
uint32_t ulSectorSize
Definition: iot_flash.h:90
IotFlashHandle_t iot_flash_open(int32_t lFlashInstance)
iot_flash_open is used to initialize the flash device. This must be called before using any other fla...
IotFlashStatus_t
Flash current status.
Definition: iot_flash.h:54
IotFlashInfo_t * iot_flash_getinfo(IotFlashHandle_t const pxFlashHandle)
iot_flash_getinfo is used to get the information about the physical flash device. ...
IotFlashWriteProtect_t
Flash sector protection type.
Definition: iot_flash.h:77
Definition: iot_flash.h:70
IotFlashOperationStatus_t
Flash driver last operation status.
Definition: iot_flash.h:66
Definition: iot_flash.h:123
int32_t iot_flash_write_async(IotFlashHandle_t const pxFlashHandle, uint32_t ulAddress, uint8_t *const pvBuffer, size_t xBytes)
iot_flash_write_async is used to write data to flash starting at the address provided. The sector(s) being written to, must be erased first before any write can take place. This is an asynchronous (non-blocking) operation and returns as soon as the write operation is started. When the write is completed, user callback is called to notify that the write is complete. The caller can check the status of the operation by using eGetStatus IOCTL. User must register for a callback when using the non-blocking operations to know when they are complete. If there is another flash operation is in progress, write will return an error.
Definition: iot_flash.h:56
Definition: iot_flash.h:115
uint8_t ucAsyncSupported
Definition: iot_flash.h:95
void iot_flash_set_callback(IotFlashHandle_t const pxFlashHandle, IotFlashCallback_t xCallback, void *pvUserContext)
iot_flash_set_callback is used to set the callback to be called upon completion of erase/program/read...
Definition: iot_flash.h:69
int32_t iot_flash_write_sync(IotFlashHandle_t const pxFlashHandle, uint32_t ulAddress, uint8_t *const pvBuffer, size_t xBytes)
iot_flash_write_sync is used to write data to flash starting at the address provided. The sector(s) being written to, must be erased first before any write can take place. This is a blocking operation and waits until the number of bytes are written before returning. If there is another flash operation is in progress, write will return an error.
Definition: iot_flash.h:71
flash information
Definition: iot_flash.h:86
uint32_t ulFlashSize
Definition: iot_flash.h:88
int32_t iot_flash_close(IotFlashHandle_t const pxFlashHandle)
iot_flash_close is used to close the flash device. If any operations are in progress when close is ca...
int32_t iot_flash_ioctl(IotFlashHandle_t const pxFlashHandle, IotFlashIoctlRequest_t xRequest, void *const pvBuffer)
iot_flash_ioctl is used to configure the flash parameters and setup certain flash operations and also...
IotFlashIoctlRequest_t
Ioctl request types.
Definition: iot_flash.h:112
#define IOT_FLASH_ERASE_FAILED
Definition: iot_flash.h:46
#define IOT_FLASH_SUCCESS
Return values used by this driver.
Definition: iot_flash.h:42
int32_t iot_flash_erase_sectors(IotFlashHandle_t const pxFlashHandle, uint32_t ulStartAddress, size_t xSize)
iot_flash_erase_sectors is used to erase data in flash from the start of the address specified until ...
uint32_t ulSize
Definition: iot_flash.h:105
struct IotFlashDescriptor * IotFlashHandle_t
IotFlashHandle_t type is the flash handle returned by calling iot_flash_open() this is initialized in...
Definition: iot_flash.h:137
#define IOT_FLASH_READ_FAILED
Definition: iot_flash.h:45
#define IOT_FLASH_WRITE_FAILED
Definition: iot_flash.h:44
int32_t iot_flash_erase_chip(IotFlashHandle_t const pxFlashHandle)
iot_erase_chip is used to erase the entire flash chip. If there is another flash operation is in prog...
Definition: iot_flash.h:57
Definition: iot_flash.h:124
Definition: iot_flash.h:58
Definition: iot_flash.h:117
int32_t iot_flash_read_sync(IotFlashHandle_t const pxFlashHandle, uint32_t ulAddress, uint8_t *const pvBuffer, size_t xBytes)
iot_flash_read_sync is used to read data from flash. This is a blocking operation and waits until the...
Flash protection configuration.
Definition: iot_flash.h:102
uint32_t ulAddress
Definition: iot_flash.h:104
void(* IotFlashCallback_t)(IotFlashOperationStatus_t xStatus, void *pvUserContext)
Flash notification callback type. This callback can be passed to the driver by using iot_flash_set_ca...
Definition: iot_flash.h:151
IotFlashWriteProtect_t xProtectionLevel
Definition: iot_flash.h:106
Definition: iot_flash.h:122
Definition: iot_flash.h:114
Definition: iot_flash.h:68
int32_t iot_flash_read_async(IotFlashHandle_t const pxFlashHandle, uint32_t ulAddress, uint8_t *const pvBuffer, size_t xBytes)
iot_flash_read_async is used to read data from flash. This is an asynchronous (non-blocking) operatio...