1 #ifndef __INC_DT2_COMMON_H
2 #define __INC_DT2_COMMON_H
4 #define ATAG_MV_UBOOT 0x41000403
15 #define DT2_EEPROM_ADDR 0x50
16 #define DT2_EEPROM_OFFSET 0
17 #define DT2_EEPROM_LENGTH 256
19 #define DT2_SERIAL_NUMBER_DEFAULT "run on default\0"
20 #define DT2_REVISION_DEFAULT_INIT 0xFF
21 #define DT2_CONFIG_FLAGS_DEFAULT 0x00
23 #define _PACKED_ __attribute__((packed))
25 struct DT2_EEPROM_SD_CONFIG {
33 unsigned int magic_id;
34 } _PACKED_; // 24 Bytes in total
36 struct DT2_EEPROM_FC_CONFIG {
37 unsigned char rtc_sts_mask;
38 unsigned char rtc_sts_init;
39 unsigned char rtc_int_mask;
40 unsigned char rtc_int_init;
41 unsigned char rtc_atrim_init;
42 unsigned char rtc_dtrim_init;
45 unsigned char dt2_config_flags; /* 0x80 to load rtc_values to RTC */
46 unsigned char dt2_revision; /* upper nibble is HW, lower nibble is FW */
47 unsigned char dt2_serial_number[16]; /* Serial number of DT-2 */
48 } _PACKED_; // 26 Bytes in total
50 #define CFG_LOAD_RTC_VALUES 0x80
52 struct DT2_EEPROM_GW_CONFIG {
57 unsigned char tos_video_val1;
58 unsigned char tos_video_val2;
59 unsigned char tos_voip_val;
60 unsigned char qos_igmp_cfg;
61 unsigned char num_of_ifs;
62 unsigned short vlan_ports_if[3];
63 unsigned char mac_addr[3][6];
64 } _PACKED_; // 42 Bytes in total
66 #define _SIZE_OF_ALL_STRUCTS_ (sizeof(struct DT2_EEPROM_SD_CONFIG) + sizeof(struct DT2_EEPROM_FC_CONFIG) + sizeof(struct DT2_EEPROM_GW_CONFIG))
68 // MV = EEPROM - SD - FC - GW - CRC
69 struct DT2_EEPROM_MV_CONFIG {
70 unsigned int reg_addr[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
71 unsigned int reg_data[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
74 struct DT2_EEPROM_STRUCT {
75 struct DT2_EEPROM_MV_CONFIG mv;
76 struct DT2_EEPROM_SD_CONFIG sd;
77 struct DT2_EEPROM_FC_CONFIG fc;
78 struct DT2_EEPROM_GW_CONFIG gw;