| 1 | #ifndef __INC_DT2_COMMON_H |
| 2 | #define __INC_DT2_COMMON_H |
| 3 | |
| 4 | #define ATAG_MV_UBOOT 0x41000403 |
| 5 | |
| 6 | struct tag_mv_uboot { |
| 7 | u32 uboot_version; |
| 8 | u32 tclk; |
| 9 | u32 sysclk; |
| 10 | u32 isUsbHost; |
| 11 | u32 overEthAddr; |
| 12 | u8 dt2_eeprom[256]; |
| 13 | }; |
| 14 | |
| 15 | #define DT2_EEPROM_ADDR 0x50 |
| 16 | #define DT2_EEPROM_OFFSET 0 |
| 17 | #define DT2_EEPROM_LENGTH 256 |
| 18 | |
| 19 | #define DT2_SERIAL_NUMBER_DEFAULT "run on default\0" |
| 20 | #define DT2_REVISION_DEFAULT_INIT 0xFF |
| 21 | #define DT2_CONFIG_FLAGS_DEFAULT 0x00 |
| 22 | |
| 23 | #define _PACKED_ __attribute__((packed)) |
| 24 | |
| 25 | struct DT2_EEPROM_SD_CONFIG { |
| 26 | unsigned int ram_1; |
| 27 | unsigned int ram_2; |
| 28 | unsigned int ram_3; |
| 29 | unsigned int ram_4; |
| 30 | unsigned char ram_5; |
| 31 | unsigned char ram_6; |
| 32 | unsigned short ram_7; |
| 33 | unsigned int magic_id; |
| 34 | } _PACKED_; // 24 Bytes in total |
| 35 | |
| 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; |
| 43 | unsigned char dummy1; |
| 44 | unsigned char dummy2; |
| 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 |
| 49 | |
| 50 | #define CFG_LOAD_RTC_VALUES 0x80 |
| 51 | |
| 52 | struct DT2_EEPROM_GW_CONFIG { |
| 53 | unsigned int dummy1; |
| 54 | unsigned int dummy2; |
| 55 | unsigned int dummy3; |
| 56 | unsigned char dummy4; |
| 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 |
| 65 | |
| 66 | #define _SIZE_OF_ALL_STRUCTS_ (sizeof(struct DT2_EEPROM_SD_CONFIG) + sizeof(struct DT2_EEPROM_FC_CONFIG) + sizeof(struct DT2_EEPROM_GW_CONFIG)) |
| 67 | |
| 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)]; |
| 72 | } _PACKED_; |
| 73 | |
| 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; |
| 79 | unsigned int crc; |
| 80 | } _PACKED_; |
| 81 | |
| 82 | #endif |
| 83 | |