DEENESPTFRRUARHIKOZHNL

CAN Interface (CanIf)

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

Modul-GuideKI-GENERIERT

Vermittelt CAN-Nachrichten und Modussteuerung hardwareunabhängig zwischen CAN-Treibern und Kommunikationsstack.
KI-GENERIERT ungeprüft Modell: claude-opus-5-5 · Aufwand: high · Temperatur: nicht steuerbar · Prompt: a6221da93ef5 Herkunft Offene Fragen (1)
Kausaler Anker: R20-11 Gültig ab R20-11 Neu synthetisiert für diesen Spezifikationsstand.
KI-generiertclaude-opus-5-5 · 2026-10-13

Vermittelt CAN-Nachrichten und Modussteuerung hardwareunabhängig zwischen CAN-Treibern und Kommunikationsstack.

CanIf ist die hardwareunabhängige Schicht zwischen CAN-Treibern bzw. Transceivern und den oberen Kommunikationsmodulen. Es bildet Sendeaufträge auf Can_Write() ab, puffert bei belegter Hardware und leitet Bestätigungen sowie gefilterte Empfänge an konfigurierte Callbacks weiter [SWS_CANIF_00318]. Controller- und Transceivermodi steuert es im Auftrag von CanSm und meldet BusOff und Moduswechsel zurück. PDU-Kanalmodi schalten Sende- und Empfangspfad getrennt. Gesendet wird nur, wenn der Controller in CAN_CS_STARTED und der Sendepfad freigegeben ist [SWS_CANIF_00317].

