LIN Driver (Lin)
Controls hardware LIN controllers on the ECU.
Funktionen — Übersicht
void Lin_Init (const Lin_ConfigType* Config);Initializes the LIN module.Std_ReturnType Lin_CheckWakeup (uint8 Channel);This function checks if a wakeup has occurred on the addressed LIN channel.void Lin_GetVersionInfo (Std_VersionInfoType* versioninfo);Returns the version information of this module.Std_ReturnType Lin_SendFrame (uint8 Channel, const Lin_PduType* PduInfoPtr);Sends a LIN header and a LIN response, if necessary.Std_ReturnType Lin_GoToSleep (uint8 Channel);The service instructs the driver to transmit a go - to - sleep - command on the addressed LIN channel.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...Std_ReturnType Lin_Wakeup (uint8 Channel);Generates a wake up pulse and sets the channel state to LIN_ CH_ OPERATIONAL.Std_ReturnType Lin_WakeupInternal (uint8 Channel);Sets the channel state to LIN_ CH_ OPERATIONAL without generating a wake up pulse.Lin_StatusType Lin_GetStatus (uint8 Channel, const uint8* * Lin_SduPtr);Service Lin_GetStatus.
Typen — Übersicht
struct Lin_ConfigTypeThis is the type of the external data structure containing the overall initialization data for the LIN driver and the SFR...Lin_FramePidTypeRepresents all valid protected identifier used by Lin_ Send Frame().Lin_FrameCsModelTypeThis type is used to specify the Checksum model to be used for the LIN Frame.Lin_FrameResponseTypeThi s type is used to specify whether the frame processor is required to transmit the response part of the LIN frame.Lin_FrameDlTypeThis type is used to specify the number of SDU data bytes to copy.Lin_PduTypeThis Type is used to provide PID, checksum model, data length and SDU pointer from the LIN Interface to the LIN driver.enum Lin_StatusTypeLIN operation states for a LIN channel or frame, as returned by the API service Lin_ Get Status().enum Lin_SlaveErrorTypeThis type represents the slave error types that are detected during header reception and response transmission / reception.
Funktionen & Typen — Detailansicht
函数 Lin_Init [SWS_Lin_00006] 📄 PDF
void Lin_Init (const Lin_ConfigType* Config);
Initializes the LIN module.
同步函数 Lin_Init 用于根据规范 [SWS_Lin_00006] 初始化 AUTOSAR Classic 平台的 LIN 驱动模块。该接口通过头文件 Lin.h 提供,并在内部通过服务 ID 0x00 进行寻址 [SWS_Lin_00006]。
对于该函数的使用和调用,适用以下参数和接口条件:
- 输入参数:作为唯一的传入参数,期望
Config[SWS_Lin_00006]。此处是指向类型为const Lin_ConfigType*的 LIN 驱动程序配置数据集的指针 [SWS_Lin_00006]。该接口既未规定输入/输出参数,也未规定纯输出参数 [SWS_Lin_00006]。 - 返回值:该函数不返回任何返回值(
void)[SWS_Lin_00006]。 - 执行语义:处理完全同步进行(
Synchronous),因此驱动程序的初始化步骤直接在函数调用期间执行完毕 [SWS_Lin_00006]。
关于调用上下文和并发性,规定 Lin_Init 为不可重入(Non Reentrant)[SWS_Lin_00006]。解释:由于该函数对 LIN 驱动模块进行基本初始化并且被设计为不可重入,因此通常应在整个系统的启动阶段、在调用 LIN 驱动程序的其他服务之前被调用。 问题 Q-d535602a0d4708ce (未决)在此过程中,来自不同执行上下文的并发或多次调用推测是不允许的。
本文由 AI 基于 AUTOSAR R20-11 规范生成。
实现者指南即将推出(复杂度 I1)
函数 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.
同步函数 Lin_CheckWakeup 用于检查寻址的 LIN 通道上是否发生了唤醒事件 [SWS_Lin_00160]。该接口通过头文件 Lin.h 提供,并具有服务 ID 0x0a [SWS_Lin_00160]。为了标识通道,该函数接收数据类型为 uint8 的参数 Channel [SWS_Lin_00160]。该接口未规定其他输入或输出参数 [SWS_Lin_00160]。
执行结果通过返回类型 Std_ReturnType 同步返回 [SWS_Lin_00160]。状态值 E_OK 表示在 API 调用执行期间未发生错误 [SWS_Lin_00160]。相反,如果在执行期间发生错误,该服务将返回返回值 E_NOT_OK [SWS_Lin_00160]。源资料中未针对此元素指定特定的错误码以及向 DET 或 DEM 发送的通知。
关于并发行为,Lin_CheckWakeup 被定义为不可重入(Non Reentrant)[SWS_Lin_00160]。因此,调用方必须确保按序调用且不发生并发执行。由于规范中未更详细地定义确切的调用上下文,调用推测可能由诸如唤醒管理或 ECU State Manager 等上层软件层发起。 问题 Q-40221056a2e2c042 (未决)
本文字由人工智能生成;所有陈述均源自 AUTOSAR 标准的规定。
函数 Lin_GetVersionInfo [SWS_Lin_00161] 📄 PDF
void Lin_GetVersionInfo (Std_VersionInfoType* versioninfo);
Returns the version information of this module.
函数 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.
函数 Lin_SendFrame 用于发送 LIN Header 以及在需要时发送关联的 LIN Response,且仅用于 LIN 主节点 [SWS_Lin_00191]。通过指针 PduInfoPtr 确定帧 Response 的传输方向,该方向可以映射主节点响应、从节点响应或从节点到从节点的通信 [SWS_Lin_00191]。
调用和参数:该函数的执行为异步方式 [SWS_Lin_00191]。调用时将传递以下输入参数:
Channel:将要寻址的 LIN 通道指定为uint8[SWS_Lin_00191]。PduInfoPtr:指向类型为Lin_PduType的结构的指针,该结构包含受保护标识符(PID)、校验和模型(Checksum Model)、Response 类型、数据长度(Dl)以及指向 SDU 的数据指针 [SWS_Lin_00191]。
返回值和错误行为:该函数返回返回类型 Std_ReturnType [SWS_Lin_00191]:
E_OK:发送请求已成功接收并被接受进行异步执行 [SWS_Lin_00191]。E_NOT_OK:发送请求被拒绝,因为存在开发错误(Development Error)或生产错误(Production Error)[SWS_Lin_00191]。
并发与集成:该接口被指定为不可重入(Non Reentrant),因此必须避免在同一通道上发生并发调用 [SWS_Lin_00191]。该函数具有服务 ID 0x04,并通过头文件 Lin.h 包含 [SWS_Lin_00191]。
本使用说明基于 AUTOSAR 规范 R20-11 自动生成。
函数 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.
功能与调用上下文
函数 Lin_GoToSleep 指示 LIN 驱动程序在寻址的 LIN 通道上发送 Go-to-Sleep 命令 [SWS_Lin_00166]。该驱动程序服务具有服务 ID 0x06,并通过头文件 Lin.h 提供 [SWS_Lin_00166]。对于调用者而言,该服务的执行是异步的 [SWS_Lin_00166]。函数声明为 Std_ReturnType Lin_GoToSleep (uint8 Channel) [SWS_Lin_00166]。
参数与返回值
传入的唯一传递参数是 uint8 类型的 Channel,用于标识要寻址的 LIN 通道 [SWS_Lin_00166]。不存在额外的输入或输出参数 [SWS_Lin_00166]。
Std_ReturnType 类型的返回值提供有关请求接受情况的信息 [SWS_Lin_00166]:
E_OK:Go-to-Sleep 命令已被驱动程序成功接受 [SWS_Lin_00166]。E_NOT_OK:命令未被接受,因为发生了开发错误或生产错误 [SWS_Lin_00166]。
限制与并发性
关于并发性,该函数被声明为不可重入的(Non Reentrant)[SWS_Lin_00166]。作为一项重要的功能限制,Lin_GoToSleep 仅适用于 LIN 主节点 [SWS_Lin_00166]。
本使用说明基于 AUTOSAR 规范 R20-11 自动生成。
函数 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).
同步函数 Lin_GoToSleepInternal 将寻址的 LIN 通道状态设置为 LIN_CH_SLEEP,激活唤醒检测,并在硬件支持的情况下可选地将 LIN 硬件单元置于降低能耗的节能模式 [SWS_Lin_00167]。对所需 LIN 通道的寻址通过 uint8 类型的输入参数 Channel 进行,同时没有其他输入或输出参数 [SWS_Lin_00167]。
执行结果通过 Std_ReturnType 类型的返回值同步指示 [SWS_Lin_00167]:
E_OK:置于休眠模式的命令已被成功接受 [SWS_Lin_00167]。E_NOT_OK:该命令被拒绝,因为发生了开发错误或生产错误 [SWS_Lin_00167]。
关于并发性和调用上下文,Lin_GoToSleepInternal 被指定为不可重入的(Non Reentrant)[SWS_Lin_00167]。因此调用软件单元必须确保调用按顺序进行,而不发生并发叠加。该函数在服务 ID 0x09 下定义,并通过头文件 Lin.h 提供 [SWS_Lin_00167]。
本使用说明基于规范自动生成。
实现者指南即将推出(复杂度 I1)
函数 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.
用法与调用上下文
函数 Lin_Wakeup 属于 AUTOSAR Classic 平台的驱动程序模块 Lin [SWS_Lin_00169]。其目的在于在寻址的总线通道上生成唤醒脉冲(Wake-up Pulse),并将通道状态直接转换为 LIN_CH_OPERATIONAL [SWS_Lin_00169]。该接口通过头文件 Lin.h 提供,服务 ID 为 0x07,签名为 Std_ReturnType Lin_Wakeup (uint8 Channel) [SWS_Lin_00169]。
作为输入参数,该函数接收 uint8 类型的 Channel,由此指定要控制的 LIN 通道 [SWS_Lin_00169]。不存在输入/输出参数或纯输出参数 [SWS_Lin_00169]。执行行为是异步的(Asynchronous);因此从该函数返回仅确认任务的接受,而物理唤醒脉冲随后在总线上生成 [SWS_Lin_00169]。
返回值与错误处理
任务接受的结果通过返回类型 Std_ReturnType 报告 [SWS_Lin_00169]:
E_OK:唤醒请求已被 LIN 驱动程序接受并正在处理 [SWS_Lin_00169]。E_NOT_OK:该请求被拒绝,因为发生了开发错误或生产错误 [SWS_Lin_00169]。
并发性与限制
根据规范,该函数被归类为不可重入的(Non Reentrant)[SWS_Lin_00169]。因此,不得针对同一驱动程序实例从不同的执行上下文以中断或并发方式进行调用。调用组件必须确保相应的同步。
本使用说明基于 AUTOSAR Classic R20-11 规范自动生成。
实现者指南即将推出(复杂度 I1)
函数 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.
通过头文件 Lin.h 提供的函数 Lin_WakeupInternal 将 LIN 通道异步置于运行状态 LIN_CH_OPERATIONAL,而不会在物理 LIN 总线上输出唤醒脉冲 [SWS_Lin_00256]。它处理上层 LIN 接口的内部唤醒请求,在这些请求中不得发送总线唤醒信号 [SWS_Lin_00262]。通过类型为 uint8 的参数 Channel 进行调用。如果唤醒请求被接受,该函数返回 E_OK;如果请求被拒绝或存在开发/生产错误,则返回 E_NOT_OK [SWS_Lin_00256]。
关于调用上下文和并发性,Lin_WakeupInternal 为不可重入(Non Reentrant)[SWS_Lin_00256]。作为严格的时序条件,寻址通道的状态机在调用时必须处于空闲状态 LIN_CH_SLEEP [SWS_Lin_00260]。
在启用开发错误检测时,该模块监视以下错误条件并报告相应的开发错误:
LIN_E_UNINIT:在 LIN 驱动模块初始化之前调用该函数 [SWS_Lin_00258]。LIN_E_INVALID_CHANNEL:传递的通道参数无效或寻址的通道处于非激活状态 [SWS_Lin_00259]。LIN_E_STATE_TRANSITION:存在不允许的状态转换,因为 LIN 通道未处于状态LIN_CH_SLEEP[SWS_Lin_00260]。
此使用说明是根据规范要求自动生成的。
实现者指南即将推出(复杂度 I1)
函数 Lin_GetStatus [SWS_Lin_00168] 📄 PDF
Lin_StatusType Lin_GetStatus (uint8 Channel, const uint8* * Lin_SduPtr);
Service Lin_GetStatus.
类型 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.
类型 Lin_FramePidType [SWS_Lin_00228] 📄 PDF
Represents all valid protected identifier used by Lin_ Send Frame().
类型 Lin_FrameCsModelType [SWS_Lin_00229] 📄 PDF
This type is used to specify the Checksum model to be used for the LIN Frame.
根据 [SWS_Lin_00229],枚举类型 Lin_FrameCsModelType 用于确定单个 LIN 帧所使用的校验和模型。类型定义默认通过头文件 Lin_GeneralTypes.h 提供 [SWS_Lin_00229]。
根据 [SWS_Lin_00229],有两个值可供配置:
LIN_ENHANCED_CS:选择增强校验和模型(Enhanced checksum model)[SWS_Lin_00229]。LIN_CLASSIC_CS:选择经典校验和模型(Classic checksum model)[SWS_Lin_00229]。
作为纯数据类型,Lin_FrameCsModelType 本身未定义函数接口、返回值或 DET/DEM 错误消息 [SWS_Lin_00229]。其使用主要可能作为参数或元素出现在模块 Lin 中的配置和帧描述符内(解释),以告知驱动程序在传输或接收时应根据哪种算法验证帧校验和。 问题 Q-6d3354059d0641df (未决)因此,针对无效值的错误处理推测必须在处理该数据的驱动程序 API 或模块配置层级进行拦截(解释)。 问题 Q-06e26f4bcff1e520 (未决)
本段文本由人工智能基于 AUTOSAR 规范 R20-11 生成。
实现者指南即将推出(复杂度 I1)
类型 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.
类型 Lin_FrameDlType [SWS_Lin_00231] 📄 PDF
This type is used to specify the number of SDU data bytes to copy.
类型 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.
类型 Lin_StatusType [SWS_Lin_00233] 📄 PDF
LIN operation states for a LIN channel or frame, as returned by the API service Lin_ Get Status().
枚举类型 Lin_StatusType 通过 Lin_GeneralTypes.h 提供,并定义了作为 API 服务 Lin_GetStatus() 的返回值报告的 LIN 通道和 LIN 帧的运行及传输状态 [SWS_Lin_00233]。
状态值分为通道状态和帧操作值 [SWS_Lin_00233]:
- 通道状态:
LIN_OPERATIONAL表示正常运行模式,在此模式下 LIN 通道准备好传输下一个报头,并且不存在先前帧的数据(例如在初始化之后)。相比之下,LIN_CH_SLEEP代表通道的休眠状态,在此状态下从节点的唤醒检测已激活 [SWS_Lin_00233]。 - 正在进行的传输:
LIN_TX_BUSY标识正在进行的报头或响应发送。LIN_RX_BUSY指示正在进行的接收过程,在此过程中已至少接收到一个响应字节,但尚未收到最终的校验和字节 [SWS_Lin_00233]。 - 成功完成:
LIN_TX_OK确认传输成功,而LIN_RX_OK表示完整响应的无误接收 [SWS_Lin_00233]。 - 错误状态与超时:
LIN_NOT_OK指示开发错误或生产错误。对于发送操作,该类型区分LIN_TX_HEADER_ERROR(由于数据不匹配、标识符奇偶校验错误或物理总线错误导致的报头发送错误)和LIN_TX_ERROR(由于数据不匹配或总线错误导致的响应传输错误)。在接收端,LIN_RX_ERROR标识接收错误,例如帧错误、溢出错误、校验和错误或不完整的响应;LIN_RX_NO_RESPONSE报告完全未收到响应字节 [SWS_Lin_00233]。
此使用说明基于 AUTOSAR CP R20-11 规范自动生成。
实现者指南即将推出(复杂度 I1)
类型 Lin_SlaveErrorType [SWS_Lin_91140] 📄 PDF
This type represents the slave error types that are detected during header reception and response transmission / reception.
枚举类型 Lin_SlaveErrorType 表示在接收报头期间以及在传输或接收响应期间检测到的 LIN 从节点的特定错误类型 [SWS_Lin_91140]。类型定义通过头文件 Lin_GeneralTypes.h 提供 [SWS_Lin_91140]。
错误状态与取值范围
该枚举涵盖了 LIN 通信不同阶段的错误 [SWS_Lin_91140]:
LIN_ERR_HEADER:指示在接收 LIN 报头时发生错误 [SWS_Lin_91140]。LIN_ERR_RESP_STOPBIT:显示响应中的帧错误或停止位错误 [SWS_Lin_91140]。LIN_ERR_RESP_CHKSUM:标识接收到的响应的校验和错误 [SWS_Lin_91140]。LIN_ERR_RESP_DATABIT:报告响应中发送的数据位的位监控错误 [SWS_Lin_91140]。LIN_ERR_NO_RESP:指出未收到对报头的响应 [SWS_Lin_91140]。LIN_ERR_INC_RESP:在接收或传输了不完整的响应时发生 [SWS_Lin_91140]。
使用与限制
Interpretation: 由于本规范摘录中未包含具体的函数签名,该类型很可能用作向上一级模块(如 LIN 接口)发出通知中的返回值或状态参数。 问题 Q-6a9c54976345ca2b (未决)有关可重入性、调用上下文或同步与异步执行的更多详细信息未包含在摘录中。
本使用说明是基于 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#b625dcd8- Content hash
b625dcd8- Source
- https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_LINDriver.pdf#nameddest=SWS_Lin_00006
gemini-3.8-flash-low· 2026-10-13 · 德文原文