DEENESPTFRRUARHIKOZHNL

LIN Driver (Lin)

ModulLin (LIN Driver)
BSW-Modul-ID82
Standard-Header#include "Lin.h"
SWS-SpezifikationAUTOSAR_SWS_LINDriver.pdf
ClusterLIN

Module guideAI-GENERATED

Controls the LIN hardware and provides the LIN Interface with services for frames, sleep state, and wake-up per channel.
AI-GENERATED unreviewed Model: claude-opus-5-5 · Effort: high · Temperature: not controllable · Prompt: ea366bb8619c Provenance Open questions (1)
Causal anchor: R20-11 Valid from R20-11 Synthesized for this specification release.
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Controls the LIN hardware and provides the LIN Interface with services for frames, sleep state, and wake-up per channel.

The LIN driver encapsulates the LIN hardware of the microcontroller and provides the LIN Interface with channel-specific services for frames, sleep state, and wake-up. Master channels trigger frames asynchronously with Lin_SendFrame and evaluate them via Lin_GetStatus. Slave channels respond to each received header with an indication to the LIN Interface and then transmit, receive, or ignore the response ([SWS_Lin_00280]). Which services are available depends on the configured node type; master services exist only if at least one master channel is present ([SWS_Lin_00287]).

The LIN driver Lin is the hardware driver of the LIN stack. It encapsulates LIN controllers or SCI/UARTs (SWS LIN Driver p. 9) and provides the LIN Interface with channel-specific services for frames, sleep state, and wake-up. It mandatorily requires Dem_SetEventStatus, EcuM_SetWakeupEvent, and LinIf_WakeupConfirmation ([SWS_Lin_00234]). Optionally, it uses DET, Icu, and the slave callbacks of LinIf ([SWS_Lin_00235]).

LinKontext LinIf LinIf (LIN Interface) Lin Lin (LIN-Treiber, MCAL) LinIf->Lin Lin_SendFrame, Lin_GetStatus (Master) Lin_GoToSleep(Internal), Lin_Wakeup(Internal) Lin_CheckWakeup EcuM EcuM Dem DEM Det DET (optional) Icu Icu (optional) Lin->LinIf LinIf_HeaderIndication, LinIf_RxIndication, LinIf_TxConfirmation, LinIf_LinErrorIndication (Slave) LinIf_WakeupConfirmation Lin->EcuM EcuM_SetWakeupEvent Lin->Dem Dem_SetEventStatus (LIN_E_TIMEOUT) Lin->Det Det_ReportError Lin->Icu Icu_Enable/DisableNotification HW LIN-Hardware-Unit (LIN-Controller / SCI/UART) Lin->HW Hardwarezugriff HW->Lin Interrupt Trcv Transceiver-IC HW->Trcv TxD / RxD Cluster LIN-Cluster Trcv->Cluster LIN-Bus

Context diagram: Lin is located between LinIf and the LIN hardware and reports wake-ups and errors to EcuM, LinIf, DEM, and DET. Sources: [SWS_Lin_00234], [SWS_Lin_00235]

Lin_Init transitions the module from LIN_UNINIT to LIN_INIT ([SWS_Lin_00006], SWS LIN Driver p. 24). After that, each channel alternates between LIN_CH_OPERATIONAL, LIN_CH_SLEEP_PENDING (master only), and LIN_CH_SLEEP. For this purpose, Lin_GoToSleep, Lin_GoToSleepInternal, Lin_Wakeup, and Lin_WakeupInternal are available ([SWS_Lin_00166], [SWS_Lin_00167], [SWS_Lin_00169], [SWS_Lin_00256]).

LinZustaende cluster_kanal Channel states per channel (only in LIN_INIT) Reset Reset LIN_UNINIT LIN_UNINIT (not usable) Reset->LIN_UNINIT after reset LIN_INIT LIN_INIT (channels operational) LIN_UNINIT->LIN_INIT Lin_Init LIN_CH_OPERATIONAL LIN_CH_OPERATIONAL (participates in cluster) LIN_CH_SLEEP_PENDING LIN_CH_SLEEP_PENDING (master only) LIN_CH_OPERATIONAL->LIN_CH_SLEEP_PENDING Lin_GoToSleep (Go-to-sleep-Kommando) LIN_CH_SLEEP LIN_CH_SLEEP (Wake-up-Erkennung aktiv) LIN_CH_OPERATIONAL->LIN_CH_SLEEP Lin_GoToSleepInternal LIN_CH_SLEEP_PENDING->LIN_CH_SLEEP Lin_GetStatus (Interpretation) LIN_CH_SLEEP->LIN_CH_OPERATIONAL Lin_Wakeup (with wake-up pulse) LIN_CH_SLEEP->LIN_CH_OPERATIONAL Lin_WakeupInternal (without wake-up pulse)

State diagram: Module states and channel states with their transitions. That Lin_GetStatus completes the step to LIN_CH_SLEEP is an interpretation of the diagram. Sources: SWS LIN Driver p. 24, [SWS_Lin_00166]

Master and slave channels operate fundamentally differently. A master triggers frames asynchronously with Lin_SendFrame and queries the result later with Lin_GetStatus ([SWS_Lin_00191], [SWS_Lin_00168]). These services exist only if at least one channel is configured as a master ([SWS_Lin_00287]). A slave reports each header via LinIf_HeaderIndication ([SWS_Lin_00280]). Depending on Drc, it then transmits, receives, or ignores the response and completes it with LinIf_TxConfirmation or LinIf_RxIndication ([SWS_Lin_00282], [SWS_Lin_00274], [SWS_Lin_00275]).

