-
Notifications
You must be signed in to change notification settings - Fork 10
/
eeprom.h
63 lines (53 loc) · 1.58 KB
/
eeprom.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef eeprom_h__
#define eeprom_h__
// Copyright (c) 2019 Matthew Madison
//
// SPDX-License-Identifier: MIT
#ifdef __cplusplus
extern "C"
{
#endif
#include <inttypes.h>
typedef enum {
module_type_cvm,
module_type_cvb,
module_type_other,
module_type_normal = module_type_other,
} eeprom_module_type_t;
typedef enum {
partnum_type_nvidia,
partnum_type_customer,
} eeprom_partnum_type_t;
struct eeprom_context_s;
typedef struct eeprom_context_s *eeprom_context_t;
struct module_eeprom_s {
eeprom_partnum_type_t partnumber_type;
char partnumber[22];
uint8_t factory_default_wifi_mac[6];
uint8_t factory_default_bt_mac[6];
uint8_t factory_default_wifi_alt_mac[6];
uint8_t factory_default_ether_mac[6];
char asset_id[15];
uint8_t vendor_wifi_mac[6];
uint8_t vendor_bt_mac[6];
uint8_t vendor_ether_mac[6];
uint8_t major_version;
uint8_t minor_version;
// Additions for V2/T234 layouts
uint8_t factory_default_ether_mac_count;
uint8_t vendor_ether_mac_count;
char system_partnumber[21];
char system_serialnumber[15];
};
typedef struct module_eeprom_s module_eeprom_t;
eeprom_context_t eeprom_open_i2c(unsigned int bus, unsigned int addr, eeprom_module_type_t mtype);
eeprom_context_t eeprom_open(const char *pathname, eeprom_module_type_t mtype);
int eeprom_data_valid(eeprom_context_t ctx);
int eeprom_read(eeprom_context_t ctx, module_eeprom_t *data);
int eeprom_write(eeprom_context_t ctx, module_eeprom_t *data);
void eeprom_close(eeprom_context_t ctx);
int eeprom_readonly(eeprom_context_t ctx);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* eeprom_h__ */