Bootloader.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_CrcIndex,
  51. bluecell_crc,
  52. bluecell_ext,
  53. }FirmwareUpdate_t;
  54. /*bluecell Header*/
  55. #define Bluecell_Header0 0x42//ASCII : B
  56. #define Bluecell_Header1 0x4C//ASCII : L
  57. #define Bluecell_Header2 0x55//ASCII : U
  58. #define Bluecell_Header3 0x45//ASCII : E
  59. /*bluecell type*/
  60. #define Bluecell_Reset 0x0A//ASCII : R
  61. #define Bluecell_Firmupdate_start 0x55//ASCII : U
  62. #define Bluecell_Firmupdate_sending 0x53//ASCII : S
  63. #define Bluecell_Firmupdate_end 0x65//ASCII : e
  64. #define Bluecell_Endbyte 0xED
  65. #define bluecell_Firmupdate_sendlength 1024
  66. #define bluecell_Firmupdate_Ackbytelength 12
  67. extern void FirmwareUpdate_Boot(void);
  68. extern void Firmware_BootStart_Signal();
  69. #endif /* BOOTLOADER_H_ */