Lin_CheckWakeup checks wake-ups from the bus and reports them to EcuM and LinIf ([SWS_Lin_00160]). In the event of an error, misuses are sent to the DET, such as LIN_E_UNINIT ([SWS_Lin_00258]). A hardware timeout is reported to the DEM as LIN_E_TIMEOUT ([SWS_Lin_00290]). A master channel returns bus errors as status; a slave channel reports them via LinIf_LinErrorIndication ([SWS_Lin_00233], [SWS_Lin_00277]).

Role, System Boundary, and Instance Context of the LIN Driver

The LIN driver Lin encapsulates the LIN hardware of the microcontroller. It provides channel-specific services to the LIN Interface (LinIf): transmitting and receiving frames, putting channels to sleep and waking them up, as well as checking wake-ups. All services are available via Lin.h ([SWS_Lin_00191], [SWS_Lin_00160]). As hardware, the specification mentions three types of LIN hardware units: full-featured LIN controllers, simple SCI/UARTs, and enhanced SCI/UARTs. Each is connected to a LIN cluster via transceiver ICs (SWS LIN Driver p. 9). The driver itself does not provide any callback functions (SWS LIN Driver p. 49). Instead, it calls functions of its environment.

Mandatory external interfaces are Dem_SetEventStatus, EcuM_SetWakeupEvent, and LinIf_WakeupConfirmation ([SWS_Lin_00234]). Optionally, the driver uses, among others:

  • Det_ReportError and EcuM_CheckWakeup,
  • Icu_EnableNotification and Icu_DisableNotification,
  • for slave channels, the callbacks LinIf_HeaderIndication, LinIf_RxIndication, and LinIf_LinErrorIndication ([SWS_Lin_00235]).

The imported types such as NetworkHandleType, EcuM_WakeupSourceType, or Std_ReturnType are listed in [SWS_Lin_00226].

LinKontext LinIf LinIf (LIN Interface) Lin Lin (LIN-Treiber, MCAL) LinIf->Lin Lin_SendFrame, Lin_GetStatus (Master) Lin_GoToSleep(Internal), Lin_Wakeup(Internal) Lin_CheckWakeup EcuM EcuM Dem DEM Det DET (optional) Icu Icu (optional) Lin->LinIf LinIf_HeaderIndication, LinIf_RxIndication, LinIf_TxConfirmation, LinIf_LinErrorIndication (Slave) LinIf_WakeupConfirmation Lin->EcuM EcuM_SetWakeupEvent Lin->Dem Dem_SetEventStatus (LIN_E_TIMEOUT) Lin->Det Det_ReportError Lin->Icu Icu_Enable/DisableNotification HW LIN-Hardware-Unit (LIN-Controller / SCI/UART) Lin->HW Hardwarezugriff HW->Lin Interrupt Trcv Transceiver-IC HW->Trcv TxD / RxD Cluster LIN-Cluster Trcv->Cluster LIN-Bus

Context diagram: Lin is located between LinIf and the LIN hardware unit. The driver reports wake-ups to EcuM and LinIf, and errors to DEM and DET. Sources: [SWS_Lin_00234], [SWS_Lin_00235], SWS LIN Driver p. 9

The driver is partitionable. It operates as an independent instance in each partition, and an API call only affects the partition in which it is made ([SWS_Lin_CONSTR_00270]). If LinEcucPartitionRef references partitions, LinChannelEcucPartitionRef must reference exactly one of them ([SWS_Lin_CONSTR_00291]). LinChannel and LinTrcvChannel of a communication channel must reference the same partition ([SWS_Lin_CONSTR_00279]). The module rejects partition assignments that the implementation does not support ([SWS_Lin_00269]). Per channel, parameters such as baud rate, channel ID, LinChannelWakeupSupport, and the node type LinNodeType are configured. This container description originates from a later release (SWS LIN Driver p. 60).

Module and Channel States from Lin_Init to Sleep State

After reset, the module is in the LIN_UNINIT state and cannot be used. Lin_Init transitions it to LIN_INIT; there, every available channel is operational (SWS LIN Driver p. 24). Lin_Init receives a pointer to a Lin_ConfigType structure. Its content is hardware-specific; it contains the initialization data for the driver, hardware unit, and channels ([SWS_Lin_00006], [SWS_Lin_00227]). The environment should call Lin_Init only once at runtime (SWS LIN Driver p. 24).

Within LIN_INIT, each channel has its own state:

  • LIN_CH_OPERATIONAL: The channel participates in the cluster.
  • LIN_CH_SLEEP: Wake-up detection is active; the hardware is in low-power mode if applicable.
  • LIN_CH_SLEEP_PENDING: Only for master channels, after Lin_GoToSleep.

References: SWS LIN Driver p. 24, [SWS_Lin_00166]. Lin_GoToSleepInternal sets the channel directly to LIN_CH_SLEEP ([SWS_Lin_00167]). Lin_Wakeup leads back to LIN_CH_OPERATIONAL with a wake-up pulse, Lin_WakeupInternal without a pulse ([SWS_Lin_00169], [SWS_Lin_00256]).

Interpretation: Lin_GetStatus likely completes the transition from LIN_CH_SLEEP_PENDING to LIN_CH_SLEEP. Question Q-bb592e1d2ab668f0 (open) The diagram shows Lin_GetStatus as a transition in the master section, and the LIN Interface expects the return value LIN_CH_SLEEP when checking the go-to-sleep command (SWS LIN Interface p. 56).

