HPM SDK
HPMicro Software Development Kit
eeprom_hal.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "eeprom_hal.h"

Data Structures

struct  eeprom_context_t
 eeprom hal context structure More...
 

Functions

hpm_stat_t hpm_eeprom_init (hpm_eeprom_device_t *device)
 Initialize eeprom device. More...
 
hpm_stat_t hpm_eeprom_deinit (hpm_eeprom_device_t *device)
 Deinitialize eeprom device. More...
 
hpm_stat_t hpm_eeprom_read_block (hpm_eeprom_device_t *device, uint32_t data_addr, uint32_t len, uint8_t *data)
 Read data from eeprom device. More...
 
hpm_stat_t hpm_eeprom_write_block (hpm_eeprom_device_t *device, uint32_t data_addr, uint32_t len, uint8_t *data)
 Write data to eeprom device. More...
 
static uint8_t find_empty_device_bit (uint32_t device_bit)
 Find empty device bit. More...
 
hpm_stat_t hpm_eeprom_register (hpm_eeprom_device_t *device, char device_name[])
 Register eeprom device. More...
 
hpm_stat_t hpm_eeprom_unregister (char device_name[])
 Unregister eeprom device. More...
 
hpm_eeprom_device_thpm_eeprom_find (char device_name[])
 Find eeprom device by device name. More...
 

Variables

eeprom_context_t g_e2p_ctx
 

Function Documentation

◆ find_empty_device_bit()

static uint8_t find_empty_device_bit ( uint32_t  device_bit)
static

Find empty device bit.

Parameters
[in]device_bitDevice bit map
Return values
emptydevice bit index

◆ hpm_eeprom_deinit()

hpm_stat_t hpm_eeprom_deinit ( hpm_eeprom_device_t device)

Deinitialize eeprom device.

Parameters
[in]devicePointer to eeprom device structure
Return values
status_success

◆ hpm_eeprom_find()

hpm_eeprom_device_t* hpm_eeprom_find ( char  device_name[])

Find eeprom device by device name.

Parameters
[in]device_nameDevice name
Return values
Pointerto eeprom device structure

◆ hpm_eeprom_init()

hpm_stat_t hpm_eeprom_init ( hpm_eeprom_device_t device)

Initialize eeprom device.

Parameters
[in]devicePointer to eeprom device structure
Return values
status_successor status_fail if initialization fails

◆ hpm_eeprom_read_block()

hpm_stat_t hpm_eeprom_read_block ( hpm_eeprom_device_t device,
uint32_t  data_addr,
uint32_t  len,
uint8_t *  data 
)

Read data from eeprom device.

Parameters
[in]devicePointer to eeprom device structure
[in]data_addrData address to read from
[in]lenLength of data to read
[in]dataPointer to buffer to store read data
Return values
status_successif without any error

◆ hpm_eeprom_register()

hpm_stat_t hpm_eeprom_register ( hpm_eeprom_device_t device,
char  device_name[] 
)

Register eeprom device.

Parameters
[in]devicePointer to eeprom device structure
[in]device_nameDevice name
Return values
status_success

◆ hpm_eeprom_unregister()

hpm_stat_t hpm_eeprom_unregister ( char  device_name[])

Unregister eeprom device.

Parameters
[in]device_nameDevice name
Return values
status_successor status_fail if unregister fails

◆ hpm_eeprom_write_block()

hpm_stat_t hpm_eeprom_write_block ( hpm_eeprom_device_t device,
uint32_t  data_addr,
uint32_t  len,
uint8_t *  data 
)

Write data to eeprom device.

Parameters
[in]devicePointer to eeprom device structure
[in]data_addrData address to write to
[in]lenLength of data to write
[in]dataPointer to buffer containing data to write
Return values
status_successif without any error

Variable Documentation

◆ g_e2p_ctx

eeprom_context_t g_e2p_ctx