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