LinZustaende cluster_kanal Channel states per channel (only in LIN_INIT) Reset Reset LIN_UNINIT LIN_UNINIT (not usable) Reset->LIN_UNINIT after reset LIN_INIT LIN_INIT (channels operational) LIN_UNINIT->LIN_INIT Lin_Init LIN_CH_OPERATIONAL LIN_CH_OPERATIONAL (participates in cluster) LIN_CH_SLEEP_PENDING LIN_CH_SLEEP_PENDING (master only) LIN_CH_OPERATIONAL->LIN_CH_SLEEP_PENDING Lin_GoToSleep (Go-to-sleep-Kommando) LIN_CH_SLEEP LIN_CH_SLEEP (Wake-up-Erkennung aktiv) LIN_CH_OPERATIONAL->LIN_CH_SLEEP Lin_GoToSleepInternal LIN_CH_SLEEP_PENDING->LIN_CH_SLEEP Lin_GetStatus (Interpretation) LIN_CH_SLEEP->LIN_CH_OPERATIONAL Lin_Wakeup (with wake-up pulse) LIN_CH_SLEEP->LIN_CH_OPERATIONAL Lin_WakeupInternal (without wake-up pulse)

State diagram: Lin_Init transitions the module from LIN_UNINIT to LIN_INIT. Within it, each channel alternates between operation and sleep via sleep and wake-up services; the transition via Lin_GetStatus is an interpretation. Sources: SWS LIN Driver p. 24, [SWS_Lin_00166], [SWS_Lin_00167], [SWS_Lin_00169], [SWS_Lin_00256]

Frame Description via Lin_PduType and Data Mapping

Between LinIf and the driver, Lin_PduType describes a frame. The structure contains Pid, the checksum model Cs, the response direction Drc, the data length Dl, and the data pointer SduPtr ([SWS_Lin_00232]). The element types:

  • Lin_FramePidType: Identifier 0…0x3F with two parity bits, value range 0…0xFE ([SWS_Lin_00228]).
  • Lin_FrameDlType: 1…8 data bytes ([SWS_Lin_00231]).
  • Lin_FrameCsModelType: LIN_ENHANCED_CS or LIN_CLASSIC_CS ([SWS_Lin_00229]). The driver must be able to calculate both checksums ([SWS_Lin_00019]).

Lin_FrameResponseType specifies how the node handles the response ([SWS_Lin_00230]): It transmits it itself (LIN_FRAMERESPONSE_TX), receives a relevant external response (LIN_FRAMERESPONSE_RX), or ignores it (LIN_FRAMERESPONSE_IGNORE). In memory, the byte transmitted first resides in element 0, the byte transmitted last in element n-1 (SWS LIN Driver p. 30). If the hardware cannot buffer bytes, such as in a simple UART, the driver provides a temporary buffer. Transmitting with read-back check and receiving run non-blocking (SWS LIN Driver p. 28).

Master Channels: Lin_SendFrame and Status Polling

On master channels, LinIf triggers each frame with the asynchronous Lin_SendFrame. The service transmits the LIN header and, if applicable, the response ([SWS_Lin_00191]). This applies to receive, transmit, and slave-to-slave entries of the schedule (SWS LIN Interface p. 34, SWS LIN Interface p. 37, SWS LIN Interface p. 40).

LinIf queries the result with the synchronous Lin_GetStatus: at the earliest after the maximum frame length, at the latest at the next due schedule entry (SWS LIN Interface p. 35, [SWS_Lin_00168]). The service returns a Lin_StatusType, such as LIN_TX_OK, LIN_TX_BUSY, LIN_RX_OK, LIN_RX_BUSY, or LIN_RX_NO_RESPONSE. Via Lin_SduPtr, it additionally returns a pointer to the shadow or hardware receive buffer ([SWS_Lin_00233]).

Received data remains consistent until the next frame has been received successfully or the channel state changes. Complete receive processing may reside in Lin_GetStatus (SWS LIN Driver p. 30). For event-triggered frames, the following applies (SWS LIN Interface p. 127, SWS LIN Interface p. 129):

  • LIN_RX_NO_RESPONSE does not treat LinIf as an error.
  • LIN_RX_ERROR is considered a collision and causes a switch to the collision resolving schedule.

Lin_SendFrame, Lin_GoToSleep, and Lin_GetStatus exist only if at least one channel is configured as master via LinNodeType ([SWS_Lin_00287], [SWS_Lin_00288], [SWS_Lin_00289]). In R20-11, these services are specified as non-reentrant ([SWS_Lin_00168]). Later versions permit reentrancy for different channels (SWS LIN Driver p. 48); for R20-11, the requirement applies.

Frame processing on a master channelBSW-Task (zyklisch)LinIfLinObere SchichtUse Case: Schedule entry dueLinIf_MainFunction_<ChannelId>()RequestFrame()Lin_SendFrame(Channel, PduInfoPtr)E_OKasynchronous: header and responserun non-blockingUse Case: Status check from maximum frame lengthloopper MainFunction call as long as frame is still runningLinIf_MainFunction_<ChannelId>()Lin_GetStatus(Channel, &Lin_SduPtr)LIN_TX_BUSY / LIN_RX_BUSYaltLIN_RX_OKAcquire data via Lin_SduPtr (CopyBuffer)Rx-IndicationLIN_TX_OKTx-Confirmation (E_OK)LIN_RX_NO_RESPONSE (Event-triggered Frame)kein Kommunikationsfehler,no actionLIN_RX_ERROR (Event-triggered Frame)ChangeToCollisionResolvingSchedule()

Sequence diagram: The master triggers a frame asynchronously with Lin_SendFrame and evaluates the result in later MainFunction calls via Lin_GetStatus. Sources: [SWS_Lin_00191], [SWS_Lin_00168], SWS LIN Interface p. 128, SWS LIN Interface p. 129, SWS LIN Interface p. 40

Slave Channels: Header-Driven Response Processing

A slave channel must be able to receive a header at any time in LIN_CH_OPERATIONAL ([SWS_Lin_00272]). For each header, the driver calls LinIf_HeaderIndication. In doing so, PduPtr->Pid contains the received PID, and PduPtr->SduPtr points to its hardware or shadow buffer ([SWS_Lin_00280]). If the hardware does not detect invalid PIDs, the driver passes the PID on unchecked ([SWS_Lin_00271]). After return of E_OK, it evaluates PduPtr->Drc ([SWS_Lin_00282]):

  • For LIN_FRAMERESPONSE_TX, it uses Cs, Dl, and SduPtr to transmit the response ([SWS_Lin_00283]).
  • For LIN_FRAMERESPONSE_RX, it configures reception using Cs and Dl ([SWS_Lin_00284]).

