DEENESPTFRRUARHIKOZHNL

CAN Interface (CanIf)

ModulCanIf (CAN Interface)
BSW-Modul-ID60
Standard-Header#include "CanIf.h"
SWS-SpezifikationAUTOSAR_SWS_CANInterface.pdf
ClusterCAN

模块指南人工智能生成

在 CAN 驱动与通信栈之间以独立于硬件的方式传递 CAN 报文和模式控制。
AI 生成 未审核 模型: claude-opus-5-5 · 推理强度: high · 温度: 不可控 · 提示词: a6221da93ef5 来源 未决问题(1)
因果锚点:R20-11 自 R20-11 起有效 为此规范版本重新合成。
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

在 CAN 驱动与通信栈之间以独立于硬件的方式传递 CAN 报文和模式控制。

CanIf 是 CAN 驱动或收发器与上层通信模块之间独立于硬件的层。它将发送请求映射到 Can_Write(),在硬件忙时进行缓冲,并将确认及过滤后的接收转发给已配置的回调 [SWS_CANIF_00318]。它受 CanSm 委托控制控制器模式和收发器模式,并反馈 BusOff 与模式切换。PDU 通道模式分别切换发送和接收路径。仅当控制器处于 CAN_CS_STARTED 且发送路径已使能时才执行发送 [SWS_CANIF_00317]。

CAN 接口(CanIf)承担 CAN 通信的所有独立于硬件的任务。其中包括发送请求、确认、接收指示、错误消息以及 CAN 控制器的启动和停止 SWS CanIf 第13页。CanIf 仅通过 CanDrv 服务访问硬件缓冲区 [SWS_CANIF_00023]。它通过抽象 ID 寻址多个驱动的控制器和收发器 [SWS_CANIF_00653]。在 PduR、CanNm、CanTp、CanSm 或 EcuM 中调用哪些回调由配置决定 [SWS_CANIF_00011] [SWS_CANIF_00724]。

kontext ul Obere Schichten PduR, CanNm, CanTp, J1939Tp, J1939Nm, CanTSyn, Xcp, CDD canif CanIf ul->canif CanIf_Transmit() CanIf_SetPduMode() CanIf_ReadRxPduData() cansm CanSm / CDD cansm->canif CanIf_SetControllerMode() CanIf_SetTrcvMode() ecum EcuM / Integrationscode ecum->canif CanIf_Init() CanIf_CheckWakeup() CanIf_CheckValidation() canif->ul <User_RxIndication> <User_TxConfirmation> <User_TriggerTransmit> canif->cansm <User_ControllerBusOff> <User_ControllerModeIndication> <User_TrcvModeIndication> canif->ecum <User_ValidateWakeupEvent> can CAN 驱动程序 (Can) 一个或多个实例 canif->can Can_Write() Can_SetControllerMode() Can_CheckWakeup() trcv CAN-Transceiver-Treiber (CanTrcv) canif->trcv CanTrcv_SetOpMode() CanTrcv_CheckWakeup() det Det canif->det Det_ReportError() Det_ReportRuntimeError() idsm IdsM canif->idsm Sicherheitsereignisse mirror Bus Mirroring canif->mirror Mirror_ReportCanFrame() can->canif CanIf_RxIndication() CanIf_TxConfirmation() CanIf_ControllerBusOff() CanIf_ControllerModeIndication() trcv->canif CanIf_TrcvModeIndication()

上下文图:位于上层通信模块、模式管理以及控制器与收发器驱动之间的 CanIf。来源:[SWS_CANIF_00012]、[SWS_CANIF_00358]、SWS CanIf 第21页

EcuM 使用 CanIf_Init() 初始化 CanIf。此后每个通道处于 CANIF_OFFLINE 状态 [SWS_CANIF_00864],在此之前各服务均以 E_NOT_OK 拒绝 [SWS_CANIF_00661]。通过 CanIf_SetControllerMode() 进行的控制器启动为异步执行。完成情况由 CanIf_ControllerModeIndication() 报告,CanIf 将其转发给 CanSm [SWS_CANIF_00003] [SWS_CANIF_00711]。仅在此之后,CanIf_SetPduMode() 才接受请求 [SWS_CANIF_00874]。PDU 通道模式分别切换发送和接收路径。控制器事件(如 SLEEP、STOPPED 或 BusOff)会强制设置它们 [SWS_CANIF_00865] [SWS_CANIF_00866]。

pdumodi cluster_offline OFFLINE (Oberzustand) start off CANIF_OFFLINE kein Senden, kein Empfang start->off CanIf_Init() txoff CANIF_TX_OFFLINE 仅接收 off->txoff CAN_CS_STOPPED / BusOff on CANIF_ONLINE 发送与接收 off->on CanIf_SetPduMode(CANIF_ONLINE) txoff->off CAN_CS_SLEEP txoff->on CanIf_SetPduMode(CANIF_ONLINE) txact CANIF_TX_OFFLINE_ACTIVE 接收,发送立即确认 txact->off CAN_CS_SLEEP txact->txoff CAN_CS_STOPPED / BusOff txact->on CanIf_SetPduMode(CANIF_ONLINE) on->off CanIf_SetPduMode(CANIF_OFFLINE) 或 CAN_CS_SLEEP on->txoff CanIf_SetPduMode(CANIF_TX_OFFLINE) 或 CAN_CS_STOPPED / BusOff on->txact CanIf_SetPduMode(CANIF_TX_OFFLINE_ACTIVE) hinweis 仅当控制器处于 CAN_CS_STARTED 时 才接受 CanIf_SetPduMode(); 图中显示了部分转换

状态图:四种 PDU 通道模式及其通过 CanIf_SetPduMode() 和控制器事件进行的转换。来源:[SWS_CANIF_00137]、[SWS_CANIF_00866]、SWS CanIf 图 7.8 第61页

发送时,CanIf_Transmit() 调用 Can_Write() [SWS_CANIF_00318]。若硬件忙且配置了缓冲区,CanIf 会对 L-PDU 进行缓冲 [SWS_CANIF_00381]。在下一次确认时,它会补发具有最高优先级的条目 [SWS_CANIF_00668]。接收到的 L-PDU 会经过软件过滤和长度检查,然后 CanIf 将其转发给 <User_RxIndication> [SWS_CANIF_00389] [SWS_CANIF_00056]。

在出错情况下,BusOff 会将通道设置为 CANIF_TX_OFFLINE 并报告给 CanSm [SWS_CANIF_00724]。在停止控制器时,CanIf 会以 E_NOT_OK 确认所有未完成的发送请求 [SWS_CANIF_00739]。参数错误和运行时错误发送至 DET [SWS_CANIF_91006] [SWS_CANIF_91007]。

