Block Driver

The block driver provides low level access to non-volatile storage such as EEPROM or SPI Flash. Most users will benefit more from usage of the higher level Filesystem driver.

Data Structures

ATMO_BLOCK_DeviceInfo_t

Member Name Type
readSize uint32_t
progSize uint32_t
blockSize uint32_t
blockCount uint32_t

Type Definitions

Name Definition Description
ATMO_BLOCK_DriverInstance_t typedef struct ATMO_BLOCK_DriverInstance_t ATMO_BLOCK_DriverInstance_t  

Enumerations

enum ATMO_BLOCK_Status_t

Block driver return configuration

Name Value Description
ATMO_BLOCK_Status_Success 0x00u Common - Operation was successful
ATMO_BLOCK_Status_Fail 0x01u Common - Operation failed
ATMO_BLOCK_Status_Initialized 0x02u Common - Peripheral already initialized
ATMO_BLOCK_Status_Invalid 0x03u Common - Invalid operation or result
ATMO_BLOCK_Status_NotSupported 0x04u Common - Feature not supported by platform
ATMO_BLOCK_Status_Unknown 0x05u Common - Some other status not defined

Functions

ATMO_Status_t ATMO_BLOCK_AddDriverInstance(const ATMO_BLOCK_DriverInstance_t *driverInstance, ATMO_DriverInstanceData_t *driverInstanceData, ATMO_DriverInstanceHandle_t *instanceNumber)

Register instance of block driver with underlying driver framework

Parameter Direction Type
instanceNumber out ATMO_DriverInstanceHandle_t *
driverInstanceData in ATMO_DriverInstanceData_t *
driverInstance in const ATMO_BLOCK_DriverInstance_t *
Return Type
ATMO_Status_t

ATMO_BLOCK_Status_t ATMO_BLOCK_Init(ATMO_DriverInstanceHandle_t instanceNumber)

Initialize core block driver

Parameter Direction Type
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_BLOCK_Status_t

ATMO_BLOCK_Status_t ATMO_BLOCK_Read(ATMO_DriverInstanceHandle_t instanceNumber, uint32_t block, uint32_t offset, void *buffer, uint32_t size)

Read a block from NVM

Parameter Direction Type
size in uint32_t
buffer N/A void *
offset in uint32_t
block in uint32_t
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_BLOCK_Status_t

ATMO_BLOCK_Status_t ATMO_BLOCK_Program(ATMO_DriverInstanceHandle_t instanceNumber, uint32_t block, uint32_t offset, void *buffer, uint32_t size)

Write a block to NVM

Parameter Direction Type
size in uint32_t
buffer N/A void *
offset in uint32_t
block in uint32_t
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_BLOCK_Status_t

ATMO_BLOCK_Status_t ATMO_BLOCK_Erase(ATMO_DriverInstanceHandle_t instanceNumber, uint32_t block)

Erase a block in NVM

Parameter Direction Type
block N/A uint32_t
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_BLOCK_Status_t

ATMO_BLOCK_Status_t ATMO_BLOCK_Sync(ATMO_DriverInstanceHandle_t instanceNumber)

Synchronize NVM

Parameter Direction Type
instanceNumber N/A ATMO_DriverInstanceHandle_t
Return Type
ATMO_BLOCK_Status_t

ATMO_BLOCK_Status_t ATMO_BLOCK_GetDeviceInfo(ATMO_DriverInstanceHandle_t instanceNumber, ATMO_BLOCK_DeviceInfo_t *info)

Retrieve information about underlying NVM

Parameter Direction Type
info out ATMO_BLOCK_DeviceInfo_t *
instanceNumber in ATMO_DriverInstanceHandle_t
Return Type
ATMO_BLOCK_Status_t