If LinIf_HeaderIndication returns E_NOT_OK or if Drc equals LIN_FRAMERESPONSE_IGNORE, the driver ignores the response ([SWS_Lin_00286]). It then reports nothing until the next header ([SWS_Lin_00276]). It forwards a successfully received response directly via LinIf_RxIndication and confirms a transmitted one via LinIf_TxConfirmation ([SWS_Lin_00274], [SWS_Lin_00275]). Every relevant response must be completed with one of these callbacks or with LinIf_LinErrorIndication before the next header is reported ([SWS_Lin_00285]). The reception diagram distinguishes two hardware variants: hardware LIN controller and simple UART, where the driver copies each byte into a buffer via interrupt (SWS LIN Driver p. 57).

Header and response processing on a slave channelLinController/UARTLinLinIfObere SchichtUse Case: Header-Empfang in LIN_CH_OPERATIONALInterrupt (Header empfangen)LinIf_HeaderIndication(Channel, PduPtr)PduPtr->Pid, PduPtr->SduPtr gesetztEvaluatePID()optSende-FrameTriggerTransmit (Daten in SduPtr-Puffer)SetPduPtrValues() (Drc, Cs, Dl)E_OK / E_NOT_OKPduPtr->Drc auswertenaltE_OK and Drc = LIN_FRAMERESPONSE_TXTransmit response with Cs, Dl, SduPtrInterrupt (Response gesendet)LinIf_TxConfirmation()Tx-ConfirmationE_OK and Drc = LIN_FRAMERESPONSE_RXConfigure reception with Cs, DlInterrupt (Response empfangen)LinIf_RxIndication(Channel, Lin_SduPtr)Rx-Indication (CopyBuffer)E_NOT_OK or Drc = LIN_FRAMERESPONSE_IGNOREResponse ignorieren;no notification until next headerBus error during transmission/reception: abort andLinIf_LinErrorIndication(Channel, ErrorStatus)

Sequence diagram: On a slave channel, each header triggers an indication to LinIf. Depending on Drc, the driver transmits, receives, or ignores the response. Sources: [SWS_Lin_00280], [SWS_Lin_00282], [SWS_Lin_00283], [SWS_Lin_00284], [SWS_Lin_00286], [SWS_Lin_00274], [SWS_Lin_00275], SWS LIN Interface p. 121, SWS LIN Interface p. 132

Sleep, Wake-up, and Wake-up Detection

Only a master can transmit the go-to-sleep command. Lin_GoToSleep sends it asynchronously according to LIN 2.1 and sets the channel to LIN_CH_SLEEP_PENDING even in case of an erroneous transmission. If LinChannelWakeupSupport is configured, the service additionally activates bus monitoring ([SWS_Lin_00166], SWS LIN Driver p. 43). For slaves, Lin_GoToSleep is not applicable; they use Lin_GoToSleepInternal (SWS LIN Driver p. 31). This service synchronously sets LIN_CH_SLEEP, activates wake-up detection, and optionally puts the hardware into a power-saving mode ([SWS_Lin_00167], SWS LIN Driver p. 44). Each channel accepts sleep requests independently of the others (SWS LIN Driver p. 31).

Two services are available for wake-up. Lin_Wakeup transmits a wake-up pulse onto the bus, while Lin_WakeupInternal sets the channel to operational without a pulse ([SWS_Lin_00169], [SWS_Lin_00262]). Lin_CheckWakeup checks a wake-up from the bus. If the service detects an event, such as a permanently low RxD level, it immediately reports it via EcuM_SetWakeupEvent to the EcuM and via LinIf_WakeupConfirmation to LinIf ([SWS_Lin_00160], SWS LIN Driver p. 42). Based on the wake-up source, LinIf_CheckWakeup decides whether Lin_CheckWakeup or LinTrcv_CheckWakeup is called (SWS LIN Interface p. 112). LIN does not require wake-up validation (SWS EcuM p. 173).

Checking a wake-up from the LIN busLIN-Hardware (Controller/Transceiver)EcuMLinIfLinKanal in LIN_CH_SLEEP,Bus monitoring active (LinChannelWakeupSupport)Wake-up event (interrupt or polling)LinIf_CheckWakeup(WakeupSource)Lin_CheckWakeup(Channel)(source LIN controller; otherwise LinTrcv_CheckWakeup)Wake-up auswerten(z. B. RxD dauerhaft low)optWake-up erkanntEcuM_SetWakeupEvent()LinIf_WakeupConfirmation()E_OK / E_NOT_OKE_OK / E_NOT_OKLIN does not require wake-up validation

Sequence diagram: A wake-up from the bus is passed to Lin_CheckWakeup via EcuM and LinIf_CheckWakeup. The driver reports a detected event to EcuM and LinIf. Sources: [SWS_Lin_00160], [SWS_Lin_00234], SWS LIN Driver p. 42, SWS LIN Interface p. 112, SWS EcuM p. 147

Behavior in the event of an error

When development error detection is enabled, the services report misuse to the DET ([SWS_Lin_00258], [SWS_Lin_00259], [SWS_Lin_00260]; for Lin_Wakeup analogously SWS LIN Driver p. 45):

  • LIN_E_UNINIT when called prior to initialization,
  • LIN_E_INVALID_CHANNEL for an invalid or inactive channel,
  • LIN_E_STATE_TRANSITION upon a wake-up outside of LIN_CH_SLEEP.

