DEENESPTFRRUARHIKOZHNL

CAN Interface (CanIf)

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

Guía del móduloGENERADO POR IA

Media mensajes CAN y control de modo de manera independiente del hardware entre los controladores CAN y el stack de comunicación.
GENERADO POR IA no revisado Modelo: claude-opus-5-5 · Esfuerzo: high · Temperatura: no controlable · Prompt: a6221da93ef5 Procedencia Preguntas abiertas (1)
Ancla causal: R20-11 Válido desde R20-11 Sintetizado para esta versión de especificación.
traducido de la guía alemanagemini-3.8-flash-low · 2026-10-13 · Original en alemán

Media mensajes CAN y control de modo de manera independiente del hardware entre los controladores CAN y el stack de comunicación.

CanIf es la capa independiente del hardware situada entre los controladores o transceptores CAN y los módulos de comunicación superiores. Asigna solicitudes de transmisión a Can_Write(), almacena en búfer cuando el hardware está ocupado y reenvía confirmaciones e indicaciones de recepción filtradas a callbacks configurados [SWS_CANIF_00318]. Controla los modos de controlador y transceptor por encargo de CanSm y notifica BusOff y cambios de modo. Los modos de canal de PDU conmutan la ruta de transmisión y de recepción por separado. Solo se transmite si el controlador está en CAN_CS_STARTED y la ruta de transmisión está habilitada [SWS_CANIF_00317].

La CAN Interface (CanIf) asume todas las tareas independientes del hardware de la comunicación CAN. Entre ellas se incluyen las solicitudes de transmisión, confirmaciones, indicaciones de recepción, mensajes de error, así como el inicio y la parada de los controladores CAN SWS CanIf p. 13. CanIf solo accede a los búferes de hardware a través de servicios de CanDrv [SWS_CANIF_00023]. Direcciona los controladores y transceptores de varios controladores mediante IDs abstractos [SWS_CANIF_00653]. La configuración determina qué callbacks se invocan en PduR, CanNm, CanTp, CanSm o 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 Controlador CAN (Can) una o varias instancias 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()

Diagrama de contexto: CanIf entre los módulos de comunicación superiores, la gestión de modos y los controladores para controladores y transceptores. Fuentes: [SWS_CANIF_00012], [SWS_CANIF_00358], SWS CanIf p. 21

