593 lines
18 KiB
C
593 lines
18 KiB
C
|
/**------------------<2D><>ʷ<EFBFBD>汾<EFBFBD><E6B1BE>Ϣ-------------------------------------------------------
|
|||
|
|
|||
|
** <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>:
|
|||
|
|
|||
|
** <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> V1.0
|
|||
|
|
|||
|
** <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>:
|
|||
|
|
|||
|
** <EFBFBD><EFBFBD> <EFBFBD><EFBFBD>: <EFBFBD><EFBFBD>ʼ<EFBFBD>汾
|
|||
|
|
|||
|
**-------------------------------------------------------------------------------------*/
|
|||
|
#include "CanIf.h"
|
|||
|
//#include "CanNM.h"
|
|||
|
/***************************************************************************************/
|
|||
|
static CanIf_ControllerModeType TeCanIf_e_ControllerMode;
|
|||
|
static CanTrcv_WorkModeType TeCanTrcv_e_WorkMode;
|
|||
|
static ComUint8 SeCanIf_u_IsInit;
|
|||
|
static ComUint8 SeCanIf_u_WakeEvent;
|
|||
|
static ComUint32 SeCanIf_u_TxQueueCounter;
|
|||
|
static CanIf_TxQueueType TsCanIf_h_TxQueue[CANIF_CFG_MAX_TX_HANDLE];
|
|||
|
|
|||
|
extern unsigned char TransmitCAN_Message(unsigned int ID,unsigned char Dlc,unsigned char *Data);
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void ClearCanIf_Queue(void)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/04/08
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע :
|
|||
|
*****************************************************************************************/
|
|||
|
void ClearCanIf_Queue(void)
|
|||
|
{
|
|||
|
ComUint8 LeCanIf_u_Index;
|
|||
|
|
|||
|
SeCanIf_u_TxQueueCounter = 0;
|
|||
|
for(LeCanIf_u_Index = 0; LeCanIf_u_Index < CANIF_CFG_MAX_TX_HANDLE; LeCanIf_u_Index++)
|
|||
|
{
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_CanId = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_CanDlc = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eQueued = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[0] = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[1] = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[2] = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[3] = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[4] = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[5] = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[6] = 0x00;
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_u_Index].eCanIf_Txdata[7] = 0x00;
|
|||
|
}
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void DeInitCanIf_Parameter(void)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע :
|
|||
|
*****************************************************************************************/
|
|||
|
void DeInitCanIf_Parameter(void)
|
|||
|
{
|
|||
|
SeCanIf_u_IsInit = COM_FALSE;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void ReInitCanIf_Parameter(void)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/05/7
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע :
|
|||
|
*****************************************************************************************/
|
|||
|
void ReInitCanIf_Parameter(void)
|
|||
|
{
|
|||
|
SeCanIf_u_IsInit = COM_TRUE;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void InitCanIf_Parameter(void)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע : called by main
|
|||
|
*****************************************************************************************/
|
|||
|
void InitCanIf_Parameter(void)
|
|||
|
{
|
|||
|
TeCanIf_e_ControllerMode = CANIF_CS_STOP;
|
|||
|
TeCanTrcv_e_WorkMode = CANTRCV_STANDBY;
|
|||
|
|
|||
|
ClearCanIf_Queue();
|
|||
|
|
|||
|
SeCanIf_u_IsInit = COM_TRUE;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : ComStd_ReturnType SetCanIf_BusoffEvent(void)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : ComStd_ReturnType
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע : called by can module to indicator busoff event has happened
|
|||
|
*****************************************************************************************/
|
|||
|
#if 0
|
|||
|
ComStd_ReturnType SetCanIf_BusoffEvent(CanIf_ControllerErrorType LeCanIf_u_BusoffEvent)
|
|||
|
{
|
|||
|
(void)LeCanIf_u_BusoffEvent;
|
|||
|
SetCanSM_BusoffEvent(LeCanIf_u_BusoffEvent);
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
#endif
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : ComStd_ReturnType ResetCanIf_Controller(ComUint8 LeCanIf_u_Channel)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : LeCanIf_u_Channel
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : ComStd_ReturnType
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/04/13
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע : called by can module to indicator busoff event has happened
|
|||
|
*****************************************************************************************/
|
|||
|
ComStd_ReturnType ResetCanIf_Controller(ComUint8 LeCanIf_u_Channel)
|
|||
|
{
|
|||
|
(void)LeCanIf_u_Channel;
|
|||
|
#if 0
|
|||
|
ResetCan_Controller();
|
|||
|
#endif
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : ComStd_ReturnType SetCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_u_WakeUpSource)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : ComStd_ReturnType
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע : called by can/cantrcv/ICU module to indicator wakeup event has happened
|
|||
|
*****************************************************************************************/
|
|||
|
ComStd_ReturnType SetCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource)
|
|||
|
{
|
|||
|
SeCanIf_u_WakeEvent |= LeCanIf_e_WakeUpSource;
|
|||
|
//SetCanNM_NmMode(NMStatus_WAITCHECK,NoActiveLoad);
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
ComStd_ReturnType ClrCanIf_WakeUpEvent(CanIf_WakeUpSourceType LeCanIf_e_WakeUpSource)
|
|||
|
{
|
|||
|
SeCanIf_u_WakeEvent &= ~LeCanIf_e_WakeUpSource;
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
ComStd_ReturnType GetCanIf_WakeUpEvent(CanIf_WakeUpSourceType *LeCanIf_e_WakeUpSource)
|
|||
|
{
|
|||
|
*LeCanIf_e_WakeUpSource = SeCanIf_u_WakeEvent;
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : ComStd_ReturnType SetCanIf_ControllerMode(CanIf_ControllerModeType LeCanIf_e_RequestedMode)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : CanIf_ControllerModeType LeCanIf_e_RequestedMode
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : ComStd_ReturnType
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : Call by CanSM
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע : CanIf Layer Set Controller RequestMode
|
|||
|
*****************************************************************************************/
|
|||
|
ComStd_ReturnType SetCanIf_ControllerMode(CanIf_ControllerModeType LeCanIf_e_RequestedMode)
|
|||
|
{
|
|||
|
#if 0
|
|||
|
SetCan_ControllerMode(LeCanIf_e_RequestedMode);
|
|||
|
TeCanIf_e_ControllerMode = LeCanIf_e_RequestedMode;
|
|||
|
#endif
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : ComStd_ReturnType GetCanIf_ControllerMode(CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : ComStd_ReturnType
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע : Upper Layer Get Controller Mode
|
|||
|
*****************************************************************************************/
|
|||
|
ComStd_ReturnType GetCanIf_ControllerMode(CanIf_ControllerModeType *LeCanIf_e_ControllerModePtr)
|
|||
|
{
|
|||
|
*LeCanIf_e_ControllerModePtr = TeCanIf_e_ControllerMode;
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : ComStd_ReturnType GetCanIf_TransceiverMode(CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : ComStd_ReturnType
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע : Upper Layer Get Transceive Mode
|
|||
|
*****************************************************************************************/
|
|||
|
ComStd_ReturnType GetCanIf_TransceiverMode(CanTrcv_WorkModeType *LeCanIf_e_WorkModePtr)
|
|||
|
{
|
|||
|
*LeCanIf_e_WorkModePtr = TeCanTrcv_e_WorkMode;
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : ComStd_ReturnType SetCanIf_TransceiverMode(CanTrcv_WorkModeType LeCanIf_e_WorkMode)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : CanTrcv_WorkModeType LeCanIf_e_WorkMode
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : ComStd_ReturnType
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע :
|
|||
|
*****************************************************************************************/
|
|||
|
ComStd_ReturnType SetCanIf_TransceiverMode(CanTrcv_WorkModeType LeCanIf_e_WorkMode)
|
|||
|
{
|
|||
|
SetCanTrcv_WorkMode(LeCanIf_e_WorkMode);
|
|||
|
TeCanTrcv_e_WorkMode = LeCanIf_e_WorkMode;
|
|||
|
return COM_E_OK;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void RxIndicationCanIf_Messages(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, const CanIf_CanDataType* LeCanIf_e_CanSduPtr)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, const CanIf_CanDataType* LeCanIf_e_CanSduPtr
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/16
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע :
|
|||
|
*****************************************************************************************/
|
|||
|
void RxIndicationCanIf_Messages(CanIf_HwHandleType LeCanIf_e_Hrh, CanIf_CanIdType LeCanIf_e_CanId, CanIf_CanDlcType LeCanIf_e_CanDlc, CanIf_CanDataType* LeCanIf_e_CanSduPtr)
|
|||
|
{
|
|||
|
CanIf_PduIdType LeCanIf_e_RxPduId = 0;
|
|||
|
uint16_t temp;
|
|||
|
(void)LeCanIf_e_Hrh;
|
|||
|
/* No Rx-Pdus or Ranges configured. Nothing to search. */
|
|||
|
if (0 != CANIF_CFG_GENERIC(eMaxRxPDUHandle))
|
|||
|
{
|
|||
|
/* Checked for invalid RxPduId earlier */
|
|||
|
for(LeCanIf_e_RxPduId = 0;LeCanIf_e_RxPduId < CANIF_CFG_GENERIC(eMaxRxPDUHandle);LeCanIf_e_RxPduId++)
|
|||
|
{
|
|||
|
temp = CANIF_CFG_GENERIC(eMaxRxPDUHandle);
|
|||
|
temp = CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId,eRxCanId);
|
|||
|
if( CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId,eRxCanId) == LeCanIf_e_CanId )
|
|||
|
{
|
|||
|
/* ID matches - Pdu identified */
|
|||
|
/* DLC check - if configured DLC == 0 the following condition is always false and DLC check is deactivated */
|
|||
|
CanIf_RxIndicationType rxIndicationFct;
|
|||
|
if (LeCanIf_e_CanDlc != CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId, eRxCanDlc) )
|
|||
|
{
|
|||
|
/*DLC Error*/
|
|||
|
rxIndicationFct = CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId,eCanIf_RxErrorFct);
|
|||
|
if(COM_NULL_PTR != rxIndicationFct)
|
|||
|
{
|
|||
|
rxIndicationFct(LeCanIf_e_Hrh,LeCanIf_e_CanId,LeCanIf_e_CanDlc,LeCanIf_e_CanSduPtr);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
/*Avoid Warning*/
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
rxIndicationFct = CANIF_CFG_CANRX_TABLE(LeCanIf_e_RxPduId,eCanIf_RxIndicationFct);
|
|||
|
if(COM_NULL_PTR != rxIndicationFct)
|
|||
|
{
|
|||
|
rxIndicationFct(LeCanIf_e_Hrh,LeCanIf_e_CanId,LeCanIf_e_CanDlc,LeCanIf_e_CanSduPtr);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
/*Avoid Warning*/
|
|||
|
}
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
/*Avoid Warning*/
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
/*Avoid Warning*/
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : ComStd_ReturnType TransmitCanIf_Buffer(CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : ComStd_ReturnType
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע :
|
|||
|
*****************************************************************************************/
|
|||
|
ComStd_ReturnType TransmitCanIf_Buffer(CanIf_CanIdType LeCanIf_t_TxCanID,CanIf_CanDlcType LeCanIf_t_TxCanDlc,CanIf_CanDataType *LeCanIf_t_TxCanDataPtr)
|
|||
|
{
|
|||
|
Can_ReturnType txResult = CAN_OK; /*or CAN_OK*/
|
|||
|
|
|||
|
#if 0
|
|||
|
AC_DiagResp.RcvId = LeCanIf_t_TxCanID;
|
|||
|
AC_DiagResp.RcvDLC = LeCanIf_t_TxCanDlc;
|
|||
|
AC_DiagResp.Data[0] = *LeCanIf_t_TxCanDataPtr++;
|
|||
|
AC_DiagResp.Data[1] = *LeCanIf_t_TxCanDataPtr++;
|
|||
|
AC_DiagResp.Data[2] = *LeCanIf_t_TxCanDataPtr++;
|
|||
|
AC_DiagResp.Data[3] = *LeCanIf_t_TxCanDataPtr++;
|
|||
|
AC_DiagResp.Data[4] = *LeCanIf_t_TxCanDataPtr++;
|
|||
|
AC_DiagResp.Data[5] = *LeCanIf_t_TxCanDataPtr++;
|
|||
|
AC_DiagResp.Data[6] = *LeCanIf_t_TxCanDataPtr++;
|
|||
|
AC_DiagResp.Data[7] = *LeCanIf_t_TxCanDataPtr;
|
|||
|
#endif
|
|||
|
|
|||
|
CanIf_EnterCritical();
|
|||
|
#if 0
|
|||
|
txResult = CanSnd(CanBufDsc[9]);//TransmitCAN_Message(LeCanIf_t_TxCanID,LeCanIf_t_TxCanDlc,LeCanIf_t_TxCanDataPtr);
|
|||
|
#endif
|
|||
|
txResult = TransmitCAN_Message(LeCanIf_t_TxCanID,LeCanIf_t_TxCanDlc,LeCanIf_t_TxCanDataPtr);
|
|||
|
CanIf_LeaveCritical();
|
|||
|
|
|||
|
/*<2A><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>*/
|
|||
|
if(CAN_NOT_OK == txResult)
|
|||
|
{
|
|||
|
CanIf_uint8Type LeCanIf_e_TxPduId;
|
|||
|
for(LeCanIf_e_TxPduId = 0;LeCanIf_e_TxPduId < CANIF_CFG_GENERIC(eMaxTxPDUHandle);LeCanIf_e_TxPduId++)
|
|||
|
{
|
|||
|
if( CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eTxCanId) == LeCanIf_t_TxCanID )
|
|||
|
{
|
|||
|
CanIf_uint8Type LeCanIf_e_TxDataCycle;
|
|||
|
|
|||
|
TsCanIf_h_TxQueue[CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)].eCanIf_CanId = LeCanIf_t_TxCanID;
|
|||
|
TsCanIf_h_TxQueue[CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)].eCanIf_CanDlc = LeCanIf_t_TxCanDlc;
|
|||
|
for(LeCanIf_e_TxDataCycle = 0;LeCanIf_e_TxDataCycle < LeCanIf_t_TxCanDlc;LeCanIf_e_TxDataCycle++)
|
|||
|
{
|
|||
|
TsCanIf_h_TxQueue[CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)].eCanIf_Txdata[LeCanIf_e_TxDataCycle] = LeCanIf_t_TxCanDataPtr[LeCanIf_e_TxDataCycle];
|
|||
|
}
|
|||
|
TsCanIf_h_TxQueue[CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)].eQueued = 1;
|
|||
|
SeCanIf_u_TxQueueCounter |= ( 1 << (CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eQueuedIndex)) );
|
|||
|
|
|||
|
break;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
/*Tx OK == do nothing */
|
|||
|
}
|
|||
|
return (ComStd_ReturnType)txResult;
|
|||
|
}
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void TreatCanIf_TxQueue(void)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/04/08
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע :
|
|||
|
*****************************************************************************************/
|
|||
|
#if 0
|
|||
|
void TreatCanIf_TxQueue(void)
|
|||
|
{
|
|||
|
if(0 != SeCanIf_u_TxQueueCounter)
|
|||
|
{
|
|||
|
Can_ReturnType txResult = CAN_NOT_OK;
|
|||
|
CanIf_uint8Type LeCanIf_e_Index = 0;
|
|||
|
|
|||
|
for(LeCanIf_e_Index = 0;LeCanIf_e_Index < CANIF_CFG_MAX_TX_HANDLE;LeCanIf_e_Index++)
|
|||
|
{
|
|||
|
if(0 != TsCanIf_h_TxQueue[LeCanIf_e_Index].eQueued)
|
|||
|
{
|
|||
|
txResult = TransmitCAN_Message(TsCanIf_h_TxQueue[LeCanIf_e_Index].eCanIf_CanId,TsCanIf_h_TxQueue[LeCanIf_e_Index].eCanIf_CanDlc,TsCanIf_h_TxQueue[LeCanIf_e_Index].eCanIf_Txdata);
|
|||
|
if(CAN_OK == txResult)
|
|||
|
{
|
|||
|
TsCanIf_h_TxQueue[LeCanIf_e_Index].eQueued = 0;
|
|||
|
SeCanIf_u_TxQueueCounter &= ~( 1 << LeCanIf_e_Index );
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
#endif
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void ConfirmCanIf_TxOK(CanIf_CanIdType LeCanIf_t_TxCanID)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : LeCanIf_t_TxCanID
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/04/08
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע :
|
|||
|
*****************************************************************************************/
|
|||
|
#if 0
|
|||
|
void ConfirmCanIf_TxOK(ComUint8 LeCanIf_e_Hrh,CanIf_CanIdType LeCanIf_t_TxCanID)
|
|||
|
{
|
|||
|
CanIf_PduIdType LeCanIf_e_TxPduId = 0;
|
|||
|
|
|||
|
if(0 != CANIF_CFG_MAX_TX_HANDLE)
|
|||
|
{
|
|||
|
/* Checked for invalid RxPduId earlier */
|
|||
|
for(LeCanIf_e_TxPduId = 0;LeCanIf_e_TxPduId < CANIF_CFG_GENERIC(eMaxTxPDUHandle);LeCanIf_e_TxPduId++)
|
|||
|
{
|
|||
|
if( CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eTxCanId) == LeCanIf_t_TxCanID )
|
|||
|
{
|
|||
|
CanIf_TxConfirmationType TxConfirmationFct;
|
|||
|
TxConfirmationFct = CANIF_CFG_CANTX_TABLE(LeCanIf_e_TxPduId,eCanIf_TxConfirmationFct);
|
|||
|
if(COM_NULL_PTR != TxConfirmationFct)
|
|||
|
{
|
|||
|
TxConfirmationFct(LeCanIf_e_Hrh,LeCanIf_t_TxCanID);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
/*Avoid Warning*/
|
|||
|
}
|
|||
|
break;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
/*Avoid Warning*/
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
CanIf_EnterCritical();
|
|||
|
TreatCanIf_TxQueue();
|
|||
|
CanIf_LeaveCritical();
|
|||
|
}
|
|||
|
#endif
|
|||
|
/****************************************************************************************
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void CanIf_MainFunction(void)
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ : void
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : 10ms<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>༭ʱ<EFBFBD><EFBFBD> : 2015/03/14
|
|||
|
|
|||
|
@<EFBFBD>汾 : V1.0
|
|||
|
|
|||
|
@<EFBFBD><EFBFBD>ע : CanIf<EFBFBD><EFBFBD>TASK
|
|||
|
*****************************************************************************************/
|
|||
|
void CanIf_MainFunction(void)
|
|||
|
{
|
|||
|
if( COM_FALSE != SeCanIf_u_IsInit )
|
|||
|
{
|
|||
|
if( (CANIF_CS_STOP == TeCanIf_e_ControllerMode) && (CANTRCV_STANDBY == TeCanTrcv_e_WorkMode) )
|
|||
|
{
|
|||
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><DFBB><EFBFBD><EFBFBD>¼<EFBFBD>,<2C>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD>*/
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
/*Avoid Warning*/
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|