ADC Driver (Adc)
Provides initialization and conversion services for analog-to-digital converters.
Funktionen — Übersicht
void Adc_Init (const Adc_ConfigType* ConfigPtr);Initializes the ADC hardware units and driver.Std_ReturnType Adc_SetupResultBuffer (Adc_GroupType Group, Adc_ValueGroupType* DataBufferPtr);Initializes ADC driver with the group specific result buffer start address where the conversion results will be stored.void Adc_DeInit (void);Returns all ADC HW Units to a state comparable to their power on reset state.void Adc_StartGroupConversion (Adc_GroupType Group);Starts the conversion of all channels of the requested ADC Channel group.void Adc_StopGroupConversion (Adc_GroupType Group);Stops the conversion of the requested ADC Channel group.Std_ReturnType Adc_ReadGroup (Adc_GroupType Group, Adc_ValueGroupType* DataBufferPtr);Reads the group conversion result of the last completed conversion round of the requested group and stores the channe l values...void Adc_EnableHardwareTrigger (Adc_GroupType Group);Enables the hardware trigger for the requested ADC Channel group.void Adc_DisableHardwareTrigger (Adc_GroupType Group);Disables the hardware trigger for the requested ADC Channel group.void Adc_EnableGroupNotification (Adc_GroupType Group);Enables the notification mechanism for the requested ADC Channel group.void Adc_DisableGroupNotification (Adc_GroupType Group);Disables the notification mechanism for the requested ADC Channel group.Adc_StatusType Adc_GetGroupStatus (Adc_GroupType Group);Returns the conversion status of the requested ADC Channel group.Adc_StreamNumSampleType Adc_GetStreamLastPointer (Adc_GroupType Group, Adc_ValueGroupType* * PtrToSamplePtr);Returns the number of valid samples per channel, stored in the result buffer.void Adc_GetVersionInfo (Std_VersionInfoType* versioninfo);Returns the version information of this module.Std_ReturnType Adc_SetPowerState (Adc_PowerStateRequestResultType* Result);This API configures the Adc module so that it enters the already prepared power state, chosen between a predefined set of...Std_ReturnType Adc_GetCurrentPowerState (Adc_PowerStateType* CurrentPowerState, Adc_PowerStateRequestResultType* Result);Service Adc_GetCurrentPowerState.Std_ReturnType Adc_GetTargetPowerState (Adc_PowerStateType* TargetPowerState, Adc_PowerStateRequestResultType* Result);Service Adc_GetTargetPowerState.Std_ReturnType Adc_PreparePowerState (Adc_PowerStateType PowerState, Adc_PowerStateRequestResultType* Result);This API starts the needed process to allow the ADC HW module to enter thevoid Adc_Main_PowerTransitionManager (void);This API is cyclically called and supervises the power state transitions, checking for the readiness of the module and issuing...void IoHwAb_Adc_NotifyReadyForPower (void);The API shall be invoked by the ADC Driver when the requested power state preparation for mode is completed.
Typen — Übersicht
struct Adc_ConfigTypeData structure containing the set of configuration parameters required for initializing the ADC Driver and ADC HW Unit(s).Adc_ChannelTypeNumeric ID of an ADC channel.Adc_GroupTypeNumeric ID of an ADC channel group.Adc_ValueGroupTypeType for reading the converted values of a channel group (raw, without further scaling, alignment according precompile switch...Adc_PrescaleTypeType of clock prescaler factor.Adc_ConversionTimeTypeType of conversion time, i.Adc_SamplingTimeTypeType of sampling time, i.Adc_ResolutionTypeType of channel resolution in number of bits.enum Adc_StatusTypeCurrent status of the conversion of the requested ADC Channel group.Adc_TriggerSourceTypeType for configuring the trigger source for an ADC Channel group.enum Adc_GroupConvModeTypeType for configuring the conversion mode of an ADC Channel group.Adc_GroupPriorityTypePriority level of the channel.Adc_GroupDefTypeType for assignment of channels to a channel group (this is not an API type).Adc_StreamNumSampleTypeType for configuring the number of group conversions in streaming access mode (in single access mode, parameter is 1).enum Adc_StreamBufferModeTypeType for configuring the streaming access mode buffer type.enum Adc_GroupAccessModeTypeType for configuring the access mode to group conversion results.Adc_HwTriggerSignalTypeType for configuring on which edge of the hardware trigger signal the driver should react, i.Adc_HwTriggerTimerTypeType for the reload value of the ADC module embedded timer (only if supported by the ADC hardware).Adc_PriorityImplementationTypeType for configuring the prioritization mechanism.Adc_GroupReplacementTypeReplacement mechanism, which is used on ADC group level, if a group conversion is interrupted by a group which has a higher...Adc_ChannelIn case of active limit checking: defines which conversion values are taken into account related to the boardes defineed with...Adc_ResultAlignmentTypeType for alignment of ADC raw results in ADC result buffer (left/ right alignment).enum Adc_PowerStateTypePower state currently active or set as target power state.enum Adc_PowerStateRequestResultTypeType Adc_PowerStateRequestResultType.
Funktionen & Typen — Detailansicht
函数 Adc_Init [SWS_Adc_00365] 📄 PDF
void Adc_Init (const Adc_ConfigType* ConfigPtr);
Initializes the ADC hardware units and driver.
同步函数 Adc_Init(服务 ID 0x00)用于根据 [SWS_Adc_00365] 对所有 ADC 硬件单元以及 ADC 驱动程序进行初始配置和启动。该接口通过头文件 Adc.h 提供,且没有返回值。
参数与配置变体
配置数据通过类型为 const Adc_ConfigType* 的指针参数 ConfigPtr 传递 [SWS_Adc_00365]。所要求的实参取决于选定的构建变体:
- 使用后构建配置(
Variant PB)时,ConfigPtr必须指向包含初始化值的相应数据结构。 - 若采用预编译变体(
Variant PC),该接口显式要求传递NULL_PTR[SWS_Adc_00365]。
并发性与系统集成
函数 Adc_Init 被指定为不可重入(Non Reentrant)[SWS_Adc_00365]。理解:由于硬件单元是全局配置的且不具备重入性,该调用通常应在系统初始化期间集中进行,之后才能触发其他模块功能或转换。 问题 Q-a82e9204ae7a5ab7 (未决)
在电源管理方面,存在与相关要求的直接关联:如果在运行中请求了正常电源状态(normal Power State),则相应的 API 必须使用与 Adc_Init 的初始化参数位于相同容器中的配置参数 [SWS_Adc_00483]。
此使用说明基于 AUTOSAR 规范 R20-11 自动生成。
实现者指南即将推出(复杂度 I2)
函数 Adc_SetupResultBuffer [SWS_Adc_91000] 📄 PDF
Std_ReturnType Adc_SetupResultBuffer (Adc_GroupType Group, Adc_ValueGroupType* DataBufferPtr);
Initializes ADC driver with the group specific result buffer start address where the conversion results will be stored. The applicatio n has to ensure that the application buffer, where Data Buffer Ptr points to, can hold all the conversion results of the specified group. The initialization with Adc_ Setup Result Buffer is required after reset, before a group conversion can be started.
函数 Adc_SetupResultBuffer 使用用于存储转换结果的组特定缓冲区的起始地址初始化 ADC 驱动 [SWS_Adc_91000]。在复位后,必须执行此调用才能启动组转换 [SWS_Adc_91000]。
参数与调用上下文
Group:所请求 ADC 通道组的数字标识符 [SWS_Adc_91000]。DataBufferPtr:指向用于存放结果的数据缓冲区(类型Adc_ValueGroupType*)的指针 [SWS_Adc_91000]。
该函数被声明为可重入和异步的,并通过头文件 Adc.h(服务 ID 0x0c)提供 [SWS_Adc_91000]。
返回值与错误处理
返回类型为 Std_ReturnType [SWS_Adc_91000]:
E_OK:指向结果缓冲区的指针已成功初始化 [SWS_Adc_91000]。E_NOT_OK:操作失败或发生了开发错误 [SWS_Adc_91000]。
应用程序职责
调用应用程序必须确保 DataBufferPtr 所指向的缓冲区为指定通道组的所有转换结果提供足够的存储空间 [SWS_Adc_91000]。
本使用说明是基于 AUTOSAR R20-11 的规范自动生成的。
实现者指南即将推出(复杂度 I2)
函数 Adc_DeInit [SWS_Adc_00366] 📄 PDF
void Adc_DeInit (void);
Returns all ADC HW Units to a state comparable to their power on reset state.
函数 Adc_DeInit 用于 ADC 驱动程序的去初始化,并将所有相关的 ADC 硬件单元置于与上电复位后紧随的状态相当的状态 [SWS_Adc_00366]。它由此在重新初始化之前恢复硬件的初始状态。
调用与接口
该函数在头文件 Adc.h 中声明,服务 ID 为 0x01 [SWS_Adc_00366]。调用以同步方式(Synchronous)进行,不需要任何参数(既无 In、InOut,也无 Out);同样不提供返回值(签名 void Adc_DeInit(void))[SWS_Adc_00366]。在此过程中,既不评估也不生成输入参数或返回值。由于采用同步语义,执行过程会阻塞调用方,直至所有单元的复位完成 [SWS_Adc_00366]。
并发性与限制
在并发行为方面,该函数被指定为不可重入(Non Reentrant)[SWS_Adc_00366]。由此得出的理解为:不允许从多个任务或不同的软件层对 Adc_DeInit 进行并发或重叠调用,必须由调用方进行协调和避免。
由于 Adc_DeInit 会将所有 ADC 硬件单元完全复位至复位状态 [SWS_Adc_00366],因此在调用前应确保不再有测量或转换过程处于活动状态,以防止硬件出现未定义行为。 问题 Q-15bfa2b822826786 (未决)
该文本由 AI 生成,用作参考性文档帮助。
实现者指南即将推出(复杂度 I2)
函数 Adc_StartGroupConversion [SWS_Adc_00367] 📄 PDF
void Adc_StartGroupConversion (Adc_GroupType Group);
Starts the conversion of all channels of the requested ADC Channel group.
使用
函数 Adc_StartGroupConversion 根据 [SWS_Adc_00367] 启动传入的 ADC 通道组的所有通道的转换。作为参数,传入类型为 Adc_GroupType 的数值型组 ID Group。该函数没有返回值(void)并以异步方式工作([SWS_Adc_00367])。
并发性与限制
根据规范,该服务被归类为可重入([SWS_Adc_00367])。理解:这可能意味着该函数可以针对不同的通道组并发调用。 问题 Q-8283232f222f7b0a (未决)由于启动是异步进行的,调用在实际转换完成之前即返回。
错误处理与交互
该服务通过头文件 Adc.h 提供,服务 ID 为 0x02([SWS_Adc_00367])。本有效负载中未记录具体的 DET 或 DEM 错误代码。
本使用说明基于 AUTOSAR 规范 R20-11,并由系统自动生成。
实现者指南即将推出(复杂度 I2)
函数 Adc_StopGroupConversion [SWS_Adc_00368] 📄 PDF
void Adc_StopGroupConversion (Adc_GroupType Group);
Stops the conversion of the requested ADC Channel group.
同步函数 Adc_StopGroupConversion 终止所请求的 ADC 通道组的正在进行的转换 [SWS_Adc_00368]。该接口在头文件 Adc.h 中声明,并在服务 ID 0x03 下指定 [SWS_Adc_00368]。
作为唯一参数,传入类型为 Adc_GroupType 的输入值 Group,该值代表相应 ADC 通道组的数值 ID [SWS_Adc_00368]。该调用没有返回值(void),且既不使用输入/输出参数,也不使用纯输出参数 [SWS_Adc_00368]。
在并发行为方面,该服务被归类为可重入,并具有同步执行语义 [SWS_Adc_00368]。因此允许对该接口进行并行调用。同步行为意味着操作随函数调用立即完成 [SWS_Adc_00368]。
理解:从功能上看,调用可能需要事先已为相关组启动了转换,以便能够执行停止操作。 问题 Q-644ca5344ab849b0 (未决)在当前规范摘录中,未为该服务指出具体的错误代码、用于指示错误的返回值或向开发终端设备(DET/DEM)发送的报告 [SWS_Adc_00368]。
此使用说明基于 AUTOSAR CP R20-11 规范自动生成。
实现者指南即将推出(复杂度 I1)
函数 Adc_ReadGroup [SWS_Adc_00369] 📄 PDF
Std_ReturnType Adc_ReadGroup (Adc_GroupType Group, Adc_ValueGroupType* DataBufferPtr);
Reads the group conversion result of the last completed conversion round of the requested group and stores the channe l values starting at the Data Buffer Ptr address. The group channel values are stored in ascending channel number order ( in contrast to the storage layout of the result buffer if streaming access is configured).
同步函数 Adc_ReadGroup 用于从最近完成的转换轮次([SWS_Adc_00369])中读取 ADC 通道组的转换结果。它通过头文件 Adc.h 提供,且拥有服务 ID 0x04([SWS_Adc_00369])。
参数与缓冲区布局
Group:所请求的 ADC 通道组的数值标识符([SWS_Adc_00369])。DataBufferPtr:指向目标缓冲区(Adc_ValueGroupType*)的指针,从该地址开始存放该组所有通道的转换结果([SWS_Adc_00369])。
通道值的存储从目标地址开始按通道升序进行([SWS_Adc_00369])。这种存储布局显式区别于配置流式访问时的缓冲区排列([SWS_Adc_00369])。理解:调用方应负责为该组的所有通道提供容量充足的缓冲区。 问题 Q-f22a12a6c7ab0eb3 (未决)
返回值与错误处理
类型为 Std_ReturnType 的返回值指示读取操作的状态([SWS_Adc_00369]):
E_OK:结果可用且已成功写入数据缓冲区([SWS_Adc_00369])。E_NOT_OK:没有可用结果或发生了开发错误([SWS_Adc_00369])。
并发性
该函数被指定为可重入([SWS_Adc_00369])。因此只要在并发访问中使用独立的缓冲区区域,它就可以并行执行。
该文本根据 AUTOSAR CP R20-11 规范自动生成。
实现者指南即将推出(复杂度 I2)
函数 Adc_EnableHardwareTrigger [SWS_Adc_91001] 📄 PDF
void Adc_EnableHardwareTrigger (Adc_GroupType Group);
Enables the hardware trigger for the requested ADC Channel group.
用法与参数
函数 Adc_EnableHardwareTrigger 为已配置的 ADC 通道组激活硬件触发 [SWS_Adc_91001]。它在模块 Adc 中定义为服务 ID 为 0x05 的服务,并通过头文件 Adc.h 提供 [SWS_Adc_91001]。
- 输入参数:通过类型为
Adc_GroupType的参数Group传递所需 ADC 通道组的数字 ID [SWS_Adc_91001]。不存在额外的输入/输出或输出参数 [SWS_Adc_91001]。 - 返回值:该接口不提供返回值(
void)[SWS_Adc_91001]。 - 异步语义:执行行为被指定为异步 [SWS_Adc_91001]。此调用启用触发功能,而通道的实际转换仅通过后续的硬件事件触发。
并发性
驱动将 Adc_EnableHardwareTrigger 指定为可重入 [SWS_Adc_91001]。解释:由于硬件触发是按通道组激活的,可重入性可能主要涉及使用互不相交的通道组进行并发调用。 问题 Q-5750576df9f0284d (未决)
本使用说明基于 AUTOSAR Classic R20-11 规范。
实现者指南即将推出(复杂度 I1)
函数 Adc_DisableHardwareTrigger [SWS_Adc_91002] 📄 PDF
void Adc_DisableHardwareTrigger (Adc_GroupType Group);
Disables the hardware trigger for the requested ADC Channel group.
函数 Adc_DisableHardwareTrigger 用于禁用请求的 ADC 通道组的硬件触发 [SWS_Adc_91002]。
用法与语义
- 参数:传递类型为
Adc_GroupType的参数Group,用于指定所需 ADC 通道组的数字 ID [SWS_Adc_91002]。 - 返回值:该函数无返回值(
void)[SWS_Adc_91002]。 - 执行行为:该调用被归类为异步(Sync/Async: Asynchronous)[SWS_Adc_91002]。这 vermutlich 意味着硬件事件的实际停止或解耦在硬件端可能会延迟生效。 问题 Q-b0e613163b254242 (未决)
并发性与集成
该接口被声明为可重入(Reentrancy: Reentrant),并通过头文件 Adc.h 提供;其服务 ID 为 0x06 [SWS_Adc_91002]。当前的规范摘录中未包含特定的错误码、调用上下文或 DET/DEM 报告。
本文自动生成。所有信息均完全基于 AUTOSAR Classic R20-11 规范。
实现者指南即将推出(复杂度 I1)
函数 Adc_EnableGroupNotification [SWS_Adc_91003] 📄 PDF
void Adc_EnableGroupNotification (Adc_GroupType Group);
Enables the notification mechanism for the requested ADC Channel group.
函数 Adc_EnableGroupNotification 用于激活所请求 ADC 通道组的通知机制 [SWS_Adc_91003]。该接口的声明通过头文件 Adc.h 提供给用户 [SWS_Adc_91003]。
作为唯一的输入参数,传递数据类型为 Adc_GroupType 的 Group,它决定了所请求 ADC 通道组的数字 ID [SWS_Adc_91003]。该函数既没有输入/输出参数也没有输出参数,且不返回任何返回值(void)[SWS_Adc_91003]。该服务归入服务 ID 0x07 下,并具有异步执行语义 [SWS_Adc_91003]。
在并发行为方面,Adc_EnableGroupNotification 被指定为可重入 [SWS_Adc_91003]。因此允许进行多次并行调用。执行的异步分类可能意味着组通知的激活在驱动中被登记或在后台实施,而不会在处理期间阻塞调用上下文 [SWS_Adc_91003]。 问题 Q-bae8fba7810fa269 (未决)
本规范摘录未对具体的开发或生产错误(DET 或 DEM)以及确切的调用条件或任务上下文做出进一步规定。
本使用说明完全基于 AUTOSAR 版本 R20-11 的规范要求。
实现者指南即将推出(复杂度 I1)
函数 Adc_DisableGroupNotification [SWS_Adc_91004] 📄 PDF
void Adc_DisableGroupNotification (Adc_GroupType Group);
Disables the notification mechanism for the requested ADC Channel group.
在头文件 Adc.h 中声明的函数 Adc_DisableGroupNotification 用于在 ADC 驱动程序中有针对性地关闭请求的 ADC 通道组的通知机制 [SWS_Adc_91004]。该服务的服务 ID 为 0x08,并以签名 void Adc_DisableGroupNotification (Adc_GroupType Group) 进行指定 [SWS_Adc_91004]。
参数与接口
对于该函数的执行,规定传递单个输入参数:
Group:作为类型为Adc_GroupType的数字标识符传递所需 ADC 通道组的唯一 ID,该通道组的通知应被禁用 [SWS_Adc_91004]。
该函数不向调用方返回返回值(void)[SWS_Adc_91004]。此外,根据规范,既不使用组合输入/输出参数(inout),也不使用纯输出参数(out)[SWS_Adc_91004]。
执行行为与并发性
在并发行为方面,Adc_DisableGroupNotification 被归类为可重入 [SWS_Adc_91004]。这原则上允许不同程序上下文对该服务进行并行或中断调用 [SWS_Adc_91004]。
在时间同步方面,该函数被归类为异步 [SWS_Adc_91004]。Interpretation:由于时间特性被显式声明为异步,通知机制的关闭可能在驱动内部或 ADC 硬件后台进行,而不会阻塞调用上下文直至完全完成。 问题 Q-a1a30a254aa96655 (未决)
本使用说明自动生成,作为规范的补充参考指引。
功能与使用
函数 Adc_DisableGroupNotification 用于禁用指定 ADC 通道组(ADC Channel group)的通知机制 [SWS_Adc_91004]。该接口由头文件 Adc.h 声明,其服务 ID(Service ID)为 0x08 [SWS_Adc_91004]。
在参数与返回值方面:
- 输入参数
Group(类型为Adc_GroupType)用于传入所请求操作的 ADC 通道组的数值标识符(Numeric ID)[SWS_Adc_91004]。 - 该函数无输入输出参数、无输出参数,且无返回值(
void)[SWS_Adc_91004]。
执行特性与并发约束
根据规范定义,该函数具有以下调用约束与执行属性:
- 异步语义(Asynchronous):该服务以异步方式执行 [SWS_Adc_91004]。
- 可重入性(Reentrant):该函数具备可重入特性,支持并发重入调用 [SWS_Adc_91004]。
本说明由 AI 基于 AUTOSAR 规范条目生成,仅供参考。
实现者指南即将推出(复杂度 I1)
函数 Adc_GetGroupStatus [SWS_Adc_00374] 📄 PDF
Adc_StatusType Adc_GetGroupStatus (Adc_GroupType Group);
Returns the conversion status of the requested ADC Channel group.
函数 Adc_GetStreamLastPointer [SWS_Adc_00375] 📄 PDF
Adc_StreamNumSampleType Adc_GetStreamLastPointer (Adc_GroupType Group, Adc_ValueGroupType* * PtrToSamplePtr);
Returns the number of valid samples per channel, stored in the result buffer. Reads a pointer, pointing to a position in the group result buffer. With the pointer position, the results of all group channels of the last completed conversion round can be acc essed. With the pointer and the return value, all valid group conversion results can be accessed (the user has to take the layout of the result buffer into account).
函数 Adc_GetVersionInfo [SWS_Adc_00376] 📄 PDF
void Adc_GetVersionInfo (Std_VersionInfoType* versioninfo);
Returns the version information of this module.
函数 Adc_SetPowerState [SWS_Adc_00475] 📄 PDF
Std_ReturnType Adc_SetPowerState (Adc_PowerStateRequestResultType* Result);
This API configures the Adc module so that it enters the already prepared power state, chosen between a predefined set of configured ones.
同步服务函数 Adc_SetPowerState 将 ADC 模块置于从预配置集合中选出的、先前已准备好的电源状态 [SWS_Adc_00475]。
使用
该函数通过头文件 Adc.h 提供,服务 ID 为 0x10 [SWS_Adc_00475]。它不接收输入参数,而是通过类型为 Adc_PowerStateRequestResultType* 的输出参数 Result 传递结果 [SWS_Adc_00475]。成功激活电源状态后,函数返回 E_OK,并通过 Result 指示状态 ADC_SERVICE_ACCEPTED [SWS_Adc_00475]。
错误处理
如果请求被拒绝,调用将返回返回值 E_NOT_OK [SWS_Adc_00475]。模块在此通过参数 Result 区分三种具体的错误原因:
ADC_NOT_INIT:在调用时 ADC 模块尚未初始化 [SWS_Adc_00475]。ADC_SEQUENCE_ERROR:API 调用顺序错误 [SWS_Adc_00475]。ADC_HW_FAILURE:发生的硬件错误阻止进入所请求的状态 [SWS_Adc_00475]。
并发性与限制
Adc_SetPowerState 是不可重入的(Non Reentrant),并阻塞调用方直至同步采纳状态 [SWS_Adc_00475]。作为理解:调用前必须强制执行了目标状态的准备步骤,因为该函数显式请求已准备好的状态,并以 ADC_SEQUENCE_ERROR 拒绝顺序错误 [SWS_Adc_00475]。
本文由 AI 基于 AUTOSAR R20-11 规范生成。
实现者指南即将推出(复杂度 I2)
函数 Adc_GetCurrentPowerState [SWS_Adc_00476] 📄 PDF
Std_ReturnType Adc_GetCurrentPowerState (Adc_PowerStateType* CurrentPowerState, Adc_PowerStateRequestResultType* Result);
Service Adc_GetCurrentPowerState.
函数 Adc_GetTargetPowerState [SWS_Adc_00477] 📄 PDF
Std_ReturnType Adc_GetTargetPowerState (Adc_PowerStateType* TargetPowerState, Adc_PowerStateRequestResultType* Result);
Service Adc_GetTargetPowerState.
函数 Adc_PreparePowerState [SWS_Adc_00478] 📄 PDF
Std_ReturnType Adc_PreparePowerState (Adc_PowerStateType PowerState, Adc_PowerStateRequestResultType* Result);
This API starts the needed process to allow the ADC HW module to enter the AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_ADCDriver requested power state.
用法与调用上下文
同步函数 Adc_PreparePowerState 触发必要的准备过程,以将 ADC 硬件模块置于所请求的电源状态 [SWS_Adc_00478]。作为参数,传入期望的目标状态 PowerState 以及一个指针 Result,通过该指针反馈请求的状态 [SWS_Adc_00478]。返回值通过 E_OK 指示准备过程已启动,或通过 E_NOT_OK 指示服务已被拒绝 [SWS_Adc_00478]。
结果与错误处理
在成功的情况下(E_OK),输出参数 Result 提供状态值 ADC_SERVICE_ACCEPTED [SWS_Adc_00478]。如果服务被 E_NOT_OK 拒绝,则 Result 指定具体原因 [SWS_Adc_00478]:
ADC_NOT_INIT:ADC 模块尚未初始化 [SWS_Adc_00478]。ADC_SEQUENCE_ERROR:不允许的调用序列,因为当前状态已与目标状态相同 [SWS_Adc_00478]。ADC_POWER_STATE_NOT_SUPP:所请求的电源状态不受模块支持 [SWS_Adc_00478]。ADC_TRANS_NOT_POSSIBLE:无法直接转换,或者硬件外设仍处于忙碌状态 [SWS_Adc_00478]。
并发性与交互
该函数被指定为不可重入 [SWS_Adc_00478]。因此,调用方必须确保调用按顺序进行且不重叠。调用方可能需要事先完成或停止正在进行的转换,因为处于活动状态的硬件外设会导致拒绝。 问题 Q-210c59a46a90d781 (未决)在通过 Adc_PreparePowerState 成功准备之后,用于最终完成状态转换的后续非即时生效操作将通过相关的后续 API 执行 [SWS_Adc_00499]。
本使用说明系自动生成,且完全基于来自 SWS_Adc_00478 和 SWS_Adc_00499 的规范数据。
实现者指南即将推出(复杂度 I2)
函数 Adc_Main_PowerTransitionManager [SWS_Adc_00479] 📄 PDF
void Adc_Main_PowerTransitionManager (void);
This API is cyclically called and supervises the power state transitions, checking for the readiness of the module and issuing the callbacks Io Hw Ab_ Adc_ Notify Ready For Power State
用法与调用上下文
主函数 Adc_Main_PowerTransitionManager 用于周期性监控和处理 ADC 模块中的能态转换 [SWS_Adc_00479]。它具有签名 void Adc_Main_PowerTransitionManager(void),不接收任何传入参数且不返回返回值 [SWS_Adc_00479]。该函数被周期性调用并通过头文件 SchM_Adc.h 声明 [SWS_Adc_00479]。因此,调用通常可能发生在 BSW 调度器(SchM)的周期性任务上下文中。 问题 Q-4fc01e5bed5b3b57 (未决)
状态监控与异步流程
在周期性执行期间,该函数持续检查模块对于请求的能态的运行就绪状态 [SWS_Adc_00479]。一旦确定模块就绪,它便会发出通过配置参数 AdcPowerStateReadyCbkRef 引用的通知回调 IoHwAb_Adc_NotifyReadyForPowerState<Mode> [SWS_Adc_00479]。达到目标能态所需的所有异步操作均可在 Adc_Main_PowerTransitionManager 的执行上下文中于后台完成处理 [SWS_Adc_00498]。
错误处理与边界条件
如果无法从当前能态直接达到请求的能态,API 将报告运行时错误 ADC_E_TRANSITION_NOT_POSSIBLE [SWS_Adc_00498]。通过将耗时较长的转换过程转交至该周期性管理器函数,上层调用方不会被阻塞,与此同时 ADC 模块在后台完成状态切换 [SWS_Adc_00498]。
此使用说明基于 AUTOSAR Classic R20-11 规范自动生成。
实现者指南即将推出(复杂度 I1)
函数 IoHwAb_Adc_NotifyReadyForPower [SWS_Adc_00480] 📄 PDF
void IoHwAb_Adc_NotifyReadyForPowerState<#Mode> (void);
The API shall be invoked by the ADC Driver when the requested power state preparation for mode <#Mode> is completed.
函数 IoHwAb_Adc_NotifyReadyForPower 用作 I/O 硬件抽象的通知接口,并在模式 <#Mode> 下所请求电源状态的准备工作完成后由 ADC 驱动程序调用 [SWS_Adc_00480]。该接口的声明通过头文件 IoHwAb_Adc.h 提供 [SWS_Adc_00480]。
调用上下文与语义
根据规范,调用适用以下边界条件 [SWS_Adc_00480]:
- 参数与返回值:该函数既无输入、输出,也无输入/输出参数,且不提供返回值(
void)[SWS_Adc_00480]。 - 同步性:执行行为定义为同步 [SWS_Adc_00480]。
- 重入性:该函数被归类为不可重入(
Non Reentrant)[SWS_Adc_00480]。因此,调用方必须确保调用按顺序进行,不发生并发重叠。
交互与错误处理
规范数据中未记录错误代码或向 DET 或 DEM 发送的通知 [SWS_Adc_00480]。语法说明 IoHwAb_Adc_NotifyReadyForPowerState<#Mode> 可能表明,该标识符会根据所配置的电源模式进行特定生成。 问题 Q-9e9c969f8a41d0de (未决)该函数大概充当驱动程序的回调,以向上层电源管理指示已处于可进行切换的就绪状态。
该文本由 AI 基于规范 SWS_Adc_00480 生成。
实现者指南即将推出(复杂度 I1)
类型 Adc_ConfigType [SWS_Adc_00505] 📄 PDF
Data structure containing the set of configuration parameters required for initializing the ADC Driver and ADC HW Unit(s).
类型 Adc_ChannelType [SWS_Adc_00506] 📄 PDF
Numeric ID of an ADC channel.
类型 Adc_GroupType [SWS_Adc_00507] 📄 PDF
Numeric ID of an ADC channel group.
类型 Adc_ValueGroupType [SWS_Adc_00508] 📄 PDF
Type for reading the converted values of a channel group (raw, without further scaling, alignment according precompile switch ADC_ RESULT_ ALIGNMENT).
类型 Adc_PrescaleType [SWS_Adc_00509] 📄 PDF
Type of clock prescaler factor. (This is not an API type).
类型 Adc_ConversionTimeType [SWS_Adc_00510] 📄 PDF
Type of conversion time, i.e. the time during which the sampled analogue value is converted into digital representation. (This is not an API type).
类型 Adc_SamplingTimeType [SWS_Adc_00511] 📄 PDF
Type of sampling time, i.e. the time during which the value is sampled, (in clock - cycles). (This is not an API type).
类型 Adc_ResolutionType [SWS_Adc_00512] 📄 PDF
Type of channel resolution in number of bits. (This is not an API type).
类型 Adc_StatusType [SWS_Adc_00513] 📄 PDF
Current status of the conversion of the requested ADC Channel group.
根据 [SWS_Adc_00513],枚举类型 Adc_StatusType 表示所请求的 ADC 通道组的当前转换状态,并通过头文件 Adc.h 提供。
枚举值反映了模拟-数字转换的进度以及结果的可用性 [SWS_Adc_00513]:
ADC_IDLE(0x00):指定组的转换尚未启动;不存在测量结果 [SWS_Adc_00513]。ADC_BUSY(0x01):该组的转换已启动且当前仍在运行;目前尚无可用结果 [SWS_Adc_00513]。ADC_COMPLETED(0x02):该组的一个转换轮次(非最终轮次)已完成;该组的所有通道均有结果可用 [SWS_Adc_00513]。ADC_STREAM_COMPLETED(0x03):结果缓冲区已完全填满;对于所选组的每个通道,所需数量的采样值均已就绪 [SWS_Adc_00513]。
在应用中,该类型通常用于查询或评估组进度,以确定结果是否已可读取或是否仍有进一步的采样待完成。
此文本由 AI 基于 AUTOSAR CP R20-11 规范生成。
实现者指南即将推出(复杂度 I1)
类型 Adc_TriggerSourceType [SWS_Adc_00514] 📄 PDF
Type for configuring the trigger source for an ADC Channel group.
类型 Adc_GroupConvModeType [SWS_Adc_00515] 📄 PDF
Type for configuring the conversion mode of an ADC Channel group. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_ADCDriver
枚举类型 Adc_GroupConvModeType 用于配置 ADC 通道组的转换模式,并通过头文件 Adc.h 声明 [SWS_Adc_00515]。该类型规定在配置的触发事件之后,是对组内通道进行单次转换还是重复转换 [SWS_Adc_00515]。
有两个模式可供配置 [SWS_Adc_00515]:
-
ADC_CONV_MODE_ONESHOT(0x00):在配置的触发事件之后,对 ADC 通道组的每个通道精确执行一次转换 [SWS_Adc_00515]。如果配置了软件触发作为触发源,则已启动的转换可以通过软件 API 调用停止 [SWS_Adc_00515]。相反,如果分配了硬件触发源,只要硬件支持,即可通过禁用触发事件来暂停已启动的单次转换 [SWS_Adc_00515]。 -
ADC_CONV_MODE_CONTINUOUS(0x01):对通道组内的每个通道持续执行重复转换 [SWS_Adc_00515]。该连续模式仅适用于具有软件触发源的组 [SWS_Adc_00515]。已启动的连续转换运行可随时通过软件 API 调用终止 [SWS_Adc_00515]。
关于限制条件,需要注意的是 ADC_CONV_MODE_CONTINUOUS 仅允许配合软件触发使用,不能与硬件触发源组合 [SWS_Adc_00515]。在软件触发的情况下,停止正在进行的转换需要专用的软件 API 调用,而硬件触发的单次流程则需要关闭触发事件 [SWS_Adc_00515]。
该文本由 AI 创建,且完全基于来自 AUTOSAR R20-11 的规范数据。
实现者指南即将推出(复杂度 I1)
类型 Adc_GroupPriorityType [SWS_Adc_00516] 📄 PDF
Priority level of the channel. Lowest priority is 0.
类型 Adc_GroupDefType [SWS_Adc_00517] 📄 PDF
Type for assignment of channels to a channel group (this is not an API type).
类型 Adc_StreamNumSampleType [SWS_Adc_00518] 📄 PDF
Type for configuring the number of group conversions in streaming access mode (in single access mode, parameter is 1). Available Adc.h AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_ADCDriver via
类型 Adc_StreamBufferModeType [SWS_Adc_00519] 📄 PDF
Type for configuring the streaming access mode buffer type.
枚举类型 Adc_StreamBufferModeType 用于配置 ADC 驱动程序流式访问模式下的缓冲区行为,并通过头文件 Adc.h 提供 [SWS_Adc_00519]。
该类型为流式转换时的缓冲区管理定义了两种特定的操作模式 [SWS_Adc_00519]:
ADC_STREAM_BUFFER_LINEAR(值0x00):一旦流式缓冲区变满或达到规定的采样值数量,ADC 驱动程序将自动终止转换 [SWS_Adc_00519]。ADC_STREAM_BUFFER_CIRCULAR(值0x01):在达到满缓冲区容量后,ADC 驱动程序仍通过跳回缓冲区开头并进行循环覆盖来继续转换 [SWS_Adc_00519]。
集成层和应用软件必须使缓冲区行为与各自的处理策略相协调:ADC_STREAM_BUFFER_LINEAR 适用于具有固定采样大小的自成一体的测量系列,而 ADC_STREAM_BUFFER_CIRCULAR 大概需要持续的缓冲区监控或及时提取数据,以避免由于自动覆盖而导致未察觉的数据丢失 [SWS_Adc_00519]。 问题 Q-23b411e5e6c50591 (未决)
本说明由 AI 基于 AUTOSAR Classic R20-11 规范生成。
实现者指南即将推出(复杂度 I1)
类型 Adc_GroupAccessModeType [SWS_Adc_00528] 📄 PDF
Type for configuring the access mode to group conversion results.
枚举类型 Adc_GroupAccessModeType 用于根据 [SWS_Adc_00528] 配置对 ADC 通道组转换结果的访问模式。该类型定义通过头文件 Adc.h 提供,并规定了结果在内存中的存储方式。
规范中为组访问模式的配置定义了两个值 [SWS_Adc_00528]:
ADC_ACCESS_MODE_SINGLE(值0x00):为相应组配置单值访问模式(Single value access mode)。ADC_ACCESS_MODE_STREAMING(值0x01):为相应组配置流式访问模式(Streaming access mode)。
该类型在配置 ADC 驱动时使用,以控制对转换结果缓冲区的访问行为 [SWS_Adc_00528]。解释:单值模式可能旨在为每个组通道提供单个当前结果值,而流式模式则可能是为具有多个缓冲值的更连续测量系列而设计的。 问题 Q-8a933cffcd1132ef (未决)
由于它是一个纯配置类型,该需求未为此类型定义单独的错误码、返回值或 DET/DEM 消息 [SWS_Adc_00528]。
本说明由 AI 基于 AUTOSAR Classic R20-11 规范生成。
实现者指南即将推出(复杂度 I1)
类型 Adc_HwTriggerSignalType [SWS_Adc_00520] 📄 PDF
Type for configuring on which edge of the hardware trigger signal the driver should react, i.e. start the conversion (only if supported by the ADC hardware).
类型 Adc_HwTriggerTimerType [SWS_Adc_00521] 📄 PDF
Type for the reload value of the ADC module embedded timer (only if supported by the ADC hardware).
类型 Adc_PriorityImplementationType [SWS_Adc_00522] 📄 PDF
Type for configuring the prioritization mechanism.
类型 Adc_GroupReplacementType [SWS_Adc_00523] 📄 PDF
Replacement mechanism, which is used on ADC group level, if a group conversion is interrupted by a group which has a higher priority.
类型 Adc_Channel [SWS_Adc_00524] 📄 PDF
In case of active limit checking: defines which conversion values are taken into account related to the boardes defineed with Adc Channel Low Limit and Adc Channel High Limit.
类型 Adc_ResultAlignmentType [SWS_Adc_00525] 📄 PDF
Type for alignment of ADC raw results in ADC result buffer (left/ right alignment).
使用与取值范围
枚举类型 Adc_ResultAlignmentType 由头文件 Adc.h 提供,在模块 Adc 中用于确定结果缓冲区中 ADC 原始值的对齐方式 [SWS_Adc_00525]。它构成了用于配置驱动程序缓冲区存储的标准接口 [SWS_Adc_00525]。作为纯数据类型,它本身没有函数参数、返回值或异步语义 [SWS_Adc_00525]。
根据规范,该枚举的值范围恰好包含两个取值 [SWS_Adc_00525]:
-
ADC_ALIGN_LEFT(数值0x00):配置缓冲区中转换结果的左对齐 [SWS_Adc_00525]。 -
ADC_ALIGN_RIGHT(数值0x01):配置缓冲区中转换结果的右对齐 [SWS_Adc_00525]。
含义与边界条件
所选的值决定了转换后原始数据存放在缓冲区区域的哪些位位置 [SWS_Adc_00525]。由此确定有效数据位在内存中是左对齐还是右对齐 [SWS_Adc_00525]。Interpretation:当模数转换器的硬件分辨率小于所分配缓冲区存储器的元素宽度时,对左对齐或右对齐的设定可能尤为重要。 问题 Q-54221124172a3d87 (未决)下游软件组件必须考虑所配置的对齐方式,以便能够在不发生计算错误或移位错误的情况下读出原始值。
该枚举不存在特定的错误码、DET 或 DEM 报告 [SWS_Adc_00525]。
本使用说明自动生成,基于 AUTOSAR 规范 R20-11。
类型 Adc_PowerStateType [SWS_Adc_00526] 📄 PDF
Power state currently active or set as target power state.
枚举类型 Adc_PowerStateType 在 AUTOSAR Classic 中定义了 ADC 驱动程序的能耗状态 [SWS_Adc_00526]。它在驱动程序中用于表示模块当前处于的运行状态,或指定用于电源管理的新目标状态 [SWS_Adc_00526]。该数据类型的声明通过头文件 Adc.h 提供 [SWS_Adc_00526]。
针对枚举的各个状态,规范在功耗方面规定了层级顺序 [SWS_Adc_00526]:
ADC_FULL_POWER(数值 0):表示 ADC 驱动程序的完全运行和工作模式,无电流限制 [SWS_Adc_00526]。- 取值范围 1 至 255:表示功耗逐步降低的可选节能模式 [SWS_Adc_00526]。
关于协同交互以及系统环境的集成,适用以下 Interpretation:该类型可能主要用作能态转换控制函数中的传入参数,以及用于向上层模块(如 BSW 或 ECU 状态管理)进行状态反馈。 问题 Q-e4f964bd79ad550c (未决)由于属于基本数据类型定义,调用上下文、重入要求、同步或异步语义以及运行时错误和 DET 报告等特定属性仅在关联的驱动程序 API 中定义,而不属于本类型描述的一部分 [SWS_Adc_00526]。
本文由 AI 生成。其完全基于 AUTOSAR Release R20-11 规范。
实现者指南即将推出(复杂度 I1)
类型 Adc_PowerStateRequestResultType [SWS_Adc_00527] 📄 PDF
Type Adc_PowerStateRequestResultType.
枚举类型 Adc_PowerStateRequestResultType 定义了 ADC 驱动程序电源管理中状态转换请求的返回值,并通过头文件 Adc.h 提供 [SWS_Adc_00527]。
该类型的值体现了所请求的电源状态切换的成功或具体错误原因 [SWS_Adc_00527]:
ADC_SERVICE_ACCEPTED(0):成功执行了切换至所需状态的操作 [SWS_Adc_00527]。ADC_NOT_INIT(1):调用失败,因为 ADC 模块尚未初始化 [SWS_Adc_00527]。ADC_SEQUENCE_ERROR(2):调用 API 的顺序存在错误 [SWS_Adc_00527]。ADC_HW_FAILURE(3):硬件错误阻止了切换至所要求的状态 [SWS_Adc_00527]。ADC_POWER_STATE_NOT_SUPP(4):所要求的电源状态不受 ADC 模块支持 [SWS_Adc_00527]。ADC_TRANS_NOT_POSSIBLE(5):无法直接从当前状态转换到所需状态,或者硬件外设仍处于忙碌状态 [SWS_Adc_00527]。
调用方必须评估返回值,以区分常规执行与错误条件(如错误的调用序列、模块未初始化或硬件冲突)[SWS_Adc_00527]。
本文本由 AI 基于规范生成。
实现者指南即将推出(复杂度 I1)
Request a governed re-review of this record. The record is not changed immediately.
- Record
AUTOSAR/AP/record/CP_MOD_Adc- Status
- unspecified
- Version
AUTOSAR/AP/record/CP_MOD_Adc@rel:R20-11#fc210cd7- Content hash
fc210cd7- Source
- https://www.autosar.org/fileadmin/standards/R20-11/CP/AUTOSAR_SWS_ADCDriver.pdf#nameddest=SWS_Adc_00365
gemini-3.8-flash-low· 2026-10-13 · 德文原文