Lin_GetVersionInfo reports a NULL pointer with LIN_E_PARAM_POINTER ([SWS_Lin_00161], SWS LIN Driver p. 41). When the DET is disabled, Lin_CheckWakeup returns E_NOT_OK for an invalid channel (SWS LIN Driver p. 42). In general, E_NOT_OK and LIN_NOT_OK indicate that a development or production error has occurred ([SWS_Lin_00191], [SWS_Lin_00233]).

LIN_E_TIMEOUT is specified as a production error. If a state change must be waited for following a modification to hardware control registers, a configurable timeout safeguards this waiting. If it expires, the error is reported ([SWS_Lin_00290]). The notification is sent via Dem_SetEventStatus ([SWS_Lin_00234]) to the event referenced in LinDemEventParameterRefs (SWS LIN Driver p. 65).

The driver reports communication errors differently depending on the node type. Master channels return them as the status of Lin_GetStatus ([SWS_Lin_00233]):

  • LIN_TX_HEADER_ERROR upon readback, parity, or bus errors in the header,
  • LIN_TX_ERROR upon erroneous response transmission,
  • LIN_RX_ERROR upon framing, overrun, or checksum errors, as well as a response that is too short.

Slave channels abort frame processing and call LinIf_LinErrorIndication with a Lin_SlaveErrorType ([SWS_Lin_00277], [SWS_Lin_91140]). They report invalid bus events while waiting for a header as LIN_ERR_HEADER ([SWS_Lin_00281]).

LinFehlerpfade start Error event in LIN driver art Type of error? start->art dev Development error (only with DET detection enabled) art->dev Misuse of API hw Timeout while waiting after changing hardware control registers art->hw Hardwarefehler com Communication error on the bus art->com Busfehler det Det_ReportError: LIN_E_UNINIT / LIN_E_INVALID_CHANNEL / LIN_E_STATE_TRANSITION / LIN_E_PARAM_POINTER dev->det ret Return E_NOT_OK or LIN_NOT_OK det->ret dem Dem_SetEventStatus: LIN_E_TIMEOUT hw->dem dem->ret typ Node type of channel? com->typ master Master: error status in Lin_GetStatus (LIN_TX_HEADER_ERROR, LIN_TX_ERROR, LIN_RX_ERROR) typ->master Master slave Slave: aktuelle Frame-Bearbeitung abbrechen typ->slave Slave sind LinIf_LinErrorIndication(Channel, Lin_SlaveErrorType) z. B. LIN_ERR_HEADER, LIN_ERR_RESP_CHKSUM, LIN_ERR_NO_RESP slave->sind

Activity diagram: Development errors are sent to the DET, the hardware timeout to the DEM. A master channel reports bus communication errors as a status, a slave channel as an error indication. Sources: [SWS_Lin_00258], [SWS_Lin_00290], [SWS_Lin_00233], [SWS_Lin_00277], [SWS_Lin_00281], [SWS_Lin_00235]

Further detailed evidence

AI-generated guide. It relies exclusively on the provided evidence; individual document passages originate from later releases. The requirements of R20-11 are normative. Statements marked as interpretations are not directly substantiated.

LIN Driver (Lin)

Controls hardware LIN controllers on the ECU.

Funktionen — Übersicht

Typen — Übersicht

Funktionen & Typen — Detailansicht

function Lin_Init [SWS_Lin_00006] 📄 PDF

void Lin_Init (const Lin_ConfigType* Config);

Initializes the LIN module.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 2e00d30976de Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function Lin_Init serves to initialize the LIN driver module of the AUTOSAR Classic Platform according to specification [SWS_Lin_00006]. The interface is provided via header Lin.h and is addressed internally via service ID 0x00 [SWS_Lin_00006].

The following parameter and interface conditions apply to the usage and calling of the function:

  • Input parameters: Config is expected as the only input parameter [SWS_Lin_00006]. This is a pointer to the configuration data set of the LIN driver of type const Lin_ConfigType* [SWS_Lin_00006]. Neither input/output parameters nor pure output parameters are intended for this interface [SWS_Lin_00006].
  • Return value: The function returns no return value (void) [SWS_Lin_00006].
  • Execution semantics: The processing takes place completely synchronously (Synchronous), so that the initialization steps of the driver are processed directly during the function call [SWS_Lin_00006].

Regarding the call context and concurrency, it is defined that Lin_Init is non-reentrant (Non Reentrant) [SWS_Lin_00006]. Interpretation: Since the function fundamentally initializes the LIN driver module and is designed to be non-reentrant, it is likely to be called typically during the startup phase of the overall system before other services of the LIN driver are used. Question Q-d535602a0d4708ce (open) Simultaneous or multiple calls from different execution contexts are presumably impermissible in this case.

This text was generated by an AI based on the AUTOSAR R20-11 specification.

Implementer's Guide to follow (complexity I1)

function Lin_CheckWakeup [SWS_Lin_00160] 📄 PDF

Std_ReturnType Lin_CheckWakeup (uint8 Channel);

This function checks if a wakeup has occurred on the addressed LIN channel.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 706d1bc705a9 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function Lin_CheckWakeup serves to check whether a wakeup event has occurred on an addressed LIN channel [SWS_Lin_00160]. The interface is available via header file Lin.h and has the service ID 0x0a [SWS_Lin_00160]. To identify the channel, the function accepts parameter Channel of data type uint8 [SWS_Lin_00160]. Further input or output parameters are not intended for this interface [SWS_Lin_00160].

The result of execution is reported back synchronously via the return type Std_ReturnType [SWS_Lin_00160]. The status value E_OK indicates that no error occurred during execution of the API call [SWS_Lin_00160]. If, on the other hand, an error occurs during execution, the service provides the return value E_NOT_OK [SWS_Lin_00160]. Specific error codes as well as notifications to DET or DEM are not specified for this element in the sources.

