bl_common.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*!
  2. \file gd32f1x0_libopt.h
  3. \brief library optional for gd32f1x0
  4. */
  5. /*
  6. Copyright (C) 2016 GigaDevice
  7. 2016-01-15, V1.0.0, demo for GD32F1x0(x=3,5)
  8. 2016-05-13, V2.0.0, demo for GD32F1x0(x=3,5)
  9. */
  10. #ifndef BL_COMMON_H
  11. #define BL_COMMON_H
  12. #include <stdint.h>
  13. #include <stdio.h>
  14. #include <string.h>
  15. #include <math.h>
  16. #include <stdlib.h>
  17. #include "gd32f10x.h"
  18. #include "gd32f10x_libopt.h"
  19. #define BOOTLOADER_NVIC_OFFSET (0)
  20. #define USART_BAUND (38400)
  21. #define DEBUG_MODE 0
  22. typedef struct
  23. {
  24. uint8_t set;
  25. uint16_t count;
  26. }DELAY_COMMON;
  27. typedef struct
  28. {
  29. uint8_t enable;
  30. uint8_t set;
  31. uint16_t count;
  32. }CTR_DELAY_COMMON;
  33. #define NO_EVENT 0x00000000UL
  34. #define RS485_RECEIVE_END_EVENT 0x00000001UL
  35. #define EVENT_CAN_RECEIVE_FINISH 0x00000002UL
  36. #define RS485_2_RECEIVE_END_EVENT 0x00000004UL
  37. #define SUB_BMS_1_RS485_DISC_EVENT 0x00000008UL
  38. #define SUB_BMS_2_RS485_DISC_EVENT 0x00000010UL
  39. #define MEASURE_TEMPERATURE_EVENT 0x00000020UL
  40. #define SUB_BMS_1_SEND_CMD_EVENT 0x00000040UL
  41. #define SUB_BMS_2_SEND_CMD_EVENT 0x00000080UL
  42. #define BMS_1_RESEND_CMD_EVENT 0x00000100UL
  43. #define BMS_2_RESEND_CMD_EVENT 0x00000200UL
  44. #define END_CTR_RESEND_CMD_EVENT 0x00000400UL
  45. #define ADAS_RESEND_CMD_EVENT 0x00000800UL
  46. #define BMS_1_SELF_TIMEOUT_EVENT 0x00001000UL
  47. #define BMS_2_SELF_TIMEOUT_EVENT 0x00002000UL
  48. #define END_CTR_SELF_TIMEOUT_EVENT 0x00004000UL
  49. #define ADAS_SELF_TIMEOUT_EVENT 0x00008000UL
  50. #define ADAS_PWM_1_TIMEOUT_EVENT 0x00010000UL
  51. #define ADAS_PWM_2_TIMEOUT_EVENT 0x00020000UL
  52. #define ADAS_MEAS_1_FINISH_EVENT 0x00040000UL
  53. #define ADAS_MEAS_2_FINISH_EVENT 0x00080000UL
  54. #define RE_INITIAL_CAN_EVENT 0x00100000UL
  55. extern uint32_t g_event;
  56. // 2017/9/12 19:37:50
  57. #define UTC_INITIAL (1505216210)
  58. typedef struct
  59. {
  60. uint8_t set;
  61. uint16_t count;
  62. }UART_TOUT;
  63. void WatchDog_Initial(uint8_t period);
  64. #endif /* GD32F1X0_LIBOPT_H */