MCAL中CAN模块的CanLPduReceiveCalloutFunction配置

CanLPduReceiveCalloutFunction

1. 找到“CanLPduReceiveCalloutFunction”模块

依次找到“Can”–“General”–“CanLPduReceiveCalloutFunction”

在这里插入图片描述

2. Callout函数的编写

形如:(过滤CanId == 0x123,不上传至COM层)

boolean ComCdd_CanIfRxIndicationHook(uint8 Hrh, uint32 CanId, uint8 CanDataLegth, uint8* CanSduPtr)
{
  if (CanId == 0x123) // CanId
  {
​    ComCdd_CRS_DataCallback(CanId, CanSduPtr, CanDataLegth);
​    return false; // stop further processing in CanIfRxIndication
  }
  else
  {
​    return true; // further processing in CanIfRxIndication
  }

}

3. Callout函数的返回值

当函数返回false时,

此LPDU不进行后续上传,不调用CanIf_RxIndication函数

(以上代码提前交给自定义函数ComCdd_CRS_DataCallback处理);

当函数返回true时,

此LPDU上传至COM层;

在这里插入图片描述

在这里插入图片描述

3. 完成

《AUTOSAR谱系分解(ETAS工具链)》之总目录

猜你喜欢

转载自blog.csdn.net/PlutoZuo/article/details/132543838