1 #ifndef _DISTORE_SIMPLE_H
2 #define _DISTORE_SIMPLE_H
5 #include <suiut/sui_dinfo.h>
9 #ifdef CONFIG_OC_I2C_DRV_SYSLESS
11 extern i2c_drv_t i2c_drv;
18 enum distore_encformat {
19 DISTORE_ENC_END = 0x00,
20 DISTORE_ENC_FLOAT_CODE = 0x10,
21 DISTORE_ENC_SIGNED_CODE = 0x20,
22 DISTORE_ENC_UNSIGNED_CODE = 0x30,
23 DISTORE_ENC_NUM_LEN = 0x0f,
24 DISTORE_ENC_NUM_LEN_BITS = 4,
25 DISTORE_ENC_TEXT_CODE = 0x80,
26 DISTORE_ENC_TEXT_LEN = 0x7f,
29 #define DISTORE_FLG_LOAD_ONLY 1
31 typedef unsigned short distore_id_t;
33 typedef struct distore_des_item_t {
35 unsigned char encform;
36 unsigned char idxlimit;
41 typedef struct distore_des_array_t {
43 const distore_des_item_t *items;
46 } distore_des_array_t;
48 const distore_des_item_t *
49 distore_des_array_at (const distore_des_array_t * array, unsigned indx);
51 const distore_des_item_t *
52 distore_des_array_find (const distore_des_array_t * array,
53 distore_id_t const * key);
55 typedef ssize_t distore_wrfnc_t(void *context, const void *buf, size_t count);
56 typedef ssize_t distore_rdfnc_t(void *context, void *buf, size_t count);
58 ssize_t distore_count_maxsize(const distore_des_array_t *des);
60 int distore_store_data(const distore_des_array_t *des,
61 distore_wrfnc_t *wrfnc, void *context);
63 #define DISTORE_LOAD_IGNORE_UNKNOWN 1
64 #define DISTORE_LOAD_IGNORE_WRITE_ERR 2
66 int distore_load_data(const distore_des_array_t *des,
67 distore_rdfnc_t *rdfnc, void *context, int mode);
73 #endif /* _DISTORE_SIMPLE_H*/