no-OS
no_os_eeprom.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef _NO_OS_EEPROM_H_
41 #define _NO_OS_EEPROM_H_
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 
47 #include <stdint.h>
48 
49 /******************************************************************************/
50 /********************** Macros and Constants Definitions **********************/
51 /******************************************************************************/
52 
53 /******************************************************************************/
54 /*************************** Types Declarations *******************************/
55 /******************************************************************************/
56 
57 /* Forward declaration of structure */
59 
66  uint32_t device_id;
69  void *extra;
70 };
71 
78  uint32_t device_id;
81  void *extra;
82 };
83 
91  int32_t (*init)(struct no_os_eeprom_desc **,
92  const struct no_os_eeprom_init_param *);
94  int32_t (*write)(struct no_os_eeprom_desc *, uint32_t, uint8_t *, uint16_t);
96  int32_t (*read)(struct no_os_eeprom_desc *, uint32_t, uint8_t *, uint16_t);
98  int32_t (*remove)(struct no_os_eeprom_desc *);
99 };
100 
101 /******************************************************************************/
102 /************************ Functions Declarations ******************************/
103 /******************************************************************************/
104 
105 /* Initialize the EEPROM */
106 int32_t no_os_eeprom_init(struct no_os_eeprom_desc **desc,
107  const struct no_os_eeprom_init_param *param);
108 
109 /* Write into EEPROM */
110 int32_t no_os_eeprom_write(struct no_os_eeprom_desc *desc, uint32_t address,
111  uint8_t *data, uint16_t bytes);
112 
113 /* Read from EEPROM */
114 int32_t no_os_eeprom_read(struct no_os_eeprom_desc *desc, uint32_t address,
115  uint8_t *data, uint16_t bytes);
116 
117 /* Free the resources allocated by no_os_eeprom_init() */
118 int32_t no_os_eeprom_remove(struct no_os_eeprom_desc *desc);
119 
120 #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:67
no_os_eeprom_desc
Structure holding the EEPROM descriptor.
Definition: no_os_eeprom.h:76
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:95
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:115
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:94
no_os_eeprom_desc::platform_ops
const struct no_os_eeprom_platform_ops * platform_ops
Definition: no_os_eeprom.h:79
no_os_eeprom_init_param::device_id
uint32_t device_id
Definition: no_os_eeprom.h:66
no_os_eeprom_desc::extra
void * extra
Definition: no_os_eeprom.h:81
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:96
no_os_eeprom_platform_ops::remove
int32_t(* remove)(struct no_os_eeprom_desc *)
Definition: no_os_eeprom.h:98
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:91
no_os_eeprom_platform_ops
Structure holding the EEPROM function pointers that point to the platform specific function.
Definition: no_os_eeprom.h:89
no_os_eeprom_desc::device_id
uint32_t device_id
Definition: no_os_eeprom.h:78
no_os_eeprom_init_param::extra
void * extra
Definition: no_os_eeprom.h:69
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:51
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:76
no_os_eeprom_init_param
Structure holding the parameters for EEPROM initialization.
Definition: no_os_eeprom.h:64