AM263x MCU+ SDK  08.02.01

Introduction

This module contains APIs to program and use the I2C based EEPROM module on the board like AT24CM01. See EEPROM for more details.

Data Structures

struct  EEPROM_Params
 Parameters passed during EEPROM_open() More...
 
struct  EEPROM_Fxns
 Driver implementation callbacks. More...
 
struct  EEPROM_Attrs
 EEPROM device attributes, these are filled by SysCfg based on the device that is selected. More...
 
struct  EEPROM_Config
 EEPROM driver configuration, these are filled by SysCfg based on the device that is selected. More...
 
struct  EEPROM_Object
 EEPROM driver object - not to be used by application. More...
 

Functions

void EEPROM_Params_init (EEPROM_Params *params)
 Set default parameters in the EEPROM_Params_s structure. More...
 
EEPROM_Handle EEPROM_open (uint32_t instanceId, const EEPROM_Params *params)
 Open EEPROM driver. More...
 
void EEPROM_close (EEPROM_Handle handle)
 Open EEPROM driver. More...
 
int32_t EEPROM_read (EEPROM_Handle handle, uint32_t offset, uint8_t *buf, uint32_t len)
 Read data from EEPROM. More...
 
int32_t EEPROM_write (EEPROM_Handle handle, uint32_t offset, const uint8_t *buf, uint32_t len)
 Write to EEPROM. More...
 
const EEPROM_AttrsEEPROM_getAttrs (uint32_t instanceId)
 Return EEPROM attributes. More...
 

Typedefs

typedef void * EEPROM_Handle
 Handle to the EEPROM driver returned by EEPROM_open() More...
 

Macros

#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...
 

EEPROM driver implementation callbacks

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...
 

Macro Definition Documentation

◆ 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

#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.

Typedef Documentation

◆ EEPROM_Handle

typedef void* EEPROM_Handle

Handle to the EEPROM driver returned by EEPROM_open()

◆ 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

Function Documentation

◆ 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()

void EEPROM_close ( EEPROM_Handle  handle)

Open EEPROM driver.

Parameters
handle[IN] EEPROM driver handle from EEPROM_open

◆ 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()

const EEPROM_Attrs* EEPROM_getAttrs ( uint32_t  instanceId)

Return EEPROM attributes.

Parameters
instanceId[IN] EEPROM instance ID
Returns
EEPROM_Attrs, else NULL if instanceId is invalid