报文到底是怎么被发出去的
报文被触发发送方式有两种
- 轮询
- 中断
RTE 调取发送接口
/**********************************************************************************************************************
Function name : Com_SendSignal
Syntax : uint8 Com_SendSignal(Com_SignalIdType SignalId, const void* SignalDataPtr)
Description : Service updates the signal object identified by SignalId with the signal
referenced by the SignalDataPtr parameter.
Parameter : SignalId -> Id of the signal.
: SignalDataPtr -> The pointer to the address where the application data is available.
Return value : E_OK/COM_SERVICE_NOT_AVAILABLE/COM_BUSY
*********************************************************************************************************************/
#define COM_START_SEC_CODE
#include "Com_MemMap.h"
FUNC(uint8, COM_CODE) Com_SendSignal( VAR(Com_SignalIdType, AUTOMATIC) SignalId,
P2CONST(void, AUTOMATIC, COM_APPL_DATA) SignalDataPtr )
那么数据又发给谁了呢
经过路由,往下走,走到了CanIf

/************************************************************************************************************/
/* Function name : CanIf_Transmit */
/* Syntax : FUNC(Std_ReturnType, CANIF_CODE) CanIf_Transmit(
VAR(PduIdType,AUTOMATIC) CanIfTxSduId,
P2CONST(PduInfoType, AUTOMATIC, CANIF_APPL_CONST) CanIfTxInfoPtr
) */
/* Description : This service initiates a request for transmission of the CAN L-PDU specified by the
CanTxPduId and CAN related data in the L-PDU structure. */
/* Parameter : CanTxPduId, PduInfoPtr */
/* Return value : E_OK / E_NOT_OK */
/************************************************************************************************************/
#define CANIF_START_SEC_CODE
#include "CanIf_MemMap.h"
FUNC(Std_ReturnType, CANIF_CODE) CanIf_Transmit(VAR(PduIdType,AUTOMATIC) CanIfTxSduId,
P2CONST(PduInfoType, AUTOMATIC, CANIF_APPL_CONST) CanIfTxInfoPtr)
发了半天也没发到BUS上啊

/**********************************************************************************************************************
* Function name : CanIf_Prv_WriteTxBuffer
* Syntax : void CanIf_Prv_WriteTxBuffer(VAR(PduIdType, AUTOMATIC) CanIfTxSduId,
* VAR(Can_PduType, AUTOMATIC) Pdu)
* Service ID[hex] : --
* Sync/Async : --
* Reentrancy : --
* Parameters (in) : CanIfTxSduId, Pdu
* Parameters (inout): None
* Parameters (out) : None
* Return value : Std_ReturnType
* Description : Function is called by CanIf_Transmit() which writes PDU to corresponding TxBuffer. **
**********************************************************************************************************************/
#define CANIF_START_SEC_CODE
#include "CanIf_MemMap.h"
FUNC(Std_ReturnType, CANIF_CODE) CanIf_Prv_WriteTxBuffer(
VAR(PduIdType, AUTOMATIC) CanIfTxSduId,
VAR(Can_PduType, AUTOMATIC) Pdu
)
这里终于从CanIf到了CAN (硬件驱动相关)
硬件驱动谁来调呢
上一步CanIf 填充了Tx buffer, 这里触发了中断

这中断咋就被执行了呢
哦 在os 里面,根据芯片硬件的信息已经把对应的中断信息进行了配置


中断触发后怎么办呢
这时候才是真正的驱动代码把数据发送到总线,终端服务函数
/*******************************************************************************
** Traceability : [cover parentID={D47A49B6-985A-4c4f-86D5-C17125DAE268}] **
** **
** **
** Syntax : void Can_17_McmCan_IsrTransmitHandler **
** ( **
** const uint8 HwKernelId **
** const uint8 NodeIdIndex **
** ) **
** **
** Description :The function identifies the message object belonging to **
** the given CAN controller for which the transmission request**
** was successful. It extracts the corresponding software PDU **
** handle and gives notification to upper layer. **
** The Can_17_McmCan_IsrTransmitHandler() handler is available**
** only when CanTxProcessing is enabled **
** Due to Mixed mode support, if one of the HTH is configured **
** in INTERRUPT mode every successful transmission will **
** trigger interrupt. **
** **
** Service ID : None **
** **
** Sync/Async : Synchronous **
** **
** Reentrancy : Reentrant **
** **
** Parameters (in) : HwKernelId - The CAN controller which is to be processed,*
** is associated with the passed Kernel **
** NodeIdIndex - The CAN node which is to be processed **
** **
** Parameters (out) : None **
** **
** Return value : None **
*******************************************************************************/
void Can_17_McmCan_IsrTransmitHandler(const uint8 HwKernelId,
const uint8 NodeIdIndex)

本文详细介绍了报文从应用层到硬件驱动的整个发送过程,包括通过Com_SendSignal进行信号更新,经由CanIf模块处理并写入TxBuffer,直至硬件驱动通过中断将数据发送到总线。

603

被折叠的 条评论
为什么被折叠?



