Ethernet Driver (Eth)
Provides uniform hardware access to Ethernet controller interfaces.
Funktionen — Übersicht
void Eth_Init (const Eth_ConfigType* CfgPtr);Initializes the Ethernet DriverStd_ReturnType Eth_SetControllerMode (uint8 CtrlIdx, Eth_ModeType CtrlMode);Enables / disables the indexed controller Tags: atp.Std_ReturnType Eth_SetControllerMode (uint8 CtrlIdx, Eth_ModeType CtrlMode);Enables / Disables Rx/ Tx communication of the indexed controller Tags: atp.Std_ReturnType Eth_GetControllerMode (uint8 CtrlIdx, Eth_ModeType* CtrlModePtr);Obtains the state of the indexed controller Tags: atp.Std_ReturnType Eth_GetControllerMode (uint8 CtrlIdx, Eth_ModeType* CtrlModePtr);Obtains the communication state of the indexed controller Tags: atp.void Eth_GetPhysAddr (uint8 CtrlIdx, uint8* PhysAddrPtr);Obtains the physical source address used by the indexed controllervoid Eth_SetPhysAddr (uint8 CtrlIdx, const uint8* PhysAddrPtr);Sets the physical source address used by the indexed controllerStd_ReturnType Eth_UpdatePhysAddrFilter (uint8 CtrlIdx, const uint8* PhysAddrPtr, Eth_FilterActionType Action);Update the physica l source address to/ from the indexed controller filter.Std_ReturnType Eth_WriteMii (uint8 CtrlIdx, uint8 TrcvIdx, uint8 RegIdx, uint16 RegVal);Configures a transceiver register or triggers a function offered by the receiverStd_ReturnType Eth_ReadMii (uint8 CtrlIdx, uint8 TrcvIdx, uint8 RegIdx, uint16* RegValPtr);Reads a transceiver registerStd_ReturnType Eth_GetCounterValues (uint8 CtrlIdx, Eth_CounterType* CounterPtr);Reads a list with drop counter values of the corresponding controller.Std_ReturnType Eth_GetRxStats (uint8 CtrlIdx, Eth_RxStatsType* RxStats);Returns the following list according to IETF RFC281 9, where the maximal possible value shall denote an invalid value, e.Std_ReturnType Eth_GetTxStats (uint8 CtrlIdx, Eth_TxStatsType* TxStats);Returns the list of Transmission Statistics out of IETF RFC1213 defined with Eth_ Tx Stats Type, where the maximal possible...Std_ReturnType Eth_GetTxErrorCounterValues (uint8 CtrlIdx, Eth_TxErrorCounterValuesType* TxErrorCounterValues);Returns the list of Transmission Error Counters out of IETF RFC1213 and RFC1643 defined with Eth_ Tx Error Counter Values...Std_ReturnType Eth_GetCurrentTime (uint8 CtrlIdx, Eth_TimeStampQualType* timeQualPtr, Eth_TimeStampType* timeStampPtr);Returns a time value out of the HW registers according to the capability of the HW.void Eth_EnableEgressTimeStamp (uint8 CtrlIdx, Eth_BufIdxType BufIdx);Activat es egress time stamping on a dedicated message object.Std_ReturnType Eth_GetEgressTimeStamp (uint8 CtrlIdx, Eth_BufIdxType BufIdx, Eth_TimeStampQualType* timeQualPtr, Eth_TimeStampType* timeStampPtr);Reads back the egress time stamp on a dedicated message object.Std_ReturnType Eth_GetIngressTimeStamp (uint8 CtrlIdx, const Eth_DataType* DataPtr, Eth_TimeStampQualType* timeQualPtr, Eth_TimeStampType* timeStampPtr);Reads back the ingress time stamp on a dedicated message object.BufReq_ReturnType Eth_ProvideTxBuffer (uint8 CtrlIdx, uint8 Priority, Eth_BufIdxType* BufIdxPtr, uint8* * BufPtr, uint16* LenBytePtr);Provides access to a transmit buffer of the FIFO related to the specified priorityStd_ReturnType Eth_Transmit (uint8 CtrlIdx, Eth_BufIdxType BufIdx, Eth_FrameType FrameType, boolean TxConfirmation, uint16 LenByte, const uint8* PhysAddrPtr);Triggers transmission of a previously filled transmit buffervoid Eth_Receive (uint8 CtrlIdx, uint8 FifoIdx, Eth_RxStatusType* RxStatusPtr);Receive a frame from the related fifo.void Eth_TxConfirmation (uint8 CtrlIdx);Triggers frame transmission confirmationvoid Eth_GetVersionInfo (Std_VersionInfoType* VersionInfoPtr);Returns the version information of this modulevoid Eth_MainFunction (void);The function checks for controller errors and lost frames.
Typen — Übersicht
struct Eth_ConfigTypeImplementation specific structure of the post build configurationenum Eth_ModeTypeThis is an generic type and used in the layers of the Ethernet communication stack (e.enum Eth_ModeTypeThis is an generic type and used in the layers of the Ethernet commun ication stack (e.enum Eth_StateTypeStatus supervision used for Development Error Detection.Eth_FrameTypeThis type defines the Ethernet frame type used in the Ethernet frame headerEth_DataTypeThis type defines the Ethernet data type used for data transmission.Eth_BufIdxTypeEthernet buffer identifier type.enum Eth_RxStatusTypeUsed as out parameter in Eth_ Receive() indicates whether a frame has been received and if so, whether more frames are...enum Eth_FilterActionTypeThe Enumeration Type Eth_ Filter Action Type describes the action to be taklen for the MAC address given in *Phys Addr Ptr.Eth_TimeStampQualTypeDepending on the HW, quality information regarding the evaluated time stamp might be supported.Eth_TimeStampTypeVariables of this type are used for expressing time stamps including relative time and absolute calendar time.Eth_TimeIntDiffTypeVariables of this type are used to express time differences.Eth_RateRatioTypeVariables of this type are used to express frequency ratios.struct Eth_MacVlanTypeThis type is used to read out addresses from the address resolution logic (A RL) table of the switch.Eth_CounterTypeType Eth_CounterType.Eth_RxStatsTypeType Eth_RxStatsType.Eth_TxStatsTypeStatistic counter for diag nostics.Eth_TxErrorCounterValuesTypeType Eth_TxErrorCounterValuesType.
Funktionen & Typen — Detailansicht
函数 Eth_Init [SWS_Eth_00027] 📄 PDF
void Eth_Init (const Eth_ConfigType* CfgPtr);
Initializes the Ethernet Driver
函数 Eth_Init 用于初始化以太网驱动程序 [SWS_Eth_00027]。它通过头文件 Eth.h 声明,具有服务 ID 0x01,且没有返回值(void)[SWS_Eth_00027]。它需要 CfgPtr 作为输入参数,该参数指向 Eth_ConfigType 类型的实现特定配置结构体 [SWS_Eth_00027]。该调用为同步调用,并被定义为不可重入(Non Reentrant)[SWS_Eth_00027]。
在操作流程中,Eth_Init 构成了使用该模块的基本前置条件。所有其他函数都强制要求预先通过 Eth_Init 进行控制器初始化 [SWS_Eth_00070]、[SWS_Eth_00167]、[SWS_Eth_00185]。该依赖关系针对驱动程序的各类控制器服务进行了强制性规定 [SWS_Eth_00189]、[SWS_Eth_00194]、[SWS_Eth_00199]、[SWS_Eth_00232]。
对于未初始化访问的情况,提供了针对性的错误处理机制:在启用开发错误检测(Development Error Detection,DET)时,驱动程序函数会检查服务 Eth_Init 事先是否已按规范调用 [SWS_Eth_00066]。如果该检查未通过,它们将触发开发错误 ETH_E_UNINIT [SWS_Eth_00164]、[SWS_Eth_00182]、[SWS_Eth_00187]、[SWS_Eth_00196]。反之,如果 DET 被停用,受影响的函数将拒绝执行,并通过返回状态 E_NOT_OK 来指示该不允许的状态 [SWS_Eth_00228]、[SWS_Eth_00235]、[SWS_Eth_00248]、[SWS_Eth_00252]。
本段文本由人工智能基于 AUTOSAR 规范 R20-11 生成。
实现者指南即将推出(复杂度 I2)
函数 Eth_SetControllerMode [SWS_Eth_00041] 📄 PDF
Std_ReturnType Eth_SetControllerMode (uint8 CtrlIdx, Eth_ModeType CtrlMode);
Enables / disables the indexed controller Tags: atp.Status=obsolete
函数 Eth_SetControllerMode 用于激活(ETH_MODE_ACTIVE)或停用(ETH_MODE_DOWN)通过参数 CtrlIdx 寻址的 Ethernet 控制器 [SWS_Eth_00041]。在 AUTOSAR Classic R20-11 中,此服务被归类为已过时(obsolete)[SWS_Eth_00041]。
该服务的执行是异步且不可重入的(Non Reentrant)[SWS_Eth_00041]。作为返回值,该函数在成功启动时返回 E_OK,如果无法切换运行模式,则返回 E_NOT_OK [SWS_Eth_00041]。解释:由于调用被指定为异步,但有效负载中未定义回调,因此实际的状态采纳可能在函数返回后在靠近硬件的驱动程序后台完成。 问题 Q-d7ec04578e921eb9 (未决)
如果通过 Eth_SetControllerMode 停用控制器或其发送和接收通信,则适用具有约束力的缓冲区清理规则:
- 必须释放所有锁定的发送缓冲区(locked transmit buffers)[SWS_Eth_00137] [SWS_Eth_00280]。
- 所有挂起的发送缓冲区(pending transmit buffers)也必须予以释放 [SWS_Eth_00138] [SWS_Eth_00281]。
由于属性 Non Reentrant,对于相同或其他控制器实例,不得并发执行该函数 [SWS_Eth_00041]。未列出特定的 DET 或 DEM 错误消息;错误状态通过返回值 E_NOT_OK 通知调用者 [SWS_Eth_00041]。
本使用说明基于 AUTOSAR Classic R20-11 规范数据自动生成。
实现者指南即将推出(复杂度 I2)
函数 Eth_SetControllerMode [SWS_Eth_91009] 📄 PDF
Std_ReturnType Eth_SetControllerMode (uint8 CtrlIdx, Eth_ModeType CtrlMode);
Enables / Disables Rx/ Tx communication of the indexed controller Tags: atp.Status=draft
函数Eth_SetControllerMode(服务ID 0x03,通过Eth.h提供)用于激活和停用特定以太网控制器的接收和发送通信(Rx/Tx)[SWS_Eth_91009]。
使用和调用条件
该函数的执行是异步的,且被指定为不可重入(Non Reentrant)[SWS_Eth_91009]。调用时传递两个参数:
CtrlIdx:在以太网驱动程序上下文中相关控制器的索引[SWS_Eth_91009]。CtrlMode:控制器的目标模式,为用于激活Rx/Tx通信的ETH_MODE_ACTIVE,或用于停用通信的ETH_MODE_DOWN[SWS_Eth_91009]。
该函数返回状态Std_ReturnType作为返回值:E_OK表示执行成功,而E_NOT_OK表示控制器的模式未能切换[SWS_Eth_91009]。
交互与缓冲区管理
如果指定索引的控制器的Rx/Tx通信通过Eth_SetControllerMode被停用(模式ETH_MODE_DOWN),则必须强制执行发送缓冲区的清理操作:
- 必须释放所有锁定的发送缓冲区(locked transmit buffers)[SWS_Eth_00280]。
- 同样必须释放所有待处理的发送缓冲区(pending transmit buffers)[SWS_Eth_00281]。
关于释放锁定和待处理缓冲区的当前规定以及函数定义本身均具有“草案”(draft)状态[SWS_Eth_91009]、[SWS_Eth_00280]、[SWS_Eth_00281]。它们取代了历史上先前被归类为已废弃的需求[SWS_Eth_00137]和[SWS_Eth_00138]。
本说明由人工智能基于 AUTOSAR 规范生成。
实现者指南即将推出(复杂度 I2)
函数 Eth_GetControllerMode [SWS_Eth_00046] 📄 PDF
Std_ReturnType Eth_GetControllerMode (uint8 CtrlIdx, Eth_ModeType* CtrlModePtr);
Obtains the state of the indexed controller Tags: atp.Status=obsolete
函数 Eth_GetControllerMode [SWS_Eth_91010] 📄 PDF
Std_ReturnType Eth_GetControllerMode (uint8 CtrlIdx, Eth_ModeType* CtrlModePtr);
Obtains the communication state of the indexed controller Tags: atp.Status=draft
函数 Eth_GetPhysAddr [SWS_Eth_00052] 📄 PDF
void Eth_GetPhysAddr (uint8 CtrlIdx, uint8* PhysAddrPtr);
Obtains the physical source address used by the indexed controller
函数 Eth_SetPhysAddr [SWS_Eth_00151] 📄 PDF
void Eth_SetPhysAddr (uint8 CtrlIdx, const uint8* PhysAddrPtr);
Sets the physical source address used by the indexed controller
函数 Eth_UpdatePhysAddrFilter [SWS_Eth_00152] 📄 PDF
Std_ReturnType Eth_UpdatePhysAddrFilter (uint8 CtrlIdx, const uint8* PhysAddrPtr, Eth_FilterActionType Action);
Update the physica l source address to/ from the indexed controller filter. If the Ethernet Controller is not capable to do the filtering, the software has to do this.
同步接口 Eth_UpdatePhysAddrFilter 通过头文件 Eth.h 提供,并具有服务 ID 0x12 [SWS_Eth_00152]。该函数用于将物理地址添加到索引指定的以太网控制器的过滤器中或从中移除 [SWS_Eth_00152]。
该函数的参数包含三个输入值 [SWS_Eth_00152]:
CtrlIdx:确定驱动程序上下文中相关以太网控制器的索引 [SWS_Eth_00152]。PhysAddrPtr:指向包含按网络字节序排列的物理目标地址(MAC 地址)的内存区域的指针;这是第 2 层以太网数据包的组播目标地址 [SWS_Eth_00152]。Action:通过枚举类型Eth_FilterActionType指定是将给定地址添加到控制器的过滤器中还是从中删除 [SWS_Eth_00152]。
该函数返回类型为 Std_ReturnType 的状态:E_OK 确认过滤器更改成功,而 E_NOT_OK 报告无法更改过滤器 [SWS_Eth_00152]。如果以太网控制器在硬件层面无法独立进行过滤,则必须由软件实现过滤任务 [SWS_Eth_00152]。
对于执行存在严格的可重入性限制:该函数对于相同的控制器索引(CtrlIdx)是不可重入的,但对于彼此不同的控制器索引,可以并发且可重入地调用 [SWS_Eth_00152]。
本使用说明由 AI 系统基于 AUTOSAR Classic R20-11 规范生成。
实现者指南即将推出(复杂度 I1)
函数 Eth_WriteMii [SWS_Eth_00058] 📄 PDF
Std_ReturnType Eth_WriteMii (uint8 CtrlIdx, uint8 TrcvIdx, uint8 RegIdx, uint16 RegVal);
Configures a transceiver register or triggers a function offered by the receiver
函数 Eth_WriteMii 用于通过 MII 接口配置以太网收发器的寄存器,或触发收发器提供的功能 [SWS_Eth_00058]。其声明可通过头文件 Eth.h 获取 [SWS_Eth_00058]。
用法与参数
该调用使用服务 ID 0x05,并处理四个输入参数 [SWS_Eth_00058]:
CtrlIdx:以太网驱动程序上下文中以太网控制器的索引 [SWS_Eth_00058]。TrcvIdx:MII 接口上的收发器索引 [SWS_Eth_00058]。RegIdx:MII 上要写入的收发器寄存器索引 [SWS_Eth_00058]。RegVal:要写入寻址寄存器的 16 位值 [SWS_Eth_00058]。
该服务的执行被指定为异步 [SWS_Eth_00058]。这意味着通过硬件接口进行的实际写入过程通常应在后台处理,而函数在接受请求后立即返回。 问题 Q-0f9a9e682985d796 (未决)
返回值与限制
该函数提供类型为 Std_ReturnType 的返回值 [SWS_Eth_00058]:
E_OK:写入请求已被成功接受 [SWS_Eth_00058]。E_NOT_OK:服务被拒绝 [SWS_Eth_00058]。
在并发性方面,Eth_WriteMii 被指定为不可重入(Non Reentrant)[SWS_Eth_00058]。因此,未经调用方相应同步,不得并发执行调用。
本使用说明由 AI 基于 AUTOSAR 规范 R20-11 生成。
实现者指南即将推出(复杂度 I1)
函数 Eth_ReadMii [SWS_Eth_00064] 📄 PDF
Std_ReturnType Eth_ReadMii (uint8 CtrlIdx, uint8 TrcvIdx, uint8 RegIdx, uint16* RegValPtr);
Reads a transceiver register
用法与参数
函数 Eth_ReadMii(服务 ID 0x06)用于通过 MII 接口读取收发器寄存器,并通过头文件 Eth.h 提供 [SWS_Eth_00064]。调用时,CtrlIdx 标识驱动程序上下文中的相应 Ethernet 控制器,TrcvIdx 标识 MII 上寻址的收发器,RegIdx 标识具体的收发器寄存器 [SWS_Eth_00064]。确定的寄存器值被写入指针 RegValPtr 所引用的内存区域 [SWS_Eth_00064]。
执行与并发性
执行异步进行(Asynchronous)[SWS_Eth_00064]。返回值 E_OK 仅确认服务或读取请求已被成功接受(Service accepted),而 E_NOT_OK 发出请求被拒绝的信号(Service denied)[SWS_Eth_00064]。由于其异步特性,为 RegValPtr 传递的内存区域在读取过程最终完成之前可能必须保持有效。 问题 Q-04a94624b96bf51f (未决)由于该函数还被归类为不可重入(Non Reentrant)[SWS_Eth_00064],因此调用者在没有外部同步的情况下不得通过不同的任务或中断上下文执行同时访问。
错误处理
如果驱动程序无法接受读取请求,则直接以 E_NOT_OK 确认该调用 [SWS_Eth_00064]。在与元素相关的规范数据中,未针对该函数列出特定错误码、DET 运行时检查或 DEM 诊断事件。
本使用说明由 AI 基于规范创建。
实现者指南即将推出(复杂度 I1)
函数 Eth_GetCounterValues [SWS_Eth_00226] 📄 PDF
Std_ReturnType Eth_GetCounterValues (uint8 CtrlIdx, Eth_CounterType* CounterPtr);
Reads a list with drop counter values of the corresponding controller. The meaning of these values is described at Eth_ Counter Type.
函数 Eth_GetRxStats [SWS_Eth_00233] 📄 PDF
Std_ReturnType Eth_GetRxStats (uint8 CtrlIdx, Eth_RxStatsType* RxStats);
Returns the following list according to IETF RFC281 9, where the maximal possible value shall denote an invalid value, e.g. if this counter is not available: 1. ether Stats Drop Events 2. ether Stats Octets 3. ether Stats Pkts 4. ether Stats Broadcast Pkts 5. ether Stats Multicast Pkts 6. ether Stats Crc Al ign Errors 7. ether Stats Undersize Pkts 8. ether Stats Oversize Pkts 9. ether Stats Fragments 10. ether Stats Jabbers 11. ether Stats Collisions 12. ether Stats Pkts64Octets 13. ether Stats Pkts65to127Octets 14. ether Stats Pkts128to255Octets 15. ether St ats Pkts256to511Octets 16. ether Stats Pkts512to1023Octets 17. ether
函数 Eth_GetTxStats [SWS_Eth_91005] 📄 PDF
Std_ReturnType Eth_GetTxStats (uint8 CtrlIdx, Eth_TxStatsType* TxStats);
Returns the list of Transmission Statistics out of IETF RFC1213 defined with Eth_ Tx Stats Type, where the maximal possible value shall denote an invalid value, e.g. this counter is not available.
函数 Eth_GetTxErrorCounterValues [SWS_Eth_91006] 📄 PDF
Std_ReturnType Eth_GetTxErrorCounterValues (uint8 CtrlIdx, Eth_TxErrorCounterValuesType* TxErrorCounterValues);
Returns the list of Transmission Error Counters out of IETF RFC1213 and RFC1643 defined with Eth_ Tx Error Counter Values Type, where the maximal possible value shall denote an invalid value, e.g. this counter is not available.
函数 Eth_GetCurrentTime [SWS_Eth_00181] 📄 PDF
Std_ReturnType Eth_GetCurrentTime (uint8 CtrlIdx, Eth_TimeStampQualType* timeQualPtr, Eth_TimeStampType* timeStampPtr);
Returns a time value out of the HW registers according to the capability of the HW. Is the HW resolution is lower than the Eth_ Time Stamp Type resolution resp. range, than an the remainin g bits will be filled with 0. Important Note: Eth_ Get Current Time may be called within an exclusive area.
函数 Eth_EnableEgressTimeStamp [SWS_Eth_00186] 📄 PDF
void Eth_EnableEgressTimeStamp (uint8 CtrlIdx, Eth_BufIdxType BufIdx);
Activat es egress time stamping on a dedicated message object. Some HW does store once the egress time stamp marker and some HW needs it always before transmission. There will be no "disable" functionality, due to the fact, that the message type is always "time st amped" by network design.
同步函数 Eth_EnableEgressTimeStamp 为以太网驱动程序的专用消息对象激活发送时间戳(Egress Time Stamping)捕获 [SWS_Eth_00186]。该调用通过头文件 Eth.h 进行,服务 ID 为 0x17,并且没有返回值 [SWS_Eth_00186]。
调用时应传入以下输入参数 [SWS_Eth_00186]:
CtrlIdx:寻址的以太网控制器索引 [SWS_Eth_00186]。BufIdx:上层应用程序期望为其生成出口时间戳的消息缓冲区索引 [SWS_Eth_00186]。
在并发性方面,该函数被指定为不可重入(Non Reentrant)[SWS_Eth_00186]。因此,针对相同或其他缓冲区的并行调用必须在调用端进行同步或予以避免。
硬件行为因控制器实现而异:某些硬件会永久保存发送时间戳标记,而其他控制器则强制要求在每次传输前进行激活 [SWS_Eth_00186]。解释:为了实现与硬件无关的控制,建议在所需缓冲区的每次发送过程之前调用该函数。 问题 Q-c2b8d2db03e9d13b (未决)由于根据网络设计,该消息类型始终带有时间戳进行传输,因此不存在停用接口 [SWS_Eth_00186]。
本段文本由人工智能基于 AUTOSAR 规范 R20-11 生成。
函数 Eth_GetEgressTimeStamp [SWS_Eth_00190] 📄 PDF
Std_ReturnType Eth_GetEgressTimeStamp (uint8 CtrlIdx, Eth_BufIdxType BufIdx, Eth_TimeStampQualType* timeQualPtr, Eth_TimeStampType* timeStampPtr);
Reads back the egress time stamp on a dedicated message object. It must be called within the Tx Confirmation() function.
函数 Eth_GetIngressTimeStamp [SWS_Eth_00195] 📄 PDF
Std_ReturnType Eth_GetIngressTimeStamp (uint8 CtrlIdx, const Eth_DataType* DataPtr, Eth_TimeStampQualType* timeQualPtr, Eth_TimeStampType* timeStampPtr);
Reads back the ingress time stamp on a dedicated message object. It must be called within the Rx Indication() function.
函数 Eth_ProvideTxBuffer [SWS_Eth_00077] 📄 PDF
BufReq_ReturnType Eth_ProvideTxBuffer (uint8 CtrlIdx, uint8 Priority, Eth_BufIdxType* BufIdxPtr, uint8* * BufPtr, uint16* LenBytePtr);
Provides access to a transmit buffer of the FIFO related to the specified priority
使用
同步函数 Eth_ProvideTxBuffer 提供对分配给所传入优先级的 FIFO 的以太网发送缓冲区的访问 [SWS_Eth_00077]。它通过头文件 Eth.h 提供,并被指定为可重入 [SWS_Eth_00077]。通过输入参数传入控制器索引 CtrlIdx 以及用于 FIFO 选择的帧优先级 Priority [SWS_Eth_00077]。输入输出参数 LenBytePtr 传入所需的缓冲区大小,并在调用后返回实际授予的字节大小 [SWS_Eth_00077]。输出参数 BufIdxPtr(用于后续请求的资源索引)和 BufPtr(指向缓冲区的指针)提供对内存区域的引用 [SWS_Eth_00077]。
错误处理与返回值
该函数通过类型为 BufReq_ReturnType 的返回值指示结果 [SWS_Eth_00077]:
BUFREQ_OK:发送缓冲区已成功提供 [SWS_Eth_00077]。BUFREQ_E_BUSY:所有缓冲区资源当前均被占用 [SWS_Eth_00077]。BUFREQ_E_OVFL:请求的缓冲区过大 [SWS_Eth_00077]。BUFREQ_E_NOT_OK:检测到开发错误 [SWS_Eth_00077]。
相互作用
当 EthCtrlConfigSwBufferHandling 配置为 TRUE 时,内部将保存由传入 BufIdxPtr 的软件缓冲区池缓冲区索引与指定优先级 Priority 组成的元组 [SWS_Eth_00267]。
如果随后调用 Eth_Transmit(),则给定的缓冲区索引将被分配给其配置 EthCtrlConfigEgressFifoPriorityAssignment 与先前在 Eth_ProvideTxBuffer() 中传入的优先级相符的软件 FIFO [SWS_Eth_00268]。
本段文本由人工智能基于 AUTOSAR 规范 R20-11 生成。
实现者指南即将推出(复杂度 I1)
函数 Eth_Transmit [SWS_Eth_00087] 📄 PDF
Std_ReturnType Eth_Transmit (uint8 CtrlIdx, Eth_BufIdxType BufIdx, Eth_FrameType FrameType, boolean TxConfirmation, uint16 LenByte, const uint8* PhysAddrPtr);
Triggers transmission of a previously filled transmit buffer
用法与调用上下文
同步接口 Eth_Transmit 为先前提供并填充的以太网发送缓冲区触发发送过程 [SWS_Eth_00087]。它接收以下参数:
CtrlIdx:驱动程序上下文中以太网控制器的索引 [SWS_Eth_00087]。BufIdx:要传输的缓冲区资源索引 [SWS_Eth_00087]。FrameType:特定以太网帧类型 [SWS_Eth_00087]。TxConfirmation:用于激活发送确认的开关 [SWS_Eth_00087]。LenByte:有效载荷的数据长度(以字节为单位)[SWS_Eth_00087]。PhysAddrPtr:指向按网络字节序排列的物理目标地址(MAC 地址)的指针 [SWS_Eth_00087]。
类型为 Std_ReturnType 的返回值通过 E_OK 指示传输成功启动,通过 E_NOT_OK 指示失败 [SWS_Eth_00087]。
交互与缓冲区处理
在发送流程中,Eth_Transmit 将缓冲区指针 BufIdx 分配给其配置元素 EthCtrlConfigEgressFifoPriorityAssignment 与先前在 Eth_ProvideTxBuffer() 中指定的优先级相匹配的软件 FIFO [SWS_Eth_00268]。通过该调用,相应的消息将从软件 FIFO 传输至硬件 FIFO [SWS_Eth_00269]。
并发性
对于使用不同缓冲区索引(BufIdx)以及不同控制器索引(CtrlIdx)的调用,该函数是可重入的 [SWS_Eth_00087]。
本使用说明基于 AUTOSAR 规范 R20-11 自动生成。
实现者指南即将推出(复杂度 I2)
函数 Eth_Receive [SWS_Eth_00095] 📄 PDF
void Eth_Receive (uint8 CtrlIdx, uint8 FifoIdx, Eth_RxStatusType* RxStatusPtr);
Receive a frame from the related fifo.
同步函数 Eth_Receive 用于从以太网控制器的特定 FIFO 缓冲区接收以太网帧 [SWS_Eth_00095]。它没有返回值,但通过类型为 Eth_RxStatusType 的指针 RxStatusPtr 向调用方返回查询结果 [SWS_Eth_00095]。该输出参数指示是否已成功接收帧,以及对于相关 FIFO 缓冲区是否还有其他帧等待提取 [SWS_Eth_00095]。
参数与调用上下文
作为输入参数,该函数需要以太网驱动程序内部的控制器索引 CtrlIdx 以及要读取的 FIFO 的索引 FifoIdx [SWS_Eth_00095]。该函数在头文件 Eth.h 中声明 [SWS_Eth_00095]。该调用通常应在上层驱动程序层或接口层通过轮询机制周期性进行。 问题 Q-f5ec0693a5887bcf (未决)
并发性与限制
在并发性方面,Eth_Receive 针对不同 FIFO 的实现是可重入的,但针对同一 FIFO 则是不可重入的 [SWS_Eth_00095]。查询同一控制器的同一 FIFO 的并发调用是不允许的,必须由调用软件予以排除。
与以太网接口的交互
在轮询模式下,在接收过程成功时,以太网驱动程序有义务直接从例程 Eth_Receive 中调用函数 EthIf_RxIndication,以便将接收到的帧报告给上层以进行进一步处理 [SWS_Eth_00244]。
本文本由 AI 基于规范生成。
实现者指南即将推出(复杂度 I1)
函数 Eth_TxConfirmation [SWS_Eth_00100] 📄 PDF
void Eth_TxConfirmation (uint8 CtrlIdx);
Triggers frame transmission confirmation
用法与调用上下文
通过头文件 Eth.h 可用的函数 Eth_TxConfirmation 用于针对性地触发已发送 Ethernet 帧的传输确认 [SWS_Eth_00100]。它具有服务 ID 0x0C 并同步执行 [SWS_Eth_00100]。作为唯一的传递参数,该函数期望 CtrlIdx,其确定 Ethernet 驱动程序实例内要寻址的控制器的逻辑索引 [SWS_Eth_00100]。不存在返回值(void),并且不传递任何输出参数 [SWS_Eth_00100]。
发送流程中的交互
在层间交互中,Eth_TxConfirmation 负责将发送状态传递给上层 Ethernet 接口。只要启用了相应的通知,Ethernet 驱动程序就有义务调用带有结果值 E_OK 的 EthIf_TxConfirmation,以发出传输成功的信号 [SWS_Eth_00243]。在轮询模式下,此调用明确在例程 Eth_TxConfirmation 的上下文中进行,而在中断控制模式下,它也可以替代地直接从中断例程中发出 [SWS_Eth_00243]。
并发性和执行条件
对于执行,适用的限制是 Eth_TxConfirmation 被定义为不可重入(Non Reentrant)[SWS_Eth_00100]。因此,调用者必须防止针对同一控制器同时进行调用。在轮询操作中,调用通常可能由上层流程控制周期性执行。 问题 Q-c19295838459b689 (未决)函数规范中未指定特定错误码以及关于 DET 或 DEM 消息的规定,因此不需要单独的错误处理。
此文本由 AI 创建;以引用的规范为准。
实现者指南即将推出(复杂度 I1)
函数 Eth_GetVersionInfo [SWS_Eth_00106] 📄 PDF
void Eth_GetVersionInfo (Std_VersionInfoType* VersionInfoPtr);
Returns the version information of this module
函数 Eth_MainFunction [SWS_Eth_00171] 📄 PDF
void Eth_MainFunction (void);
The function checks for controller errors and lost frames. Used for polling state changes. Calls Eth If_ Ctrl Mode Indication when the controller mode changed.
用法与调用上下文
函数 Eth_MainFunction 具有签名 void Eth_MainFunction(void) 并通过头文件 SchM_Eth.h 提供 [SWS_Eth_00171]。由此可以理解为:调用可能由调度管理器(SchM)在基于任务的上下文中周期性执行,因为没有定义传递参数或返回值。 问题 Q-690a2dc372d49c6a (未决)
功能范围与轮询
该函数的主要任务是对状态改变进行轮询,并检查控制器错误以及丢失的以太网帧[SWS_Eth_00171]。如果该函数确定以太网控制器的模式已发生更改,则调用函数EthIf_CtrlModeIndication,以通知上层状态切换[SWS_Eth_00171]。
发送路径中的处理顺序
在Eth_MainFunction()的上下文中,预先规定了软件FIFO的处理固定顺序[SWS_Eth_00270]:
- 首先遍历所有SW-FIFO并更新其信用账户(Credits Account)[SWS_Eth_00270]。
- 随后再次遍历所有SW-FIFO并检查是否有准备好发送的消息[SWS_Eth_00270]。
- 然后针对每个遍历到的SW-FIFO尝试进行传输[SWS_Eth_00270]。
本使用说明由 AI 基于 AUTOSAR 规范 R20-11 生成。
实现者指南即将推出(复杂度 I2)
类型 Eth_ConfigType [SWS_Eth_00156] 📄 PDF
Implementation specific structure of the post build configuration
类型 Eth_ModeType [SWS_Eth_00158] 📄 PDF
This is an generic type and used in the layers of the Ethernet communication stack (e.g. EthIf, Eth, EthSwt, EthTrcv) to enable and disable, resp ectively, the Ethernet communcation channel and set the corresponding hardware (e.g. Ethernet controller, Ethernet Switch port, Ethernet transceiver) to an lowpower sleep and power on mode, respectively. Tags: atp.Status=obsolete
通用枚举类型 Eth_ModeType 用于以太网通信栈的各层(如 EthIf、Eth、EthSwt 和 EthTrcv),以激活或停用以太网通信通道,并将关联硬件(如以太网控制器、以太网交换机端口或以太网收发器)置于低功耗休眠状态或激活模式 [SWS_Eth_00158]。
该类型可通过头文件 Eth_GeneralTypes.h 获取,并定义了以下取值范围 [SWS_Eth_00158]:
ETH_MODE_DOWN(0x00):停用以太网通信通道,并将关联硬件置于低功耗休眠模式(Low-Power Sleep Mode)[SWS_Eth_00158]。ETH_MODE_ACTIVE(0x01):激活以太网通信通道,并将硬件置于工作模式(Power-On Mode)[SWS_Eth_00158]。
在生命周期和使用方面需要注意的是,Eth_ModeType 在版本 R20-11 中被标记为 obsolete 状态 [SWS_Eth_00158]。因此在新的开发中应避免使用该类型,因为过时的接口类型在未来标准中通常会被更现代的控制结构所取代。
本使用说明由自动生成。规范依据仅指提供的需求上下文。
实现者指南即将推出(复杂度 I1)
类型 Eth_ModeType [SWS_Eth_91008] 📄 PDF
This is an generic type and used in the layers of the Ethernet commun ication stack (e.g. Eth If, Eth, Eth Swt, Eth Trcv) to enable and disable, respectively, the Ethernet communcation channel and set the corresponding hardware (e.g. Ethernet controller, Ethernet Switch port, Ethernet transceiver) to an lowpower sleep and po wer on mode, respectively. The type also support to transfer a wake - up request from the services layer (Com M) to the communication drivers (Eth Trcv). This could be used e.g. for Ethernet hardware that has the capability to wake - up and sleep on data line (see OA TC10) Tags: atp.Status=draft
枚举类型 Eth_ModeType 通过 Eth_GeneralTypes.h 声明,并在 AUTOSAR 以太网通信栈中用作跨层模式类型([SWS_Eth_91008])。它用于 EthIf、Eth、EthSwt 和 EthTrcv 等模块中,以有针对性地激活或停用通信通道,并在节能睡眠模式与活动工作模式之间切换关联的硬件组件(以太网控制器、交换机端口或收发器)([SWS_Eth_91008])。
该类型包含三种用于模式控制的状态([SWS_Eth_91008]):
ETH_MODE_DOWN(0x00):停用 Rx 和 Tx 通信,并将关联硬件置于低功耗睡眠模式。若硬件支持,还将同时启动睡眠流程(例如根据 OPEN Alliance TC10 在数据线上请求 Sleep)。ETH_MODE_ACTIVE(0x01):激活 Rx 和 Tx 通信,并将关联硬件切换到常规工作模式(上电)。ETH_MODE_ACTIVE_WITH_WAKEUP_REQUEST(0x02):激活 Rx 和 Tx 通信,将硬件置于工作模式,并且如果硬件具备唤醒能力,还会在网络上触发唤醒请求(例如符合 OPEN Alliance TC10 的数据线唤醒)。
在协议栈交互中,Eth_ModeType 特别支持将唤醒请求从服务层(ComM)经由中间层向下传递至通信驱动程序(EthTrcv),从而根据需要控制在数据线上具有唤醒和睡眠功能的硬件([SWS_Eth_91008])。
本使用说明基于规范 SWS_Eth_91008 自动生成。
实现者指南即将推出(复杂度 I1)
类型 Eth_StateType [SWS_Eth_00159] 📄 PDF
Status supervision used for Development Error Detection. The state shall be available for debugging.
枚举类型 Eth_StateType 通过头文件 Eth_GeneralTypes.h 提供,并根据 [SWS_Eth_00159] 用于 Ethernet 驱动程序的状态监控。其目的在于支持开发错误检测(Development Error Detection),根据规范,当前状态必须可用于调试目的([SWS_Eth_00159])。
对于状态管理,Eth_StateType 定义了两个离散的枚举值([SWS_Eth_00159]):
ETH_STATE_UNINIT(值0x00):表示 Ethernet 驱动程序尚未配置([SWS_Eth_00159])。ETH_STATE_INIT(值0x01):表示 Ethernet 驱动程序已成功配置([SWS_Eth_00159])。
在错误处理和交互方面,该状态类型构成了内部错误检测的基础。可以推测,只要驱动程序处于未初始化状态 ETH_STATE_UNINIT,驱动程序 API 就会查询此状态并拒绝调用([SWS_Eth_00159])。 问题 Q-35a17e3267274d70 (未决)只有当驱动程序转换到状态 ETH_STATE_INIT 时,它才被视为已配置并准备就绪([SWS_Eth_00159])。由于类型定义位于 Eth_GeneralTypes.h 中,因此它是跨驱动程序可用的([SWS_Eth_00159])。
此文本由 AI 基于 AUTOSAR CP R20-11 规范生成。
实现者指南即将推出(复杂度 I1)
类型 Eth_FrameType [SWS_Eth_00160] 📄 PDF
This type defines the Ethernet frame type used in the Ethernet frame header
类型 Eth_DataType [SWS_Eth_00161] 📄 PDF
This type defines the Ethernet data type used for data transmission. Its definition depends on the used CPU.
类型 Eth_BufIdxType [SWS_Eth_00175] 📄 PDF
Ethernet buffer identifier type.
类型 Eth_RxStatusType [SWS_Eth_00162] 📄 PDF
Used as out parameter in Eth_ Receive() indicates whether a frame has been received and if so, whether more frames are available or frames go t lost.
使用与取值范围
枚举类型 Eth_RxStatusType 根据 [SWS_Eth_00162] 在头文件 Eth_GeneralTypes.h 中定义。它在函数 Eth_Receive() 中用作输出参数(out parameter),以太网驱动程序通过它指示是否已接收到以太网帧,以及随后缓冲区中是否存在更多帧或数据是否已丢失 [SWS_Eth_00162]。
规范为该类型定义了三个离散的枚举值 [SWS_Eth_00162]:
ETH_RECEIVED(0x00):已接收到一个以太网帧;控制器中不再有其他可用帧。ETH_NOT_RECEIVED(0x01):未接收到以太网帧;没有更多帧。ETH_RECEIVED_MORE_DATA_AVAILABLE(0x02):已接收到一个以太网帧,且有额外的帧等待提取。
帧处理中的交互
在调用 Eth_Receive() 时,调用层会传入一个指向类型为 Eth_RxStatusType 的变量的指针。对该输出参数的求值控制着接收周期的后续流程:返回值 ETH_RECEIVED_MORE_DATA_AVAILABLE 应作为调用方立即再次调用 Eth_Receive() 的判据,以便迅速处理接收缓冲区中剩余的帧 [SWS_Eth_00162]。 问题 Q-4ed309522aa004f8 (未决)相比之下,状态 ETH_RECEIVED 和 ETH_NOT_RECEIVED 则指示缓冲区已耗尽,没有更多数据等待处理。通过 Eth_GeneralTypes.h 提供该类型确保了跨模块的一致类型使用 [SWS_Eth_00162]。
本段文本由 AI 生成,并完全基于 AUTOSAR R20-11 的规范数据。
实现者指南即将推出(复杂度 I1)
类型 Eth_FilterActionType [SWS_Eth_00163] 📄 PDF
The Enumeration Type Eth_ Filter Action Type describes the action to be taklen for the MAC address given in *Phys Addr Ptr.
类型 Eth_TimeStampQualType [SWS_Eth_00177] 📄 PDF
Depending on the HW, quality information regarding the evaluated time stamp might be supported. If not supported, the value shall be always Valid. For Uncertain and Invalid values, the upper layer shall discard the time stamp.
类型 Eth_TimeStampType [SWS_Eth_00178] 📄 PDF
Variables of this type are used for expressing time stamps including relative time and absolute calendar time. The absolute time starts at 1970 - - 01. 0 to 281474976710655s == 3257812230d [0x FFFF FFFF FFFF] 0 to 999999999ns [0x3B9A C9FF] invalid value in nanoseconds: [0x3B9A CA00] to [0x3FFF FFFF] Bit 30 and 31 reserved, default: 0
类型 Eth_TimeIntDiffType [SWS_Eth_00179] 📄 PDF
Variables of this type are used to express time differences.
类型 Eth_RateRatioType [SWS_Eth_00180] 📄 PDF
Variables of this type are used to express frequency ratios.
类型 Eth_MacVlanType [SWS_Eth_91001] 📄 PDF
This type is used to read out addresses from the address resolution logic (A RL) table of the switch. typedef struct { uint8 Mac Addr[6U]; uint16 Vlan Id; uint32 Switch Port; } Eth_ Mac Vlan Type; In case of Macaddr contains a Multicast Address Mac Vlan Type.Switch Port shall be handled as Bitmask, each bit represents a Switch Port , Bit 0 represents Eth Swicht Port Idx = 0 , Bit 1 represents Eth Swicht Port Idx = 1 and so on. In case of Macaddr contains not a Multicast Address Mac Vlan Type.Switch Port shall be handled as a value representing the Eth Switch Port Idx.
类型 Eth_CounterType [SWS_Eth_91007] 📄 PDF
Type Eth_CounterType.
类型 Eth_RxStatsType [SWS_Eth_91002] 📄 PDF
Type Eth_RxStatsType.
类型 Eth_TxStatsType [SWS_Eth_91003] 📄 PDF
Statistic counter for diag nostics.
类型 Eth_TxErrorCounterValuesType [SWS_Eth_91004] 📄 PDF
Type Eth_TxErrorCounterValuesType.
使用与目的
根据 [SWS_Eth_91004],数据类型 Eth_TxErrorCounterValuesType 被规范为以太网驱动中用于诊断目的的统计计数器结构体。该定义通过头文件 Eth_GeneralTypes.h 提供。该结构体汇集了多个 32 位计数器(uint32),用于映射接口级别的特定传输状态和发送障碍。
结构体组件与语义
根据 [SWS_Eth_91004],各个计数器参考了标准化的网络 MIB 定义:
Tx Dropped No Error Pkts:尽管处于无错误状态但仍被丢弃的出站数据包数量,例如为了释放缓冲内存(RFC1213ifOutDiscards)。Tx Dropped Error Pkts:由于发生错误而未能传输的数据包数量(RFC1213ifOutErrors)。Tx Deferred Trans:因传输介质忙碌而导致首次发送尝试被延迟的帧数量(RFC1643dot3StatsDeferredTransmissions)。Tx Single Collision和Tx Multiple Collision:成功传输但在发送过程中分别因恰好一次或多次冲突而延迟的帧(RFC1643)。Tx Late Collision:在数据包传输开始后超过 512 位时间才检测到的冲突(RFC1643dot3StatsLateCollisions)。Tx Excessive Collison:由于冲突过多而最终失败的传输次数(RFC1643dot3StatsExcessiveCollisions)。
调用上下文与限制
Interpretation:由于规范摘录未列出关联的 API 函数,推测该诊断类型可能是通过指针作为输出参数传递给相应的驱动函数以进行计数器查询。 问题 Q-2bfbe59d1fb81938 (未决)在源材料中,未针对该纯数据结构定义关于错误处理、DET 报告或并发性的特定要求。
此文本由 AI 基于 AUTOSAR CP R20-11 规范生成。
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/CP_MOD_Eth- Status
- unspecified
- Version
AUTOSAR/AP/record/CP_MOD_Eth@rel:R20-11#49968559- Content hash
49968559- Source
- https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_EthernetDriver.pdf#nameddest=SWS_Eth_00027
gemini-3.8-flash-low· 2026-10-13 · 德文原文