角色:CAN 驱动与通信栈之间独立于硬件的枢纽

CAN 接口(CanIf)承担 ECU 的 CAN 通信中所有独立于硬件的任务。底层的 CAN 驱动仅负责其具体硬件。CanIf 处理发送请求、发送确认、接收指示和错误消息,并启动或停止 CAN 控制器 SWS CanIf 第13页。它仅通过 CanDrv 的服务访问硬件缓冲区 [SWS_CANIF_00023]。控制服务使用抽象的 ControllerId 进行操作,该 ID 将所有 CanDrv 实例的控制器从 0 开始连续编号 [SWS_CANIF_00653]。对于收发器,带有 TransceiverId 的规则同样适用 [SWS_CANIF_00655]。

向下,CanIf 将多个 CanTrcv 驱动的 API 汇总为一个统一样式的接口,但其本身不包含任何收发器逻辑 SWS CanIf 第21页。即使存在多个 CanDrv,每个回调也仅存在一次。CanIf 根据 Can_HwType 中的 ControllerId 识别调用驱动 SWS CanIf 第68页。

向上,CanIf 调用可配置的回调,如 <User_TxConfirmation> 和 <User_RxIndication> [SWS_CANIF_00011] [SWS_CANIF_00012]。配置决定了具体的接收者,例如 PduR_CanIfRxIndication [SWS_CANIF_00442] 或 CanTp_TxConfirmation [SWS_CANIF_00550]。CanIf 将 BusOff 和模式切换报告给 CanSm 或 CDD [SWS_CANIF_00724] [SWS_CANIF_00711]。唤醒验证发送给 EcuM [SWS_CANIF_00563]。

kontext ul Obere Schichten PduR, CanNm, CanTp, J1939Tp, J1939Nm, CanTSyn, Xcp, CDD canif CanIf ul->canif CanIf_Transmit() CanIf_SetPduMode() CanIf_ReadRxPduData() cansm CanSm / CDD cansm->canif CanIf_SetControllerMode() CanIf_SetTrcvMode() ecum EcuM / Integrationscode ecum->canif CanIf_Init() CanIf_CheckWakeup() CanIf_CheckValidation() canif->ul <User_RxIndication> <User_TxConfirmation> <User_TriggerTransmit> canif->cansm <User_ControllerBusOff> <User_ControllerModeIndication> <User_TrcvModeIndication> canif->ecum <User_ValidateWakeupEvent> can CAN 驱动程序 (Can) 一个或多个实例 canif->can Can_Write() Can_SetControllerMode() Can_CheckWakeup() trcv CAN-Transceiver-Treiber (CanTrcv) canif->trcv CanTrcv_SetOpMode() CanTrcv_CheckWakeup() det Det canif->det Det_ReportError() Det_ReportRuntimeError() idsm IdsM canif->idsm Sicherheitsereignisse mirror Bus Mirroring canif->mirror Mirror_ReportCanFrame() can->canif CanIf_RxIndication() CanIf_TxConfirmation() CanIf_ControllerBusOff() CanIf_ControllerModeIndication() trcv->canif CanIf_TrcvModeIndication()

上下文图:CanIf 在上层通信模块、模式管理(CanSm、EcuM)以及 CAN 控制器和收发器驱动之间进行协调传递。错误、安全和镜像消息发送至 DET、IdsM 和 Mirror。来源:[SWS_CANIF_00011]、[SWS_CANIF_00724]、[SWS_CANIF_00358]、[SWS_CANIF_00905]、[SWS_CANIF_00913]、SWS CanIf 第13页

功能范围高度依赖于配置。CanIf_Init() 从配置容器中读取控制器数量以及 HTH/HRH 的分配等信息 SWS CanIf 第22页。HTH 和 HRH 是逻辑发送或接收对象的句柄 [SWS_CANIF_00291] [SWS_CANIF_00292]。许多服务可以通过预编译开关取消选择,例如 CanIf_ReadRxPduData() [SWS_CANIF_00330] 或 CanIf_SetBaudrate() [SWS_CANIF_00871]。如果未为非强制性回调配置名称,则省略该调用 SWS CanIf 第133页。相比之下,<User_ControllerBusOff> 则必须始终进行配置 [SWS_CANIF_00524]。

从初始化到已启动的控制器

EcuM 调用 CanIf_Init() [SWS_CANIF_00001]。此时 CanIf 初始化变量、标志位和缓冲区 [SWS_CANIF_00085] 以及所有发送 L-PDU 缓冲区 [SWS_CANIF_00387]。每个通道在 CANIF_OFFLINE 状态下启动 [SWS_CANIF_00864]。此后控制器保持在 STOPPED 模式,在该模式下既不发送也不接收。EcuM 分别初始化 CanDrv 和 CanTrcv SWS CanIf 第40页。在初始化之前,除 CanIf_Init() 和 CanIf_GetVersionInfo() 之外的所有服务均返回 E_NOT_OK [SWS_CANIF_00661]。调用 CanIf_DeInit() [SWS_CANIF_91002] 的调用方必须确保不再有传输在进行 SWS CanIf 第81页。

控制器启动为异步执行。CanIf_SetControllerMode() [SWS_CANIF_00003] 调用 Can_SetControllerMode() [SWS_CANIF_00308]。驱动稍后通过 CanIf_ControllerModeIndication() [SWS_CANIF_00699] 报告已完成的切换,CanIf 将该消息转发给 CanSm [SWS_CANIF_00711]。在轮询模式下,Can_MainFunction_Mode() 检测到该切换 SWS CanIf 第152页。仅在 CAN_CS_STARTED 中,CanIf_SetPduMode() 才接受请求 [SWS_CANIF_00874]。

启动控制器并使能 PDU 通道CanSm / obere SchichtCanIfCanCanControllerCanIf_SetControllerMode(ControllerId,CAN_CS_STARTED)Can_SetControllerMode(Controller, Transition)请求转换到 STARTE_OKE_OK (Anforderung angenommen)异步:切换尚未完成loopCan_MainFunction_Mode() bis Moduswechsel erkannt检查硬件状态CanIf_ControllerModeIndication(ControllerId,CAN_CS_STARTED)<User_ControllerModeIndication>(CanSM_ControllerModeIndication)Use Case: PDU-Pfade freischaltenCanIf_SetPduMode(ControllerId, CANIF_ONLINE)仅在 CAN_CS_STARTED 中允许E_OK

时序图:启动请求立即被确认,但模式切换稍后才进行指示。随后可以使能 PDU 路径。来源:[SWS_CANIF_00308]、[SWS_CANIF_00711]、[SWS_CANIF_00874]、SWS CanIf 第156页

