123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- #ifndef HAL_MODULE_ADAPTER_H
- #define HAL_MODULE_ADAPTER_H
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- #include "commontypedef.h"
- #include "sensor.h"
- #include "can.h"
- #include "bsp.h"
- #define USING_PRINTF
- #define DEBUGLOG
- #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
- {
- FAST_CHARGE_TEMP = 1,
- NORMAL_CHARGE_TEMP,
- OTHER_TEMP_1,
- OTHER_TEMP_2,
- VBAT
- } ADC_CHANNEL_TYPE;
- 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;
- typedef struct UTC8Time_Type
- {
- UINT16 year;
- UINT8 month;
- UINT8 day;
- UINT8 hour;
- UINT8 minute;
- UINT8 second;
- } UTC8TimeType;
- #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);
- UINT8 HAL_Can_Receive(CAN_Msg_Type *CanRxMsgBuffer);
- void UTCToBeijing(UTC8TimeType *UTC8Time, unsigned int UTCyear, unsigned char UTCmonth, unsigned char UTCday, unsigned int UTChour, unsigned char UTCminute, unsigned char UTCsecond);
- BOOL NB_ADC_Get(UINT32 *adcValue, ADC_CHANNEL_TYPE adcChannel);
- #ifdef DEBUGLOG
- void Debug_Del_Logfile(void);
- void Debug_Read_Logfile(UINT8 *rbuf, UINT16 FileSize);
- void Debug_printf(const UINT8 *format, ...);
- UINT16 Debug_GetSize();
- #endif
- #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 */
|