Regarding concurrency behavior, Lin_CheckWakeup is defined as non-reentrant (Non Reentrant) [SWS_Lin_00160]. Callers must therefore ensure that calls take place sequentially and no simultaneous execution occurs. Since the exact call context is not defined in more detail in the specification, the call is presumably likely to be initiated by higher-level layers such as Wakeup Management or the ECU State Manager. Question Q-40221056a2e2c042 (open)

This text was created by an AI; all statements originate from the requirements of the AUTOSAR standard.

function Lin_SendFrame [SWS_Lin_00191] 📄 PDF

Std_ReturnType Lin_SendFrame (uint8 Channel, const Lin_PduType* PduInfoPtr);

Sends a LIN header and a LIN response, if necessary. The direction of the frame response (master response, slave response, slave - to - slave communication) is provided by the Pdu Info Ptr. Only used for LIN master nodes.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: fb92456f64e2 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The function Lin_SendFrame serves to send a LIN header and, if required, the associated LIN response and is exclusively intended for LIN master nodes [SWS_Lin_00191]. Via the pointer PduInfoPtr, the transmission direction of the frame response is defined, which can represent a master response, a slave response, or a slave-to-slave communication [SWS_Lin_00191].

Call and parameters: Execution of the function is performed asynchronously [SWS_Lin_00191]. Upon calling, the following input parameters are passed:

  • Channel: Determines the LIN channel to be addressed as uint8 [SWS_Lin_00191].
  • PduInfoPtr: Pointer to a structure of type Lin_PduType, which contains the protected identifier (PID), the checksum model, the response type, the data length (Dl), as well as the data pointer to the SDU [SWS_Lin_00191].

Return values and error behavior: The function provides the return type Std_ReturnType [SWS_Lin_00191]:

  • E_OK: The transmit request was successfully accepted and acknowledged for asynchronous execution [SWS_Lin_00191].
  • E_NOT_OK: The transmit request was rejected because a development error or a production error is present [SWS_Lin_00191].

Concurrency and integration: The interface is specified as non-reentrant (Non Reentrant), which is why parallel calls on the same channel must be avoided [SWS_Lin_00191]. The function has the service ID 0x04 and is included via header file Lin.h [SWS_Lin_00191].

This usage note was generated automatically based on the AUTOSAR R20-11 specification.

function Lin_GoToSleep [SWS_Lin_00166] 📄 PDF

Std_ReturnType Lin_GoToSleep (uint8 Channel);

The service instructs the driver to transmit a go - to - sleep - command on the addressed LIN channel. Only used for LIN master nodes.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: e15a8b1ff51c Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Function and Call Context

The function Lin_GoToSleep instructs the LIN driver to send a go-to-sleep command on the addressed LIN channel [SWS_Lin_00166]. This driver service has the Service ID 0x06 and is provided via the header file Lin.h [SWS_Lin_00166]. Execution of the service is asynchronous for the caller [SWS_Lin_00166]. The function declaration is Std_ReturnType Lin_GoToSleep (uint8 Channel) [SWS_Lin_00166].

Parameters and Return Values

Channel of type uint8 is passed as the only input parameter, which identifies the LIN channel to be addressed [SWS_Lin_00166]. Additional input or output parameters do not exist [SWS_Lin_00166].

The return value of type Std_ReturnType provides information about the acceptance of the request [SWS_Lin_00166]:

  • E_OK: The go-to-sleep command was successfully accepted by the driver [SWS_Lin_00166].
  • E_NOT_OK: The command was not accepted because a development error or a production error occurred [SWS_Lin_00166].

Restrictions and Concurrency

Regarding concurrency, the function is declared as non-reentrant (Non Reentrant) [SWS_Lin_00166]. As an essential functional restriction, Lin_GoToSleep is intended exclusively for LIN master nodes [SWS_Lin_00166].

This usage note was generated automatically based on the AUTOSAR specification R20-11.

function Lin_GoToSleepInternal [SWS_Lin_00167] 📄 PDF

Std_ReturnType Lin_GoToSleepInternal (uint8 Channel);

Sets the channel state to LIN_ CH_ SLEEP, enables the wake - up detection and optionally sets the LIN hardware unit to reduced power operation mode (if supported by HW).

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: dd333dd75b58 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The synchronous function Lin_GoToSleepInternal sets the state of the addressed LIN channel to LIN_CH_SLEEP, activates wake-up detection, and optionally places the LIN hardware unit into a reduced power saving mode, provided this is supported by the hardware [SWS_Lin_00167]. Addressing of the desired LIN channel is performed via input parameter Channel of type uint8, while no further input or output parameters exist [SWS_Lin_00167].

The result of the execution is signaled synchronously via the return value of type Std_ReturnType [SWS_Lin_00167]:

  • E_OK: The command to set into sleep mode was successfully accepted [SWS_Lin_00167].
  • E_NOT_OK: The command was rejected because a development or a production error occurred [SWS_Lin_00167].

Regarding concurrency and call context, Lin_GoToSleepInternal is specified as non-reentrant (Non Reentrant) [SWS_Lin_00167]. Calling software units must therefore ensure that calls occur sequentially and are not superimposed concurrently. The function is defined under Service ID 0x09 and is available via the header file Lin.h [SWS_Lin_00167].

This usage note was generated automatically based on the specification.

Implementer's Guide to follow (complexity I1)

function Lin_Wakeup [SWS_Lin_00169] 📄 PDF

Std_ReturnType Lin_Wakeup (uint8 Channel);

Generates a wake up pulse and sets the channel state to LIN_ CH_ OPERATIONAL.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 6a03f55b81c5 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

Usage and Call Context