PDU 通道模式:分别切换发送和接收路径

控制器的每个通道都具有一个 CanIf_PduModeType 类型的模式 [SWS_CANIF_00137]。上层通过 CanIf_SetPduMode() 对其进行设置,并通过 CanIf_GetPduMode() 对其进行读取 [SWS_CANIF_00008] [SWS_CANIF_00009]。各模式详情如下 SWS CanIf 第58页:

  • CANIF_OFFLINE:发送请求被拒绝并返回 E_NOT_OK,且清空缓冲区。指示和确认被抑制 [SWS_CANIF_00073]。
  • CANIF_TX_OFFLINE:仅发送路径被阻塞,接收保持激活 [SWS_CANIF_00489]。
  • CANIF_TX_OFFLINE_ACTIVE:发送请求立即被确认,而不会传递给 CanDrv [SWS_CANIF_00072]。
  • CANIF_ONLINE:发送和接收完全处于活动状态 [SWS_CANIF_00075]。

控制器事件强制设置通道模式。CAN_CS_SLEEP 导致 CANIF_OFFLINE [SWS_CANIF_00865]。CAN_CS_STOPPED 和 BusOff 导致 CANIF_TX_OFFLINE [SWS_CANIF_00866]。

pdumodi cluster_offline OFFLINE (Oberzustand) start off CANIF_OFFLINE kein Senden, kein Empfang start->off CanIf_Init() txoff CANIF_TX_OFFLINE 仅接收 off->txoff CAN_CS_STOPPED / BusOff on CANIF_ONLINE 发送与接收 off->on CanIf_SetPduMode(CANIF_ONLINE) txoff->off CAN_CS_SLEEP txoff->on CanIf_SetPduMode(CANIF_ONLINE) txact CANIF_TX_OFFLINE_ACTIVE 接收,发送立即确认 txact->off CAN_CS_SLEEP txact->txoff CAN_CS_STOPPED / BusOff txact->on CanIf_SetPduMode(CANIF_ONLINE) on->off CanIf_SetPduMode(CANIF_OFFLINE) 或 CAN_CS_SLEEP on->txoff CanIf_SetPduMode(CANIF_TX_OFFLINE) 或 CAN_CS_STOPPED / BusOff on->txact CanIf_SetPduMode(CANIF_TX_OFFLINE_ACTIVE) hinweis 仅当控制器处于 CAN_CS_STARTED 时 才接受 CanIf_SetPduMode(); 图中显示了部分转换

状态图:四种 PDU 通道模式,包含通过 CanIf_SetPduMode() 和通过控制器事件发生的转换。三种受限模式如规范中那样组合成一个复合状态。来源:[SWS_CANIF_00864]、[SWS_CANIF_00865]、[SWS_CANIF_00866]、[SWS_CANIF_00874]、SWS CanIf 图 7.8 第61页

发送路径:CanIf_Transmit、缓冲和 Trigger Transmit

CanIf_Transmit() [SWS_CANIF_00005] 确定 HTH 并调用 Can_Write()。传入的 swPduHandle 稍后在 CanIf_TxConfirmation() 中返回 [SWS_CANIF_00318]。在此之前,CanIf 设置 CanId 的两个最高有效位 [SWS_CANIF_00243]。如果 Can_Write() 返回 E_OK,该结果也适用于该发送请求 [SWS_CANIF_00162]。

仅在满足以下条件时才接受请求:

更新的文档出处还额外提及 CanXL_Write() SWS CanIf 第87页。对于 R20-11,仅 Can_Write() 具有规范性。

txentscheidung start aufruf CanIf_Transmit(TxPduId, PduInfoPtr) start->aufruf init CanIf initialisiert? aufruf->init modus 控制器是否处于 CAN_CS_STARTED 且 发送路径处于 online / offline active? init->modus 是 nok1 E_NOT_OK init->nok1 不 active Kanal in CANIF_TX_OFFLINE_ACTIVE? modus->active 是 nok2 E_NOT_OK (若为 CANIF_OFFLINE 则额外报告 CANIF_E_STOPPED) modus->nok2 不 pn PnTxFilter 是否激活且非 CanIfTxPduPnFilterPdu? active->pn 不 bestaetigen <User_TxConfirmation> sofort, kein Can_Write() active->bestaetigen 是 laenge SduLength 是否大于 全局 PDU? pn->laenge 不 nok3 E_NOT_OK pn->nok3 是 trunc CanIfTxPduTruncation aktiviert? laenge->trunc 是 write Can_Write(Hth, PduInfo) laenge->write 不 kuerzen 将数据截断为 全局 PDU 的长度 trunc->kuerzen 是 nok4 CANIF_E_TXPDU_LENGTH_EXCEEDED, E_NOT_OK trunc->nok4 不 kuerzen->write rueck Can_Write() 的返回值? write->rueck puffer 缓冲是否激活且 缓冲区大小 > 0? rueck->puffer CAN_BUSY ok E_OK rueck->ok E_OK gleich 同一 L-PDU 是否 已被缓冲? puffer->gleich 是 nok5 E_NOT_OK (L-PDU verloren) puffer->nok5 不 frei freies Pufferelement? gleich->frei 不 ueberschreiben 覆盖已缓冲的实例 gleich->ueberschreiben 是 ablegen L-PDU in CanIfTxBuffer ablegen frei->ablegen 是 nok6 E_NOT_OK frei->nok6 不 ueberschreiben->ok ablegen->ok

活动图:CanIf_Transmit() 如何在拒绝、模拟确认、直接发送和缓冲之间做出决定。解释:检查顺序的选择是为了提高可读性。来源:[SWS_CANIF_00317]、[SWS_CANIF_00382]、[SWS_CANIF_00072]、[SWS_CANIF_00381]、[SWS_CANIF_00837]、SWS CanIf 图 7.5 第51页

如果 Can_Write() 报告 CAN_BUSY 且 CanIfPublicTxBuffering 处于激活状态 [SWS_CANIF_00063],CanIf 将尝试缓冲 L-PDU [SWS_CANIF_00381]。这以缓冲区大小大于零为前提 [SWS_CANIF_00835]。如果相同的 L-PDU 已存在于缓冲区中,它将被覆盖 [SWS_CANIF_00068]。如果缓冲区已满,新的 L-PDU 将被拒绝并返回 E_NOT_OK [SWS_CANIF_00837]。一个 L-PDU 始终仅存在于一个位置:硬件对象中或 CanIf 缓冲区中 SWS CanIf 第43页。

在 CanIf_TxConfirmation() [SWS_CANIF_00007] 时,CanIf 通过带有 E_OK 的 <User_TxConfirmation> 通知相应用户 [SWS_CANIF_00383]。在同一次调用中,它会检查已空闲 HTH 的缓冲区 [SWS_CANIF_00386]。它将等待中具有最高优先级的条目传递给 Can_Write() [SWS_CANIF_00668] [SWS_CANIF_00070]。在 E_OK 时,它会立即从缓冲区中移除该条目 [SWS_CANIF_00183]。更新的文档出处将该回调称为 LSduR_CanIfTxConfirmation() SWS CanIf 第157页。在 R20-11 中适用 <User_TxConfirmation>。

带缓冲的发送以及在确认时补发Obere Schicht (z. B. PduR)CanIfCanCanControllerUse Case: 硬件繁忙时的发送请求CanIf_Transmit(TxPduId, PduInfoPtr)Can_Write(Hth, PduInfo)CAN_BUSYL-PDU in CanIfTxBuffer ablegenE_OKUse Case: 早期请求的确认Transmit-InterruptCanIf_TxConfirmation(CanTxPduId)检查已释放 HTH 的缓冲区alt缓冲区已填入针对条目的 Can_Write()调用 Can_Write()L-PDU in Hardware schreibenE_OK立即从缓冲区移除条目Puffer leerkein weiterer Can_Write()-Aufruf<User_TxConfirmation>(TxPduId, E_OK)

时序图:当硬件忙时,L-PDU 将被缓冲。早期请求的确认随后触发从缓冲区补发。来源:[SWS_CANIF_00381]、[SWS_CANIF_00386]、[SWS_CANIF_00668]、[SWS_CANIF_00183]、SWS CanIf 第138页、SWS CanIf 第143页

在 Triggered Transmission 中,用户不传递数据,而是传递一个 NULL-SduDataPtr [SWS_CANIF_00882]。若硬件空闲,驱动通过 CanIf_TriggerTransmit() 获取数据 [SWS_CANIF_00883]。CanIf 将该调用转发给 <User_TriggerTransmit> 并返回其结果 [SWS_CANIF_00885]。若硬件忙,CanIf 仅缓冲 Transmit Request [SWS_CANIF_00881]。动态 L-PDU 的 CanId 可通过 CanIf_SetDynamicTxId() 更改 [SWS_CANIF_00189]。或者,它来自 MetaData [SWS_CANIF_00855] SWS CanIf 第34页。

Trigger TransmitObere SchichtCanIfCanCanControllerCanIf_Transmit(TxPduId, PduInfoPtr)SduDataPtr = NULL,仅 SduLengthCan_Write(Hth, PduInfo)altHardwareobjekt freiCanIf_TriggerTransmit(TxPduId, PduInfoPtr)<User_TriggerTransmit>(TxPduId, PduInfoPtr)Daten in bereitgestelltenPuffer kopierenE_OKE_OK(透传返回值)L-PDU in Hardware kopierenE_OKE_OKHardwareobjekt belegtCAN_BUSY仅将发送请求在CanIfTxBuffer 中缓冲(若可能)

时序图:在 Trigger Transmit 中,仅当硬件对象空闲时,驱动才向用户获取数据。来源:[SWS_CANIF_00882]、[SWS_CANIF_00885]、[SWS_CANIF_00881]、SWS CanIf 图 9.6 第137页

接收路径:过滤、检查长度、转发

接收后,驱动使用 Mailbox 和数据调用 CanIf_RxIndication() [SWS_CANIF_00006]。处理分为三个阶段:

rx start aufruf CanIf_RxIndication(Mailbox, PduInfoPtr) start->aufruf init CanIf initialisiert? aufruf->init keine 不进行 Rx 处理 init->keine 不 filterkonf Software-Filter konfiguriert (BasicCAN-HRH)? init->filterkonf 是 filter Software-Filter: CanId akzeptiert? filterkonf->filter 是 dlckonf 长度检查是否激活? filterkonf->dlckonf 不 verworfen 结束且不进行指示 filter->verworfen 不 filter->dlckonf 是 dlc 长度 >= 配置的 长度? dlckonf->dlc 是 akzeptiert L-PDU akzeptiert dlckonf->akzeptiert 不 dlcfehler Det_ReportRuntimeError() CANIF_E_INVALID_DATA_LENGTH dlc->dlcfehler 不 dlc->akzeptiert 是 neben 根据配置: 填充接收缓冲区, 设置通知状态 akzeptiert->neben ziel Ziel-Nutzer konfiguriert? akzeptiert->ziel indikation <User_RxIndication>(RxPduId, PduInfoPtr) ziel->indikation 是 ende Ende ziel->ende 不 indikation->ende

活动图:软件过滤和长度检查决定是否指示接收到的 L-PDU。依赖于配置的附带影响以并行方式展示。来源:[SWS_CANIF_00421]、[SWS_CANIF_00389]、[SWS_CANIF_00168]、[SWS_CANIF_00199]、[SWS_CANIF_00392]、SWS CanIf 图 7.6 第51页

作为补充,CanIf 提供查询服务。CanIf_ReadRxPduData() 从其专用的接收缓冲区读取数据 [SWS_CANIF_00194] [SWS_CANIF_00198],但不适用于范围接收 [SWS_CANIF_00329]。CanIf_ReadTxNotifStatus() 和 CanIf_ReadRxNotifStatus() 在读取时重置状态 [SWS_CANIF_00393] [SWS_CANIF_00394]。这种“读并消耗”(read-and-consume)确保自上次调用以来至少发生了一次事件 SWS CanIf 第55页。CanIf_GetTxConfirmationState() 汇总整个控制器的确认 [SWS_CANIF_00734]。

收发器、唤醒和局部网络(Partial Networking)

CanIf 将收发器服务直接转发给 CanTrcv 驱动。CanIf_SetTrcvMode() 调用 CanTrcv_SetOpMode() [SWS_CANIF_00358],CanIf_GetTrcvMode() 调用 CanTrcv_GetOpMode() [SWS_CANIF_00363]。收发器的模式切换由 CanIf 转发给 CanSm [SWS_CANIF_00712]。

对于唤醒,CanIf_CheckWakeup() 向控制器和收发器查询唤醒源 [SWS_CANIF_00395] SWS CanIf 第56页。为了进行验证,CanIf 保存已启动控制器的首次有效接收 [SWS_CANIF_00286]。然后 CanIf_CheckValidation() 通过 <User_ValidateWakeupEvent> 报告该接收 [SWS_CANIF_00179]。

如果激活了局部网络,PnTxFilter 会在每个控制器的通道模式之上覆盖一个附加层 [SWS_CANIF_00747]。它在 CAN_CS_SLEEP 时被激活 [SWS_CANIF_00749],并在收到第一次确认或指示时再次被停用 [SWS_CANIF_00751] [SWS_CANIF_00896] SWS CanIf 第70页。

发生错误时的行为

BusOff:驱动使用 CanIf_ControllerBusOff() 报告该错误 [SWS_CANIF_00218]。CanIf 随后将通道设置为 CANIF_TX_OFFLINE [SWS_CANIF_00866],并将 BusOff 报告给 CanSm [SWS_CANIF_00724] SWS CanIf 图 9.11 第147页。CanSm 通过 CanIf_SetControllerMode() 控制恢复过程 SWS CanIf 第160页。

BusOff 报告与恢复CanSm (<User_ControllerBusOff>)CanIfCanCanControllerBusOff-Erkennung控制器(如需要)设置为 STOPPEDCanIf_ControllerBusOff(ControllerId)通道设为 CANIF_TX_OFFLINE,Sendepuffer leeren在安全事件报告时:CANIF_SEV_ERRORSTATE_BUSOFF<User_ControllerBusOff>(ControllerId)= CanSM_ControllerBusOff()Use Case: WiederherstellungCanIf_SetControllerMode(ControllerId,CAN_CS_STARTED)Can_SetControllerMode(Controller, Transition)E_OKE_OKCanIf_ControllerModeIndication(ControllerId,CAN_CS_STARTED)<User_ControllerModeIndication>

时序图:从 BusOff 检测、向 CanSm 报告直到重新启动控制器的流程。来源:[SWS_CANIF_00218]、[SWS_CANIF_00866]、[SWS_CANIF_00724]、[SWS_CANIF_00918]、SWS CanIf 第154页、SWS CanIf 第160页

控制器已停止:在进入 CAN_CS_STOPPED 时,CanIf 清空发送缓冲区 [SWS_CANIF_00485]。它以 E_NOT_OK 确认所有未完成的发送请求 [SWS_CANIF_00739]。这样每个被接受的 PDU 都会收到一次确认,无论是肯定的还是否定的 SWS CanIf 第54页。

错误消息:无效参数由 CanIf 作为开发错误报告,例如 CANIF_E_PARAM_CONTROLLERID [SWS_CANIF_00311] [SWS_CANIF_91006]。运行时错误包括 CANIF_E_INVALID_DATA_LENGTH [SWS_CANIF_00168] 和 CANIF_E_STOPPED [SWS_CANIF_00382] [SWS_CANIF_91007] 等。丢失的发送请求仅通过返回值或缺失的确认体现 Error Description 第22页。安全事件(如 CANIF_SEV_ERRORSTATE_PASSIVE)由 CanIf 报告给 IdsM [SWS_CANIF_00913] [SWS_CANIF_00917]。

进一步详细证据

基于规范摘录的 AI 生成指南。对于 R20-11,链接的需求具有规范性;来自更新版本的文档出处已标明。

CAN Interface (CanIf)

The CanIf abstracts CAN hardware details and provides uniform access to multiple CAN controllers and transceivers for higher-layer modules (PduR, CanTp, CanNm, CanSM).

Funktionen — Übersicht

Typen — Übersicht

Funktionen & Typen — Detailansicht

函数 CanIf_Init [SWS_CANIF_00001] 📄 PDF

void CanIf_Init (const CanIf_ConfigType* ConfigPtr);

This service Initializes internal and external interfaces of the CAN Interface for the further processing.

实现者指南即将推出(复杂度 I3)

函数 CanIf_DeInit [SWS_CANIF_91002] 📄 PDF

void CanIf_DeInit (void);

De-initializes the CanIf module.

实现者指南即将推出(复杂度 I1)

函数 CanIf_ReadRxPduData [SWS_CANIF_00194] 📄 PDF

Std_ReturnType CanIf_ReadRxPduData (PduIdType CanIfRxSduId, PduInfoType* CanIfRxInfoPtr);

This service provides the Data Length and the received data of the requested CanIfRxSduId to the calling upper layer.

实现者指南即将推出(复杂度 I2)

函数 CanIf_ReadTxNotifStatus [SWS_CANIF_00202] 📄 PDF

CanIf_NotifStatusType CanIf_ReadTxNotifStatus (PduIdType CanIfTxSduId);

This service returns the confirmation status (confirmation occurred or not) of a specific static or dynamic CAN Tx L-PDU, requested by the CanIfTxSduId.

实现者指南即将推出(复杂度 I2)

函数 CanIf_ReadRxNotifStatus [SWS_CANIF_00230] 📄 PDF

CanIf_NotifStatusType CanIf_ReadRxNotifStatus (PduIdType CanIfRxSduId);

This service returns the indication status (indication occurred or not) of a specific CAN Rx L-PDU, requested by the CanIfRxSduId.

实现者指南即将推出(复杂度 I2)

函数 CanIf_SetTrcvMode [SWS_CANIF_00287] 📄 PDF

Std_ReturnType CanIf_SetTrcvMode (uint8 TransceiverId, CanTrcv_TrcvModeType TransceiverMode);

This service changes the operation mode of the tansceiver TransceiverId, via calling the corresponding CAN Transceiver Driver service.

实现者指南即将推出(复杂度 I3)

函数 CanIf_GetTxConfirmationState [SWS_CANIF_00734] 📄 PDF

CanIf_NotifStatusType CanIf_GetTxConfirmationState (uint8 ControllerId);

This service reports, if any TX confirmation has been done for the whole CAN controller since the last CAN controller start.

函数 CanIf_ClearTrcvWufFlag [SWS_CANIF_00760] 📄 PDF

Std_ReturnType CanIf_ClearTrcvWufFlag (uint8 TransceiverId);

Requests the CanIf module to clear the WUF flag of the designated CAN transceiver.

实现者指南即将推出(复杂度 I2)

函数 CanIf_CheckTrcvWakeFlag [SWS_CANIF_00761] 📄 PDF

Std_ReturnType CanIf_CheckTrcvWakeFlag (uint8 TransceiverId);

Requests the CanIf module to check the Wake flag of the designated CAN transceiver.

实现者指南即将推出(复杂度 I2)

函数 CanIf_SetBaudrate [SWS_CANIF_00867] 📄 PDF

Std_ReturnType CanIf_SetBaudrate (uint8 ControllerId, uint16 BaudRateConfigID);

This service shall set the baud rate configuration of the CAN controller. Depending on necessary baud rate modifications the controller might have to reset.

函数 CanIf_GetControllerRxErrorCounter [SWS_CANIF_91003] 📄 PDF

Std_ReturnType CanIf_GetControllerRxErrorCounter (uint8 ControllerId, uint8* RxErrorCounterPtr);

This service calls the corresponding CAN Driver service for obtaining the Rx error counter of the CAN controller.

