Commit 4f944745 authored by 李秉薇's avatar 李秉薇

fix:39983

parent 51ebc182
......@@ -1729,6 +1729,7 @@ void UDS_Service_28_Indication ( uint32_t A_TA_type, uint16_t A_Length, uint8_t
return;
} */
//所有应用报文
#if 0
if( 1 == UDS_ISO14229_Transfer[1])
{
Com_RxStart();
......@@ -1741,7 +1742,9 @@ void UDS_Service_28_Indication ( uint32_t A_TA_type, uint16_t A_Length, uint8_t
CANNetTxOFF = 0;
}
//所有应用报文和所有网络管理报文
else if( 3 == UDS_ISO14229_Transfer[1] )
else
#endif
if( 3 == UDS_ISO14229_Transfer[1] )
{
Com_RxStart();
Com_TxStart();
......@@ -1769,6 +1772,7 @@ void UDS_Service_28_Indication ( uint32_t A_TA_type, uint16_t A_Length, uint8_t
//CommunicationType=UDS_ISO14229_Transfer[0];
//ControlType=disableRxAndEnableTx;
//所有应用报文
#if 0
if( 1 == UDS_ISO14229_Transfer[1])
{
Com_TxStop();
......@@ -1781,7 +1785,9 @@ void UDS_Service_28_Indication ( uint32_t A_TA_type, uint16_t A_Length, uint8_t
CANNetTxOFF = 1;
}
//所有应用报文和所有网络管理报文
else if( 3 == UDS_ISO14229_Transfer[1] )
else
#endif
if( 3 == UDS_ISO14229_Transfer[1] )
{
Com_TxStop();
Com_RxStop();
......
/******************************************************************************
文 件 名:Communication_Over_CAN.h
功能描述:基于CAN总线的信号收发函数库头文件
作 者:张暄
版 本:V1.3
日 期:2017.5.31
?? ?? ????Communication_Over_CAN.h
??????????????CAN?????????????????????
?? ???????
?? ????V1.3
?? ???2017.5.31
******************************************************************************/
#ifndef _COMMUNICATION_OVER_CAN_
......@@ -16,36 +16,36 @@
#include "CAN_Communication_Matrix.h"
/******************************************************************************
CAN通信参数配置
CAN??????????
******************************************************************************/
#define CoCAN_RX_MSG_FIFO_MAX_DEPTH 16 //接收FIFO深度
#define CoCAN_MSG_NUM_CHECK 0 //报文数量检查(Debug用)
#define CoCAN_RX_MSG_FIFO_MAX_DEPTH 16 //????FIFO???
#define CoCAN_MSG_NUM_CHECK 0 //???????????(Debug??)
#define CoCAN_TOTAL_MSG_NUM (sizeof(CANMsgAttrTable) / sizeof(CANMsgAttrStruct))
/******************************************************************************
CAN通信收发使能状态
CAN???????????
******************************************************************************/
#define CoCAN_DISABLE 0
#define COCAN_PSEUDO_DISABLE 1
#define CoCAN_ENABLE 2
/******************************************************************************
CAN报文发送请求状态
CAN?????????????
******************************************************************************/
#define CoCAN_TX_IDLE 0
#define CoCAN_TX_REQ 1
#define CoCAN_TX_ON 2
/******************************************************************************
CAN报文发送请求状态
CAN?????????????
******************************************************************************/
#define CoCAN_MODE_NORMAL 0
#define CoCAN_MODE_INIT 1
/******************************************************************************
CAN报文发送FIFO结构
CAN???????FIFO??
******************************************************************************/
typedef struct
{
......@@ -56,7 +56,7 @@ typedef struct
}CoCANTxMsgFIFOStruct;
/******************************************************************************
CAN报文接收FIFO结构
CAN???????FIFO??
******************************************************************************/
typedef struct
{
......@@ -68,61 +68,61 @@ typedef struct
typedef struct
{
CoCANMsgStruct Msg[CoCAN_RX_MSG_FIFO_MAX_DEPTH];
uint8_t Iptr;//进队列位置
uint8_t Optr;//出队列位置
uint8_t Iptr;//????????
uint8_t Optr;//????????
uint8_t Depth;
}CoCANRxMsgFIFOStruct;
/******************************************************************************
CAN报文快速查找表结构
CAN?????????????
******************************************************************************/
/*** 发送报文查找表结构 ***/
/*** ????????????? ***/
typedef struct
{
uint32_t Identifier; //报文ID
uint16_t Offset; //报文发送时间偏移
uint16_t Cycle; //报文发送周期
uint8_t Rsvd; //保留
uint8_t Index; //发送报文对应在周期性报文表中的序号,0xFF表示非周期性报文
uint8_t TxReq; //发送请求
uint8_t DLC; //报文长度
volatile uint8_t *pMsg; //报文寄存器
const uint8_t *pInit; //报文初始化值
volatile uint8_t *pStatus; //状态寄存器
uint32_t Identifier; //????ID
uint16_t Offset; //?????????????
uint16_t Cycle; //???????????
uint8_t Rsvd; //????
uint8_t Index; //??????????????????????????,0xFF??????????????
uint8_t TxReq; //????????
uint8_t DLC; //???????
volatile uint8_t *pMsg; //????????
const uint8_t *pInit; //?????????
volatile uint8_t *pStatus; //???????
}CoCANTxMsgIDLookupStruct;
/*** 接收报文查找表结构 ***/
/*** ????????????? ***/
typedef struct
{
uint32_t Identifier; //报文ID
uint16_t Cycle; //报文超时周期,用于掉线判断
uint8_t Rsvd; //保留
uint8_t Index; //接收报文对应在周期性报文表中的序号,0xFF表示非周期性报文
uint8_t DLCMax; //报文最大长度
uint8_t DLCMin; //报文最小长度
volatile uint8_t *pMsg; //报文寄存器
const uint8_t *pInit; //报文初始化值
const uint8_t *pTimeOut; //报文掉线值
const uint8_t *pMask; //报文屏蔽位(决定某一位在掉线时是否更新为掉线值)
volatile uint8_t *pStatus; //状态寄存器
uint32_t Identifier; //????ID
uint16_t Cycle; //??????????,?????????
uint8_t Rsvd; //????
uint8_t Index; //??????????????????????????,0xFF??????????????
uint8_t DLCMax; //????????
uint8_t DLCMin; //??????????
volatile uint8_t *pMsg; //????????
const uint8_t *pInit; //?????????
const uint8_t *pTimeOut; //????????
const uint8_t *pMask; //????????(????????????????????????)
volatile uint8_t *pStatus; //???????
}CoCANRxMsgIDLookupStruct;
/******************************************************************************
CAN周期性报文管理结构
CAN??????????????
******************************************************************************/
typedef struct
{
uint8_t TxNum; //周期性发送报文数量
uint8_t TxIndex[CAN_TX_MSG_NUM]; //报文对应在发送报文查找表中的序号
uint16_t TxTimer[CAN_TX_MSG_NUM]; //发送报文定时器
uint8_t TxNum; //????????????????
uint8_t TxIndex[CAN_TX_MSG_NUM]; //???????????????????????
uint16_t TxTimer[CAN_TX_MSG_NUM]; //???????????
uint8_t RxNum; //周期性发送报文数量
uint8_t RxIndex[CAN_RX_MSG_NUM]; //报文对应在发送报文查找表中的序号
uint16_t RxTimer[CAN_RX_MSG_NUM]; //接收报文定时器,用于掉线判断
uint8_t RxNum; //????????????????
uint8_t RxIndex[CAN_RX_MSG_NUM]; //???????????????????????
uint16_t RxTimer[CAN_RX_MSG_NUM]; //???????????,?????????
}CoCANCycleMsgStruct;
/******************************************************************************
CAN通信控制结构
CAN???????
******************************************************************************/
typedef struct
{
......@@ -134,13 +134,13 @@ typedef struct
}CoCANCtrlStruct;
extern CoCANCtrlStruct CoCANCtrl;
/******************************************************************************
函数声明
????????
******************************************************************************/
void CoCAN_L_Data_Indication(uint32_t Identifier, uint8_t DLC, uint8_t *Data); //必须由下一层函数引用
void CoCAN_L_Data_Indication(uint32_t Identifier, uint8_t DLC, uint8_t *Data); //?????????????????
//void CoCAN_L_Data_Request(uint32_t Identifier, uint8_t DLC, uint8_t *Data);
#define CoCAN_L_Data_Request(Identifier, DLC, Data) MSCAN0_L_Data_Request(Identifier, DLC, Data, 2)
//void CoCAN_L_Data_Confirm(uint32_t Identifier, uint8_t TransferStatus); //必须由下一层函数引用
//void CoCAN_L_Data_Confirm(uint32_t Identifier, uint8_t TransferStatus); //?????????????????
void CoCAN_Init(void);
void CoCAN_Reset(void);
......@@ -151,7 +151,7 @@ void CoCAN_Tx_Enable(uint8_t En);
uint8_t CoCAN_Search_Tx_Msg(uint32_t Identifier);
uint8_t CoCAN_Search_Rx_Msg(uint32_t Identifier);
void CoCAN_Signal_Update_Service(void); //必须每1ms被调用一次
void CoCAN_Signal_Update_Service(void); //?????1ms?????????
void CoCAN_Transmit_Message(uint32_t Identifier);
void CoCAN_Modify_Tx_Msg_Cycle(uint32_t Identifier, uint16_t Cycle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment