Bootloader.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Bootloader.h
  3. *
  4. * Created on: Jul 10, 2019
  5. * Author: parkyj
  6. */
  7. #ifndef BOOTLOADER_H_
  8. #define BOOTLOADER_H_
  9. #include "main.h"
  10. #include "uart.h"
  11. extern uint8_t * UpdateFiledata;
  12. typedef struct{
  13. uint8_t bluecell_header01;
  14. uint8_t bluecell_header02;
  15. uint8_t bluecell_header03;
  16. uint8_t bluecell_header04;
  17. uint8_t bluecell_type;
  18. uint8_t bluecell_length_h;
  19. uint8_t bluecell_length_l;
  20. uint8_t bluecell_data[2048];
  21. }Blueprotocol_t;
  22. typedef enum {
  23. BLUECELL_HEADER00 = 0,
  24. BLUECELL_HEADER01,
  25. BLUECELL_HEADER02,
  26. BLUECELL_HEADER03,
  27. BLUECELL_TYPE,
  28. BLUECELL_LENGTH_H,
  29. BLUECELL_LENGTH_L,
  30. BLUECELL_UPDATACNT_H,
  31. BLUECELL_UPDATACNT_L,
  32. BLUECELL_DATA,
  33. }Bluenum;
  34. typedef enum {
  35. BLUECELL_RESET = 0,
  36. BLUECELL_START,
  37. BLUECELL_SENDING,
  38. BLUECELL_END,
  39. }updateseq;
  40. typedef enum updateseqok
  41. {
  42. UpdateResetOK = 0,
  43. UpdateStartOK,
  44. UpdateSendingOK,
  45. UpdateEndOK,
  46. };
  47. typedef enum{
  48. bluecell_stx = 0,
  49. bluecell_type = 1,
  50. bluecell_length,
  51. bluecell_CrcIndex,
  52. bluecell_crc,
  53. bluecell_ext,
  54. }FirmwareUpdate_t;
  55. /*bluecell Header*/
  56. #define Bluecell_Header0 0x42//ASCII : B
  57. #define Bluecell_Header1 0x4C//ASCII : L
  58. #define Bluecell_Header2 0x55//ASCII : U
  59. #define Bluecell_Header3 0x45//ASCII : E
  60. /*bluecell type*/
  61. #define Bluecell_Reset 0x0A//ASCII : R
  62. #define Bluecell_Firmupdate_start 0x55//ASCII : U
  63. #define Bluecell_Firmupdate_sending 0x53//ASCII : S
  64. #define Bluecell_Firmupdate_end 0x65//ASCII : e
  65. #define Bluecell_Endbyte 0xED
  66. #define bluecell_Firmupdate_Ackbytelength 12
  67. extern void FirmwareUpdate_Boot(void);
  68. extern void Firmware_BootStart_Signal();
  69. #endif /* BOOTLOADER_H_ */