函数 CanIf_GetControllerTxErrorCounter [SWS_CANIF_91004] 📄 PDF

Std_ReturnType CanIf_GetControllerTxErrorCounter (uint8 ControllerId, uint8* TxErrorCounterPtr);

This service calls the corresponding CAN Driver service for obtaining the Tx error counter of the CAN controller.

函数 CanIf_TriggerTransmit [SWS_CANIF_00883] 📄 PDF

Std_ReturnType CanIf_TriggerTransmit (PduIdType TxPduId, PduInfoType* PduInfoPtr);

Within this API, the upper layer module (called module) shall check whether the available data fits into the buffer size reported by PduInfoPtr->SduLength. If it fits, it shall copy its data into the buffer provided by PduInfoPtr->SduDataPtr and update the length of the actual copied data in PduInfoPtr->SduLength. If not, it returns E_NOT_OK without changing PduInfoPtr.

实现者指南即将推出(复杂度 I2)

函数 CanIf_TxConfirmation [SWS_CANIF_00007] 📄 PDF

void CanIf_TxConfirmation (PduIdType CanTxPduId);

This service confirms a previously successfully processed transmission of a CAN TxPDU.

实现者指南即将推出(复杂度 I3)

函数 CanIf_RxIndication [SWS_CANIF_00006] 📄 PDF

void CanIf_RxIndication (const Can_HwType* Mailbox, const PduInfoType* PduInfoPtr);

This service indicates a successful reception of a received CAN Rx L-PDU to the CanIf after passing all filters and validation checks.

实现者指南即将推出(复杂度 I3)

函数 CanIf_ControllerBusOff [SWS_CANIF_00218] 📄 PDF

void CanIf_ControllerBusOff (uint8 ControllerId);

This service indicates a Controller BusOff event referring to the corresponding CAN Controller with the abstract CanIf ControllerId.

实现者指南即将推出(复杂度 I2)

函数 CanIf_ConfirmPnAvailability [SWS_CANIF_00815] 📄 PDF

void CanIf_ConfirmPnAvailability (uint8 TransceiverId);

This service indicates that the transceiver is running in PN communication mode referring to the corresponding CAN transceiver with the abstract CanIf TransceiverId.

实现者指南即将推出(复杂度 I2)

函数 CanIf_ClearTrcvWufFlagIndication [SWS_CANIF_00762] 📄 PDF

void CanIf_ClearTrcvWufFlagIndication (uint8 TransceiverId);

This service indicates that the transceiver has cleared the WufFlag referring to the corresponding CAN transceiver with the abstract CanIf TransceiverId.

实现者指南即将推出(复杂度 I2)

函数 CanIf_CheckTrcvWakeFlagIndication [SWS_CANIF_00763] 📄 PDF

void CanIf_CheckTrcvWakeFlagIndication (uint8 TransceiverId);

This service indicates that the check of the transceiver's wake-up flag has been finished by the corresponding CAN transceiver with the abstract CanIf TransceiverId. This indication is used to cope with the asynchronous transceiver communication.

实现者指南即将推出(复杂度 I2)

函数 CanIf_ControllerModeIndication [SWS_CANIF_00699] 📄 PDF

void CanIf_ControllerModeIndication (uint8 ControllerId, Can_ControllerStateType ControllerMode);

This service indicates a controller state transition referring to the corresponding CAN controller with the abstract CanIf ControllerId.

实现者指南即将推出(复杂度 I2)

函数 CanIf_TrcvModeIndication [SWS_CANIF_00764] 📄 PDF

void CanIf_TrcvModeIndication (uint8 TransceiverId, CanTrcv_TrcvModeType TransceiverMode);

This service indicates a transceiver state transition referring to the corresponding CAN transceiver with the abstract CanIf TransceiverId.

实现者指南即将推出(复杂度 I2)

函数 CanIf_ControllerErrorStatePassive [SWS_CANIF_91008] 📄 PDF

void CanIf_ControllerErrorStatePassive (uint8 ControllerId, uint16 RxErrorCounter, uint16 TxErrorCounter);

The function derives the ErrorCounterTreshold from RxErrorCounter/ TxErrorCounter values and reports it to the IdsM as security event CANIF_SEV_ERRORSTATE_PASSIVE to the IdsM. It also prepares the context data for the respective security event.

实现者指南即将推出(复杂度 I2)

函数 CanIf_ErrorNotification [SWS_CANIF_91009] 📄 PDF

void CanIf_ErrorNotification (uint8 ControllerId, Can_ErrorType Can_ErrorType);

The function shall derive the bus error source rx or tx from the parameter CanError and report the bus error as security event CANIF_SEV_TX_ERROR_DETECTED or CANIF_SEV_RX_ ERROR_DETECTED. It also prepares the context data for the respective security event.

实现者指南即将推出(复杂度 I2)

函数 <User_TriggerTransmit> [SWS_CANIF_00886] 📄 PDF

Std_ReturnType <User_TriggerTransmit> (PduIdType TxPduId, PduInfoType* PduInfoPtr);

Within this API, the upper layer module (called module) shall check whether the available data fits into the buffer size reported by PduInfoPtr->SduLength. If it fits, it shall copy its data into the buffer provided by PduInfoPtr->SduDataPtr and update the length of the actual copied data in PduInfoPtr->SduLength. If not, it returns E_NOT_OK without changing PduInfoPtr.

实现者指南即将推出(复杂度 I1)

函数 <User_TxConfirmation> [SWS_CANIF_00011] 📄 PDF

void <User_TxConfirmation> (PduIdType TxPduId, Std_ReturnType result);

The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.

实现者指南即将推出(复杂度 I1)

函数 <User_RxIndication> [SWS_CANIF_00012] 📄 PDF

void <User_RxIndication> (PduIdType RxPduId, const PduInfoType* PduInfoPtr);

Indication of a received PDU from a lower layer communication interface module.

实现者指南即将推出(复杂度 I2)

函数 <User_ValidateWakeupEvent> [SWS_CANIF_00532] 📄 PDF

void <User_ValidateWakeupEvent> (EcuM_WakeupSourceType sources);

This service indicates if a wake up event initiated from the wake up source (CAN controller or transceiver) after a former request to the CAN Driver or CAN Transceiver Driver module is valid.

实现者指南即将推出(复杂度 I1)

函数 <User_ControllerBusOff> [SWS_CANIF_00014] 📄 PDF

void <User_ControllerBusOff> (uint8 ControllerId);

This service indicates a bus-off event to the corresponding upper layer module (mainly the CAN State Manager module).

实现者指南即将推出(复杂度 I1)