The function Lin_Wakeup belongs to the driver module Lin of the AUTOSAR Classic Platform [SWS_Lin_00169]. Its purpose is to generate a wake-up pulse on the addressed bus channel and immediately transition the channel state to LIN_CH_OPERATIONAL [SWS_Lin_00169]. The interface is provided via the header file Lin.h with Service ID 0x07 and signature Std_ReturnType Lin_Wakeup (uint8 Channel) [SWS_Lin_00169].

As an input parameter, the function accepts Channel of type uint8, specifying the LIN channel to be addressed [SWS_Lin_00169]. Input/output parameters or pure output parameters do not exist [SWS_Lin_00169]. The execution behavior is asynchronous; return from the function thus merely confirms acceptance of the job, while the physical wake-up pulse is subsequently generated on the bus [SWS_Lin_00169].

Return Values and Error Handling

The result of the job acceptance is reported via the return type Std_ReturnType [SWS_Lin_00169]:

  • E_OK: The wake-up request was accepted by the LIN driver and will be processed [SWS_Lin_00169].
  • E_NOT_OK: The request was rejected because a development or production error occurred [SWS_Lin_00169].

Concurrency and Limitations

According to the specification, the function is classified as non-reentrant (Non Reentrant) [SWS_Lin_00169]. Calls must therefore not occur interruptingly or concurrently from different execution contexts for the same driver instance. Calling components must ensure appropriate synchronization.

This usage note was generated automatically based on the AUTOSAR Classic R20-11 specification.

Implementer's Guide to follow (complexity I1)

function Lin_WakeupInternal [SWS_Lin_00256] 📄 PDF

Std_ReturnType Lin_WakeupInternal (uint8 Channel);

Sets the channel state to LIN_ CH_ OPERATIONAL without generating a wake up pulse.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 5812acd7bb93 Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The function Lin_WakeupInternal provided via header Lin.h transitions a LIN channel asynchronously into the operational state LIN_CH_OPERATIONAL without outputting a wakeup pulse to the physical LIN bus [SWS_Lin_00256]. It processes internal wakeup requests of the higher-level LIN interface in which no bus wake-up signal may be sent [SWS_Lin_00262]. The call takes place via parameter Channel of type uint8. The function returns E_OK if the wakeup request was accepted, or E_NOT_OK if the request was rejected or a development or production error is present [SWS_Lin_00256].

Regarding call context and concurrency, Lin_WakeupInternal is non-reentrant (Non Reentrant) [SWS_Lin_00256]. As a strict ordering condition, the state machine of the addressed channel must be in the sleep state LIN_CH_SLEEP at the time of calling [SWS_Lin_00260].

When development error detection is enabled, the module monitors the following error conditions and reports corresponding development errors:

  • LIN_E_UNINIT: Call of the function before initialization of the LIN driver module [SWS_Lin_00258].
  • LIN_E_INVALID_CHANNEL: The passed channel parameter is invalid or the addressed channel is inactive [SWS_Lin_00259].
  • LIN_E_STATE_TRANSITION: An invalid state transition has occurred because the LIN channel is not in state LIN_CH_SLEEP [SWS_Lin_00260].

This usage note was generated automatically based on the specification requirements.

Implementer's Guide to follow (complexity I1)

type Lin_ConfigType [SWS_Lin_00227] 📄 PDF

This is the type of the external data structure containing the overall initialization data for the LIN driver and the SFR settings affecting the LIN channels. A pointe r to such a structure is provided to the LIN driver initialization routine for configuration of the driver, LIN hardware unit and LIN hardware channels.

type Lin_FramePidType [SWS_Lin_00228] 📄 PDF

Represents all valid protected identifier used by Lin_ Send Frame().

type Lin_FrameCsModelType [SWS_Lin_00229] 📄 PDF

This type is used to specify the Checksum model to be used for the LIN Frame.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: e48ff51e4fe8 Provenance Open questions (2)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The enumeration type Lin_FrameCsModelType serves according to [SWS_Lin_00229] to define the checksum model that is used for an individual LIN frame. The type definition is available as standard via header Lin_GeneralTypes.h [SWS_Lin_00229].

According to [SWS_Lin_00229], two values are available for the configuration:

As a pure data type, Lin_FrameCsModelType does not define any function interfaces, return values, or DET/DEM error messages itself [SWS_Lin_00229]. Its use is likely to primarily take place as a parameter or element within configuration and frame descriptors in module Lin (interpretation), to inform the driver which algorithm is used to verify the frame checksum upon transmission or reception. Question Q-6d3354059d0641df (open) Error handling for invalid values must therefore presumably be caught at the level of the processing driver APIs or module configuration (interpretation). Question Q-06e26f4bcff1e520 (open)

This text was generated by an AI based on the AUTOSAR specification R20-11.

Implementer's Guide to follow (complexity I1)

type Lin_FrameResponseType [SWS_Lin_00230] 📄 PDF

Thi s type is used to specify whether the frame processor is required to transmit the response part of the LIN frame.

type Lin_PduType [SWS_Lin_00232] 📄 PDF

This Type is used to provide PID, checksum model, data length and SDU pointer from the LIN Interface to the LIN driver.

type Lin_StatusType [SWS_Lin_00233] 📄 PDF

LIN operation states for a LIN channel or frame, as returned by the API service Lin_ Get Status().

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 7c3f3f6172fb Provenance
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The enumeration type Lin_StatusType is provided via Lin_GeneralTypes.h and defines the operational and transmission states for LIN channels and LIN frames that are reported as the return value of the API service Lin_GetStatus() [SWS_Lin_00233].