EcuM inicializa CanIf con CanIf_Init(). A continuación, cada canal se encuentra en CANIF_OFFLINE [SWS_CANIF_00864], y hasta ese momento los servicios rechazan con E_NOT_OK [SWS_CANIF_00661]. El inicio del controlador a través de CanIf_SetControllerMode() se ejecuta de forma asíncrona. La finalización la notifica CanIf_ControllerModeIndication(), la cual CanIf reenvía a CanSm [SWS_CANIF_00003] [SWS_CANIF_00711]. Solo después CanIf_SetPduMode() acepta solicitudes [SWS_CANIF_00874]. Los modos de canal de PDU conmutan la ruta de transmisión y recepción por separado. Eventos del controlador como SLEEP, STOPPED o BusOff los fuerzan [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 solo recepción off->txoff CAN_CS_STOPPED / BusOff on CANIF_ONLINE envío y recepción off->on CanIf_SetPduMode(CANIF_ONLINE) txoff->off CAN_CS_SLEEP txoff->on CanIf_SetPduMode(CANIF_ONLINE) txact CANIF_TX_OFFLINE_ACTIVE recepción, el envío se confirma de inmediato txact->off CAN_CS_SLEEP txact->txoff CAN_CS_STOPPED / BusOff txact->on CanIf_SetPduMode(CANIF_ONLINE) on->off CanIf_SetPduMode(CANIF_OFFLINE) o CAN_CS_SLEEP on->txoff CanIf_SetPduMode(CANIF_TX_OFFLINE) o CAN_CS_STOPPED / BusOff on->txact CanIf_SetPduMode(CANIF_TX_OFFLINE_ACTIVE) hinweis CanIf_SetPduMode() solo se acepta con controlador en CAN_CS_STARTED; se muestra una selección de las transiciones

Diagrama de estados: Los cuatro modos de canal de PDU y sus transiciones mediante CanIf_SetPduMode() y eventos del controlador. Fuentes: [SWS_CANIF_00137], [SWS_CANIF_00866], SWS CanIf Fig. 7.8 p. 61

Durante la transmisión, CanIf_Transmit() invoca Can_Write() [SWS_CANIF_00318]. Si el hardware está ocupado, CanIf almacena en búfer la L-PDU, siempre que haya un búfer configurado [SWS_CANIF_00381]. Con la siguiente confirmación, envía posteriormente la entrada con la prioridad más alta [SWS_CANIF_00668]. Las L-PDUs recibidas pasan por filtros de software y verificación de longitud antes de que CanIf las reenvíe a <User_RxIndication> [SWS_CANIF_00389] [SWS_CANIF_00056].

En caso de error, un BusOff establece el canal en CANIF_TX_OFFLINE y se notifica a CanSm [SWS_CANIF_00724]. Al detener un controlador, CanIf confirma todas las solicitudes de transmisión pendientes con E_NOT_OK [SWS_CANIF_00739]. Los errores de parámetros y de tiempo de ejecución van al DET [SWS_CANIF_91006] [SWS_CANIF_91007].

Rol: centro neurálgico independiente del hardware entre los controladores CAN y el stack de comunicación

La CAN Interface (CanIf) asume todas las tareas independientes del hardware de la comunicación CAN de una ECU. Los controladores CAN subyacentes solo se encargan ya de su hardware concreto. CanIf procesa solicitudes de transmisión, confirmaciones de transmisión, indicaciones de recepción y mensajes de error, e inicia o detiene los controladores CAN SWS CanIf p. 13. Accede a los búferes de hardware exclusivamente mediante servicios de CanDrv [SWS_CANIF_00023]. Los servicios de control operan con un ControllerId abstracto, que numera correlativamente a partir de 0 los controladores de todas las instancias de CanDrv [SWS_CANIF_00653]. Para los transceptores aplica lo mismo con el TransceiverId [SWS_CANIF_00655].

Hacia abajo, CanIf agrupa las APIs de varios controladores CanTrcv en una interfaz uniforme, pero no contiene lógica de transceptor en sí misma SWS CanIf p. 21. Incluso con varios CanDrvs, cada callback existe solo una vez. CanIf reconoce el controlador llamante mediante el ControllerId en Can_HwType SWS CanIf p. 68.

Hacia arriba, CanIf invoca callbacks configurables como <User_TxConfirmation> y <User_RxIndication> [SWS_CANIF_00011] [SWS_CANIF_00012]. La configuración determina el receptor concreto, por ejemplo PduR_CanIfRxIndication [SWS_CANIF_00442] o CanTp_TxConfirmation [SWS_CANIF_00550]. CanIf notifica BusOff y cambios de modo a CanSm o a un CDD [SWS_CANIF_00724] [SWS_CANIF_00711]. Las validaciones de wake-up se envían a 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 Controlador CAN (Can) una o varias instancias 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()

Diagrama de contexto: CanIf media entre los módulos de comunicación superiores, la gestión de modos (CanSm, EcuM) y los controladores para controladores CAN y transceptores. Los mensajes de error, de seguridad y de mirroring van a DET, IdsM y Mirror. Fuentes: [SWS_CANIF_00011], [SWS_CANIF_00724], [SWS_CANIF_00358], [SWS_CANIF_00905], [SWS_CANIF_00913], SWS CanIf p. 13.

El alcance de funciones depende en gran medida de la configuración. CanIf_Init() lee de los contenedores de configuración, entre otros datos, el número de controladores y la asignación de los HTHs/HRHs SWS CanIf p. 22. HTH y HRH son handles a objetos lógicos de transmisión y recepción, respectivamente [SWS_CANIF_00291] [SWS_CANIF_00292]. Muchos servicios pueden deseleccionarse mediante modificadores de precompilación, p. ej. CanIf_ReadRxPduData() [SWS_CANIF_00330] o CanIf_SetBaudrate() [SWS_CANIF_00871]. Si para un callback no obligatorio no se ha configurado ningún nombre, la llamada se omite SWS CanIf p. 133. En cambio, <User_ControllerBusOff> debe estar configurado siempre [SWS_CANIF_00524].

De la inicialización al controlador iniciado

EcuM invoca CanIf_Init() [SWS_CANIF_00001]. Al hacerlo, CanIf inicializa variables, flags y búferes [SWS_CANIF_00085], así como todos los búferes de L-PDUs de transmisión [SWS_CANIF_00387]. Cada canal se inicia en CANIF_OFFLINE [SWS_CANIF_00864]. Los controladores permanecen después en el modo STOPPED, en el que ni se transmite ni se recibe. EcuM inicializa CanDrv y CanTrcv por separado SWS CanIf p. 40. Antes de la inicialización, todos los servicios devuelven E_NOT_OK excepto CanIf_Init() y CanIf_GetVersionInfo() [SWS_CANIF_00661]. Quien invoque CanIf_DeInit() [SWS_CANIF_91002] debe asegurarse de que no se estén ejecutando más transmisiones SWS CanIf p. 81.

El inicio del controlador se ejecuta de forma asíncrona. CanIf_SetControllerMode() [SWS_CANIF_00003] invoca Can_SetControllerMode() [SWS_CANIF_00308]. El controlador notifica posteriormente el cambio consumado mediante CanIf_ControllerModeIndication() [SWS_CANIF_00699], y CanIf traslada la notificación a CanSm [SWS_CANIF_00711]. En funcionamiento por sondeo (polling), Can_MainFunction_Mode() detecta el cambio SWS CanIf p. 152. Solo en CAN_CS_STARTED CanIf_SetPduMode() acepta solicitudes [SWS_CANIF_00874].

Iniciar controlador y habilitar canal de PDUCanSm / obere SchichtCanIfCanCanControllerCanIf_SetControllerMode(ControllerId,CAN_CS_STARTED)Can_SetControllerMode(Controller, Transition)Solicitar transición a STARTE_OKE_OK (Anforderung angenommen)Asíncrono: el cambio aúnno se ha completadoloopCan_MainFunction_Mode() bis Moduswechsel erkanntcomprobar estado de hardwareCanIf_ControllerModeIndication(ControllerId,CAN_CS_STARTED)<User_ControllerModeIndication>(CanSM_ControllerModeIndication)Use Case: PDU-Pfade freischaltenCanIf_SetPduMode(ControllerId, CANIF_ONLINE)solo admisible en CAN_CS_STARTEDE_OK

Diagrama de secuencias: La solicitud de inicio se confirma de inmediato, pero el cambio de modo se indica más tarde. Después se pueden habilitar las rutas de PDU. Fuentes: [SWS_CANIF_00308], [SWS_CANIF_00711], [SWS_CANIF_00874], SWS CanIf p. 156

Modos de canal de PDU: conmutar por separado la ruta de transmisión y recepción

Cada canal de un controlador tiene un modo de tipo CanIf_PduModeType [SWS_CANIF_00137]. Las capas superiores lo establecen con CanIf_SetPduMode() y lo leen con CanIf_GetPduMode() [SWS_CANIF_00008] [SWS_CANIF_00009]. Los modos en detalle SWS CanIf p. 58:

  • CANIF_OFFLINE: Las solicitudes de transmisión se rechazan con E_NOT_OK y se vacían los búferes. Las indicaciones y confirmaciones se suprimen [SWS_CANIF_00073].
  • CANIF_TX_OFFLINE: Solo la ruta de transmisión está bloqueada; la recepción permanece activa [SWS_CANIF_00489].
  • CANIF_TX_OFFLINE_ACTIVE: Las solicitudes de transmisión se confirman inmediatamente sin reenviarse a CanDrv [SWS_CANIF_00072].
  • CANIF_ONLINE: Transmisión y recepción están completamente activas [SWS_CANIF_00075].

Los eventos del controlador fuerzan el modo de canal. CAN_CS_SLEEP conduce a CANIF_OFFLINE [SWS_CANIF_00865]. CAN_CS_STOPPED y BusOff conducen a 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 solo recepción off->txoff CAN_CS_STOPPED / BusOff on CANIF_ONLINE envío y recepción off->on CanIf_SetPduMode(CANIF_ONLINE) txoff->off CAN_CS_SLEEP txoff->on CanIf_SetPduMode(CANIF_ONLINE) txact CANIF_TX_OFFLINE_ACTIVE recepción, el envío se confirma de inmediato txact->off CAN_CS_SLEEP txact->txoff CAN_CS_STOPPED / BusOff txact->on CanIf_SetPduMode(CANIF_ONLINE) on->off CanIf_SetPduMode(CANIF_OFFLINE) o CAN_CS_SLEEP on->txoff CanIf_SetPduMode(CANIF_TX_OFFLINE) o CAN_CS_STOPPED / BusOff on->txact CanIf_SetPduMode(CANIF_TX_OFFLINE_ACTIVE) hinweis CanIf_SetPduMode() solo se acepta con controlador en CAN_CS_STARTED; se muestra una selección de las transiciones

Diagrama de estados: Los cuatro modos de canal de PDU con transiciones mediante CanIf_SetPduMode() y mediante eventos del controlador. Los tres modos restringidos se agrupan en un superestado como en la especificación. Fuentes: [SWS_CANIF_00864], [SWS_CANIF_00865], [SWS_CANIF_00866], [SWS_CANIF_00874], SWS CanIf Fig. 7.8 p. 61

Ruta de transmisión: CanIf_Transmit, almacenamiento en búfer y Trigger Transmit

CanIf_Transmit() [SWS_CANIF_00005] determina el HTH e invoca Can_Write(). El swPduHandle pasado retorna más tarde en CanIf_TxConfirmation() [SWS_CANIF_00318]. Antes, CanIf establece los dos bits más significativos del CanId [SWS_CANIF_00243]. Si Can_Write() devuelve E_OK, esto aplica también a la solicitud de transmisión [SWS_CANIF_00162].

Una solicitud solo se acepta bajo estas condiciones:

Pasajes de documentos más recientes citan adicionalmente CanXL_Write() SWS CanIf p. 87. Para R20-11, solo Can_Write() es normativo.

txentscheidung start aufruf CanIf_Transmit(TxPduId, PduInfoPtr) start->aufruf init CanIf initialisiert? aufruf->init modus ¿Controlador en CAN_CS_STARTED y ruta de transmisión online / offline active? init->modus Sí nok1 E_NOT_OK init->nok1 No active Kanal in CANIF_TX_OFFLINE_ACTIVE? modus->active Sí nok2 E_NOT_OK (en CANIF_OFFLINE adicionalmente CANIF_E_STOPPED) modus->nok2 No pn ¿PnTxFilter activo y ninguna CanIfTxPduPnFilterPdu? active->pn No bestaetigen <User_TxConfirmation> sofort, kein Can_Write() active->bestaetigen Sí laenge ¿SduLength mayor que la PDU global? pn->laenge No nok3 E_NOT_OK pn->nok3 Sí trunc CanIfTxPduTruncation aktiviert? laenge->trunc Sí write Can_Write(Hth, PduInfo) laenge->write No kuerzen Recortar datos a la longitud de la PDU global trunc->kuerzen Sí nok4 CANIF_E_TXPDU_LENGTH_EXCEEDED, E_NOT_OK trunc->nok4 No kuerzen->write rueck ¿Retorno de Can_Write()? write->rueck puffer ¿Almacenamiento en búfer activo y tamaño de búfer > 0? rueck->puffer CAN_BUSY ok E_OK rueck->ok E_OK gleich ¿La misma L-PDU ya está almacenada en búfer? puffer->gleich Sí nok5 E_NOT_OK (L-PDU verloren) puffer->nok5 No frei freies Pufferelement? gleich->frei No ueberschreiben sobrescribir instancia almacenada en búfer gleich->ueberschreiben Sí ablegen L-PDU in CanIfTxBuffer ablegen frei->ablegen Sí nok6 E_NOT_OK frei->nok6 No ueberschreiben->ok ablegen->ok

Diagrama de actividades: Así decide CanIf_Transmit() entre rechazo, confirmación simulada, transmisión directa y almacenamiento en búfer. Interpretación: El orden de las comprobaciones se ha seleccionado por motivos de legibilidad. Fuentes: [SWS_CANIF_00317], [SWS_CANIF_00382], [SWS_CANIF_00072], [SWS_CANIF_00381], [SWS_CANIF_00837], SWS CanIf Fig. 7.5 p. 51.

Si Can_Write() notifica CAN_BUSY y CanIfPublicTxBuffering está activo [SWS_CANIF_00063], CanIf intenta almacenar en búfer la L-PDU [SWS_CANIF_00381]. Esto presupone un tamaño de búfer superior a cero [SWS_CANIF_00835]. Si la misma L-PDU ya se encuentra en el búfer, se sobrescribe [SWS_CANIF_00068]. Si el búfer está lleno, se rechaza una nueva L-PDU con E_NOT_OK [SWS_CANIF_00837]. Una L-PDU se encuentra siempre en un solo lugar: en el objeto de hardware o en el búfer de CanIf SWS CanIf p. 43.

Con CanIf_TxConfirmation() [SWS_CANIF_00007], CanIf notifica al usuario correspondiente mediante <User_TxConfirmation> con E_OK [SWS_CANIF_00383]. En la misma llamada, comprueba los búferes del HTH que ha quedado libre [SWS_CANIF_00386]. Pasa la entrada en espera con la prioridad más alta a Can_Write() [SWS_CANIF_00668] [SWS_CANIF_00070]. Con E_OK, elimina inmediatamente la entrada del búfer [SWS_CANIF_00183]. Pasajes de documentos más recientes denominan al callback LSduR_CanIfTxConfirmation() SWS CanIf p. 157. En R20-11 aplica <User_TxConfirmation>.

Transmisión con almacenamiento en búfer y reenvío tras confirmaciónObere Schicht (z. B. PduR)CanIfCanCanControllerUse Case: Solicitud de envío con hardware ocupadoCanIf_Transmit(TxPduId, PduInfoPtr)Can_Write(Hth, PduInfo)CAN_BUSYL-PDU in CanIfTxBuffer ablegenE_OKUse Case: Confirmación de una solicitud anteriorTransmit-InterruptCanIf_TxConfirmation(CanTxPduId)Comprobar búfer del HTH que ha quedado librealtBúfer llenoCan_Write() para la entradade mayor prioridadL-PDU in Hardware schreibenE_OKEliminar la entrada inmediatamente del búferPuffer leerkein weiterer Can_Write()-Aufruf<User_TxConfirmation>(TxPduId, E_OK)

Diagrama de secuencias: Si el hardware está ocupado, la L-PDU se almacena en búfer. La confirmación de una solicitud anterior desencadena entonces el envío posterior desde el búfer. Fuentes: [SWS_CANIF_00381], [SWS_CANIF_00386], [SWS_CANIF_00668], [SWS_CANIF_00183], SWS CanIf p. 138, SWS CanIf p. 143

En caso de Triggered Transmission, el usuario no pasa datos, sino un SduDataPtr NULL [SWS_CANIF_00882]. Si el hardware está libre, el controlador obtiene los datos mediante CanIf_TriggerTransmit() [SWS_CANIF_00883]. CanIf reenvía la llamada a <User_TriggerTransmit> y devuelve su resultado [SWS_CANIF_00885]. Si el hardware está ocupado, CanIf solo almacena en búfer el Transmit Request [SWS_CANIF_00881]. El CanId de L-PDUs dinámicas puede modificarse con CanIf_SetDynamicTxId() [SWS_CANIF_00189]. Como alternativa, procede de los MetaData [SWS_CANIF_00855] SWS CanIf p. 34.

Trigger TransmitObere SchichtCanIfCanCanControllerCanIf_Transmit(TxPduId, PduInfoPtr)SduDataPtr = NULL, solo SduLengthCan_Write(Hth, PduInfo)altHardwareobjekt freiCanIf_TriggerTransmit(TxPduId, PduInfoPtr)<User_TriggerTransmit>(TxPduId, PduInfoPtr)Daten in bereitgestelltenPuffer kopierenE_OKE_OK (valor de retorno transmitido)L-PDU in Hardware kopierenE_OKE_OKHardwareobjekt belegtCAN_BUSYsolo almacenar en búfer Transmit Request enCanIfTxBuffer (si es posible)

Diagrama de secuencia: En Trigger Transmit, el controlador no recoge los datos del usuario hasta que el objeto de hardware está libre. Fuentes: [SWS_CANIF_00882], [SWS_CANIF_00885], [SWS_CANIF_00881], SWS CanIf Fig. 9.6 p. 137

Ruta de recepción: filtrado, comprobación de longitud, reenvío

Tras una recepción, el controlador llama a CanIf_RxIndication() con Mailbox y datos [SWS_CANIF_00006]. El procesamiento transcurre en tres etapas:

rx start aufruf CanIf_RxIndication(Mailbox, PduInfoPtr) start->aufruf init CanIf initialisiert? aufruf->init keine sin procesamiento de Rx init->keine No filterkonf Software-Filter konfiguriert (BasicCAN-HRH)? init->filterkonf Sí filter Software-Filter: CanId akzeptiert? filterkonf->filter Sí dlckonf ¿Comprobación de longitud activa? filterkonf->dlckonf No verworfen Fin sin indicación filter->verworfen No filter->dlckonf Sí dlc ¿Longitud >= longitud configurada? dlckonf->dlc Sí akzeptiert L-PDU akzeptiert dlckonf->akzeptiert No dlcfehler Det_ReportRuntimeError() CANIF_E_INVALID_DATA_LENGTH dlc->dlcfehler No dlc->akzeptiert Sí neben según la configuración: llenar búfer de recepción, establecer estado de notificación akzeptiert->neben ziel Ziel-Nutzer konfiguriert? akzeptiert->ziel indikation <User_RxIndication>(RxPduId, PduInfoPtr) ziel->indikation Sí ende Ende ziel->ende No indikation->ende

Diagrama de actividades: El filtro por software y la comprobación de longitud deciden si se notifica una L-PDU recibida. Los efectos secundarios dependientes de la configuración se muestran en paralelo. Fuentes: [SWS_CANIF_00421], [SWS_CANIF_00389], [SWS_CANIF_00168], [SWS_CANIF_00199], [SWS_CANIF_00392], SWS CanIf Fig. 7.6 p. 51

De forma complementaria, CanIf ofrece servicios de consulta. CanIf_ReadRxPduData() lee datos de un búfer de recepción propio [SWS_CANIF_00194] [SWS_CANIF_00198], pero no está previsto para la recepción por rangos [SWS_CANIF_00329]. CanIf_ReadTxNotifStatus() y CanIf_ReadRxNotifStatus() restablecen el estado durante la lectura [SWS_CANIF_00393] [SWS_CANIF_00394]. Este «read-and-consume» garantiza que se haya producido al menos un evento desde la última llamada SWS CanIf p. 55. CanIf_GetTxConfirmationState() agrupa las confirmaciones de un controlador completo [SWS_CANIF_00734].

Transceptor, wake-up y Partial Networking

CanIf reenvía los servicios de transceptor directamente al controlador CanTrcv. CanIf_SetTrcvMode() llama a CanTrcv_SetOpMode() [SWS_CANIF_00358], CanIf_GetTrcvMode() llama a CanTrcv_GetOpMode() [SWS_CANIF_00363]. CanIf transmite los cambios de modo del transceptor a CanSm [SWS_CANIF_00712].

Para el wake-up, CanIf_CheckWakeup() consulta a los controladores y transceptores por la fuente de wake-up [SWS_CANIF_00395] SWS CanIf p. 56. Para la validación, CanIf almacena la primera recepción válida de un controlador iniciado [SWS_CANIF_00286]. A continuación, CanIf_CheckValidation() la notifica mediante <User_ValidateWakeupEvent> [SWS_CANIF_00179].

Si Partial Networking está activo, un PnTxFilter por cada controlador añade una capa adicional sobre los modos de canal [SWS_CANIF_00747]. Se activa con CAN_CS_SLEEP [SWS_CANIF_00749] y se vuelve a desactivar con la primera confirmación o indicación [SWS_CANIF_00751] [SWS_CANIF_00896] SWS CanIf p. 70.

Comportamiento en caso de error

BusOff: El controlador notifica el error mediante CanIf_ControllerBusOff() [SWS_CANIF_00218]. En consecuencia, CanIf establece el canal en CANIF_TX_OFFLINE [SWS_CANIF_00866] y notifica el BusOff a CanSm [SWS_CANIF_00724] SWS CanIf Fig. 9.11 p. 147. CanSm controla la recuperación a través de CanIf_SetControllerMode() SWS CanIf p. 160.

Notificación y recuperación de BusOffCanSm (<User_ControllerBusOff>)CanIfCanCanControllerBusOff-ErkennungControlador en caso de necesidadestablecer en STOPPEDCanIf_ControllerBusOff(ControllerId)canal a CANIF_TX_OFFLINE,Sendepuffer leerenen caso de 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>

Diagrama de secuencia: Secuencia desde la detección de BusOff y la notificación a CanSm hasta el reinicio del controlador. Fuentes: [SWS_CANIF_00218], [SWS_CANIF_00866], [SWS_CANIF_00724], [SWS_CANIF_00918], SWS CanIf p. 154, SWS CanIf p. 160

Controlador detenido: Al entrar en CAN_CS_STOPPED, CanIf vacía los búferes de transmisión [SWS_CANIF_00485]. Confirma todas las solicitudes de transmisión pendientes con E_NOT_OK [SWS_CANIF_00739]. De este modo, cada PDU aceptada recibe una confirmación, positiva o negativa SWS CanIf p. 54.

Mensajes de error: CanIf notifica los parámetros no válidos como errores de desarrollo, p. ej. CANIF_E_PARAM_CONTROLLERID [SWS_CANIF_00311] [SWS_CANIF_91006]. Entre los errores de tiempo de ejecución se encuentran CANIF_E_INVALID_DATA_LENGTH [SWS_CANIF_00168] y CANIF_E_STOPPED [SWS_CANIF_00382] [SWS_CANIF_91007]. Una solicitud de transmisión perdida solo se manifiesta en el valor de retorno o en la falta de confirmación Error Description p. 22. CanIf notifica los eventos de seguridad como CANIF_SEV_ERRORSTATE_PASSIVE al IdsM [SWS_CANIF_00913] [SWS_CANIF_00917].

Más evidencia detallada

Guía generada por IA sobre la base de extractos de especificaciones. Para R20-11 son normativos los requirements enlazados; los pasajes de documentos procedentes de versiones más recientes están identificados como tales.

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

función 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.

Guía del implementador pendiente (complejidad I3)

función CanIf_DeInit [SWS_CANIF_91002] 📄 PDF

void CanIf_DeInit (void);

De-initializes the CanIf module.

Guía del implementador pendiente (complejidad I1)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I3)