Das CAN Interface (CanIf) übernimmt alle hardwareunabhängigen Aufgaben der CAN-Kommunikation. Dazu gehören Sendeaufträge, Bestätigungen, Empfangsindikationen, Fehlermeldungen sowie Start und Stopp von CAN-Controllern SWS CanIf S. 13. Auf Hardwarepuffer greift CanIf nur über CanDrv-Dienste zu [SWS_CANIF_00023]. Controller und Transceiver mehrerer Treiber spricht es über abstrakte IDs an [SWS_CANIF_00653]. Welche Callbacks in PduR, CanNm, CanTp, CanSm oder EcuM aufgerufen werden, legt die Konfiguration fest [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-Treiber (Can) eine oder mehrere Instanzen 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()

Kontextdiagramm: CanIf zwischen oberen Kommunikationsmodulen, Modusverwaltung und den Treibern für Controller und Transceiver. Quellen: [SWS_CANIF_00012], [SWS_CANIF_00358], SWS CanIf S. 21

EcuM initialisiert CanIf mit CanIf_Init(). Danach steht jeder Kanal auf CANIF_OFFLINE [SWS_CANIF_00864], und bis dahin lehnen die Dienste mit E_NOT_OK ab [SWS_CANIF_00661]. Der Controllerstart über CanIf_SetControllerMode() läuft asynchron. Den Abschluss meldet CanIf_ControllerModeIndication(), die CanIf an CanSm weitergibt [SWS_CANIF_00003] [SWS_CANIF_00711]. Erst danach nimmt CanIf_SetPduMode() Anforderungen an [SWS_CANIF_00874]. Die PDU-Kanalmodi schalten Sende- und Empfangspfad getrennt. Controllerereignisse wie SLEEP, STOPPED oder BusOff setzen sie zwangsweise [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 nur Empfang off->txoff CAN_CS_STOPPED / BusOff on CANIF_ONLINE Senden und Empfang off->on CanIf_SetPduMode(CANIF_ONLINE) txoff->off CAN_CS_SLEEP txoff->on CanIf_SetPduMode(CANIF_ONLINE) txact CANIF_TX_OFFLINE_ACTIVE Empfang, Senden wird sofort bestätigt txact->off CAN_CS_SLEEP txact->txoff CAN_CS_STOPPED / BusOff txact->on CanIf_SetPduMode(CANIF_ONLINE) on->off CanIf_SetPduMode(CANIF_OFFLINE) oder CAN_CS_SLEEP on->txoff CanIf_SetPduMode(CANIF_TX_OFFLINE) oder CAN_CS_STOPPED / BusOff on->txact CanIf_SetPduMode(CANIF_TX_OFFLINE_ACTIVE) hinweis CanIf_SetPduMode() wird nur bei Controller in CAN_CS_STARTED angenommen; gezeigt ist eine Auswahl der Übergänge

Zustandsdiagramm: Die vier PDU-Kanalmodi und ihre Übergänge durch CanIf_SetPduMode() und Controllerereignisse. Quellen: [SWS_CANIF_00137], [SWS_CANIF_00866], SWS CanIf Abb. 7.8 S. 61

Beim Senden ruft CanIf_Transmit() Can_Write() auf [SWS_CANIF_00318]. Ist die Hardware belegt, puffert CanIf die L-PDU, sofern ein Puffer konfiguriert ist [SWS_CANIF_00381]. Bei der nächsten Bestätigung sendet es den Eintrag mit der höchsten Priorität nach [SWS_CANIF_00668]. Empfangene L-PDUs durchlaufen Software-Filter und Längenprüfung, bevor CanIf sie an <User_RxIndication> weiterleitet [SWS_CANIF_00389] [SWS_CANIF_00056].

Im Fehlerfall setzt ein BusOff den Kanal auf CANIF_TX_OFFLINE und wird an CanSm gemeldet [SWS_CANIF_00724]. Beim Stopp eines Controllers bestätigt CanIf alle ausstehenden Sendeaufträge mit E_NOT_OK [SWS_CANIF_00739]. Parameter- und Laufzeitfehler gehen an den DET [SWS_CANIF_91006] [SWS_CANIF_91007].

Rolle: hardwareunabhängige Drehscheibe zwischen CAN-Treibern und Kommunikationsstack

Das CAN Interface (CanIf) übernimmt alle hardwareunabhängigen Aufgaben der CAN-Kommunikation einer ECU. Die darunterliegenden CAN-Treiber kümmern sich nur noch um ihre konkrete Hardware. CanIf bearbeitet Sendeaufträge, Sendebestätigungen, Empfangsindikationen und Fehlermeldungen und startet bzw. stoppt CAN-Controller SWS CanIf S. 13. Auf Hardwarepuffer greift es ausschließlich über Dienste des CanDrv zu [SWS_CANIF_00023]. Steuerdienste arbeiten mit einer abstrakten ControllerId, die die Controller aller CanDrv-Instanzen ab 0 durchnummeriert [SWS_CANIF_00653]. Für Transceiver gilt dasselbe mit der TransceiverId [SWS_CANIF_00655].

Nach unten fasst CanIf die APIs mehrerer CanTrcv-Treiber zu einer einheitlichen Schnittstelle zusammen, enthält aber selbst keine Transceiverlogik SWS CanIf S. 21. Auch bei mehreren CanDrvs gibt es jeden Callback nur einmal. CanIf erkennt den aufrufenden Treiber an der ControllerId in Can_HwType SWS CanIf S. 68.

Nach oben ruft CanIf konfigurierbare Callbacks wie <User_TxConfirmation> und <User_RxIndication> auf [SWS_CANIF_00011] [SWS_CANIF_00012]. Die Konfiguration legt den konkreten Empfänger fest, etwa PduR_CanIfRxIndication [SWS_CANIF_00442] oder CanTp_TxConfirmation [SWS_CANIF_00550]. BusOff und Moduswechsel meldet CanIf an CanSm oder ein CDD [SWS_CANIF_00724] [SWS_CANIF_00711]. Wake-up-Validierungen gehen an 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-Treiber (Can) eine oder mehrere Instanzen 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()

Kontextdiagramm: CanIf vermittelt zwischen den oberen Kommunikationsmodulen, der Modusverwaltung (CanSm, EcuM) und den Treibern für CAN-Controller und Transceiver. Fehler-, Sicherheits- und Mirroring-Meldungen gehen an DET, IdsM und Mirror. Quellen: [SWS_CANIF_00011], [SWS_CANIF_00724], [SWS_CANIF_00358], [SWS_CANIF_00905], [SWS_CANIF_00913], SWS CanIf S. 13

Der Funktionsumfang hängt stark von der Konfiguration ab. CanIf_Init() liest aus den Konfigurationscontainern unter anderem die Zahl der Controller und die Zuordnung der HTHs/HRHs SWS CanIf S. 22. HTH und HRH sind Handles auf logische Sende- bzw. Empfangsobjekte [SWS_CANIF_00291] [SWS_CANIF_00292]. Viele Dienste lassen sich per Pre-Compile-Schalter abwählen, z. B. CanIf_ReadRxPduData() [SWS_CANIF_00330] oder CanIf_SetBaudrate() [SWS_CANIF_00871]. Ist für einen nicht verpflichtenden Callback kein Name konfiguriert, entfällt der Aufruf SWS CanIf S. 133. <User_ControllerBusOff> muss dagegen immer konfiguriert sein [SWS_CANIF_00524].

Von der Initialisierung zum gestarteten Controller

EcuM ruft CanIf_Init() auf [SWS_CANIF_00001]. Dabei initialisiert CanIf Variablen, Flags und Puffer [SWS_CANIF_00085] sowie alle Sende-L-PDU-Puffer [SWS_CANIF_00387]. Jeder Kanal startet in CANIF_OFFLINE [SWS_CANIF_00864]. Die Controller bleiben danach im Modus STOPPED, in dem weder gesendet noch empfangen wird. CanDrv und CanTrcv initialisiert EcuM separat SWS CanIf S. 40. Vor der Initialisierung liefern alle Dienste außer CanIf_Init() und CanIf_GetVersionInfo() E_NOT_OK [SWS_CANIF_00661]. Wer CanIf_DeInit() [SWS_CANIF_91002] aufruft, muss sicherstellen, dass keine Übertragungen mehr laufen SWS CanIf S. 81.

Der Controllerstart läuft asynchron. CanIf_SetControllerMode() [SWS_CANIF_00003] ruft Can_SetControllerMode() auf [SWS_CANIF_00308]. Den vollzogenen Wechsel meldet der Treiber später mit CanIf_ControllerModeIndication() [SWS_CANIF_00699], und CanIf reicht die Meldung an CanSm weiter [SWS_CANIF_00711]. Im Polling-Betrieb erkennt Can_MainFunction_Mode() den Wechsel SWS CanIf S. 152. Erst in CAN_CS_STARTED nimmt CanIf_SetPduMode() Anforderungen an [SWS_CANIF_00874].

Controller starten und PDU-Kanal freischaltenCanSm / obere SchichtCanIfCanCanControllerCanIf_SetControllerMode(ControllerId,CAN_CS_STARTED)Can_SetControllerMode(Controller, Transition)Übergang nach START anfordernE_OKE_OK (Anforderung angenommen)Asynchron: Der Wechsel istnoch nicht vollzogenloopCan_MainFunction_Mode() bis Moduswechsel erkanntHardwarezustand prüfenCanIf_ControllerModeIndication(ControllerId,CAN_CS_STARTED)<User_ControllerModeIndication>(CanSM_ControllerModeIndication)Use Case: PDU-Pfade freischaltenCanIf_SetPduMode(ControllerId, CANIF_ONLINE)nur in CAN_CS_STARTED zulässigE_OK

Sequenzdiagramm: Die Startanforderung wird sofort quittiert, der Moduswechsel aber erst später indiziert. Danach können die PDU-Pfade freigeschaltet werden. Quellen: [SWS_CANIF_00308], [SWS_CANIF_00711], [SWS_CANIF_00874], SWS CanIf S. 156

PDU-Kanalmodi: Sende- und Empfangspfad getrennt schalten

Jeder Kanal eines Controllers hat einen Modus vom Typ CanIf_PduModeType [SWS_CANIF_00137]. Obere Schichten setzen ihn mit CanIf_SetPduMode() und lesen ihn mit CanIf_GetPduMode() [SWS_CANIF_00008] [SWS_CANIF_00009]. Die Modi im Einzelnen SWS CanIf S. 58:

  • CANIF_OFFLINE: Sendeaufträge werden mit E_NOT_OK abgewiesen und die Puffer geleert. Indikationen und Bestätigungen werden unterdrückt [SWS_CANIF_00073].
  • CANIF_TX_OFFLINE: Nur der Sendepfad ist gesperrt, der Empfang bleibt aktiv [SWS_CANIF_00489].
  • CANIF_TX_OFFLINE_ACTIVE: Sendeaufträge werden sofort bestätigt, ohne an CanDrv weitergegeben zu werden [SWS_CANIF_00072].
  • CANIF_ONLINE: Senden und Empfangen sind voll aktiv [SWS_CANIF_00075].

Controllerereignisse setzen den Kanalmodus zwangsweise. CAN_CS_SLEEP führt zu CANIF_OFFLINE [SWS_CANIF_00865]. CAN_CS_STOPPED und BusOff führen zu 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 nur Empfang off->txoff CAN_CS_STOPPED / BusOff on CANIF_ONLINE Senden und Empfang off->on CanIf_SetPduMode(CANIF_ONLINE) txoff->off CAN_CS_SLEEP txoff->on CanIf_SetPduMode(CANIF_ONLINE) txact CANIF_TX_OFFLINE_ACTIVE Empfang, Senden wird sofort bestätigt txact->off CAN_CS_SLEEP txact->txoff CAN_CS_STOPPED / BusOff txact->on CanIf_SetPduMode(CANIF_ONLINE) on->off CanIf_SetPduMode(CANIF_OFFLINE) oder CAN_CS_SLEEP on->txoff CanIf_SetPduMode(CANIF_TX_OFFLINE) oder CAN_CS_STOPPED / BusOff on->txact CanIf_SetPduMode(CANIF_TX_OFFLINE_ACTIVE) hinweis CanIf_SetPduMode() wird nur bei Controller in CAN_CS_STARTED angenommen; gezeigt ist eine Auswahl der Übergänge

Zustandsdiagramm: Die vier PDU-Kanalmodi mit Übergängen durch CanIf_SetPduMode() und durch Controllerereignisse. Die drei eingeschränkten Modi sind wie in der Spezifikation zu einem Oberzustand zusammengefasst. Quellen: [SWS_CANIF_00864], [SWS_CANIF_00865], [SWS_CANIF_00866], [SWS_CANIF_00874], SWS CanIf Abb. 7.8 S. 61

Sendepfad: CanIf_Transmit, Pufferung und Trigger Transmit

CanIf_Transmit() [SWS_CANIF_00005] ermittelt das HTH und ruft Can_Write() auf. Das übergebene swPduHandle kommt später in CanIf_TxConfirmation() zurück [SWS_CANIF_00318]. Vorher setzt CanIf die beiden höchstwertigen Bits der CanId [SWS_CANIF_00243]. Liefert Can_Write() E_OK, gilt das auch für den Sendeauftrag [SWS_CANIF_00162].

Angenommen wird ein Auftrag nur unter diesen Bedingungen:

Neuere Dokumentstellen nennen zusätzlich CanXL_Write() SWS CanIf S. 87. Für R20-11 ist nur Can_Write() normativ.

txentscheidung start aufruf CanIf_Transmit(TxPduId, PduInfoPtr) start->aufruf init CanIf initialisiert? aufruf->init modus Controller CAN_CS_STARTED und Sendepfad online / offline active? init->modus ja nok1 E_NOT_OK init->nok1 nein active Kanal in CANIF_TX_OFFLINE_ACTIVE? modus->active ja nok2 E_NOT_OK (bei CANIF_OFFLINE zusätzlich CANIF_E_STOPPED) modus->nok2 nein pn PnTxFilter aktiv und keine CanIfTxPduPnFilterPdu? active->pn nein bestaetigen <User_TxConfirmation> sofort, kein Can_Write() active->bestaetigen ja laenge SduLength größer als globale PDU? pn->laenge nein nok3 E_NOT_OK pn->nok3 ja trunc CanIfTxPduTruncation aktiviert? laenge->trunc ja write Can_Write(Hth, PduInfo) laenge->write nein kuerzen Daten auf Länge der globalen PDU kürzen trunc->kuerzen ja nok4 CANIF_E_TXPDU_LENGTH_EXCEEDED, E_NOT_OK trunc->nok4 nein kuerzen->write rueck Rückgabe von Can_Write()? write->rueck puffer Pufferung aktiv und Puffergröße > 0? rueck->puffer CAN_BUSY ok E_OK rueck->ok E_OK gleich dieselbe L-PDU bereits gepuffert? puffer->gleich ja nok5 E_NOT_OK (L-PDU verloren) puffer->nok5 nein frei freies Pufferelement? gleich->frei nein ueberschreiben gepufferte Instanz überschreiben gleich->ueberschreiben ja ablegen L-PDU in CanIfTxBuffer ablegen frei->ablegen ja nok6 E_NOT_OK frei->nok6 nein ueberschreiben->ok ablegen->ok

Aktivitätsdiagramm: So entscheidet CanIf_Transmit() zwischen Ablehnung, simulierter Bestätigung, direktem Senden und Pufferung. Interpretation: Die Reihenfolge der Prüfungen ist zur Lesbarkeit gewählt. Quellen: [SWS_CANIF_00317], [SWS_CANIF_00382], [SWS_CANIF_00072], [SWS_CANIF_00381], [SWS_CANIF_00837], SWS CanIf Abb. 7.5 S. 51

Meldet Can_Write() CAN_BUSY und ist CanIfPublicTxBuffering aktiv [SWS_CANIF_00063], versucht CanIf, die L-PDU zu puffern [SWS_CANIF_00381]. Das setzt eine Puffergröße größer null voraus [SWS_CANIF_00835]. Liegt dieselbe L-PDU schon im Puffer, wird sie überschrieben [SWS_CANIF_00068]. Ist der Puffer voll, wird eine neue L-PDU mit E_NOT_OK abgewiesen [SWS_CANIF_00837]. Eine L-PDU liegt immer nur an einer Stelle: im Hardwareobjekt oder im CanIf-Puffer SWS CanIf S. 43.

Bei CanIf_TxConfirmation() [SWS_CANIF_00007] benachrichtigt CanIf den zuständigen Nutzer über <User_TxConfirmation> mit E_OK [SWS_CANIF_00383]. Im selben Aufruf prüft es die Puffer des frei gewordenen HTH [SWS_CANIF_00386]. Den wartenden Eintrag mit der höchsten Priorität übergibt es an Can_Write() [SWS_CANIF_00668] [SWS_CANIF_00070]. Bei E_OK entfernt es den Eintrag sofort aus dem Puffer [SWS_CANIF_00183]. Neuere Dokumentstellen nennen den Callback LSduR_CanIfTxConfirmation() SWS CanIf S. 157. In R20-11 gilt <User_TxConfirmation>.

Senden mit Pufferung und Nachsenden bei BestätigungObere Schicht (z. B. PduR)CanIfCanCanControllerUse Case: Sendeauftrag bei belegter HardwareCanIf_Transmit(TxPduId, PduInfoPtr)Can_Write(Hth, PduInfo)CAN_BUSYL-PDU in CanIfTxBuffer ablegenE_OKUse Case: Bestätigung eines früheren AuftragsTransmit-InterruptCanIf_TxConfirmation(CanTxPduId)Puffer des frei gewordenen HTH prüfenaltPuffer gefülltCan_Write() für Eintraghöchster PrioritätL-PDU in Hardware schreibenE_OKEintrag sofort aus Puffer entfernenPuffer leerkein weiterer Can_Write()-Aufruf<User_TxConfirmation>(TxPduId, E_OK)

Sequenzdiagramm: Bei belegter Hardware wird die L-PDU gepuffert. Die Bestätigung eines früheren Auftrags stößt dann das Nachsenden aus dem Puffer an. Quellen: [SWS_CANIF_00381], [SWS_CANIF_00386], [SWS_CANIF_00668], [SWS_CANIF_00183], SWS CanIf S. 138, SWS CanIf S. 143

Bei Triggered Transmission übergibt der Nutzer keine Daten, sondern einen NULL-SduDataPtr [SWS_CANIF_00882]. Ist die Hardware frei, holt der Treiber die Daten über CanIf_TriggerTransmit() [SWS_CANIF_00883]. CanIf leitet den Aufruf an <User_TriggerTransmit> weiter und gibt dessen Ergebnis zurück [SWS_CANIF_00885]. Ist die Hardware belegt, puffert CanIf nur den Transmit Request [SWS_CANIF_00881]. Die CanId dynamischer L-PDUs lässt sich mit CanIf_SetDynamicTxId() ändern [SWS_CANIF_00189]. Alternativ stammt sie aus den MetaData [SWS_CANIF_00855] SWS CanIf S. 34.

Trigger TransmitObere SchichtCanIfCanCanControllerCanIf_Transmit(TxPduId, PduInfoPtr)SduDataPtr = NULL, nur SduLengthCan_Write(Hth, PduInfo)altHardwareobjekt freiCanIf_TriggerTransmit(TxPduId, PduInfoPtr)<User_TriggerTransmit>(TxPduId, PduInfoPtr)Daten in bereitgestelltenPuffer kopierenE_OKE_OK (Rückgabewert durchgereicht)L-PDU in Hardware kopierenE_OKE_OKHardwareobjekt belegtCAN_BUSYnur Transmit Request inCanIfTxBuffer puffern (falls möglich)

Sequenzdiagramm: Bei Trigger Transmit holt der Treiber die Daten erst dann beim Nutzer ab, wenn das Hardwareobjekt frei ist. Quellen: [SWS_CANIF_00882], [SWS_CANIF_00885], [SWS_CANIF_00881], SWS CanIf Abb. 9.6 S. 137

Empfangspfad: Filtern, Länge prüfen, weiterleiten

Nach einem Empfang ruft der Treiber CanIf_RxIndication() mit Mailbox und Daten auf [SWS_CANIF_00006]. Die Verarbeitung läuft in drei Stufen:

rx start aufruf CanIf_RxIndication(Mailbox, PduInfoPtr) start->aufruf init CanIf initialisiert? aufruf->init keine keine Rx-Verarbeitung init->keine nein filterkonf Software-Filter konfiguriert (BasicCAN-HRH)? init->filterkonf ja filter Software-Filter: CanId akzeptiert? filterkonf->filter ja dlckonf Längenprüfung aktiv? filterkonf->dlckonf nein verworfen Ende ohne Indikation filter->verworfen nein filter->dlckonf ja dlc Länge >= konfigurierte Länge? dlckonf->dlc ja akzeptiert L-PDU akzeptiert dlckonf->akzeptiert nein dlcfehler Det_ReportRuntimeError() CANIF_E_INVALID_DATA_LENGTH dlc->dlcfehler nein dlc->akzeptiert ja neben je nach Konfiguration: Empfangspuffer füllen, Notification-Status setzen akzeptiert->neben ziel Ziel-Nutzer konfiguriert? akzeptiert->ziel indikation <User_RxIndication>(RxPduId, PduInfoPtr) ziel->indikation ja ende Ende ziel->ende nein indikation->ende

Aktivitätsdiagramm: Software-Filter und Längenprüfung entscheiden, ob eine empfangene L-PDU indiziert wird. Konfigurationsabhängige Nebenwirkungen sind parallel dargestellt. Quellen: [SWS_CANIF_00421], [SWS_CANIF_00389], [SWS_CANIF_00168], [SWS_CANIF_00199], [SWS_CANIF_00392], SWS CanIf Abb. 7.6 S. 51

Ergänzend bietet CanIf Abfragedienste. CanIf_ReadRxPduData() liest Daten aus einem eigenen Empfangspuffer [SWS_CANIF_00194] [SWS_CANIF_00198], ist aber nicht für Bereichsempfang gedacht [SWS_CANIF_00329]. CanIf_ReadTxNotifStatus() und CanIf_ReadRxNotifStatus() setzen den Status beim Lesen zurück [SWS_CANIF_00393] [SWS_CANIF_00394]. Dieses „read-and-consume“ sichert zu, dass seit dem letzten Aufruf mindestens ein Ereignis eintraf SWS CanIf S. 55. CanIf_GetTxConfirmationState() fasst die Bestätigungen eines ganzen Controllers zusammen [SWS_CANIF_00734].

Transceiver, Wake-up und Partial Networking

Die Transceiver-Dienste leitet CanIf direkt an den CanTrcv-Treiber weiter. CanIf_SetTrcvMode() ruft CanTrcv_SetOpMode() [SWS_CANIF_00358], CanIf_GetTrcvMode() ruft CanTrcv_GetOpMode() [SWS_CANIF_00363]. Moduswechsel des Transceivers gibt CanIf an CanSm weiter [SWS_CANIF_00712].

Für den Wake-up fragt CanIf_CheckWakeup() die Controller und Transceiver nach der Wake-up-Quelle ab [SWS_CANIF_00395] SWS CanIf S. 56. Zur Validierung speichert CanIf den ersten gültigen Empfang eines gestarteten Controllers [SWS_CANIF_00286]. CanIf_CheckValidation() meldet ihn dann über <User_ValidateWakeupEvent> [SWS_CANIF_00179].

Ist Partial Networking aktiv, legt ein PnTxFilter je Controller eine zusätzliche Schicht über die Kanalmodi [SWS_CANIF_00747]. Er wird bei CAN_CS_SLEEP aktiviert [SWS_CANIF_00749] und mit der ersten Bestätigung oder Indikation wieder deaktiviert [SWS_CANIF_00751] [SWS_CANIF_00896] SWS CanIf S. 70.

Verhalten im Fehlerfall

BusOff: Der Treiber meldet den Fehler mit CanIf_ControllerBusOff() [SWS_CANIF_00218]. CanIf setzt den Kanal daraufhin auf CANIF_TX_OFFLINE [SWS_CANIF_00866] und meldet den BusOff an CanSm [SWS_CANIF_00724] SWS CanIf Abb. 9.11 S. 147. Die Wiederherstellung steuert CanSm über CanIf_SetControllerMode() SWS CanIf S. 160.

BusOff-Meldung und WiederherstellungCanSm (<User_ControllerBusOff>)CanIfCanCanControllerBusOff-ErkennungController bei Bedarfauf STOPPED setzenCanIf_ControllerBusOff(ControllerId)Kanal auf CANIF_TX_OFFLINE,Sendepuffer leerenbei Security-Event-Reporting: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>

Sequenzdiagramm: Ablauf von der BusOff-Erkennung über die Meldung an CanSm bis zum Neustart des Controllers. Quellen: [SWS_CANIF_00218], [SWS_CANIF_00866], [SWS_CANIF_00724], [SWS_CANIF_00918], SWS CanIf S. 154, SWS CanIf S. 160

Controller gestoppt: Beim Eintritt in CAN_CS_STOPPED leert CanIf die Sendepuffer [SWS_CANIF_00485]. Alle ausstehenden Sendeaufträge bestätigt es mit E_NOT_OK [SWS_CANIF_00739]. So erhält jede angenommene PDU eine Bestätigung, positiv oder negativ SWS CanIf S. 54.

Fehlermeldungen: Ungültige Parameter meldet CanIf als Entwicklungsfehler, z. B. CANIF_E_PARAM_CONTROLLERID [SWS_CANIF_00311] [SWS_CANIF_91006]. Laufzeitfehler sind unter anderem CANIF_E_INVALID_DATA_LENGTH [SWS_CANIF_00168] und CANIF_E_STOPPED [SWS_CANIF_00382] [SWS_CANIF_91007]. Ein verlorener Sendeauftrag zeigt sich nur am Rückgabewert oder an der fehlenden Bestätigung Error Description S. 22. Sicherheitsereignisse wie CANIF_SEV_ERRORSTATE_PASSIVE meldet CanIf an den IdsM [SWS_CANIF_00913] [SWS_CANIF_00917].

Weiterführende Detailbelege

KI-generierter Leitfaden auf Basis von Spezifikationsauszügen. Normativ für R20-11 sind die verlinkten Requirements; Dokumentstellen aus neueren Releases sind als solche gekennzeichnet.

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

function 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.

Implementer's Guide folgt (Komplexität I3)

function CanIf_DeInit [SWS_CANIF_91002] 📄 PDF

void CanIf_DeInit (void);

De-initializes the CanIf module.

Implementer's Guide folgt (Komplexität I1)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I3)

function 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.

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

function 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.

function 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.

function 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.

Implementer's Guide folgt (Komplexität I2)

function CanIf_TxConfirmation [SWS_CANIF_00007] 📄 PDF

void CanIf_TxConfirmation (PduIdType CanTxPduId);

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

Implementer's Guide folgt (Komplexität I3)

function 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.

Implementer's Guide folgt (Komplexität I3)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function 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.

Implementer's Guide folgt (Komplexität I2)

function <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.

Implementer's Guide folgt (Komplexität I1)

function <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.

Implementer's Guide folgt (Komplexität I1)

function <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.

Implementer's Guide folgt (Komplexität I2)

function <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.

Implementer's Guide folgt (Komplexität I1)

function <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).

Implementer's Guide folgt (Komplexität I1)

function <User_ConfirmPnAvailability> [SWS_CANIF_00821] 📄 PDF

void <User_ConfirmPnAvailability> (uint8 TransceiverId);

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

Implementer's Guide folgt (Komplexität I1)

function <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.

Implementer's Guide folgt (Komplexität I1)

function <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.

Implementer's Guide folgt (Komplexität I1)

function <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).

Implementer's Guide folgt (Komplexität I1)

function <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).

Implementer's Guide folgt (Komplexität I1)

type 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.

type 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.

Implementer's Guide folgt (Komplexität I2)

type CanIf_NotifStatusType [SWS_CANIF_00201] 📄 PDF

Type CanIf_NotifStatusType.

Implementer's Guide folgt (Komplexität 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#1bded3a5
Content hash
1bded3a5
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_CANInterface.pdf#nameddest=SWS_CANIF_00001

Initialisierung und Status

CanIf_DeInit function

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 function

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

void CanIf_Init (const CanIf_ConfigType* ConfigPtr);

Dienste · 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);

Dienste · 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);

Dienste · 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);

Dienste · 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);

Dienste · 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);

Dienste · Weitere

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);

Callbacks

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);

Callouts und erwartete Schnittstellen

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);

Typen

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.