MBIC_Bootloader.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * MBIC_Bootloader.h
  3. *
  4. * Created on: 2020. 5. 18.
  5. * Author: parkyj
  6. */
  7. #ifndef MBIC_BOOTLOADER_H_
  8. #define MBIC_BOOTLOADER_H_
  9. #define MBIC_HEADER_SIZE 22
  10. #define MBIC_TAIL_SIZE 3
  11. #define MBIC_PREAMBLE0 0x16
  12. #define MBIC_PREAMBLE1 0x16
  13. #define MBIC_PREAMBLE2 0x16
  14. #define MBIC_PREAMBLE3 0x16
  15. #define MBIC_SUBUID0 0x00
  16. #define MBIC_SUBUID1 0xF1
  17. #define MBIC_RCODE
  18. #define MBIC_TRID
  19. #define MBIC_SEQNUM
  20. #define MBIC_TTL
  21. #define MBIC_TIME
  22. #define MBIC_ERRRESPONSE 0x00
  23. #define MBIC_CMD
  24. #define MBIC_LENGTH
  25. #define MBIC_CHECKSHUM_INDEX MBIC_HEADER_SIZE - 1 //CheckSUM REMOVE INDEX
  26. #define MBIC_ETX 0x03
  27. #define MBIC_NODE_MU 0x80
  28. #define MARK_START_POSITION 0
  29. #define TYPE_START_POSITION 9
  30. #define FILE_TYPE_START_POSITION 10
  31. #define VERSION_START_POSITION 11
  32. #define FILENAME_START_POSITION 14
  33. #define CREATION_TIME_START_POSITION 55
  34. #define LENGTH_START_POSITION 61
  35. #define CRC_START_POSITION 65
  36. #define RESERVED_START_POSITION 69
  37. typedef enum{
  38. MBIC_PREAMBLE_0 = 0,
  39. MBIC_PREAMBLE_1,
  40. MBIC_PREAMBLE_2,
  41. MBIC_PREAMBLE_3,
  42. MBIC_SUBUID_0,
  43. MBIC_SUBUID_1,
  44. MBIC_RCODE_0,
  45. MBIC_TRID_0,
  46. MBIC_TRID_1,
  47. MBIC_SEQSUM_0, // 9Index
  48. MBIC_TTL_0, //10 INDEX
  49. MBIC_TIME_0,
  50. MBIC_TIME_1,
  51. MBIC_TIME_2,
  52. MBIC_TIME_3,
  53. MBIC_TIME_4,
  54. MBIC_TIME_5,
  55. MBIC_ERRRESPONSE_0,
  56. MBIC_CMD_0,
  57. MBIC_LENGTH_0, // 19INDEX
  58. MBIC_LENGTH_1, // 20
  59. MBIC_HEADERCHECKSUM_0,
  60. MBIC_PAYLOADSTART,
  61. /*
  62. * PayLoadSTART
  63. */
  64. }MBICProt_st;
  65. typedef enum{
  66. MBIC_Notice_REQ = 0x10,
  67. MBIC_Download_DATA_REQ,
  68. MBIC_Download_Confirm_REQ,
  69. MBIC_Complete_Notice_REQ_REQ,
  70. MBIC_Reboot_Notice_REQ,
  71. }MBIC_Download_Req_L;
  72. typedef enum{
  73. MBIC_Notice_RSP = 0x90,
  74. MBIC_Download_DATA_RSP,
  75. MBIC_Download_Confirm_RSP,
  76. MBIC_Complete_Notice_RSP,
  77. MBIC_Reboot_Notice_RSP,
  78. }MBIC_Download_Rsp_L;
  79. typedef struct{
  80. uint16_t Length;
  81. uint16_t Crcchk;
  82. bool FileChk;
  83. }BootLoaderDataCheck_st;
  84. #endif /* MBIC_BOOTLOADER_H_ */