system_info.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /**
  2. * Copyright(c) 2012 Sunmedia Technologies - All Rights Reserved.
  3. *
  4. * @file
  5. *
  6. * @brief Definitions for 9202 header info structure and operation.
  7. *
  8. * @note This file must match packmod tool.
  9. *
  10. */
  11. #ifndef _SYSTEM_HEADER_INFO_
  12. #define _SYSTEM_HEADER_INFO_
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. #endif
  17. #define FLAG_LEN (12)
  18. #define TIMESTAMP_LEN (32)
  19. #define SVN_LEN (8)
  20. /**
  21. * Version definition.
  22. * @brief Define header infomation version.
  23. *
  24. * @note These macro defines the version of header infomation, any changes of
  25. * configuration will lead to version increased by 1.
  26. *
  27. */
  28. #define BOOTSYSINFO_VER (1)
  29. #define MAINSYSINFO_VER (1)
  30. /** Macro define to get offset of item in a data structure */
  31. #define SYSHEADER_ITEMOFFSET(type, field) ((UINT32)&(((type *)0)->field))
  32. /** Macro define to get the size of item in a given data structure */
  33. #define SYSHEADER_ITEMSIZE(type, field) (sizeof ((type *)0)->field)
  34. /**
  35. * struct MAIN_HEAD_t
  36. * @brief main header parameter.
  37. *
  38. * @note This structure is for V1.
  39. *
  40. * This structure defines the parameter of system information.
  41. */
  42. typedef struct MAIN_HEAD_t
  43. {
  44. unsigned int s_version; /**< MAIN_HEAD_t version, zero means bad magic. currently V1 is valid */
  45. unsigned int version; /**< main code version */
  46. unsigned char flag[FLAG_LEN]; /**< s2tek */
  47. unsigned char OUI[3];
  48. unsigned short sw_model;
  49. unsigned short sw_version;
  50. unsigned short hw_model;
  51. unsigned short hw_version;
  52. unsigned char timestamp[TIMESTAMP_LEN];
  53. unsigned short Chipid;
  54. unsigned short flash_size;
  55. unsigned char sw_svnversion[SVN_LEN];
  56. } MAIN_HEAD_t;
  57. /**
  58. * struct LOADER_HEAD_t
  59. * @brief Bootloader header parameter.
  60. *
  61. * @note This structure is for V1.
  62. *
  63. * This structure defines the parameter of bootloader header information.
  64. */
  65. typedef struct LOADER_HEAD_t
  66. {
  67. unsigned int s_version; /**< LOADER_HEAD_t version, zero means bad magic. currently V1 is valid */
  68. unsigned int version; /**< bootloader version */
  69. unsigned char flag[FLAG_LEN]; /**< boot */
  70. /**
  71. * The following items are the same as main header, when main code is
  72. * unfortunatly destroied, bootloader will use these fields to recover
  73. * the system.
  74. */
  75. unsigned char OUI[3];
  76. unsigned short sw_model;
  77. unsigned short sw_version;
  78. unsigned short hw_model;
  79. unsigned short hw_version;
  80. unsigned short Chipid;
  81. } LOADER_HEAD_t;
  82. #ifdef __cplusplus
  83. }
  84. #endif
  85. #endif /* _SYSTEM_HEADER_INFO_ */