hal_module_adapter.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #ifndef HAL_MODULE_ADAPTER_H
  2. #define HAL_MODULE_ADAPTER_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include "commontypedef.h"
  7. #include "sensor.h"
  8. #include "can.h"
  9. #define USING_PRINTF
  10. #define GPS_DATA_RECV_BUFFER_SIZE (1024)
  11. #define I2C_INT1_REQ_BITMAP (0x1)
  12. #define I2C_INT2_REQ_BITMAP (0x2)
  13. #define ADC_REQ_BITMAP_VBAT (0x01)
  14. #define ADC_REQ_BITMAP_TEMP (0x02)
  15. #define ADC_REQ_BITMAP_CH1 (0x04)
  16. #define ADC_REQ_BITMAP_CH2 (0x08)
  17. #define ADC_REQ_BITMAP_CH30 (0x10)
  18. #define ADC_REQ_BITMAP_CH31 (0x20)
  19. #define ADC_REQ_BITMAP_CH4 (0x40)
  20. #define ADC_REQ_BITMAP_VBAT_CALI (0x80)
  21. #define ADC_REQ_BITMAP_INRES_CALI (0x100)
  22. #define ADC_GET_RESULT_TIMOUT (2000)
  23. typedef enum _ntc_channel
  24. {
  25. NTC_Channel1 ,
  26. NTC_Channel2 ,
  27. NTC_Channel30 ,
  28. NTC_Channel31 ,
  29. NTC_Channel4 ,
  30. NTC_Channel4_VbatCali ,
  31. NTC_Channel4_InresCali ,
  32. NTC_ChannelMax
  33. } ntc_channel_t;
  34. typedef enum{
  35. LED_SOC_0,
  36. LED_SOC_1,
  37. LED_SOC_2,
  38. LED_SOC_3,
  39. LED_MAX_INX
  40. }ledInx_t;
  41. typedef enum
  42. {
  43. AON_IO = 0,
  44. NORMAL_IO = 1,
  45. }IOType;
  46. typedef enum{
  47. LED_TURN_ON,
  48. LED_TURN_OFF
  49. }ledStaus_t;
  50. typedef struct
  51. {
  52. UINT32 request;
  53. UINT32 param[7];
  54. }adcReqMsg;
  55. typedef struct
  56. {
  57. void * dataPtr;
  58. UINT32 len;
  59. }gpsReqMsg;
  60. typedef struct
  61. {
  62. UINT32 event;
  63. UINT32 value;
  64. } i2c_recv_msgqueue_obj_t;
  65. typedef struct _led_pin_config
  66. {
  67. INT32 pinPort;
  68. INT32 pinInx;
  69. INT32 padInx;
  70. pad_mux_t padMutex;
  71. } led_pin_config_t;
  72. typedef enum
  73. {
  74. STD_PACK ,
  75. EXT_PACK ,
  76. PACK_MAX
  77. }PackType;
  78. typedef struct _can_initType
  79. {
  80. INT32 baudrate;
  81. INT16 mode;
  82. INT8 TxStdIDH;
  83. /*
  84. std : sid0 - sid2 ->bit5-bit7
  85. ext :eid17: bit1
  86. ext: eid16 :bit0
  87. */
  88. INT8 TxStdIDL;
  89. INT8 TxExtIDH;
  90. INT8 TxExtIDL;
  91. INT8 RxStdIDH[6];
  92. INT8 RxStdIDL[6];
  93. INT8 RxExtIDH[6];
  94. INT8 RxExtIDL[6];
  95. PackType packType; //0 STID; 1 EXTID;
  96. }Can_InitType;
  97. typedef struct _Can_TxMsgType
  98. {
  99. UINT16 stdIDH;
  100. UINT16 stdIDL;
  101. UINT8 DLC;
  102. UINT8 Data[8];
  103. }Can_TxMsgType;
  104. #ifdef BL_FILE_LOG
  105. typedef enum
  106. {
  107. BL_LEVEL0,
  108. BL_LEVEL1,
  109. BL_LEVEL2,
  110. BL_LEVEL3,
  111. }BlLogLevel;
  112. #endif
  113. typedef struct CAN_Msg_Type
  114. {
  115. UINT32 Id;
  116. UINT8 DLC;
  117. UINT8 Data[8];
  118. }CAN_Msg_Type;
  119. typedef void (*posGGACallBack )(UINT8 res, UINT8 * params);
  120. void PowerPinConfig(IOType iotype);
  121. void relayConfigInit(void);
  122. void relayControl(BOOL onOrOff);
  123. void posGGAServiceStop( void);
  124. void posGGAReset(void);
  125. void NetSocDisplay(ledInx_t Inx , ledStaus_t status);
  126. void FaultDisplay(ledStaus_t status);
  127. INT32 AdcSendReq(UINT32 req,UINT32 * param , UINT8 len ,UINT32 timeout);
  128. INT32 AdcTaskInit(void);
  129. void CanSPIHandler(ARM_SPI_SignalEvent_t cb_event,UINT8 mode,UINT8 dataBits, UINT32 spiRate );
  130. #if 1
  131. UINT8 CanTriggerEvtInit(void);
  132. void CanWaitEvt(UINT32 timeout);
  133. void CanTiggerEvt(UINT8 cmd);
  134. #endif
  135. INT32 CAN_WriteReg(UINT8 addr, UINT8 value);
  136. INT32 CAN_ReadReg(UINT8 reg, UINT8 len, UINT8 *buf);
  137. void HAL_Can_Init(Can_InitType param);
  138. void HAL_Can_Sleep(void);
  139. INT32 HAL_Can_Reset(void);
  140. INT8 HAL_Can_Transmit(CAN_Msg_Type Can_TxMsg);
  141. void HAL_Can_Receive(CAN_Msg_Type* CanRxMsgBuffer);
  142. #ifdef BL_FILE_LOG
  143. void bluejoy_printf(BlLogLevel level, const UINT8 *format, ...);
  144. void bluejoy_read_logfile(void);
  145. void bluejoy_del_logfile(void);
  146. #endif
  147. extern void GsensorInit(void);
  148. extern void GsensorI2CHandler(ARM_I2C_SignalEvent_t cb_event);
  149. extern void GsensorI2CCallback(UINT32 event);
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. #endif /* HAL_MODULE_ADAPTER_H */