dt2-common.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef __INC_DT2_COMMON_H
  2. #define __INC_DT2_COMMON_H
  3. #define ATAG_MV_UBOOT 0x41000403
  4. struct tag_mv_uboot {
  5. u32 uboot_version;
  6. u32 tclk;
  7. u32 sysclk;
  8. u32 isUsbHost;
  9. u32 overEthAddr;
  10. u8 dt2_eeprom[256];
  11. };
  12. #define DT2_EEPROM_ADDR 0x50
  13. #define DT2_EEPROM_OFFSET 0
  14. #define DT2_EEPROM_LENGTH 256
  15. #define DT2_SERIAL_NUMBER_DEFAULT "run on default\0"
  16. #define DT2_REVISION_DEFAULT_INIT 0xFF
  17. #define DT2_CONFIG_FLAGS_DEFAULT 0x00
  18. #define _PACKED_ __attribute__((packed))
  19. struct DT2_EEPROM_SD_CONFIG {
  20. unsigned int ram_1;
  21. unsigned int ram_2;
  22. unsigned int ram_3;
  23. unsigned int ram_4;
  24. unsigned char ram_5;
  25. unsigned char ram_6;
  26. unsigned short ram_7;
  27. unsigned int magic_id;
  28. } _PACKED_; // 24 Bytes in total
  29. struct DT2_EEPROM_FC_CONFIG {
  30. unsigned char rtc_sts_mask;
  31. unsigned char rtc_sts_init;
  32. unsigned char rtc_int_mask;
  33. unsigned char rtc_int_init;
  34. unsigned char rtc_atrim_init;
  35. unsigned char rtc_dtrim_init;
  36. unsigned char dummy1;
  37. unsigned char dummy2;
  38. unsigned char dt2_config_flags; /* 0x80 to load rtc_values to RTC */
  39. unsigned char dt2_revision; /* upper nibble is HW, lower nibble is FW */
  40. unsigned char dt2_serial_number[16]; /* Serial number of DT-2 */
  41. } _PACKED_; // 26 Bytes in total
  42. #define CFG_LOAD_RTC_VALUES 0x80
  43. struct DT2_EEPROM_GW_CONFIG {
  44. unsigned int dummy1;
  45. unsigned int dummy2;
  46. unsigned int dummy3;
  47. unsigned char dummy4;
  48. unsigned char tos_video_val1;
  49. unsigned char tos_video_val2;
  50. unsigned char tos_voip_val;
  51. unsigned char qos_igmp_cfg;
  52. unsigned char num_of_ifs;
  53. unsigned short vlan_ports_if[3];
  54. unsigned char mac_addr[3][6];
  55. } _PACKED_; // 42 Bytes in total
  56. #define _SIZE_OF_ALL_STRUCTS_ (sizeof(struct DT2_EEPROM_SD_CONFIG) + sizeof(struct DT2_EEPROM_FC_CONFIG) + sizeof(struct DT2_EEPROM_GW_CONFIG))
  57. // MV = EEPROM - SD - FC - GW - CRC
  58. struct DT2_EEPROM_MV_CONFIG {
  59. unsigned int reg_addr[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
  60. unsigned int reg_data[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
  61. } _PACKED_;
  62. struct DT2_EEPROM_STRUCT {
  63. struct DT2_EEPROM_MV_CONFIG mv;
  64. struct DT2_EEPROM_SD_CONFIG sd;
  65. struct DT2_EEPROM_FC_CONFIG fc;
  66. struct DT2_EEPROM_GW_CONFIG gw;
  67. unsigned int crc;
  68. } _PACKED_;
  69. #endif