目录
- 关键词
- 平台说明
- 一、背景
- 二、顺序总览
- 三、函数说明
- 3.1 Com_RxIndication()
关键词
嵌入式、C语言、autosar、OS、BSW
平台说明
项目 | Value |
---|---|
OS | autosar OS |
autosar厂商 | vector , |
芯片厂商 | TI 英飞凌 |
编程语言 | C,C++ |
编译器 | HighTec (GCC) |
autosar版本 | 4.3.1 |
>>>>>回到总目录<<<<<<
一、背景
介绍了一个信号如何从底层传输到应用层的函数调用。note:该报文类型为应用报文
处理方式为轮询模式
二、顺序总览
1.因为CAN_RX_PROCESSING is set to POLLING,中断模式的情况后续更新.所以由BSW 轮询调度Can_MainFunction_Read()。Can_MainFunction_Read()会获取can 控制器中的寄存器数据。它会查询当前所有MO或接收报文邮箱是否有报文被成功接收,如果有,则调用
CanIf_RxIndication 函数来向上层(PDUR)通知有报文被接收。一直通知到COM层。
2.到了COM之后进行解包,APP 通过RTE_read_XX–>Com_ReceiveSignal() 从COM中获取数据。
三、函数说明
3.1 Com_RxIndication()
对数据进行解包。
FUNC(void, COM_CODE) Com_RxIndication(PduIdType RxPduId, P2CONST(PduInfoType, AUTOMATIC, COM_APPL_DATA) PduInfoPtr)
{
(void) Com_RxIndication_Processing((Com_RxPduInfoIterType) RxPduId, PduInfoPtr);
}
FUNC(boolean, COM_CODE) Com_RxIndication_Processing(Com_RxPduInfoIterType rxPduId, P2CONST(PduInfoType, AUTOMATIC, COM_APPL_DATA) PduInfoPtr)
{
Com_RxIndication_ProcessPdu(rxPduId, &PduInfoLocal); /* SBSW_COM_FCTCALL_WITH_P2CONST */
}
COM_LOCAL_INLINE FUNC(void, COM_CODE) Com_RxIndication_ProcessPdu(Com_RxPduInfoIterType comRxPduInfoIdx, P2CONST(PduInfoType, AUTOMATIC, COM_APPL_DATA) PduInfoPtr)
{
# if (COM_EXISTS_DEFERRED_SIGNALPROCESSINGOFRXPDUINFO == STD_ON)
/* #10 If the passed Rx ComIPdu is handled deferred */
if(Com_IsHandleRxPduDeferredUsedOfRxPduInfo(comRxPduInfoIdx)) /* COV_COM_FEATURE_ALWAYS_TRUE_TX */
{
SchM_Enter_Com_COM_EXCLUSIVE_AREA_RX();
# if (COM_RXDEFPDUBUFFERUSEDOFRXPDUINFO == STD_ON)
switch (Com_GetTypeOfRxPduInfo(comRxPduInfoIdx))
{
# if(COM_EXISTS_NORMAL_TYPEOFRXPDUINFO == STD_ON)
case COM_NORMAL_TYPEOFRXPDUINFO:
/* #20 If the passed Rx ComIPdu is not a TP Pdu and no NULL_PTR, copy the passed Sdu data to the deferred Pdu buffer */
if(PduInfoPtr->SduDataPtr != NULL_PTR)
{
if(Com_IsRxDefPduBufferUsedOfRxPduInfo(comRxPduInfoIdx)) /* COV_COM_CSL03_ISUSED_OPTIONAL_INDIRECTION */
{
Com_RxDefPduBufferLengthOfRxPduInfoType numberOfBytes =
((Com_GetRxDefPduBufferLengthOfRxPduInfo(comRxPduInfoIdx)) >
PduInfoPtr->SduLength) ? (Com_RxDefPduBufferLengthOfRxPduInfoType) (PduInfoPtr->SduLength) : Com_GetRxDefPduBufferLengthOfRxPduInfo(comRxPduInfoIdx);
VStdMemCpyRamToRam(Com_GetAddrRxDefPduBuffer(Com_GetRxDefPduBufferStartIdxOfRxPduInfo(comRxPduInfoIdx)), (P2CONST(uint8, AUTOMATIC, COM_APPL_DATA)) PduInfoPtr->SduDataPtr, numberOfBytes); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_COM_MEM_CPY_2RAM */
}
}
break;
# endif
# if(COM_RXTPINFOUSEDOFRXPDUINFO == STD_ON)
case COM_TP_TYPEOFRXPDUINFO:
break;
# endif
default: /* COV_COM_MISRA */
break;
}
# endif
# if (COM_RXDEFERREDEVENTCACHE == STD_ON)
/* #30 If the passed ComIPdu is not cached yet, add the Rx ComIPdu to the deferred event cache */
if(Com_GetHandleRxPduDeferred(Com_GetHandleRxPduDeferredIdxOfRxPduInfo(comRxPduInfoIdx)) == 0u) /* COV_COM_RXDEFERRED_PROCESSING */
{
Com_RxIndication_CacheDeferredEvent(comRxPduInfoIdx);
}
# endif
/* #40 Store the passed Sdu length in the handle deferred buffer */
Com_SetHandleRxPduDeferred(Com_GetHandleRxPduDeferredIdxOfRxPduInfo(comRxPduInfoIdx), (PduInfoPtr->SduLength + 1u)); /* SBSW_COM_CSL03 */
# if(COM_GWEVENTCACHE == STD_ON)
Com_RxIndication_CacheDeferredDescriptionGwEvent(comRxPduInfoIdx);
# endif
SchM_Exit_Com_COM_EXCLUSIVE_AREA_RX();
}
# endif
# if ((COM_EXISTS_DEFERRED_SIGNALPROCESSINGOFRXPDUINFO == STD_ON) && (COM_EXISTS_IMMEDIATE_SIGNALPROCESSINGOFRXPDUINFO == STD_ON))
else
# endif
# if (COM_EXISTS_IMMEDIATE_SIGNALPROCESSINGOFRXPDUINFO == STD_ON)
/* #50 Otherwise process the Rx ComIPdu immediate */
{
FctPtrCacheStrct immediateFctPtrCacheStrct;
# if (COM_RXIMMEDIATEFCTPTRCACHE == STD_ON)
uint32 fctPtrCache[COM_RXIMMEDIATEFCTPTRCACHESIZE];
immediateFctPtrCacheStrct.ptrToCache = fctPtrCache;
immediateFctPtrCacheStrct.cacheSize = COM_RXIMMEDIATEFCTPTRCACHESIZE;
immediateFctPtrCacheStrct.cacheIndex = 0;
# else
immediateFctPtrCacheStrct.ptrToCache = NULL_PTR;
immediateFctPtrCacheStrct.cacheSize = 0;
immediateFctPtrCacheStrct.cacheIndex = 0;
# endif
SchM_Enter_Com_COM_EXCLUSIVE_AREA_RX();
# if (COM_RXSIGINFOENDIDXOFRXPDUINFO == STD_ON)
/* #60 Do Rx ComSignal processing */
Com_RxProcessing_RxPduSigEvent(comRxPduInfoIdx, PduInfoPtr, &immediateFctPtrCacheStrct); /* SBSW_COM_FCTCALL_WITH_P2CONST_AND_FCTPTR_CACHE_PTR_1 */
# endif
# if (COM_RXSIGGRPINFOINDENDIDXOFRXPDUINFO == STD_ON)
/* #70 Do Rx ComSignalGroup processing */
Com_RxProcessing_RxPduSigGrpEvent(comRxPduInfoIdx, PduInfoPtr, &immediateFctPtrCacheStrct); /* SBSW_COM_FCTCALL_WITH_P2CONST_AND_FCTPTR_CACHE_PTR_1 */
# endif
# if (COM_GWTXPDUDESCRIPTIONINFOUSEDOFRXPDUINFO == STD_ON)
/* #75 If rxPdu has any configured GwDescriptions, do gateway description processing */
if(Com_IsGwTxPduDescriptionInfoUsedOfRxPduInfo(comRxPduInfoIdx)) /* COV_COM_FEATURE_ALWAYS_TRUE_TX */
{
SchM_Enter_Com_COM_EXCLUSIVE_AREA_TX();
Com_GwDescriptionEvent(comRxPduInfoIdx, /* SBSW_COM_FCTCALL_WITH_P2CONST */
PduInfoPtr, FALSE);
SchM_Exit_Com_COM_EXCLUSIVE_AREA_TX();
}
# endif
# if (COM_RXTOUTINFOUSEDOFRXPDUINFO == STD_ON)
/* #80 If the passed Rx ComIPdu has a timeout, remove the timeout occurred flag */
if(Com_IsRxTOutInfoUsedOfRxPduInfo(comRxPduInfoIdx)) /* COV_COM_FEATURE_ALWAYS_TRUE_TX */
{
Com_LMgt_RemoveOccurredFlag(Com_GetRxTOutInfoIdxOfRxPduInfo(comRxPduInfoIdx)); /* SBSW_COM_CSL02_CSL03 */
}
# endif
SchM_Exit_Com_COM_EXCLUSIVE_AREA_RX();
# if (COM_RXIMMEDIATEFCTPTRCACHE == STD_ON)
/* #90 Call all cached notification or invalid notifications and clear the immediate function pointer cache */
Com_ProcessRxFctPtrCache(&immediateFctPtrCacheStrct); /* SBSW_COM_FCTPTR_CACHE_PTR_1 */
# endif
COM_DUMMY_STATEMENT(immediateFctPtrCacheStrct); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /* lint -e{438} */
} /* Immediate signal processing */
# endif
} /* PRQA S 6050 */ /* MD_MSR_STCAL */
#endif
}
>>>>>回到总目录<<<<<<