función 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.

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

función 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.

función 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.

función 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.

Guía del implementador pendiente (complejidad I2)

función CanIf_TxConfirmation [SWS_CANIF_00007] 📄 PDF

void CanIf_TxConfirmation (PduIdType CanTxPduId);

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

Guía del implementador pendiente (complejidad I3)

función 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.

Guía del implementador pendiente (complejidad I3)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función 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.

Guía del implementador pendiente (complejidad I2)

función <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.

Guía del implementador pendiente (complejidad I1)

función <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.

Guía del implementador pendiente (complejidad I1)

función <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.

Guía del implementador pendiente (complejidad I2)

función <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.

Guía del implementador pendiente (complejidad I1)

función <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).

Guía del implementador pendiente (complejidad I1)

función <User_ConfirmPnAvailability> [SWS_CANIF_00821] 📄 PDF

void <User_ConfirmPnAvailability> (uint8 TransceiverId);

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

Guía del implementador pendiente (complejidad I1)

función <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.

Guía del implementador pendiente (complejidad I1)

función <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.

Guía del implementador pendiente (complejidad I1)

función <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).

Guía del implementador pendiente (complejidad I1)

función <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).

Guía del implementador pendiente (complejidad I1)

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

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

Guía del implementador pendiente (complejidad I2)

tipo CanIf_NotifStatusType [SWS_CANIF_00201] 📄 PDF

Type CanIf_NotifStatusType.

Guía del implementador pendiente (complejidad 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#511d698e
Content hash
511d698e
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_CANInterface.pdf#nameddest=SWS_CANIF_00001

Inicialización y estado

CanIf_DeInit función

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 función

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

void CanIf_Init (const CanIf_ConfigType* ConfigPtr);

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

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

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

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

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

Servicios · Otros

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 e interfaces esperadas

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

Tipos

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.