Initial commit: CCU621_M firmware project with BLE debug link support.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
|
||||
#ifndef SAE1939_H
|
||||
#define SAE1939_H
|
||||
|
||||
#ifdef __cplusplus /*C++编译环境下兼容C语言*/
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*------ Exported includes(头文件) ----------------------*/
|
||||
#include "main.h"
|
||||
#include "bsp_include.h"
|
||||
|
||||
/*------ Exported macro(宏定义) -------------------------*/
|
||||
#define SAE1939_MULTI_PACKET_MAX_NUM 80 //80*7 -- bmv需要512字节
|
||||
|
||||
typedef U32_T (*U32_CAN_RX)(CAN_DATA *s_canData);
|
||||
typedef U32_T (*U32_CAN_TX)(CAN_DATA *s_canData);
|
||||
|
||||
/*------ Exported struct(结构体定义) --------------------*/
|
||||
typedef struct
|
||||
{
|
||||
U32_T u32_pgn; //参数组编号
|
||||
U8_T u8_src_addr; //源地址
|
||||
U8_T u8_dest_addr; //目标地址
|
||||
U8_T u8_pri; //优先级
|
||||
U16_T u16_len; //长度,不能大于SAE1939_MULTI_PACKET_MAX_NUM*7
|
||||
U8_T u8_data[SAE1939_MULTI_PACKET_MAX_NUM*7]; //数据
|
||||
}CAN_DATA_T;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NONE=0, //无多包发送和接收
|
||||
|
||||
// //作为多包发送方使用
|
||||
// TX_WAIT_CTS_T3, //己发送RTS,等待接收CTS,超时T3=1250ms
|
||||
// TX_WAIT_CTS_T4, //等待接收保持连接CTS,超时T4=1050ms
|
||||
|
||||
//作为多包接收方使用
|
||||
RX_WAIT_DATA_T2, //己发送CTS,等待接收数据,超时T2=1250ms
|
||||
RX_WAIT_DATA_T1, //接收数据阶段,等待接收下一个数据包,超时T1=750ms
|
||||
}MULTI_MSG_STATE_E;
|
||||
//此数据结构在BMS通信开始化进行初始化,初始化完成后BMS层不能再修改此结构
|
||||
typedef struct
|
||||
{
|
||||
MULTI_MSG_STATE_E e_msg_state; //多包解析流程状态
|
||||
U8_T u8_packet_cnt; //包数量
|
||||
|
||||
U8_T u8_src_addr; //源地址
|
||||
U8_T u8_dest_addr; //目标地址
|
||||
U8_T u8_pri; //优先级
|
||||
|
||||
U8_T u8_retry; //重试次数
|
||||
|
||||
U16_T u16_len; //长度,不能大于 80*7
|
||||
|
||||
U32_T u32_pgn; //参数组编号
|
||||
U32_T u32_time; //用于多包数据处理的计时
|
||||
|
||||
struct
|
||||
{
|
||||
U8_T u8_data[7]; //数据
|
||||
U8_T u8_flag; //标记,0:未接收或未发送,1:己接收或己发送
|
||||
}t_packet[SAE1939_MULTI_PACKET_MAX_NUM];
|
||||
|
||||
|
||||
U32_CAN_TX u32_can_tx; //驱动层发送函数
|
||||
U32_CAN_RX u32_can_rx; //驱动层接收函数 - 从缓冲区里读,不只接收一帧
|
||||
}DLL_DATA_T;
|
||||
|
||||
/*------ Exported variables(变量定义) -------------------*/
|
||||
|
||||
/*------ Exported function prototypes (函数声明) -------*/
|
||||
|
||||
void v_sae1393_clear_multi_pacet(DLL_DATA_T *pt_dll_data);
|
||||
U32_T u32_sae1393_tx(DLL_DATA_T *pt_dll_data, CAN_DATA_T *pt_can_data);
|
||||
U32_T u32_sae1393_rx(DLL_DATA_T *pt_dll_data, CAN_DATA_T *pt_can_data, CAN_DATA t_rx_msg);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SAE1939_H */
|
||||
Reference in New Issue
Block a user