This module contains APIs to program and use the I2C based EEPROM module on the board like AT24CM01. See EEPROM for more details.
|
#define | EEPROM_PAGE_SIZE (256U) |
| Max EEPROM page size used to allocate temp write buffer so that address (offset) and data can be done in single I2C operation. More...
|
|
#define | EEPROM_WR_BUF_SIZE (2U + EEPROM_PAGE_SIZE) |
| Temp write buffer to hold address offset and data for page write operation - 2 bytes for offset and remaining for one page data. More...
|
|
|
typedef int32_t(* | EEPROM_OpenFxn) (EEPROM_Config *config, const EEPROM_Params *params) |
| Driver implementation to open a specific EEPROM driver. More...
|
|
typedef void(* | EEPROM_CloseFxn) (EEPROM_Config *config) |
| Driver implementation to close a specific EEPROM driver. More...
|
|
typedef int32_t(* | EEPROM_ReadFxn) (EEPROM_Config *config, uint32_t offset, uint8_t *buf, uint32_t len) |
| Driver implementation to read from EEPROM using a specific EEPROM driver. More...
|
|
typedef int32_t(* | EEPROM_WriteFxn) (EEPROM_Config *config, uint32_t offset, const uint8_t *buf, uint32_t len) |
| Driver implementation to write to EEPROM using specific EEPROM driver. More...
|
|
◆ EEPROM_PAGE_SIZE
#define EEPROM_PAGE_SIZE (256U) |
Max EEPROM page size used to allocate temp write buffer so that address (offset) and data can be done in single I2C operation.
◆ EEPROM_WR_BUF_SIZE
Temp write buffer to hold address offset and data for page write operation - 2 bytes for offset and remaining for one page data.
◆ EEPROM_Handle
◆ EEPROM_OpenFxn
typedef int32_t(* EEPROM_OpenFxn) (EEPROM_Config *config, const EEPROM_Params *params) |
Driver implementation to open a specific EEPROM driver.
Typically this callback is hidden from the end application and is implemented when a new type of EEPROM device needs to be implemented.
- Parameters
-
config | [IN] EEPROM configuration for the specific EEPROM device |
params | [IN] User controllable parameters when opening the EEPROM device |
- Returns
- SystemP_SUCCESS on success, else failure
◆ EEPROM_CloseFxn
typedef void(* EEPROM_CloseFxn) (EEPROM_Config *config) |
Driver implementation to close a specific EEPROM driver.
Typically this callback is hidden from the end application and is implemented when a new type of EEPROM device needs to be implemented.
- Parameters
-
config | [IN] EEPROM configuration for the specific EEPROM device |
- Returns
- SystemP_SUCCESS on success, else failure
◆ EEPROM_ReadFxn
typedef int32_t(* EEPROM_ReadFxn) (EEPROM_Config *config, uint32_t offset, uint8_t *buf, uint32_t len) |
Driver implementation to read from EEPROM using a specific EEPROM driver.
Typically this callback is hidden from the end application and is implemented when a new type of EEPROM device needs to be implemented.
- Parameters
-
config | [IN] EEPROM configuration for the specific EEPROM device |
offset | [IN] Offset in the EEPROM from where to start the read |
buf | [IN] Buffer into which to read the data into |
len | [IN] Length of the data to read, in bytes |
- Returns
- SystemP_SUCCESS on success, else failure
◆ EEPROM_WriteFxn
typedef int32_t(* EEPROM_WriteFxn) (EEPROM_Config *config, uint32_t offset, const uint8_t *buf, uint32_t len) |
Driver implementation to write to EEPROM using specific EEPROM driver.
Typically this callback is hidden from the end application and is implemented when a new type of EEPROM device needs to be implemented.
- Parameters
-
config | [IN] EEPROM configuration for the specific EEPROM device |
offset | [IN] Offset in the EEPROM from where to start the write. |
buf | [IN] Buffer which has the data to write. |
len | [IN] Length of the data to write, in bytes |
- Returns
- SystemP_SUCCESS on success, else failure
◆ EEPROM_Params_init()
void EEPROM_Params_init |
( |
EEPROM_Params * |
params | ) |
|
Set default parameters in the EEPROM_Params_s structure.
Call this API to set defaults and then override the fields as needed before calling EEPROM_open.
- Parameters
-
params | [OUT] Initialized parameters |
◆ EEPROM_open()
EEPROM_Handle EEPROM_open |
( |
uint32_t |
instanceId, |
|
|
const EEPROM_Params * |
params |
|
) |
| |
Open EEPROM driver.
Make sure the SOC peripheral driver is open'ed before calling this API. Drivers_open function generated by SysCfg opens the underlying SOC peripheral driver, e.g I2C.
Global variables EEPROM_Config gEepromConfig[]
and uint32_t gEepromConfigNum
is instantiated by SysCfg to describe the EEPROM configuration based on user selection in SysCfg.
- Parameters
-
instanceId | [IN] Index within EEPROM_Config gEepromConfig[] denoting the EEPROM driver to open |
params | [IN] Open parameters |
- Returns
- Handle to EEPROM driver which should be used in subsequent API call Else returns NULL in case of failure
◆ EEPROM_close()
Open EEPROM driver.
- Parameters
-
◆ EEPROM_read()
int32_t EEPROM_read |
( |
EEPROM_Handle |
handle, |
|
|
uint32_t |
offset, |
|
|
uint8_t * |
buf, |
|
|
uint32_t |
len |
|
) |
| |
Read data from EEPROM.
- Parameters
-
handle | [IN] EEPROM driver handle from EEPROM_open |
offset | [IN] Offset in the EEPROM from where to start the read |
buf | [IN] Buffer into which to read the data into |
len | [IN] Length of the data to read, in bytes |
- Returns
- SystemP_SUCCESS on success, else failure
◆ EEPROM_write()
int32_t EEPROM_write |
( |
EEPROM_Handle |
handle, |
|
|
uint32_t |
offset, |
|
|
const uint8_t * |
buf, |
|
|
uint32_t |
len |
|
) |
| |
Write to EEPROM.
Make sure the block is erased before writing
- Parameters
-
handle | [IN] EEPROM driver handle from EEPROM_open |
offset | [IN] Offset in the EEPROM from where to start the write. |
buf | [IN] Buffer which has the data to write. |
len | [IN] Length of the data to write, in bytes |
- Returns
- SystemP_SUCCESS on success, else failure
◆ EEPROM_getAttrs()
Return EEPROM attributes.
- Parameters
-
instanceId | [IN] EEPROM instance ID |
- Returns
- EEPROM_Attrs, else NULL if instanceId is invalid