#ifndef HAL_MODULE_ADAPTER_H #define HAL_MODULE_ADAPTER_H #ifdef __cplusplus extern "C" { #endif #include "commontypedef.h" #include "sensor.h" #include "can.h" #define USING_PRINTF #define GPS_DATA_RECV_BUFFER_SIZE (1024) #define I2C_INT1_REQ_BITMAP (0x1) #define I2C_INT2_REQ_BITMAP (0x2) #define ADC_REQ_BITMAP_VBAT (0x01) #define ADC_REQ_BITMAP_TEMP (0x02) #define ADC_REQ_BITMAP_CH1 (0x04) #define ADC_REQ_BITMAP_CH2 (0x08) #define ADC_REQ_BITMAP_CH30 (0x10) #define ADC_REQ_BITMAP_CH31 (0x20) #define ADC_REQ_BITMAP_CH4 (0x40) #define ADC_REQ_BITMAP_VBAT_CALI (0x80) #define ADC_REQ_BITMAP_INRES_CALI (0x100) #define ADC_GET_RESULT_TIMOUT (2000) typedef enum _ntc_channel { NTC_Channel1 , NTC_Channel2 , NTC_Channel30 , NTC_Channel31 , NTC_Channel4 , NTC_Channel4_VbatCali , NTC_Channel4_InresCali , NTC_ChannelMax } ntc_channel_t; typedef enum{ LED_SOC_0, LED_SOC_1, LED_SOC_2, LED_SOC_3, LED_MAX_INX }ledInx_t; typedef enum { AON_IO = 0, NORMAL_IO = 1, }IOType; typedef enum{ LED_TURN_ON, LED_TURN_OFF }ledStaus_t; typedef struct { UINT32 request; UINT32 param[7]; }adcReqMsg; typedef struct { void * dataPtr; UINT32 len; }gpsReqMsg; typedef struct { UINT32 event; UINT32 value; } i2c_recv_msgqueue_obj_t; typedef struct _led_pin_config { INT32 pinPort; INT32 pinInx; INT32 padInx; pad_mux_t padMutex; } led_pin_config_t; typedef enum { STD_PACK , EXT_PACK , PACK_MAX }PackType; typedef struct _can_initType { INT32 baudrate; INT16 mode; INT8 TxStdIDH; /* std : sid0 - sid2 ->bit5-bit7 ext :eid17: bit1 ext: eid16 :bit0 */ INT8 TxStdIDL; INT8 TxExtIDH; INT8 TxExtIDL; INT8 RxStdIDH[6]; INT8 RxStdIDL[6]; INT8 RxExtIDH[6]; INT8 RxExtIDL[6]; PackType packType; //0 STID; 1 EXTID; }Can_InitType; typedef struct _Can_TxMsgType { UINT16 stdIDH; UINT16 stdIDL; UINT8 DLC; UINT8 Data[8]; }Can_TxMsgType; #ifdef BL_FILE_LOG typedef enum { BL_LEVEL0, BL_LEVEL1, BL_LEVEL2, BL_LEVEL3, }BlLogLevel; #endif typedef struct CAN_Msg_Type { UINT32 Id; UINT8 DLC; UINT8 Data[8]; }CAN_Msg_Type; typedef void (*posGGACallBack )(UINT8 res, UINT8 * params); void PowerPinConfig(IOType iotype); void relayConfigInit(void); void relayControl(BOOL onOrOff); void posGGAServiceStop( void); void posGGAReset(void); void NetSocDisplay(ledInx_t Inx , ledStaus_t status); void FaultDisplay(ledStaus_t status); INT32 AdcSendReq(UINT32 req,UINT32 * param , UINT8 len ,UINT32 timeout); INT32 AdcTaskInit(void); void CanSPIHandler(ARM_SPI_SignalEvent_t cb_event,UINT8 mode,UINT8 dataBits, UINT32 spiRate ); #if 1 UINT8 CanTriggerEvtInit(void); void CanWaitEvt(UINT32 timeout); void CanTiggerEvt(UINT8 cmd); #endif INT32 CAN_WriteReg(UINT8 addr, UINT8 value); INT32 CAN_ReadReg(UINT8 reg, UINT8 len, UINT8 *buf); void HAL_Can_Init(Can_InitType param); void HAL_Can_Sleep(void); INT32 HAL_Can_Reset(void); INT8 HAL_Can_Transmit(CAN_Msg_Type Can_TxMsg); void HAL_Can_Receive(CAN_Msg_Type* CanRxMsgBuffer); #ifdef BL_FILE_LOG void bluejoy_printf(BlLogLevel level, const UINT8 *format, ...); void bluejoy_read_logfile(void); void bluejoy_del_logfile(void); #endif extern void GsensorInit(void); extern void GsensorI2CHandler(ARM_I2C_SignalEvent_t cb_event); extern void GsensorI2CCallback(UINT32 event); #ifdef __cplusplus } #endif #endif /* HAL_MODULE_ADAPTER_H */