函数 <User_ConfirmPnAvailability> [SWS_CANIF_00821] 📄 PDF

void <User_ConfirmPnAvailability> (uint8 TransceiverId);

This service indicates that the CAN transceiver is running in PN communication mode.

实现者指南即将推出(复杂度 I1)

函数 <User_ClearTrcvWufFlagIndication> [SWS_CANIF_00788] 📄 PDF

void <User_ClearTrcvWufFlagIndication> (uint8 TransceiverId);

This service indicates that the CAN transceiver has cleared the WufFlag. This function is called in CanIf_ClearTrcvWufFlagIndication.

实现者指南即将推出(复杂度 I1)

函数 <User_CheckTrcvWakeFlagIndication> [SWS_CANIF_00814] 📄 PDF

void <User_CheckTrcvWakeFlagIndication> (uint8 TransceiverId);

This service indicates that the wake up flag in the CAN transceiver is set. This function is called in CanIf_CheckTrcvWakeFlagIndication.

实现者指南即将推出(复杂度 I1)

函数 <User_ControllerModeIndication> [SWS_CANIF_00687] 📄 PDF

void <User_ControllerModeIndication> (uint8 ControllerId, Can_ControllerStateType ControllerMode);

This service indicates a CAN controller state transition to the corresponding upper layer module (mainly the CAN State Manager module).

实现者指南即将推出(复杂度 I1)

函数 <User_TrcvModeIndication> [SWS_CANIF_00693] 📄 PDF

void <User_TrcvModeIndication> (uint8 TransceiverId, CanTrcv_TrcvModeType TransceiverMode);

This service indicates a CAN transceiver state transition to the corresponding upper layer module (mainly the CAN State Manager module).

实现者指南即将推出(复杂度 I1)

类型 CanIf_ConfigType [SWS_CANIF_00144] 📄 PDF

This type defines a data structure for the post build parameters of the CAN interface for all underlying CAN drivers. At initialization the CanIf gets a pointer to a structure of this type to get access to its configuration data, which is necessary for initialization.

类型 CanIf_PduModeType [SWS_CANIF_00137] 📄 PDF

The PduMode of a channel defines its transmit or receive activity. Communication direction (transmission and/or reception) of the channel can be controlled separately or together by upper layers.

实现者指南即将推出(复杂度 I2)

类型 CanIf_NotifStatusType [SWS_CANIF_00201] 📄 PDF

Type CanIf_NotifStatusType.

实现者指南即将推出(复杂度 I2)

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/CP_MOD_CanIf
Status
unspecified
Version
AUTOSAR/AP/record/CP_MOD_CanIf@rel:R20-11#2969cd21
Content hash
2969cd21
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_CANInterface.pdf#nameddest=SWS_CANIF_00001

初始化与状态

De-initializes the CanIf module.

void CanIf_DeInit (void);

This service returns the version information of the called CAN Interface module.

void CanIf_GetVersionInfo (Std_VersionInfoType* VersionInfo);
CanIf_Init 函数

This service Initializes internal and external interfaces of the CAN Interface for the further processing.

void CanIf_Init (const CanIf_ConfigType* ConfigPtr);

服务 · Get…

This service calls the corresponding CAN Driver service for obtaining the error state of the CAN controller.

Std_ReturnType CanIf_GetControllerErrorState (uint8 ControllerId, Can_ErrorStateType* ErrorStatePtr);

This service calls the corresponding CAN Driver service for obtaining the current status of the CAN controller.

Std_ReturnType CanIf_GetControllerMode (uint8 ControllerId, Can_ControllerStateType* ControllerModePtr);

This service calls the corresponding CAN Driver service for obtaining the Rx error counter of the CAN controller.

Std_ReturnType CanIf_GetControllerRxErrorCounter (uint8 ControllerId, uint8* RxErrorCounterPtr);

This service calls the corresponding CAN Driver service for obtaining the Tx error counter of the CAN controller.

Std_ReturnType CanIf_GetControllerTxErrorCounter (uint8 ControllerId, uint8* TxErrorCounterPtr);

This service reports the current mode of a requested PDU channel.

Std_ReturnType CanIf_GetPduMode (uint8 ControllerId, CanIf_PduModeType* PduModePtr);

This function invokes CanTrcv_GetOpMode and updates the parameter TransceiverModePtr with the value OpMode provided by CanTrcv.

Std_ReturnType CanIf_GetTrcvMode (uint8 TransceiverId, CanTrcv_TrcvModeType* TransceiverModePtr);

This service returns the reason for the wake up of the transceiver TransceiverId, via calling the corresponding CAN Transceiver Driver service.

Std_ReturnType CanIf_GetTrcvWakeupReason (uint8 TransceiverId, CanTrcv_TrcvWakeupReasonType* TrcvWuReasonPtr);

This service reports, if any TX confirmation has been done for the whole CAN controller since the last CAN controller start.

CanIf_NotifStatusType CanIf_GetTxConfirmationState (uint8 ControllerId);

服务 · Set…

This service shall set the baud rate configuration of the CAN controller. Depending on necessary baud rate modifications the controller might have to reset.

Std_ReturnType CanIf_SetBaudrate (uint8 ControllerId, uint16 BaudRateConfigID);

This service calls the corresponding CAN Driver service for changing of the CAN controller mode.

Std_ReturnType CanIf_SetControllerMode (uint8 ControllerId, Can_ControllerStateType ControllerMode);

This service reconfigures the corresponding CAN identifier of the requested CAN L-PDU.

void CanIf_SetDynamicTxId (PduIdType CanIfTxSduId, Can_IdType CanId);

This service sets the requested mode at the L-PDUs of a predefined logical PDU channel.

Std_ReturnType CanIf_SetPduMode (uint8 ControllerId, CanIf_PduModeType PduModeRequest);

This service changes the operation mode of the tansceiver TransceiverId, via calling the corresponding CAN Transceiver Driver service.

Std_ReturnType CanIf_SetTrcvMode (uint8 TransceiverId, CanTrcv_TrcvModeType TransceiverMode);

This function shall call CanTrcv_SetTrcvWakeupMode.

Std_ReturnType CanIf_SetTrcvWakeupMode (uint8 TransceiverId, CanTrcv_TrcvWakeupModeType TrcvWakeupMode);

服务 · Check…

Requests the CanIf module to check the Wake flag of the designated CAN transceiver.

Std_ReturnType CanIf_CheckTrcvWakeFlag (uint8 TransceiverId);

This service indicates that the check of the transceiver's wake-up flag has been finished by the corresponding CAN transceiver with the abstract CanIf TransceiverId. This indication is used to cope with the asynchronous transceiver communication.

void CanIf_CheckTrcvWakeFlagIndication (uint8 TransceiverId);