The state values are divided into channel states and frame operation values [SWS_Lin_00233]:

  • Channel status: LIN_OPERATIONAL represents normal operation, in which the LIN channel is ready to transmit the next header and no data of a previous frame is present (e.g. after initialization). In contrast, LIN_CH_SLEEP represents the sleep state of the channel, in which wake-up detection for slave nodes is enabled [SWS_Lin_00233].
  • Ongoing transmissions: LIN_TX_BUSY indicates an ongoing transmission of header or response. LIN_RX_BUSY signals an ongoing reception process in which at least one response byte, but not yet the final checksum byte, has arrived [SWS_Lin_00233].
  • Successful completion: LIN_TX_OK confirms the successful transmission, while LIN_RX_OK indicates the error-free reception of a complete response [SWS_Lin_00233].
  • Error states and timeouts: LIN_NOT_OK indicates development or production errors. For transmission operations, the type distinguishes between LIN_TX_HEADER_ERROR (error during header transmission due to data mismatch, identifier parity errors, or physical bus errors) and LIN_TX_ERROR (error during response transmission due to data mismatch or bus errors). On the reception side, LIN_RX_ERROR designates reception errors such as framing, overrun, checksum errors, or incomplete responses; LIN_RX_NO_RESPONSE reports the complete absence of response bytes [SWS_Lin_00233].

This usage note was generated automatically based on the specification AUTOSAR CP R20-11.

Implementer's Guide to follow (complexity I1)

type Lin_SlaveErrorType [SWS_Lin_91140] 📄 PDF

This type represents the slave error types that are detected during header reception and response transmission / reception.

AI-GENERATED unreviewed Model: gemini-3.8-flash-medium · Effort: medium · Temperature: not controllable · Prompt: 34669dffb4d6 Provenance Open questions (1)
translated from the German guidegemini-3.8-flash-low · 2026-10-13 · German original

The enumeration type Lin_SlaveErrorType represents the specific error types of a LIN slave that are detected during reception of the header as well as during transmission or reception of the response [SWS_Lin_91140]. The type definition is made available via the header file Lin_GeneralTypes.h [SWS_Lin_91140].

Error States and Value Range

The enumeration covers errors during the various phases of LIN communication [SWS_Lin_91140]:

  • LIN_ERR_HEADER: Signals an error during reception of the LIN header [SWS_Lin_91140].
  • LIN_ERR_RESP_STOPBIT: Indicates a framing error or stop bit error in the response [SWS_Lin_91140].
  • LIN_ERR_RESP_CHKSUM: Designates a checksum error of the received response [SWS_Lin_91140].
  • LIN_ERR_RESP_DATABIT: Reports a bit monitoring error of a transmitted data bit in the response [SWS_Lin_91140].
  • LIN_ERR_NO_RESP: Indicates that no response to the header was received [SWS_Lin_91140].
  • LIN_ERR_INC_RESP: Occurs when an incomplete response was received or transmitted [SWS_Lin_91140].

Usage and restrictions

Interpretation: Since the present specification excerpt does not contain specific function signatures, the type likely serves as a return value or status parameter in notifications to upper-layer modules such as the LIN interface. Question Q-6a9c54976345ca2b (open) Further details on reentrancy, call contexts, or synchronous or asynchronous execution are not contained in the excerpt.

This usage note was generated automatically based on the specification of AUTOSAR R20-11.

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

Record
AUTOSAR/AP/record/CP_MOD_Lin
Status
unspecified
Version
AUTOSAR/AP/record/CP_MOD_Lin@rel:R20-11#e8ea5339
Content hash
e8ea5339
Source
https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_LINDriver.pdf#nameddest=SWS_Lin_00006

Initialization and status

Lin_GetStatus function

Service Lin_GetStatus.

Lin_StatusType Lin_GetStatus (uint8 Channel, const uint8* * Lin_SduPtr);

Returns the version information of this module.

void Lin_GetVersionInfo (Std_VersionInfoType* versioninfo);
Lin_Init function

Initializes the LIN module.

void Lin_Init (const Lin_ConfigType* Config);

Services

This function checks if a wakeup has occurred on the addressed LIN channel.

Std_ReturnType Lin_CheckWakeup (uint8 Channel);
Lin_GoToSleep function

The service instructs the driver to transmit a go - to - sleep - command on the addressed LIN channel. Only used for LIN master nodes.

Std_ReturnType Lin_GoToSleep (uint8 Channel);

Sets the channel state to LIN_ CH_ SLEEP, enables the wake - up detection and optionally sets the LIN hardware unit to reduced power operation mode (if supported by HW).

Std_ReturnType Lin_GoToSleepInternal (uint8 Channel);
Lin_SendFrame function

Sends a LIN header and a LIN response, if necessary. The direction of the frame response (master response, slave response, slave - to - slave communication) is provided by the Pdu Info Ptr. Only used for LIN master nodes.

Std_ReturnType Lin_SendFrame (uint8 Channel, const Lin_PduType* PduInfoPtr);
Lin_Wakeup function

Generates a wake up pulse and sets the channel state to LIN_ CH_ OPERATIONAL.

Std_ReturnType Lin_Wakeup (uint8 Channel);

Sets the channel state to LIN_ CH_ OPERATIONAL without generating a wake up pulse.

Std_ReturnType Lin_WakeupInternal (uint8 Channel);

Types

This is the type of the external data structure containing the overall initialization data for the LIN driver and the SFR settings affecting the LIN channels. A pointe r to such a structure is provided to the LIN driver initialization routine for configuration of the driver, LIN hardware unit and LIN hardware channels.

This type is used to specify the Checksum model to be used for the LIN Frame.

This type is used to specify the number of SDU data bytes to copy.

Represents all valid protected identifier used by Lin_ Send Frame().

Thi s type is used to specify whether the frame processor is required to transmit the response part of the LIN frame.

This Type is used to provide PID, checksum model, data length and SDU pointer from the LIN Interface to the LIN driver.

This type represents the slave error types that are detected during header reception and response transmission / reception.

LIN operation states for a LIN channel or frame, as returned by the API service Lin_ Get Status().