no-OS
no_os_eeprom.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef _NO_OS_EEPROM_H_
35 #define _NO_OS_EEPROM_H_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 
41 #include <stdint.h>
42 
43 /******************************************************************************/
44 /********************** Macros and Constants Definitions **********************/
45 /******************************************************************************/
46 
47 /******************************************************************************/
48 /*************************** Types Declarations *******************************/
49 /******************************************************************************/
50 
51 /* Forward declaration of structure */
53 
60  uint32_t device_id;
63  void *extra;
64 };
65 
72  uint32_t device_id;
75  void *extra;
76 };
77 
85  int32_t (*init)(struct no_os_eeprom_desc **,
86  const struct no_os_eeprom_init_param *);
88  int32_t (*write)(struct no_os_eeprom_desc *, uint32_t, uint8_t *, uint16_t);
90  int32_t (*read)(struct no_os_eeprom_desc *, uint32_t, uint8_t *, uint16_t);
92  int32_t (*remove)(struct no_os_eeprom_desc *);
93 };
94 
95 /******************************************************************************/
96 /************************ Functions Declarations ******************************/
97 /******************************************************************************/
98 
99 /* Initialize the EEPROM */
100 int32_t no_os_eeprom_init(struct no_os_eeprom_desc **desc,
101  const struct no_os_eeprom_init_param *param);
102 
103 /* Write into EEPROM */
104 int32_t no_os_eeprom_write(struct no_os_eeprom_desc *desc, uint32_t address,
105  uint8_t *data, uint16_t bytes);
106 
107 /* Read from EEPROM */
108 int32_t no_os_eeprom_read(struct no_os_eeprom_desc *desc, uint32_t address,
109  uint8_t *data, uint16_t bytes);
110 
111 /* Free the resources allocated by no_os_eeprom_init() */
112 int32_t no_os_eeprom_remove(struct no_os_eeprom_desc *desc);
113 
114 #endif // _NO_OS_EEPROM_H_
no_os_eeprom_init_param::platform_ops
const struct no_os_eeprom_platform_ops * platform_ops
Definition: no_os_eeprom.h:61
no_os_eeprom_desc
Structure holding the EEPROM descriptor.
Definition: no_os_eeprom.h:70
no_os_eeprom_write
int32_t no_os_eeprom_write(struct no_os_eeprom_desc *desc, uint32_t address, uint8_t *data, uint16_t bytes)
Write the EEPROM data.
Definition: no_os_eeprom.c:89
no_os_eeprom_read
int32_t no_os_eeprom_read(struct no_os_eeprom_desc *desc, uint32_t address, uint8_t *data, uint16_t bytes)
Read the EEPROM data.
Definition: no_os_eeprom.c:109
no_os_eeprom_platform_ops::write
int32_t(* write)(struct no_os_eeprom_desc *, uint32_t, uint8_t *, uint16_t)
Definition: no_os_eeprom.h:88
no_os_eeprom_desc::platform_ops
const struct no_os_eeprom_platform_ops * platform_ops
Definition: no_os_eeprom.h:73
no_os_eeprom_init_param::device_id
uint32_t device_id
Definition: no_os_eeprom.h:60
no_os_eeprom_desc::extra
void * extra
Definition: no_os_eeprom.h:75
no_os_eeprom_platform_ops::read
int32_t(* read)(struct no_os_eeprom_desc *, uint32_t, uint8_t *, uint16_t)
Definition: no_os_eeprom.h:90
no_os_eeprom_platform_ops::remove
int32_t(* remove)(struct no_os_eeprom_desc *)
Definition: no_os_eeprom.h:92
no_os_eeprom_platform_ops::init
int32_t(* init)(struct no_os_eeprom_desc **, const struct no_os_eeprom_init_param *)
Definition: no_os_eeprom.h:85
no_os_eeprom_platform_ops
Structure holding the EEPROM function pointers that point to the platform specific function.
Definition: no_os_eeprom.h:83
no_os_eeprom_desc::device_id
uint32_t device_id
Definition: no_os_eeprom.h:72
no_os_eeprom_init_param::extra
void * extra
Definition: no_os_eeprom.h:63
no_os_eeprom_init
int32_t no_os_eeprom_init(struct no_os_eeprom_desc **desc, const struct no_os_eeprom_init_param *param)
Initialize the EEPROM.
Definition: no_os_eeprom.c:45
no_os_eeprom_remove
int32_t no_os_eeprom_remove(struct no_os_eeprom_desc *desc)
Free the resources allocated by no_os_eeprom_init()
Definition: no_os_eeprom.c:70
no_os_eeprom_init_param
Structure holding the parameters for EEPROM initialization.
Definition: no_os_eeprom.h:58