[AutoSar]BSW_Com07 CAN报文接收流程的函数调用


  

关键词

嵌入式、C语言、autosar、OS、BSW

平台说明

项目Value
OSautosar 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
}

在这里插入图片描述
>>>>>回到总目录<<<<<<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

老灰╮(╯-╰)╭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值