This service is performed to validate a previous wakeup event.

Std_ReturnType CanIf_CheckValidation (EcuM_WakeupSourceType WakeupSource);

This service checks, whether an underlying CAN driver or a CAN transceiver driver already signals a wakeup event.

Std_ReturnType CanIf_CheckWakeup (EcuM_WakeupSourceType WakeupSource);

服务 · Controller…

This service indicates a Controller BusOff event referring to the corresponding CAN Controller with the abstract CanIf ControllerId.

void CanIf_ControllerBusOff (uint8 ControllerId);

The function derives the ErrorCounterTreshold from RxErrorCounter/ TxErrorCounter values and reports it to the IdsM as security event CANIF_SEV_ERRORSTATE_PASSIVE to the IdsM. It also prepares the context data for the respective security event.

void CanIf_ControllerErrorStatePassive (uint8 ControllerId, uint16 RxErrorCounter, uint16 TxErrorCounter);

This service indicates a controller state transition referring to the corresponding CAN controller with the abstract CanIf ControllerId.

void CanIf_ControllerModeIndication (uint8 ControllerId, Can_ControllerStateType ControllerMode);

服务 · Read…

This service returns the indication status (indication occurred or not) of a specific CAN Rx L-PDU, requested by the CanIfRxSduId.

CanIf_NotifStatusType CanIf_ReadRxNotifStatus (PduIdType CanIfRxSduId);

This service provides the Data Length and the received data of the requested CanIfRxSduId to the calling upper layer.

Std_ReturnType CanIf_ReadRxPduData (PduIdType CanIfRxSduId, PduInfoType* CanIfRxInfoPtr);

This service returns the confirmation status (confirmation occurred or not) of a specific static or dynamic CAN Tx L-PDU, requested by the CanIfTxSduId.

CanIf_NotifStatusType CanIf_ReadTxNotifStatus (PduIdType CanIfTxSduId);

服务 · 其他

Requests the CanIf module to clear the WUF flag of the designated CAN transceiver.

Std_ReturnType CanIf_ClearTrcvWufFlag (uint8 TransceiverId);

This service indicates that the transceiver has cleared the WufFlag referring to the corresponding CAN transceiver with the abstract CanIf TransceiverId.

void CanIf_ClearTrcvWufFlagIndication (uint8 TransceiverId);

This service indicates that the transceiver is running in PN communication mode referring to the corresponding CAN transceiver with the abstract CanIf TransceiverId.

void CanIf_ConfirmPnAvailability (uint8 TransceiverId);

Enables or disables mirroring for a CAN controller.

Std_ReturnType CanIf_EnableBusMirroring (uint8 ControllerId, boolean MirroringActive);

The function shall derive the bus error source rx or tx from the parameter CanError and report the bus error as security event CANIF_SEV_TX_ERROR_DETECTED or CANIF_SEV_RX_ ERROR_DETECTED. It also prepares the context data for the respective security event.

void CanIf_ErrorNotification (uint8 ControllerId, Can_ErrorType Can_ErrorType);

Requests transmission of a PDU.

Std_ReturnType CanIf_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);

This service indicates a transceiver state transition referring to the corresponding CAN transceiver with the abstract CanIf TransceiverId.

void CanIf_TrcvModeIndication (uint8 TransceiverId, CanTrcv_TrcvModeType TransceiverMode);

回调

This service indicates a successful reception of a received CAN Rx L-PDU to the CanIf after passing all filters and validation checks.

void CanIf_RxIndication (const Can_HwType* Mailbox, const PduInfoType* PduInfoPtr);

Within this API, the upper layer module (called module) shall check whether the available data fits into the buffer size reported by PduInfoPtr->SduLength. If it fits, it shall copy its data into the buffer provided by PduInfoPtr->SduDataPtr and update the length of the actual copied data in PduInfoPtr->SduLength. If not, it returns E_NOT_OK without changing PduInfoPtr.

Std_ReturnType CanIf_TriggerTransmit (PduIdType TxPduId, PduInfoType* PduInfoPtr);

This service confirms a previously successfully processed transmission of a CAN TxPDU.

void CanIf_TxConfirmation (PduIdType CanTxPduId);

Callout 与预期接口

This service indicates that the wake up flag in the CAN transceiver is set. This function is called in CanIf_CheckTrcvWakeFlagIndication.

void <User_CheckTrcvWakeFlagIndication> (uint8 TransceiverId);

This service indicates that the CAN transceiver has cleared the WufFlag. This function is called in CanIf_ClearTrcvWufFlagIndication.

void <User_ClearTrcvWufFlagIndication> (uint8 TransceiverId);

This service indicates that the CAN transceiver is running in PN communication mode.

void <User_ConfirmPnAvailability> (uint8 TransceiverId);

This service indicates a bus-off event to the corresponding upper layer module (mainly the CAN State Manager module).

void <User_ControllerBusOff> (uint8 ControllerId);

This service indicates a CAN controller state transition to the corresponding upper layer module (mainly the CAN State Manager module).

void <User_ControllerModeIndication> (uint8 ControllerId, Can_ControllerStateType ControllerMode);

Indication of a received PDU from a lower layer communication interface module.

void <User_RxIndication> (PduIdType RxPduId, const PduInfoType* PduInfoPtr);

This service indicates a CAN transceiver state transition to the corresponding upper layer module (mainly the CAN State Manager module).

void <User_TrcvModeIndication> (uint8 TransceiverId, CanTrcv_TrcvModeType TransceiverMode);

Within this API, the upper layer module (called module) shall check whether the available data fits into the buffer size reported by PduInfoPtr->SduLength. If it fits, it shall copy its data into the buffer provided by PduInfoPtr->SduDataPtr and update the length of the actual copied data in PduInfoPtr->SduLength. If not, it returns E_NOT_OK without changing PduInfoPtr.

Std_ReturnType <User_TriggerTransmit> (PduIdType TxPduId, PduInfoType* PduInfoPtr);

The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.

void <User_TxConfirmation> (PduIdType TxPduId, Std_ReturnType result);

This service indicates if a wake up event initiated from the wake up source (CAN controller or transceiver) after a former request to the CAN Driver or CAN Transceiver Driver module is valid.

void <User_ValidateWakeupEvent> (EcuM_WakeupSourceType sources);

类型

This type defines a data structure for the post build parameters of the CAN interface for all underlying CAN drivers. At initialization the CanIf gets a pointer to a structure of this type to get access to its configuration data, which is necessary for initialization.

Type CanIf_NotifStatusType.

The PduMode of a channel defines its transmit or receive activity. Communication direction (transmission and/or reception) of the channel can be controlled separately or together by upper layers.