specification of adc driver - autosar.org · the adc driver initializes and controls the internal...

77
Specification of ADC Driver V2.0.1 1 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential - Document Title Specification of ADC Driver Document Owner AUTOSAR GbR Document Responsibility AUTOSAR GbR Document Version 2.0.1 Document Status Final Document Change History Date Version Changed by Change Description 27.06.2006 2.0.1 AUTOSAR Administration Layout Adaptations 27.03.2006 2.0.0 AUTOSAR Administration Document structure adapted to common Release 2.0 SWS Template. Gated continuous conversion mode added On Demand conversion mode added Other minor changes 30.06.2005 1.0.0 AUTOSAR Administration Initial Release

Upload: others

Post on 08-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

1 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Document Title Specification of ADC Driver Document Owner AUTOSAR GbR Document Responsibility AUTOSAR GbR Document Version 2.0.1 Document Status Final

Document Change History Date Version Changed by Change Description 27.06.2006 2.0.1 AUTOSAR

Administration Layout Adaptations

27.03.2006 2.0.0 AUTOSAR Administration

Document structure adapted to common Release 2.0 SWS Template. • Gated continuous conversion mode

added • On Demand conversion mode added • Other minor changes

30.06.2005 1.0.0 AUTOSAR Administration

Initial Release

Page 2: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

2 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Disclaimer This specification as released by the AUTOSAR Development Partnership is intended for the purpose of information only. The use of material contained in this specification requires membership within the AUTOSAR Development Partnership or an agreement with the AUTOSAR Development Partnership . The AUTOSAR Development Partnership will not be liable for any use of this Specification. Following the completion of the development of the AUTOSAR Specifications commercial exploitation licenses will be made available to end users by way of written License Agreement only. No part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from the publisher. The word AUTOSAR and the AUTOSAR logo are registered trademarks. Copyright © 2004-2006 AUTOSAR Development Partnership. All rights reserved. Advice to users of AUTOSAR Specification Documents: AUTOSAR Specification Documents may contain exemplary items (exemplary reference models, "use cases", and/or references to exemplary technical solutions, devices, processes or software). Any such exemplary items are contained in the Specification Documents for illustration purposes only, and they themselves are not part of the AUTOSAR Standard. Neither their presence in such Specification Documents, nor any later AUTOSAR compliance certification of products actually implementing such exemplary items, imply that intellectual property rights covering such exemplary items are licensed under the same rules as applicable to the AUTOSAR Standard.

Page 3: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

3 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Table of Contents 1 Introduction and functional overview ................................................................... 6

2 Acronyms and abbreviations ............................................................................... 8

3 Related documentation........................................................................................ 9

3.1 Input documents........................................................................................... 9 3.2 Related standards and norms ...................................................................... 9

4 Constraints and assumptions ............................................................................ 10

4.1 Limitations .................................................................................................. 10 4.2 Applicability to car domains........................................................................ 10

5 Dependencies to other modules........................................................................ 11

5.1 File structure .............................................................................................. 11 5.1.1 Code file structure ............................................................................... 11 5.1.2 Header file structure............................................................................ 11

6 Requirements traceability .................................................................................. 13

7 Functional specification ..................................................................................... 20

7.1 General behavior........................................................................................ 20 7.1.1 Background & Rationale ..................................................................... 20 7.1.2 Requirements...................................................................................... 21

7.2 Conversion processing and interaction ...................................................... 22 7.2.1 Background & Rationale ..................................................................... 22 7.2.2 Requirements...................................................................................... 29

7.3 Version check............................................................................................. 30 7.3.1 Background & Rationale ..................................................................... 30 7.3.2 Requirements...................................................................................... 30

7.4 Error classification ...................................................................................... 30 7.5 Error detection............................................................................................ 31 7.6 Error notification ......................................................................................... 33

8 API specification................................................................................................ 34

8.1 Imported types............................................................................................ 34 8.1.1 Standard types .................................................................................... 34 8.1.2 Other Modules types ........................................................................... 34

8.2 Type definitions .......................................................................................... 34 8.2.1 Adc_ConfigType.................................................................................. 34 8.2.2 Adc_ConfigGatedType........................................................................ 34 8.2.3 Adc_ChannelType............................................................................... 34 8.2.4 Adc_GroupType .................................................................................. 34 8.2.5 Adc_ValueType................................................................................... 35 8.2.6 Adc_ClockSourceType........................................................................ 35 8.2.7 Adc_PrescaleType .............................................................................. 35 8.2.8 Adc_ConvTimeType............................................................................ 35 8.2.9 Adc_VoltageSourceType .................................................................... 35 8.2.10 Adc_GroupDefType ............................................................................ 35

Page 4: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

4 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

8.2.11 Adc_PointerBufferType ....................................................................... 36 8.2.12 Adc_PeriodType.................................................................................. 36 8.2.13 Adc_StatusType.................................................................................. 36 8.2.14 Adc_GroupTriggSrcOneShotType ...................................................... 36 8.2.15 Adc_GroupConvModeType................................................................. 36 8.2.16 Adc_GatedGroupAcqTriggSrc............................................................. 37

8.3 Function definitions .................................................................................... 37 8.3.1 Adc_Init ............................................................................................... 37 8.3.2 Adc_DeInit........................................................................................... 39 8.3.3 Adc_StartGroupConversion ................................................................ 39 8.3.4 Adc_StopGroupConversion................................................................. 40 8.3.5 Adc_SingleValueReadChannel ........................................................... 41 8.3.6 Adc_EnableHardwareTrigger .............................................................. 42 8.3.7 Adc_DisableHardwareTrigger ............................................................. 43 8.3.8 Adc_EnableGroupNotification ............................................................. 45 8.3.9 Adc_DisableGroupNotification ............................................................ 46 8.3.10 Adc_GatedSetUp ................................................................................ 47 8.3.11 Adc_StartOnDemandConversion ........................................................ 47 8.3.12 Adc_OnDemandReadChannel............................................................ 48 8.3.13 Adc_StartGatedConversion ................................................................ 49 8.3.14 Adc_GetGatedLastPointer .................................................................. 50 8.3.15 Adc_GetGroupStatus .......................................................................... 51 8.3.16 Adc_GetVersionInfo ............................................................................ 52

8.4 Call-back Notifications................................................................................ 53 8.5 Scheduled functions ................................................................................... 53 8.6 Expected Interfaces.................................................................................... 53

8.6.1 Mandatory Interfaces .......................................................................... 53 8.6.2 Optional Interfaces .............................................................................. 53 8.6.3 Configurable interfaces ....................................................................... 53

9 Sequence diagrams .......................................................................................... 55

9.1 Adc_Init() .................................................................................................... 55 9.2 Adc_DeInit() ............................................................................................... 55 9.3 SW triggered One Shot conversion of one group without notification......... 56 9.4 SW triggered conversion of two groups with notification ............................ 56 9.5 HW triggered One Shot conversion of one group with notification ............. 58 9.6 SW triggered continuous conversion of two groups, sharing one channel . 59 9.7 HW-Triggered Conversion using an internal timer of one group with notification............................................................................................................. 60

10 Configuration specification............................................................................. 61

10.1 How to read this chapter ............................................................................ 61 10.1.1 Configuration and configuration parameters ....................................... 61 10.1.2 Containers........................................................................................... 61 10.1.3 Specification template for configuration parameters ........................... 62

10.2 Configuration and configuration parameters .............................................. 62 10.2.1 Variants............................................................................................... 62 10.2.2 AdcDriverGeneralConfiguration .......................................................... 63 10.2.3 AdcHWUnitConfiguration .................................................................... 64 10.2.4 AdcChannelConfiguration ................................................................... 65

Page 5: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

5 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10.2.5 AdcGroupConfiguration....................................................................... 66 10.2.6 AdcStreamingConfiguration ................................................................ 68 10.2.7 Configuration of optional API services ................................................ 70

10.3 Published information................................................................................. 72 10.4 Configuration of symbolic names ............................................................... 73

11 Changes to Release 1 ................................................................................... 74

11.1 Deleted SWS Items.................................................................................... 74 11.2 Replaced SWS Items ................................................................................. 74 11.3 Changed SWS Items.................................................................................. 74 11.4 Added SWS Items...................................................................................... 75

Page 6: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

6 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

1 Introduction and functional overview This specification specifies the functionality, API and the configuration of the AUTOSAR Basic Software module ADC driver The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with a set of basic functionalities with single value result access mode. In order to permit frequency analysis of the signal (i.e. FFT), needed in some special applications, enhanced functionalities with a stream access are let available. Typical applications in which this sort of specific analogue conversion is requested are knocking detection or valve control position via spectrum analysis of the current on the coil. The ADC driver provides services for:

• Single value results access mode A One Shot conversion can be started by a software trigger or a hardware event. A special type of One Shot conversion is the so called On Demand conversion. This conversion is started by a software trigger and it is allowed to interrupt a One Shot conversion or a Continuous conversion in progress. A Continuous conversion can be started by a software trigger. The ADC conversion results are returned by an ADC read service. This service returns the last converted result from an internal buffer (HW or SW).

• Stream access

A stream conversion can be started/stopped by a software trigger or a hardware event. The ADC conversion results are written to an ADC user data buffer. When the end of the buffer is reached the conversion is stopped or the gate is closed or the programmed number of samples are acquired the conversion is stopped.

Page 7: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

7 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

The following table shows all ADC modes and the functional boundary of the ADC driver:

Trigger Source Conversion Mode

Results Access Mode

Continuous On Demand SW API

External HW

Internal HW

One Shot Single value

SW API

External HW

Internal HW

Gated Continuous Streaming

Table 1: ADC driver modes and functional boundary

Enhanced funct.

Basic funct.

Page 8: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

8 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

2 Acronyms and abbreviations Abbreviatiosn / Acronyms:

Description:

DEM Diagnostic Event Manager DET Development Error Tracer ADC channel Represents a logical ADC entity bound to one port pin. Multiple ADC entities can

be mapped to the same port pin. ADC channel group

A group of ADC channels linked to the same ADC hardware unit. (e.g. one sample&hold and one A/D converter) The conversion of the whole group is triggered by one trigger source. Limitation only for Gated Continuous: one ADC channel can only belong to one ADC channel group.

ADC internal buffer for basic functionalities

The ADC Driver provides a buffer for each ADC channel. This buffer can hold one single ADC value and is always overwritten by the last conversion result of this channel. Depending on the HW capability is possible to have some other specific buffer in which the driver stores the result of an On Demand conversion.

ADC external buffer for enhanced functionalities

The ADC Driver user shall provide a buffer for every channels configured in a Gated Continuous mode. This buffer can hold multiple samples of the same channel.

Trigger Source Source event that starts a single conversion or a continuous series of conversions Basic funct.

One-Shot: The conversion of an ADC channel group is performed once after a trigger and the result is written to the assigned buffer. The One-Shot conversion can be stopped by a software API call (stop). A trigger can be a software API call or an internal or external hardware event. On Demand: The conversion of an ADC channel group is performed after a software API call (start). It is allowed to suspend an on going conversion activity of another channel group. Continuous: The conversions of an ADC channel group are performed continuously after a software API call (start). The conversions itself are running automatically (hardware/interrupt controlled). The Continuous conversions can be stopped by a software API call (stop).

Conv-ersion Mode

Enhanced funct.

Gated Continuous: The conversions of an ADC channel group are performed once after a trigger until the buffer is full or until the gate is closed or the number of sample is reached and the result is written to the assigned buffer. A trigger can be a software API call or an internal or external hardware event.

Single value

Direct access by an API Results Access Mode Strea

ming Access to a buffer by a pointer

Conversion time The time necessary to perform a conversion (including sampling) is referred to as conversion time.

Table 2: Acronym and abbreviation used on the document

Page 9: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

9 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

3 Related documentation

3.1 Input documents [1] General Requirements on Basic Software Modules,

AUTOSAR_SRS_General.pdf [2] General Requirements on SPAL,

AUTOSAR_SRS_SPAL_General.pdf

[3] Specification of Standard Types, AUTOSAR_SWS_StandardTypes.pdf

[4] List of Basic Software Modules, AUTOSAR_BasicSoftwareModules.pdf

[5] Specification of Diagnostics Event Manager, AUTOSAR_SWS_DEM.pdf

[6] Specification of Development Error Tracer, AUTOSAR_SWS_DevelopmentErrorTracer.pdf

[7] Requirements on ADC Driver, AUTOSAR_SRS_ADC_Driver.pdf

[8] Specification of ECU Configuration, AUTOSAR_ECU_Configuration.pdf

[9] Layered Software Architecture, AUTOSAR_LayeredSoftwareArchitecture.pdf

[10] Specification of ECU State Manager, AUTOSAR_SWS_ECU_StateManager.pdf

[11] Specification of I/O Hardware Abstraction, AUTOSAR_SWS_IOHW_Abstraction.pdf

3.2 Related standards and norms [12] HIS Specification I/O Drivers

http://www.automotive-his.de/download/ API_IODriver_2_1_3.pdf

[13] IEC 7498-1 The Basic Model, IEC Norm, 1994

Page 10: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

10 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

4 Constraints and assumptions

4.1 Limitations No limitations.

4.2 Applicability to car domains No restrictions.

Page 11: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

11 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

5 Dependencies to other modules Module DET In development mode the DET will be called. Module DEM Production errors will be reported to the Diagnostic Event Manager Mcu Driver The clock frequency may affect:

• Trigger frequency • Conversion time

Port driver Port pins must be configured correctly. Consider conversion pins and external trigger pins.

5.1 File structure 5.1.1 Code file structure ADC240: The code file structure shall not be defined within this specification. 5.1.2 Header file structure ADC267: The file include structure shall be as follows

Page 12: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

12 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

includes

Dem.h includes

Dem_IntErrId.h (Event Id Symbols)

Adc.h includes

includes

Std_Types.h

Adc.c

Det.h

Platform_Type.h Compiler.h

Adc_Cfg.c

Adc_Cfg.h

includes

includes

includes includes

includes (if development error detection is turned on)

includes

Figure 1: Adc Driver file structure

ADC239: The module shall include the Dem.h file. By this inclusion the APIs to report errors as well as the required Event Id symbols are included. This specification defines the name of the Event Id symbols which are provided by XML to the DEM configuration tool. The DEM configuration tool assigns ECU dependent values to the Event Id symbols and publishes the symbols in Dem_IntErrId.h.

Page 13: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

13 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

6 Requirements traceability Document: General Requirements on Basic Software, (see References) Requirements Satisfied [BSW00344] Reference to link-time configuration ADC027, ADC054 [BSW00404] Reference to post build time configuration ADC028 [BSW00405] Reference to multiple configuration sets ADC054, ADC242 [BSW00345] Pre-compile-time configuration ADC027 [BSW159] Tool-based configuration Both static and runtime configuration

parameters are located outside the source code of the module. This is the prerequisite for automatic configuration.

[BSW167] Static configuration checking Not applicable (requirement on configuration tool)

[BSW171] Configurability of optional functionality ADC120, ADC121, ADC186, ADC210, ADC228, ADC237, ADC238, ADC259, ADC260, ADC261, ADC262, ADC263, ADC264, ADC265, ADC266

[BSW170] Data for reconfiguration of AUTOSAR SW-Components

Not applicable (no reconfiguration and not a SWC)

[BSW00380] Separate C-File for configuration parameters ADC240

[BSW00419] Separate C-Files for pre-compile time configuration parameters

ADC240

[BSW00381] Separate configuration header file for pre-compile time parameters

ADC267

[BSW00412] Separate H-File for configuration parameters ADC267 [BSW00383] List dependencies of configuration files ADC267 [BSW00384] List dependencies to other modules See chapter 5 [BSW00387] Specify the configuration class of call-back function See chapter 8.4 [BSW00388] Introduce containers ADC027, ADC028, ADC197, ADC238,

ADC242, ADC268 [BSW00389] Containers shall have names ADC027, ADC028, ADC197, ADC238,

ADC242, ADC268 [BSW00390] Parameter content shall be unique within the module

ADC027, ADC028, ADC197, ADC238, ADC242, ADC268

[BSW00391] Parameter shall have unique names ADC027, ADC028, ADC197, ADC238, ADC242, ADC268

[BSW00392] Parameters shall have a type ADC027, ADC028, ADC197, ADC238, ADC242, ADC268

[BSW00393] Parameters shall have a range ADC027, ADC028, ADC197, ADC238, ADC242, ADC268

[BSW00394] Specify the scope of the parameters ADC027, ADC028, ADC197, ADC238, ADC242, ADC268

[BSW00395] List the required parameters (per parameter) ADC027, ADC028, ADC197, ADC238, ADC242, ADC268

[BSW00396] Configuration classes ADC027, ADC028, ADC197, ADC238, ADC242, ADC268

[BSW00397] Pre-compile-time parameters ADC027, ADC238, ADC242, ADC268 [BSW00398] Link-time parameters ADC028, ADC197 [BSW00399] Loadable Post-build time parameters ADC028, ADC197 [BSW00400] Selectable Post-build time parameters ADC028, ADC197 [BSW00402] Published information ADC030 [BSW00375] Notification of wake-up reason Not applicable

(this module does not provide any wake-up reason)

[BSW101] Initialization interface ADC054, ADC169

Page 14: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

14 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Requirements Satisfied [BSW00416] Sequence of Initialization Not applicable

(SW Integration requirement) [BSW00406] Check module initialization ADC068, ADC107, ADC243 [BSW168] Diagnostic Interface of SW components Not applicable

(this module does not support a special diagnostic interface)

[BSW00407] Function to read out published parameters ADC236, ADC237 [BSW00423] Usage of SW-C template to describe BSW modules with AUTOSAR Interfaces

Not applicable (driver has no Autosar interfaces)

[BSW00424] BSW main processing function task allocation Not applicable (this module does not provide a schedulable main function)

[BSW00425] Trigger conditions for schedulable objects Not applicable (requirement on implementation, not on specification)

[BSW00426] Exclusive areas in BSW modules Not applicable (requirement on implementation, not on specification)

[BSW00427] ISR description for BSW modules Not applicable (requirement on implementation, not on specification)

[BSW00428] Execution order dependencies of main processing functions

Not applicable (this module does not provide a schedulable main function)

[BSW00429] Restricted BSW OS functionality access Not applicable (requirement on implementation, not on specification)

[BSW00431] The BSW Scheduler module implements task bodies

Not applicable (requirement on implementation, not on specification)

[BSW00432] Modules should have separate main processing functions for read/receive and write/transmit data path

Not applicable (this module does not provide a schedulable main function)

[BSW00433] Calling of main processing functions Not applicable (this is a general requirement)

[BSW00434] The Schedule Module shall provide an API for exclusive areas

Not applicable (this is a special requirement for the BSW scheduler)

[BSW00336] Shutdown interface ADC109, ADC111 [BSW00337] Classification of errors ADC065, ADC069, ADC229, ADC230 [BSW00338] Detection and Reporting of development errors ADC067, ADC233 [BSW00369] Do not return development error codes via API ADC067, ADC233, ADC234 [BSW00339] Reporting of production relevant error and exceptions

ADC068, ADC069, ADC235, ADC239

[BSW00421] Reporting of production relevant error events ADC068, ADC069, ADC235, ADC239 [BSW00422] Debouncing of production relevant error status Not applicable

(applies only for DEM) [BSW00420] Production relevant error event rate detection Not applicable

(applies only for DEM) [BSW00417] Reporting of Error Events by Non-Basic Software Not applicable

(module is a BSW) [BSW00323] API parameter checking ADC065, ADC125, ADC126, ADC128,

ADC129, ADC130, ADC131, ADC132, ADC152, ADC176, ADC184, ADC193, ADC209, ADC225, ADC241, ADC218, ADC243, ADC269

[BSW004] Version check ADC030, ADC124 [BSW00409] Header files for production code error IDs ADC239

Page 15: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

15 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Requirements Satisfied [BSW00385] List possible error notifications ADC065, ADC069 [BSW00386] Configuration for detecting an error ADC068, ADC069, ADC086, ADC107,

ADC112, ADC115, ADC118, ADC125, ADC126, ADC128, ADC129, ADC130, ADC131, ADC132, ADC133, ADC134, ADC135, ADC136, ADC137, ADC152, ADC154, ADC164, ADC165, ADC166, ADC168, ADC175, ADC176, ADC183, ADC184, ADC185, ADC193, ADC208, ADC209, ADC212, ADC218, ADC225, ADC233, ADC241, ADC243, ADC269

[BSW161] Microcontroller abstraction Not applicable (architectural Autosar concept is the basis for this driver)

[BSW162] ECU layout abstraction Not applicable (architectural Autosar concept is the basis for this driver)

[BSW00324] Do not use HIS I/O Library Not applicable (architectural Autosar concept is the basis for this driver)

[BSW005] No hard coded horizontal interfaces within MCAL Not applicable (architectural Autosar concept is the basis for this driver)

[BSW00415] User dependent include files ADC267 [BSW164] Implementation of interrupt service routines Not applicable

(ADC driver is a part of microcontroller abstraction layer)

[BSW00325] Runtime of interrupt service routines Not applicable (requirement on implementation, not on specification)

[BSW00326] Transition from ISRs to OS tasks Not applicable (requirement on implementation, not on specification)

[BSW00342] Usage of source code and object code Not applicable (requirement on implementation, not on specification)

[BSW00343] Specification and configuration of time Not applicable (requirement on implementation, not on specification)

[BSW160] Human-readable configuration data Not applicable (requirement on implementation, not on specification)

[BSW007] HIS MISRA C Not applicable (requirement on implementation, not on specification)

[BSW00300] Module naming convention ADC267 [BSW00413] Accessing instances of BSW modules Not applicable

(requirement on implementation, not on specification)

[BSW00347] Naming separation of different instances of BSW drivers

Not applicable (requirement on implementation, not on specification)

[BSW00305] Self-defined data types naming convention See section 8.2 [BSW00307] Global variables naming convention Not applicable

(requirement on implementation, not on specification)

[BSW00310] API naming convention See section 8.3

Page 16: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

16 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Requirements Satisfied [BSW00373] Main processing function naming convention Not applicable

(this module does not provide a schedulable main function)

[BSW00327] Error values naming convention ADC065 [BSW00335] Status values naming convention ADC221, ADC222, ADC223, ADC224 [BSW00350] Development error detection keyword ADC027, ADC233 [BSW00408] Configuration parameter naming convention See section 10.2 [BSW00410] Compiler switches shall have defined values See section 10.2 [BSW00411] Get version info keyword ADC237, ADC238 [BSW00346] Basic set of module files ADC267 [BSW158] Separation of configuration from implementation ADC027, ADC028, ADC242, ADC267 [BSW00314] Separation of interrupt frames and service routines ADC267 [BSW00370] Separation of call-back interface from API ADC267, see section 8.4 [BSW00348] Standard type header ADC267, see section 8.1.1 [BSW00353] Platform specific type header ADC267, see section 8.1.1 [BSW00361] Compiler specific language extension header ADC267 [BSW00301] Limit imported information Not applicable

(requirement on implementation, not on specification)

[BSW00302] Limit exported information Not applicable (requirement on implementation, not on specification)

[BSW00328] Avoid duplication of code Not applicable (requirement on implementation, not on specification)

[BSW00312] Shared code shall be reentrant Not applicable (requirement on implementation, not on specification)

[BSW006] Platform independency Not applicable (requirement on implementation, not on specification)

[BSW00357] Standard API return type Not applicable (this type is not used within this SWS)

[BSW00377] Module specific API return types Not applicable (this type is not used within this SWS)

[BSW00304] AUTOSAR integer data types See section 8.2, 10.3 [BSW00355] Do not redefine AUTOSAR integer data types Not applicable

(no integer data types redefined in this specification)

[BSW00378] AUTOSAR boolean type See section 10.2 [BSW00306] Avoid direct use of compiler and platform specific keywords

Not applicable (requirement on implementation, not on specification)

[BSW00308] Definition of global data Not applicable (requirement on implementation, not on specification)

[BSW00309] Global data with read-only constraint See section 8.3.1 [BSW00371] Do not pass function pointers via API Not applicable

(requirement on implementation, not on specification)

[BSW00358] Return type of init() functions See section 8.3.1 [BSW00414] Parameter of init function Not applicable

(due to a SPAL Team decision, the parameter will be kept in any variant see ADC275)

[BSW00376] Return type and parameters of main processing functions

Not applicable (this module does not provide a schedulable main function)

Page 17: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

17 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Requirements Satisfied [BSW00359] Return type of call-back functions See section 8.6.3 [BSW00360] Parameters of call-back functions ADC270 [BSW00329] Avoidance of generic interfaces Not applicable

(no generic interface in this module. See section 8.3)

[BSW00330] Usage of macros / inline functions instead of functions

Not applicable (requirement on implementation, not on specification)

[BSW00331] Separation of error and status values See section 8.3.15, ADC065, ADC269 [BSW009] Module User Documentation See this SWS [BSW00401] Documentation of multiple instances of configuration parameters

See section 10.2

[BSW172] Compatibility and documentation of scheduling strategy

See section 8.3

[BSW010] Memory resource documentation Not applicable (requirement on implementation, not on specification)

[BSW00333] Documentation of call-back function context See section 8.6.3, ADC153, [BSW00374] Module vendor identification ADC030 [BSW00379] Module identification ADC030 [BSW003] Version identification ADC030 [BSW00318] Format of module version numbers ADC030 [BSW00321] Enumeration of module version numbers ADC030 [BSW00341] Microcontroller compatibility documentation Not applicable

(requirement on implementation, not on specification)

[BSW00334] Provision of XML file Not applicable (requirement on implementation, not on specification)

Document: General Requirements on SPAL. Requirements Satisfied by [BSW12263] Object code compatible configuration concept ADC028, ADC268 [BSW12056] Configuration of notification mechanisms ADC079, ADC080, ADC084, ADC085, [BSW12267] Configuration of wake-up sources Not applicable

(this module does not provide any wake-up reason)

[BSW12057] Driver module initialization ADC054, ADC169 [BSW12125] Initialization of hardware resources ADC056 [BSW12163] Driver module deinitialization ADC109, ADC110, ADC111 [BSW12461] Responsibility for register initialization ADC054, ADC147, ADC150, ADC151,

ADC246, ADC247, ADC248, ADC249, ADC250

[BSW12462] Provide settings for register initialization See section 10.3 [BSW12463] Combine and forward settings for register initialization

Not applicable (applies only for configuration tool)

[BSW12068] MCAL initialization sequence Not applicable (this is a general software integration requirement)

[BSW12069] Wake-up notification of ECU State Manager Not applicable (this module does not provide any wake-up reason)

[BSW157] Notification mechanisms of drivers and handlers ADC057, ADC058, ADC082, ADC083, ADC104

Page 18: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

18 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Requirements Satisfied by [BSW12169] Control of operation mode Not applicable

(no mode used) [BSW12063] Raw value mode ADC113, ADC189, ADC214, ADC189 [BSW12075] Use of application buffers ADC271 [BSW12129] Resetting of interrupt flags ADC078 [BSW12064] Change of operation mode during running operation Not applicable

(no mode used) [BSW12448] Behavior after development error detection ADC065, ADC086, ADC107, ADC112,

ADC115, ADC118, ADC125, ADC126, ADC128, ADC129, ADC130, ADC131, ADC132, ADC133, ADC134, ADC135, ADC136, ADC137, ADC152, ADC154, ADC164, ADC165, ADC166, ADC168, ADC175, ADC176, ADC183, ADC184, ADC185, ADC193, ADC208, ADC209, ADC212, ADC218, ADC225, ADC241, ADC243, ADC269,

[BSW12067] Setting of wake-up conditions Not applicable (this module does not provide any wake-up reason)

Non Functional Requirements Satisfied by [BSW12077] Non-blocking implementation Not applicable

(requirement on implementation, not on specification)

[BSW12078] Runtime and memory efficiency Not applicable (requirement on implementation, not on specification)

[BSW12092] Access to drivers Not applicable (requirement on implementation, not on specification)

[BSW12265] Configuration data shall be kept constant Not applicable (requirement on implementation, not on specification)

[BSW12264]Specification of configuration items See section 10.3 Requirements (module specific) Satisfied by [BSW12446] Number of supported ADC HW units ADC098, ADC127, ADC138, ADC242 [BSW12306] ADC Global Configuration ADC011, ADC087, ADC088, ADC242

[BSW12307] ADC Channel Configuration ADC011, ADC019, ADC023, ADC089, ADC099, ADC268

[BSW12447] Allow grouping of ADC channels

ADC014, ADC090, ADC091, ADC092, ADC093, ADC127, ADC158, ADC159, ADC160, ADC161, ADC162, ADC187, ADC211

[BSW12359] ADC Channel Group configuration of trigger source ADC094, ADC095, ADC096, ADC119, ADC139, ADC146, ADC163

[BSW12360] ADC Channel Group Configuration

ADC001, ADC002, ADC014, ADC023, ADC089, ADC094, ADC095, ADC096, ADC098, ADC099, ADC100, ADC101, ADC104, ADC105, ADC195, ADC196, ADC251, ADC254,

[BSW12805] Configuration of Gated Continuous conversion mode

ADC169, ADC175, ADC197, ADC198, ADC199, ADC251

[BSW12354] Assignment of multiple ADC channels to one port pin ADC092

[BSW12286] Set up of ADC stream service ADC177, ADC169, ADC198, ADC199 [BSW12280] ADC Channel Group results access mode ADC140, ADC213, ADC252, ADC271

Page 19: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

19 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Requirements Satisfied by [BSW12363] Enabling and disabling hardware triggered One Shot Conversion Mode

ADC077, ADC114, ADC116, ADC120, ADC121, ADC139, ADC142, ADC143, ADC144, ADC272, ADC273

[BSW12283] Mask out information bits ADC122, ADC190

[BSW12285] ADC channel read service ADC075, ADC106, ADC140, ADC141, ADC188, ADC191, ADC194, ADC215, ADC216, ADC219, ADC244

[BSW12317] ADC Channel Group notification function ADC060, ADC081, ADC104, ADC156, ADC181, ADC205, ADC206,

[BSW12808] ADC On Demand Channel notification function ADC180

[BSW12291] ADC Channel Group status service

ADC158, ADC159, ADC160, ADC161, ADC162, ADC187, ADC211, ADC220, ADC221, ADC222, ADC223, ADC224, ADC226, ADC255

[BSW12318] Enable / disable notification functions ADC057, ADC058, ADC077, ADC155, ADC156, ADC157, ADC174, ADC181, ADC205, ADC206

[BSW12364] Start and stop conversion of an ADC Channel Group

ADC061, ADC072, ADC108, ADC145, ADC146, ADC157, ADC163, ADC253, ADC255,

[BSW12809] Start On Demand conversion of an ADC Channel ADC167, ADC179, ADC182, ADC186, ADC251, ADC256

[BSW12395] Management of multiple ADC Channel Groups per HW unit

ADC086, ADC092, ADC183, ADC272, ADC273

[BSW12292] Handling of signed values ADC113, ADC189, ADC214 [BSW12807] Enable ADC stream service ADC197, ADC204, ADC210, [BSW12287] ADC stream job processing ADC200, ADC201, ADC274 [BSW12288] ADC stream buffer handling ADC216, ADC217 [BSW12800] ADC acquisition period configuration for stream service

ADC202, ADC203

[BSW12801] ADC stop stream service ADC255 [BSW12802]Identify most recent sample and number of available samples

ADC213, ADC214, ADC215

[BSW12811]ADC priority conversion mode ADC167, ADC182, ADC256, ADC257, [BSW12812] Continuous Scan Restart Point Published Parameter

ADC182, ADC207, ADC256, ADC257

[BSW12813] Guaranteed Validity Of On Demand Published Parameter

ADC188, ADC192

[BSW12814]Support multiple triggers ADC139 [BSW12816]Priorities for One Shot/Continuous conversion ADC167, ADC245, ADC258, [BSW12314] Multiple Groups of Channels ADC090, ADC093, ADC254

Page 20: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

20 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

7 Functional specification

7.1 General behavior 7.1.1 Background & Rationale In general the conversion requests of the ADC channels are controlled via the ADC channel group. A group can run in Continuous Conversion Mode or in One Shot conversion mode. The table below shows a list of possible desired functionalities of an ADC user and in which way they are provided by the ADC driver. Furthermore it is also depicted a possible realization/mapping of these within an commercial microcontroller (C16x).

Desired Functionality ADC Driver Function Example: C16x Derivate Wording

Just one conversion result of one channel

One-shot group conversion (where a group consists of exactly one channel)

Fixed channel single conversion

Repeated conversion of one channel

Continuous group conversion (where a group consists of exactly one channel)

Fixed channel Continuous conversion

Just one conversion result of each channel within a group

One-shot group conversion (where a group consists of more than one channel)

Auto scan single conversion

Repeated conversion of each channel within a group

Continuous group conversion (where a group consists of more than one channel)

Auto scan continuous conversion

Just one conversion starting immediately

On Demand channel group conversion

Tbd in next doc version

Multiply samples for the one channel acquired each after each other

Gated Continuous channel group conversion configured in continuously

Tbd in next doc version

Multiply samples for the each channel within a group acquired each Hw trigger event

Gated Continuous channel group conversion (where a group consists of more than one channel) configured with Hw trigger

Tbd in next doc version

Table 3: Different possibilities of One-shot, Continuous, On Demand, Gated Continuous conversions

To synchronize read access, notification functions per group can be enabled (and disabled) at runtime (see ADC104). Functions for enabling/disabling notification and hardware trigger capability are only available, if statically configured as active (like “turning a main switch on/off”).See chapter 10.2.7

Page 21: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

21 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

7.1.2 Requirements ADC090: The ADC Driver shall allow the grouping of ADC channels. The AD conversion of a group shall be started by one trigger source. ADC091: An ADC Channel Group shall contain at least 1 ADC Channel. ADC092: The ADC Driver shall allow the assignment of identical channels to more than one group. However this restricts concurrent operation of groups, sharing at least one channel. In other words, parallel operation of groups is only allowed for groups having no channel in common. ADC093: The ADC Driver shall allow the definition of several groups of ADC channels. ADC251: The ADC driver shall allow the following conversion modes:

• One-Shot: the conversion of an ADC channel group is performed once after a trigger and the result is written to the assigned buffer.

• On Demand: the conversion of an ADC channel group is performed after a software API call (start).

• Continuous: the conversions of an ADC channel group are performed continuously after a software API call (start). The conversions itself are running automatically (hardware/interrupt controlled).

• Gated Continuous: The conversions of an ADC channel group are performed once after a trigger until the buffer is full or until the gate is closed or the number of sample is reached and the result is written to the assigned buffer.

ADC252: The ADC driver shall allow the following result access modes:

• Single value: Direct access of one converted value provided by an API • Streaming: Access to a buffer by a pointer

ADC163: The ADC Driver offers an API interface for starting a software triggered One Shot or Continuous conversion of all channels within a channel group, where a channel group consists of one or more ADC channels (see 8 Table 3). Continuous or One Shot group conversions can be stopped by an API call (all channels within the channel group will be stopped). A start/stop operation is always performed on all channels of a channel group. However, starting or stopping a channel individually can be achieved by means of specifying a group, consisting of exactly one channel. ADC139: If supported by hardware and enabled via a dedicated API call, a One Shot conversion can also be triggered by an external or internal hardware event. ADC253: A Continuous conversion can only be started by an API call ADC140: For single value result access mode the converted channel results can be read as soon as the conversion is completed. Each ADC channel provides at least

Page 22: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

22 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

one single buffer that is overwritten at the moment that the next conversion result for that channel is available (single value results access). ADC167: The ADC Driver offers an API interface for a special single value conversion: On Demand. This type of conversion of an ADC channel group is performed once after a software API call (start). It is allowed to suspend a One Shot or a Continuous conversion of a group

7.2 Conversion processing and interaction 7.2.1 Background & Rationale The ADC driver shall manage more than one group configured in different conversion mode at the same time.This chapter explains in which way each conversion is executed and in which way the interaction between different request at same time are managed. The following table specifies the order of channel conversion depending on channel and conversion type:

• Example 1: Group X containing channels [CH0, CH1, CH2, CH3, CH4] is configured in Continuous Scan mode. After finishing each scan group conversion the notification (if enabled) is called. Then a new scan group conversion starts.

• Example 2: Group X containing channels [CH0, CH1, CH2, CH3, CH4] is configured in One Shot mode. After finishing the scan group conversion the notification (if enabled) is called.

• Example 3: Group X containing channel [CH3] is configured in Continuous Scan mode. After finishing each scan group conversion the notification (if enabled) is called. Then a new scan group conversion starts.

• Example 4: Group X containing channel [CH4] is configured in One Shot mode. After finishing the scan group conversion the notification (if enabled) is called.

• Example 5: Group X containing channels [CH0, CH1, CH2, CH3] is configured in Continuous Scan mode. Group Y containing channel [CH5] is configured in On Demand mode. During the conversion of Group X (CH1) an on Demand conversion for Group Y is requested. According to the published parameter ADC_TYPE_SCAN_RESTART (that in this example is supposed to take the value 2) the driver stop the Group X after finishing the ongoing conversion on CH1. Following the Group Y (CH5) is immediately converted, and the notification (if enabled) is called. After that, the Group X is restarted starting from CH2. After finishing each scan group X conversion the notification (if enabled) is called. Then a new scan group X conversion starts.

Page 23: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

23 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Figure 2: Conversion Mode behaviour examples

In the pictures below there are some examples of ADC functionalities. In particular the focus has been done on concurrent acquisitions, depending on the microcontroller hardware capability (determined by the published parameter ADC_HW_PRIORITY==FALSE).

Channel Type Conversion Type Process

Single Channel Group

Multi-channel Group

Multi-channel Group

Single Channel Group

Continuous

One-Shot

Continuous

One-Shot

CH0 CH1 CH2 CH3 CH4

CH3CH3 CH3 CH3CH3 CH3

CH2CH0 CH1 CH2 CH3 CH4CH0 CH1 CH2 CH3 CH4 CH0 CH1

CH4

ADC Channel being converted

CH4Start of conversions (hardware or sofware trigger)

Notification (if enabled)

Channels or groups continue to be converted

CH2

Single Channel Group On Demand CH3CH0 CH1 CH2 CH3 CH0CH0 CH1 CH5 CH2 CH3 CH1 CH2

Page 24: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

24 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

It means that the concurrent conversion are solved by the priority mechanism of the driver. The ADC driver user is required to manage properly ADC status to organize and solve the requested conversion sequence by the ADC user via get status, start and stop methods.

Legend

HIGH Request of an On Demand conversion

Priorityint./ext. trigger occurence during streaming conversion

LOWDefined mechanism Priority of the driver streaming conversion window

Continuous or One Shot conversion interrupted by an On Demand conversion

time

Continuous or One Shot conversion interrupted by a streaming conversion in which each sample is acquired by an int./ext. Trigger

streaming conversion window

trigger trigger trigger

time

Continuous or One Shot conversion interrupted by a streaming conversion in which each sample is acquired continuously

streaming conversion window

time

During a streamng conversion an On Demand conversion is not served

streaming conversion window

trigger trigger trigger

On Demand conversion

Continuous

Streaming conversion

Continuous

Streaming conversion

One Shot conversion

One Shot conversion

One Shot conversion

Streaming conversion

Continuous

Streaming conversion

On Demand conversion

Continuous or

On Demand conversion

One Shot conversion

Figure 3: Management of concurrent conversion (ADC_HW_PRIORTY == FALSE)

Page 25: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

25 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

In the pictures below here are some example of ADC functionalities. In particular the focus has been done on concurrent acquisition, depending on the microcontroller hardware capability (determined by the published parameter ADC_HW_PRIORITY==TRUE). It means that the microcontroller is able to manage and solve in HW the concurrent priorities. It is up to the ADC user to decide which following features should be used, configuring the streaming conversion with the parameter ADC_DEFAULT_PRIORITY in the Adc_GatedSetUp method. In this case two type of driver behaviour should be implemented. In the first case (ADC_DEFAULT_PRIORITY=FALSE) a Continuous or One Shot conversion are suspended by a streaming conversion in which each sample is triggered by an acquisition period. In the second case (ADC_DEFAULT_PRIORITY=TRUE), the driver will interrupt completely the One Shot or Continuous conversion in progress during the execution time of the Streaming conversion.

Page 26: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

26 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Continuous or One Shot conversion suspended by a streaming conversion in which each sample is triggered by an acquisition periodADC_DEFAULT_PRIORITY==FALSE

Continuous or One Shot conversion interrupted by a streaming conversion in which each sample is triggered by an acquisition periodADC_DEFAULT_PRIORITY==TRUE

Continuous or One Shot conversion suspended by a streaming conversion in which each sample is triggered by a int or ext triggerADC_DEFAULT_PRIORITY==FALSE

trigger trigger trigger

Continuous or

Group2

Continuous or One Shot

Streaming

Example of ADC concurrent acquisition with ADC_HW_PRIORITY==TRUE. The beaviohur of the driver is determined by the parameter of the streaming conversion ADC_DEFAULT_PRIORITY,

Acq period Acq periodStreaming

passed in the Adc_GatedSetUp function

conversion Group1

Acq period Acq period

Group2

Continuous or

conversion Group1

conversion Group1

One Shot

Streaming

One Shot

Figure 4: Management of concurrent conversion

Page 27: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

27 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

The driver behaves differently depending on the published information ADC_TYPE_SCAN_RESTART when a Continuous or a One Shot conversion is interrupted by a streaming or an On Demand one. In the picture below there three different cases:

• in the first one (ADC_TYPE_SCAN_RESTART=0) the group 1, configured as Continuous, the on going channel (channel 6) is interrupted and the conversions are restarted from the first channel of the group (channel 1)

• in the second one (ADC_TYPE_SCAN_RESTART=1) the group 1, configured as Continuous, the on going channel (channel 6) is interrupted and the conversions are restarted from the interrupted channel of the group (channel 6)

• in the third one (ADC_TYPE_SCAN_RESTART=2) the group 1, configured as Continuous, the on going channel (channel 6) is finished and the conversions are restarted from the following channel of the group (channel 7)

streaming convrsione windows

Streaming conversion

Continuous or One Shot conversion

The three below examples are based on a Group 1 configured as Continuous conversion and group with this channel composition:

ch1 ch3 ch4 ch6 ch7

ADC_TYPE_SCAN_RESTART=0

ch6

ADC_TYPE_SCAN_RESTART=1

ch6

ADC_TYPE_SCAN_RESTART=2

ch4

ch4

ch6

ch1

ch6

ch7ch4

Figure 5: Management of concurrent conversion (ADC_TYPE_SCAN_RESTART == TRUE)

Page 28: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

28 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

In the picture below there four different cases of gated continuous conversions to focus on the specific behaviours of different trigger sources:

Streaming conversion in which each sample is acquired at each external Hw trigger events Group1 configured with one channel (Ch1). Trigger Source configured with as ADC_GATED_GROUP_ACQ_HW_EXT_1Number of sample = 4During the acquisition the conversion is temporarly disabled. The trigger event that occurs during this period is ignored.

EnableHwTrigger() DisableHwTrigger() EnableHwTrigger() ADC_notification()Ext. Hw trigger

Ext. Hw trigger

Ext. Hw trigger

Ext. Hw trigger

Ext. Hw trigger

Streaming conversion in which each sample is acquired at each internal Hw trigger events Group1 configured with one channel (Ch1). Trigger Source configured with as ADC_GATED_GROUP_ACQ_HW_INT_1Number of sample = 4During the acquisition the conversion is temporarly disabled.

Int. Hw trigger Int. Hw trigger Int. Hw trigger Int. Hw triggerEnableHwTrigger() EnableHwTrigger() EnableHwTrigger() EnableHwTrigger() ADC_notification()

Re-arm Timer Re-arm Timer Re-arm Timer

Streaming conversion in which each sample is acquired continuosly.Group1 configured with one channel (Ch1). Trigger Source configured with as ADC_GATED_GROUP_ACQ_CONTNumber of sample = 9

Ch1 Ch1 Ch1 Ch1 Ch1 Ch1 Ch1 Ch1 Ch1

StartGatedConversion()ADC_notification()

Streaming conversion in which each sample is acquired at fixed period.Group1 configured with one channel (Ch1). Trigger Source configured with as ADC_GATED_GROUP_ACQ_PERIODNumber of sample = 9. The conversion is terminated before THE ACQ.OF CONFIGURED number of sample by a Stop Call.

Acq period ADC_notification()StopConversion()

StartGatedConversion()

Streaming conversion Group1

Acq period

Streaming conversion Group1

Streaming conversion Group1 Acq period

Streaming conversion Group1

Ch1 Ch1 Ch1 Ch1 Ch1

Ch1 Ch1 Ch1 Ch1

Ch1 Ch1 Ch1 Ch1

Figure 6: Management of different gated continuos conversion

Page 29: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

29 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Int. Timer Adc_EnableHwTrigger() + (0..*)Adc_EnableHwTrigger()

Internal Timer Exipire (to Arm once again the internal timer a new Adc_EnableHwTrigger() call is need

natural end group convertionor Adc_StopConv()

Sw API Adc_StartConv() Immediately after Open Gate natural end group convertionor Adc_StopConv()

-

Sw API Adc_StartConv() Immediately after Adc_StartConv()

Adc_StopConv()

Ext. Trigger Adc_EnableHwTrigger() External trigger event occours Adc_StopConv()or Buffer fullor Number of Sample acquired

Adc_DisableHwTrigger()

Int. Timer Adc_EnableHwTrigger() + (0..*)Adc_EnableHwTrigger()

Internal Timer Exipire (to Arm once again the internal timer a new Adc_EnableHwTrigger() call is need

Adc_StopConv()or Buffer fullor Number of Sample acquired

Sw API Adc_StartGatedConv() Immediately after Open Gate Adc_StopConv()or Buffer fullor Number of Sample acquired

Table 4:Different usage of ADC conversion mode

7.2.2 Requirements ADC254: If a channel shall be run in different modes (e.g. Continuous conversion mode during normal operation and One Shot or On Demand conversion mode for a special conversion on a dedicated point in time), the channel shall be assigned to multiple groups configured with different operation modes. ADC255: In order to change the mode of operation for a channel shared between groups the ADC user has following possibilities:

• use the built in priority mechanisms supported by the driver (On Demand and One Shot conversion mode, see ADC256 and ADC257)

• stop any current conversions for the group containing the specified channel

and then start the conversion for the new group containing the specified channel.

ADC256: The On Demand conversion shall suspend the One Shot or Continuous group conversion and shall resume it later at the end of On Demand activity according to the published parameter ADC_TYPE_SCAN_RESTART. ADC257: The Gated Continuous conversion shall suspend the One Shot or Continuous group conversion and shall resume it later at the end of Gated Continuous activities according to the published parameter ADC_TYPE_SCAN_RESTART

Page 30: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

30 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

7.3 Version check 7.3.1 Background & Rationale The integration of incompatible files shall be avoided. Minimum implementation is the version check of the header file inside the c file (version numbers of c and h file shall be identical). 7.3.2 Requirements ADC124: Adc.c shall check if the correct version of Adc.h is included. This shall be done by a preprocessor check of the version numbers ADC_MAJOR_VERSION and ADC_MINOR_VERSION. 7.4 Error classification ADC230: Values for production code Event Ids are assigned externally by the configuration of the Dem. They are published in the file Dem_IntErrId.h and included via Dem.h. ADC229: Development error values are of type uint8. ADC065: The following development errors shall be detectable by the ADC driver depending on its build version (development/production mode). This checking shall be statically configurable (on/off) by the preprocessor switch ADC_DEV_ERROR_DETECT for those errors that only can occur during development. Type of error Relevance Related error code Value [hex] Adc_Init has to be called prior to any other function call (see ADC107, ADC154)

Development ADC_E_UNINIT 0x0A

Conversion request on a group currently converting (see ADC086 and ADC183). DeInit called, while a conversion is ongoing (see ADC112).

Development ADC_E_BUSY 0x0B

Invalid channel ID requested (see ADC152and ADC193)

Development ADC_E_PARAM_CHANNEL 0x14

Invalid group ID requested (see ADC125, ADC126, ADC128, ADC129, ADC130, ADC131, ADC241, ADC243, ADC225, ADC184)

Development ADC_E_PARAM_GROUP 0x15

Adc_EnableHardwareTrigger/ Adc_DisableHardwareTrigger called on a group, configured in Continuous mode (see ADC115, ADC118).

Development ADC_E_WRONG_CONV_MODE 0x16

Page 31: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

31 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Type of error Relevance Related error code Value [hex] Adc_StartGroupConversion or Adc_StartOnDemandConversion called on a group with trigger source configured as hardware (ADC133, ADC185) Adc_EnableHardwareTrigger/Adc_DisableHardwareTrigger called on a group, configured in software API trigger mode.(ADC136, ADC137)

Development ADC_E_WRONG_TRIGG_SRC 0x17

Enable/disable notification function for a group whose configuration set has no notification available (ADC134, ADC135).

Development ADC_E_NOTIF_CAPABILITY

0x18

Adc_Init called on a group, configuring internal or external HW trigger source while �c has been statically configured with no HW trigger capability.

Development ADC_E_HW_TRIGGER_CAPABILITY

0x19

Init function: Parameter ConfigPtr is a NULL pointer. (see ADC132) or Adc_Init function called with a wrong group configuration (see ADC176)

Development ADC_E_PARAM_CONFIG 0x1E

Adc_GatedSetUp has been called with a group not configuredin gated Continuous mode (see ADC175)

Development ADC_E_GATED_UNINIT 0x0C

Adc_EnableHardwareTrigger has been called when another group is already enabled on the same HW unit and on the same HW trigger sources (see ADC272 and ADC273)

Development ADC_E_TRIGG_SRC_BUSY 0x29

Table 5:Error classification

ADC069: Additional errors that are detected because of specific implementation and/or specific hardware properties shall be added in the ADC device specific implementation specification. The classification and enumeration shall be compatible to the errors listed above 7.5 Error detection ADC233: The detection of development errors is configurable (ON/OFF) at pre-compile time. The switch ADC_DEV_ERROR_DETECT (see chapter 10) shall activate or deactivate the detection of all development errors. ADC234: If the ADC_DEV_ERROR_DETECT switch is enabled API parameter checking is enabled. The detailed description of the detected errors can be found in chapter 7.5 and chapter 8. ADC235: The detection of production code errors cannot be switched off.

Page 32: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

32 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC269: If development error detection is enabled for the ADC Driver, the following API parameter checking shall be performed according to the respective functions (see table below). The error shall be reported to the Development Error Tracer. For description and values of the error codes refer to chapter 7.1

Function Criteria of detection Related error code

Adc_Init

Other function called prior initialization ConfiPtr=NULL A group configured in on demand mode conversion is configured with more than one channel Hardware trigger capability not supported

ADC_E_UNINIT ADC_E_PARAM_CONFIG ADC_E_PARAM_GROUP ADC_E_HW_TRIGGER_CAPABILITY

Adc_DeInit Function called prior initialization Function called while conversion is running

ADC_E_UNINIT ADC_E_BUSY

Adc_SingleValueReadChannel

Function called with non existing channel ADC_E_PARAM_CHANNEL

Adc_StartGroupConversion

Function called while conversion is running Function called with non existing group Function called with non existing trigger source

ADC_E_BUSY ADC_E_PARAM_GROUP ADC_E_WRONG_TRIGG_SRC

Adc_StopGroupConversion

Function called with non existing group or a not started group Function called with non existing trigger source

ADC_E_PARAM_GROUP ADC_E_WRONG_TRIGG_SRC

Adc_EnableHardwareTrigger

Function called with not supported conversion mode Function called with non existing group Function called with non existing trigger source

ADC_E_WRONG_CONV_MODE ADC_E_PARAM_GROUP ADC_E_WRONG_TRIGG_SRC

Adc_DisableHardwareTrigger

Function called with not supported conversion mode Function called with non existing group Function called with non existing trigger source

ADC_E_WRONG_CONV_MODE ADC_E_PARAM_GROUP ADC_E_WRONG_TRIGG_SRC

Adc_EnableGroupNotification

Function called with non existing group Function called with function pointer null or with notification capability disabled

ADC_E_PARAM_GROUP ADC_E_NOTIF_CAPABILITY

Adc_DisableGroupNotification

Function called with non existing group Function called with function pointer null or with notification capability disabled

ADC_E_PARAM_GROUP ADC_E_NOTIF_CAPABILITY

Adc_GatedSetUp Function called with a group not configured in Gated Continuous mode ConfiPtr=NULL

ADC_E_GATED_UNINIT ADC_E_PARAM_CONFIG

Adc_OnDemandReadChannel

Function called with non existing channel ADC_E_PARAM_CHANNEL

Adc_GetGroupStatus

Function called with non existing group

ADC_E_PARAM_GROUP

Page 33: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

33 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Function Criteria of detection Related error code

Adc_StartOnDemand

Function called while conversion is running Function called with non existing group Function called with non existing trigger source

ADC_E_BUSY ADC_E_PARAM_GROUP ADC_E_WRONG_TRIGG_SRC

Table 6:Error detection

7.6 Error notification ADC067: Detected development errors shall be reported to the Det_ReportError service of the Development Error Tracer (DET) if the pre-processor switch ADC_DEV_ERROR_DETECT is set (see chapter 10) ADC068: Production errors shall be reported to the Diagnostic Event Manager

Page 34: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

34 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

8 API specification

8.1 Imported types 8.1.1 Standard types

- Std_Types.h • Std_VersionInfoType

8.1.2 Other Modules types

• No types from other modules are imported

8.2 Type definitions 8.2.1 Adc_ConfigType Type : structure Range : Implementation specific configuration data structure. See chapter 10 for

configurable parameters. Description: Type of the data structure including the configuration set required for initialising

the ADC unit 8.2.2 Adc_ConfigGatedType Type : structure Range : Implementation specific configuration data structure. See chapter 10 for

configurable parameters. Description: Type of the data structure including the configuration set required for initialising

and setting the parameters of group configured in Gated Continuous mode 8.2.3 Adc_ChannelType Type: uint8..uint32 Range Implementation specific Description: Type of numeric ID of an ADC channel

8.2.4 Adc_GroupType Type: uint8..uint32 Range Implementation specific Description: Type of numeric ID of an ADC channel group

Page 35: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

35 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

8.2.5 Adc_ValueType Type: uint8..uint32, sint8..sint32 Range The range of this type is µC specific and has to be described by the supplier. A

specific default value “out of range” has to be defined to report to the ADC user the converted value when it is no available. See ADC191, ADC244

Description: Type for reading the converted values (raw, without further scaling). Any diagnostic information which is part of an ADC conversion result shall be omitted. The result shall be right-aligned.

8.2.6 Adc_ClockSourceType Type: uint8..uint32 Range The range of this type is µC specific and has to be described by the supplier. Description: Type of clock input for the conversion unit to select different clock sources, if

provided by hardware (this not an API type). 8.2.7 Adc_PrescaleType Type: uint8..uint32 Range The range of this type is µC specific and has to be described by the supplier. Description: Type of clock prescaler factor (this not an API type).

8.2.8 Adc_ConvTimeType Type: uint8..uint32 Range The range of this type is µC specific and has to be described by the supplier. Description: Type of conversion time, including sample time (in clock-cycles) (this not an API

type). 8.2.9 Adc_VoltageSourceType Type: uint8..uint32, sint8..sint32 Range The range of this type is µC specific and has to be described by the supplier. Description: Type of reference voltage source (this not an API type).

8.2.10 Adc_GroupDefType Type: uint8 Range The range of this type is µC specific and has to be described by the supplier. Description: Type of assignment of channels to a channel group (this not an API type).

Page 36: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

36 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

8.2.11 Adc_PointerBufferType Type: Unsigned integer

Range The range of this type is µC specific and has to be described by the supplier. Description: Type of ADC user data buffer elements

8.2.12 Adc_PeriodType Type: uint8 uint32 Range 8..32 bit Implementation specific. This type shall be chosen in order

to have the most efficient implementation on a specific microcontroller platform.

Description: Type of the acquisition period of an ADC channel. The time resolution must be published in the ECU resource template (this not an API type).

8.2.13 Adc_StatusType Type: enumeration

ADC_IDLE No conversion of the specified group is started ADC_BUSY_NO_VALUE

The first conversion of the specified group is on going.

ADC_BUSY The conversion is on going (except the first conversion).

Range

ADC_COMPLETED The conversion is finished Description: This type specifies the range of group status conversion

8.2.14 Adc_GroupTriggSrcOneShotType Type: enumeration

ADC_TRIGG_SRC_SW_API

Group is triggered by a software API call. (mandatory)

ADC_TRIGG_SRC_HW_EXT_x

Group is triggered by a hardware event on an I/O pin. (optional, if supported by hardware, only available in One Shot mode) only available, if hardware capability is configured as active

Range

ADC_TRIGG_SRC_HW_INT_x

Group is triggered by one or more on chip hardware events (e.g. internal timer) (optional, if supported by hardware, only available in One Shot mode) only available, if hardware capability is configured as active

Description: This type specifies the trigger source (this not an API type).

8.2.15 Adc_GroupConvModeType Type: enumeration Range ADC_CONV_MODE_O

NESHOT The conversion of an ADC channel group is performed once after a trigger and the result is written to the assigned buffer. The One Shot conversions can be stopped by a software API call (stop)

Page 37: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

37 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC_CONV_MODE_CONTINUOUS

The conversions of an ADC channel group are performed continuously after a software API call (start). The conversions itself are running automatically (hardware/interrupt controlled). The Continuous conversions can be stopped by a software API call (stop)

ADC_CONV_MODE_ON_DEMAND

In order to permit to the ADC user to perform an immediate conversion in any time, an On Demand conversion is defined. It will suspend the group conversion and will resume it later at the end of On Demand activity

ADC_CONV_MODE_GATED

The conversions of an ADC channel group are performed after a trigger until the buffer is full or until the gate is close and the result is written to the assigned buffer. A trigger can be a software API call or an internal or external hardware event

Description: This type specifies the conversion mode (this not an API type).

8.2.16 Adc_GatedGroupAcqTriggSrc Type: enumeration

ADC_GATED_GROUP_ACQ_HW

One group of samples is acquired at every HW trigger (int. or ext.). Group of sample means one sample for each channel configured in the group.

ADC_GATED_GROUP_ACQ_CONT

Group of samples acquired continuosly (each sample after each other). Group of sample means one sample for each channel configured in the group

Range

ADC_GATED_GROUP_ACQ_PERIOD

One group of samples is acquired at every period time. Group of sample means one sample for each channel configured in the group

Description: This type specifies the trigger source in gated continuous conversion mode (this not an API type).

8.3 Function definitions This is a list of functions provided for upper layer modules. 8.3.1 Adc_Init Service name: Adc_Init Syntax : void Adc_Init

( const Adc_ConfigType *ConfigPtr )

Service ID [hex] :: 0x00 Sync/Async : Synchronous Reentrancy : Non re-entrant Parameters (in): ConfigPtr Pointer to configuration set Parameters (out): None Return value: None Description: ADC054: Service for initialising the hardware ADC module according to a

configuration set referenced by ConfigPtr.

Page 38: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

38 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC056:This function shall only initialise the configured resources. Resources that are not configured in the configuration file shall not be touched. ADC150: If the implementation uses one-time writable registers, the initialisation of this kind of registers shall be handled within the start-up code. ADC151: If the implementation uses registers that contain ‘overall’ settings relevant for more than one driver module, the initialisation of this kind of registers shall be handled by the MCU Driver. ADC147:If the implementation uses registers that contain ‘overall’ settings relevant for more than one driver module, the implementation shall ensure that the registers are initialised in a way that other modules are not affected. The following rules regarding initialization of controller registers shall apply to this driver implementations: ADC246: If the hardware allows for only one usage of the register, the

driver module implementing that functionality is responsible for initializing the register

ADC247: If the register can affect several hardware modules and if it is

an I/O register it shall be initialized by the PORT driver. ADC248: If the register can affect several hardware modules and if it is

not an I/O register it shall be initialized by the MCU driver. ADC249: One-time writable registers that require initialization directly

after reset shall be initialized by the startup code. ADC250: All other registers shall be initialized by the startup code.

ADC077: By default, notifications and hardware trigger capability shall be disabled after module initialisation (if statically configured as active). ADC177: If at least one group is configured as Gated Continuous the channel group will be not completely initialised without calling Adc_GatedSetUp. ADC107: Adc_Init has to be called prior to any other function call. Calling any other function prior to Adc_Init will cause a development error (ADC_E_UNINIT, see 9Table 5 ) and the service will be left without any action. ADC132: If development error detection is enabled, the parameter ConfigPtr shall be checked for not being a NULL pointer. This error shall be reported to the Development Error Tracer (ADC_E_PARAM_CONFIG, see 9Table 5) and the service will be left without any action. ADC168: If development error detection is enabled, it shall be checked if at least one group is configured with a HW trigger when the micro doesn’t support HW trigger conversion. This error shall be reported to the Development Error Tracer (ADC_E_HW_TRIGGER_CAPABILITY, see 9Table 5) and the service will be left without any action

Page 39: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

39 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC243: If development error detection is enabled, it shall be checked a group configured in On Demand conversion mode contains more than one channel. This error shall be reported to the Development Error Tracer (ADC_E_PARAM_GROUP, see 9Table 5) and the service will be left without any action .

Caveats: See Adc_EnableHardwareTrigger for restrictions about more than one group configured on the same.

Configuration: See chapter 10

8.3.2 Adc_DeInit Service name: Adc_DeInit Syntax: void Adc_DeInit

( void )

Service ID [hex]: 0x01 Sync/Async : Synchronous Reentrancy: Non re-entrant Parameters (in): None Parameters (out): None Return value: None Description: ADC109: Service for de-initializing all ADC hardware conversion units to

a state, comparable to power on reset state. ADC110: After Deinit the peripheral shall be in a state, comparable to the power on reset state. Values of registers, which are not writeable, are excluded. It’s the responsibility of the hardware design that this state does not lead to undefined activities in the µC. ADC111: The service shall disable all used interrupts and notifications. ADC112: If development error detection is enabled and Deinit is called, while the ADC is converting, the driver shall report ADC_E_BUSY (see 9Table 5) and the service will be left without any action. ADC154: Calling any other ADC function except ADC_Init after ADC_DeInit being called will cause a development error (ADC_E_UNINIT, see 9Table 5). And the service will be left without any action

Caveats: This service shall not be called during a running operation. Configuration: ADC228: This function shall be pre compile time configurable On/Off

by the configuration parameter: ADC_DEINIT_API See also chapter 10.2.7, “Configuration of optional API services”

8.3.3 Adc_StartGroupConversion Service name: Adc_StartGroupConversion Syntax : void Adc_StartGroupConversion

( Adc_GroupType group )

Page 40: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

40 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Service ID [hex]: 0x02 Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: None Description: ADC061: This service starts the conversion of all channels inside the

specified group, if the group trigger source is configured as SW API. Depending on the group configuration, One Shot or Continuous conversion is started. ADC060: When configured and enabled, the group notification function is called, whenever a conversion of all channels of the requested group is completed. ADC156: Starting a group conversion will NOT automatically enable notification for that group. ADC086: The ADC Driver shall handle only one conversion request per channel at the same time. If development error detection is enabled for the ADC Driver, starting a group, containing at least one channel, which is also part of an already started group that is currently converting, will cause a development error (ADC_E_BUSY, see 9Table 5 and also section 7.2) and the service will be left without any action. ADC125: If development error detection is enabled for the ADC Driver, calling this function with a non-existing channel group ID will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5) and the service will be left without any action. ADC133: If development error detection is enabled for the ADC Driver, calling this function on a group with trigger source configured as hardware (intern or extern), will cause a development error (ADC_E_WRONG_TRIGG_SRC, see 9Table 5) and the service will be left without any action.

Caveats: ADC146: This service is only defined for channel groups, configured in software trigger mode ADC127: Usage of re-entrant capability is only allowed if the callers take care that there is no simultaneous usage of the same HW unit.

Configuration: ADC259 : This function shall be pre compile time configurable On/Off by the configuration parameter: ADC_ENABLE_START_STOP_GROUP_API See also chapter 10.2.7, “Configuration of optional API services” ADC_GROUP_CONV_MODE ADC_GROUP_TRIGG_SRC_ONESHOT

8.3.4 Adc_StopGroupConversion Service name: Adc_StopGroupConversion Syntax : void Adc_StopGroupConversion

( Adc_GroupType group )

Service ID [hex]: 0x03

Page 41: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

41 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: None Description: ADC072: This service stops a conversion of all channels inside the

specified group. ADC126: If development error detection is enabled for the ADC Driver, calling this function with a non-existing group ID will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5) and the service will be left without any action. ADC108: The conversion for all channels within the requested group is stopped as soon as possible, according with ADC_TYPE_STOP_CONV published information, when calling this function. ADC155: Stopping a group conversion will automatically disable group notification for the specified group. ADC164: If development error detection is enabled for the ADC Driver, calling this function on a group with trigger source configured as hardware (intern or extern), will cause a development error (ADC_E_WRONG_TRIGG_SRC, see 9Table 5) and the service will be left without any action ADC241: If development error detection is enabled for the ADC Driver, calling this function on a no started group, will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5) and the service will be left without any action

Caveats: ADC158: Usage of re-entrant capability is only allowed if the callers take care that there is no simultaneous usage of the same channel.

Configuration: ADC260 : This function shall be pre compile time configurable On/Off by the configuration parameter: ADC_ENABLE_START_STOP_GROUP_API See also chapter 10.2.7, “Configuration of optional API services”

8.3.5 Adc_SingleValueReadChannel Service name: Adc_SingleValueReadChannel

Syntax:

Adc_ValueType Adc_SingleValueReadChannel ( Adc_ChannelType channel )

Service ID [hex]: 0x04 Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): channel Selected numeric channel ID Parameters (out): None Return value: Adc_ValueType Conversion result Description: ADC075: Service for reading the last valid conversion result of the

requested channel. ADC113: This service shall return the raw converted value without further

Page 42: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

42 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

scaling. The result shall be right-aligned ADC122: This service shall mask out the information bits (if provided) from the conversion result not belonging to the ADC value. ADC106: The result is overwritten, when the next conversion result on this channel is available. ADC152: If development error detection is enabled for the ADC Driver, calling this function with a non-existing channel ID will cause a development error (ADC_E_PARAM_CHANNEL, see 9Table 5). In any case the function, will return a default “out of range” value (see Adc_ValueType definition). ADC141: The read function shall provide atomic access by the use of either atomic instruction or the masking of interrupts using OS interrupt masking functions. ADC244: Reading a channel prior to ending the first conversion of the group the channel belongs to, will return a default “out of range” value (see Adc_ValueType definition).

Caveats: None Configuration: None

8.3.6 Adc_EnableHardwareTrigger Service name: Adc_EnableHardwareTrigger

Syntax:

void Adc_EnableHardwareTrigger ( Adc_GroupType group )

Service ID [hex]: 0x05 Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: None Description: ADC114: Service for enabling hardware trigger for a group configured in

One Shot conversion or Gated Continuous mode. ADC144: The One Shot group or Gated Continuous conversion will be started, whenever a trigger event (internal or external, depending on configuration) occurs. ADC142: Some micro controllers provide an internal (internal to the adc module) time trigger. If such an internal ADC timer is used for internal hardware triggering, calling Adc_EnableHardwareTrigger shall also start the timer. When the timer expires the Adc_EnableHardwareTrigger shall be called again to re-arm the timer. ADC272: If more than one group has been configured on the same HW unit and with the same trigger sources the Adc_EnableHardwareTrigger method shall verify that no more than one of those groups are enabled at the same time. If no other group is already enabled Adc_EnableHardwareTrigger shall enable the group passed as parameter. If another group is already enabled on he same HW unit and on the same

Page 43: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

43 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

trigger source and if development error detection is enabled for the ADC Driver ,calling this will cause a development error (ADC_E_TRIGG_SRC_BUSY (see 9Table 5) and the service will be left without any action ADC273: The ADC Driver shall handle only one group conversion request per HW unit at the same time. It’s up to the user guarantee no concurrent conversion on the same HW unit (happening of different hardware triggers at the same time) ADC115: This service is only defined for groups configured in One Shot or Gated Continuous mode. If development error detection is enabled for the ADC Driver, calling this function on a group, configured in Continuous mode will cause a development error (ADC_E_WRONG_CONV_MODE, see 9Table 5) and the service will be left without any action. ADC128: If development error detection is enabled for the ADC Driver ,calling this function with an invalid channel group ID will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5) and the service will be left without any action. ADC136: If development error detection is enabled for the ADC Driver, trying to call this function, while the group is configured in software API trigger mode, will cause a development error (ADC_E_WRONG_TRIGG_SRC, see 9Table 5and the service will be left without any action.

Caveats: ADC120: Service shall only be available, if the hardware trigger capability is activated. ADC159: Usage of re-entrant capability is only allowed if the callers take care that there is no simultaneous usage of the same channel.

Configuration: ADC265: This function shall be pre compile time configurable On/Off by the configuration parameter: ADC_HW_TRIGGER_API See also chapter 10.2.7, “Configuration of optional API services” ADC_HW_TRIGGER_CAPABILITY ADC_GROUP_CONV_MODE

8.3.7 Adc_DisableHardwareTrigger Service name: Adc_DisableHardwareTrigger Syntax: void Adc_DisableHardwareTrigger

( Adc_GroupType group )

Service ID [hex]: 0x06 Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: None Description: ADC116: Service for disabling hardware trigger for a group configured in

One Shot or Gated Continuous conversion mode. ADC145: An already running One Shot or Gated Continuous group

Page 44: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

44 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

conversion will be finished according ADC_TYPE_STOP_CONV ADC143: Some micro controllers provide an internal (internal to the adc module) time trigger. If such an internal ADC timer is used for internal hardware triggering, calling Adc_DisableHardwareTrigger shall also stop the timer. ADC118: This service is only defined for groups configured in One Shot mode or Gated Continuous. If development error detection is enabled for the ADC Driver, calling this function on a group, configured in Continuous or On Demand mode will cause a development error (ADC_E_WRONG_CONV_MODE, see 9Table 5). And the service will be left without any action ADC129: If development error detection is enabled for the ADC Driver, calling this function with a non-existing channel group ID will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5). And the service will be left without any action ADC137: If development error detection is enabled for the ADC Driver, trying to call this function, while the group is configured in software API trigger mode, will cause a development error (ADC_E_WRONG_TRIGG_SRC, see 9Table 5) and the service will be left without any action. ADC157: Disabling the hardware trigger source will automatically disable group notification for the specified group. If, according with the published information ADC_TYPE_STOP_CONV, the current conversion will be completed (see ADC145), the corresponding notification will be performed.

Caveats: ADC121: Service shall only be available, if the hardware trigger capability is activated. ADC160: Usage of re-entrant capability is only allowed if the callers take care that there is no simultaneous usage of the same channel.

Configuration: ADC266: This function shall be pre compile time configurable On/Off by the configuration parameter: ADC_HW_TRIGGER_API See also chapter 10.2.7, “Configuration of optional API services” ADC_HW_TRIGGER_CAPABILITY ADC_GROUP_CONV_MODE

Page 45: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

45 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

SamplingActivity CommentHW Trigger

The HW trigger source is disabled.

DIS

AB

LED

EN

AB

LED

DIS

AB

LED

One-shot conversion for the group is triggered ifthe trigger event occurs

Enable Status

Ch1

Ch2

Ch3

Ch4

Ch1

Ch2

Ch3

Ch4

Conversion is not triggered, if the trigger eventoccurs.

The HW trigger source is enabled.

The HW trigger source is disabled.

Conversion is not triggered, if the trigger eventoccurs.

A running one-shot conversion for the group isnot affected from the disabling of the triggersource.

Figure 7: Behaviour of Disable Hw Trigger (ADC_TYPE_STOP_CONV=0)

In the figure above the on going conversion is completed (ADC_TYPE_STOP_CONV=0) 8.3.8 Adc_EnableGroupNotification Service name: Adc_EnableGroupNotification Syntax : void Adc_EnableGroupNotification

( Adc_GroupType group )

Service ID [hex]: 0x07 Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: None Description: ADC057: Service for enabling the group notification at runtime, when

notification capability is activated.

Page 46: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

46 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC130: If development error detection is enabled for the ADC Driver, calling this function with a non-existing channel group ID will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5) and the service will be left without any action. ADC134: If development error detection is enabled for the ADC Driver, trying to call this function, while notification capability is disabled, will cause a development error (ADC_E_NOTIF_CAPABILITY, see 9Table 5) and the service will be left without any action ADC165: If development error detection is enabled for the ADC Driver, trying to call this function, while the group notification function pointer is NULL, will cause a development error (ADC_E_NOTIF_CAPABILITY, see 9Table 5). And the service will be left without any action

Caveats: ADC100: Service shall only be available, if the notification capability for the ADC module is activated. ADC161: Usage of re-entrant capability is only allowed if the callers take care that there is no simultaneous usage of the same channel.

Configuration: ADC_GRP_NOTIF_CAPABILITY

8.3.9 Adc_DisableGroupNotification Service name: Adc_DisableGroupNotification Syntax: void Adc_DisableGroupNotification

( Adc_GroupType group )

Service ID [hex]: 0x08 Sync/Async: Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: None Description: ADC058: Service for disabling the group notification at runtime, when

notification capability is activated. ADC131: If development error detection is enabled for the ADC Driver, calling this function with a non-existing channel group ID will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5). And the service will be left without any action. ADC135: If development error detection is enabled for the ADC Driver, trying to call this function, while notification capability is disabled, will cause a development error (ADC_E_NOTIF_CAPABILITY, see 9Table 5) and the service will be left without any action. ADC166: If development error detection is enabled for the ADC Driver, trying to call this function, while the group notification function pointer is NULL, will cause a development error (ADC_E_NOTIF_CAPABILITY, see 9Table 5). and the service will be left without any action

Caveats: ADC101: ervice shall only be available, if the notification capability for the ADC module is activated. ADC162: Usage of re-entrant capability is only allowed if the callers take care that there is no simultaneous usage of the same channel.

Page 47: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

47 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Configuration: ADC_GRP_NOTIF_CAPABILITY

8.3.10 Adc_GatedSetUp Service name: Adc_GatedSetUp Syntax: void Adc_GatedSetUp

( const Adc_ConfigGatedType *ConfigPtr )

Service ID [hex]: 0x09 Sync/Async : Synchronous Reentrancy : Non re-entrant Parameters (in): ConfigPtr Pointer to configuration set Parameters (out): None Return value: None Description: ADC169: Service for setting the gated conversion parameters according to

a configuration set referenced by ConfigPtr. ADC174: By default, notifications shall be disabled after module initialisation (if statically configured as active). ADC175: Adc_GatedSetUp has to be called for each group configured in Gated Continuous mode. If development error detection is enabled for the ADC Driver, calling Adc_GatedSetUp not for a group configured in Gated Continuous mode will cause a development error (ADC_E_GATED_UNINIT, see 9Table 5) and the service will be left without any action . ADC176: If development error detection is enabled for the ADC Driver,, the parameter ConfigPtr shall be checked for not being a NULL pointer. This error shall be reported to the Development Error Tracer (ADC_E_PARAM_CONFIG, see 9Table 5) and the service will be left without any action

Caveats: None Configuration: See chapter 10

8.3.11 Adc_StartOnDemandConversion Service name: Adc_StartOnDemandConversion Syntax: void Adc_StartOnDemandConversion

( Adc_GroupType group )

Service ID [hex]: 0x0A Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: None Description: ADC179: This service starts the conversion of the channel inside the

specified group configured as an On Demand group

Page 48: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

48 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC180: When configured and enabled, the group notification function is called, whenever the conversion of the channel of the requested group is completed. ADC181: Starting a group conversion will NOT automatically enable notification for that group. ADC182: Starting an On Demand conversion of a group will suspend (according with the published information ADC_TYPE_SCAN_RESTART) One Shot or Continuous conversion in progress of any other group (assigned to the same HW unit). When the on Demand conversion is finished the suspended conversion will be restarted according with the published information ADC_TYPE_SCAN_RESTART. It could be the first channel in the channel group or the next channel after the suspension by the On Demand conversion. ADC183: The ADC Driver shall handle only one On Demand request per channel at the same time. If development error detection is enabled for the ADC Driver, starting a group, when another On Demand conversion is in progress, will cause a development error (ADC_E_BUSY, see 9Table 5and also section 7.2) and the service will be left without any action. ADC184: If development error detection is enabled for the ADC Driver, calling this function with a non-existing channel group ID will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5) and the service will be left without any action. ADC185: If development error detection is enabled for the ADC Driver, calling this function on a group with trigger source configured as hardware (intern or extern), will cause a development error (ADC_E_WRONG_TRIGG_SRC, see 9Table 5) and the service will be left without any action.

Caveats: ADC186: This service is only defined for channel groups, configured in On Demand mode ADC187: Usage of re-entrant capability is only allowed if the callers take care that there is no simultaneous usage of the same HW unit.

Configuration: ADC261: : This function shall be pre compile time configurable On/Off by the configuration parameter: ADC_ENABLE_ON_DEMAND_API See also chapter 10.2.7, “Configuration of optional API services”

8.3.12 Adc_OnDemandReadChannel Service name: Adc_OnDemandReadChannel Syntax: Adc_ValueType Adc_OnDemandReadChannel

( Adc_ChannelType channel )

Service ID [hex]: 0x0B Sync/Async: Synchronous Reentrancy: Re-entrant Parameters (in): channel Selected numeric channel ID Parameters (out): None Return value: Adc_ValueType Conversion result Description: ADC188: Service for reading the last valid conversion result of the

Page 49: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

49 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

requested channel. ADC189: This service shall return the raw converted value without further scaling. ADC190: This service shall mask out the information bits (if provided) from the conversion result not belonging to the ADC value. ADC191: Reading a channel prior to ending the first On Demand conversion of the group the channel belongs to, will return a default “out of range” value (see Adc_ValueType definition) if ADC_CHANNEL_RESULT=0. Otherwise the returned value will be the more recent scan on the same ADC channel. ADC192: If there is no specific buffer (depending on hw capability or implementation and according to the published information ADC_CHANNEL_RESULT) for On Demand conversion the result is overwritten, when the next conversion result on this channel is available. If there is a specific buffer (depending on hw capability) for On Demand conversion the result is overwritten, when the next On Demand conversion result on this channel is available. ADC193: If development error detection is enabled for the ADC Driver, calling this function with a non-existing channel ID will cause a development error (ADC_E_PARAM_CHANNEL, see9Table 5). In any case the function, will return a default “out of range” value (see Adc_ValueType definition). ADC194: The read function shall provide atomic access by the use of either atomic instruction or the masking of interrupts using OS interrupt masking functions.

Caveats: None Configuration: ADC262: This function shall be pre compile time configurable On/Off by

the configuration parameter: ADC_ENABLE_ON_DEMAND_API See also chapter 10.2.7, “Configuration of optional API services”

8.3.13 Adc_StartGatedConversion Service name: Adc_StartGatedConversion Syntax: void Adc_StartGatedConversion

( Adc_GroupType group )

Service ID [hex]: 0x0C Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: None Description: ADC204: This service starts the conversion of the channels inside the

specified group configured as a Gated Continuous group ADC205: When configured and enabled, the group notification function is called, whenever the conversion of the channels of the requested group is

Page 50: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

50 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

completed. ADC271: The ADC Driver user shall provide a buffer for every channel group configured in a Gated Continuous mode ADC206: Starting a group conversion will NOT automatically enable notification for that group. ADC207: Starting a Gated Continuous conversion of a group will suspend (according with the published parameter ADC_TYPE_SCAN_RESTART and with ADC258) One Shot or Continuous conversion in progress of any other group. When the Gated Continuous conversion is finished the suspended conversion will be restarted according with the published information ADC_TYPE_SCAN_RESTART. It could be the first channel in the channel group or the next channel after the suspension by the Gated Continuous conversion (an On Demand conversion couldn’t be interrupted because there is only one channel per group configured in On Demand mode). ADC258: Depending on Hw capabilities (selected by published information ADC_HW_PRIORITY) a One Shot or Continuous group conversion suspended by a Gated Continuous conversion should be run in “background” according the configuration of the Gated Continuous group selected by configuration parameter ADC_DEFAULT_PRIORITY ADC208: The ADC Driver shall handle only one Gated Continuous request per HW unit at the same time. If development error detection is enabled for the ADC Driver, starting a group, when another Gated Continuous conversion is in progress, will cause a development error (ADC_E_BUSY, see 9Table 5and also section 7.2) and the service will be left without any action. ADC209: If development error detection is enabled for the ADC Driver, calling this function with a non-existing channel group ID will cause a development error (ADC_E_PARAM_GROUP, see 9Table 5) and the service will be left without any action. ADC212: If development error detection is enabled for the ADC Driver, calling this function on a group with trigger source configured as hardware (intern or extern), will cause a development error (ADC_E_WRONG_TRIGG_SRC, see 9Table 5and the service will be left without any action.

Caveats: ADC210: This service is only defined for channel groups, configured in Gated Continuous mode ADC211: Usage of re-entrant capability is only allowed if the callers take care that there is no simultaneous usage of the same HW unit.

Configuration: ADC263: This function shall be pre compile time configurable On/Off by the configuration parameter: ADC_ENABLE_GATED_API See also chapter 10.2.7, “Configuration of optional API services”

8.3.14 Adc_GetGatedLastPointer Service name: Adc_GetGatedLastPointer Syntax: Adc_Pointer Adc_GetGatedLastPointer

( Adc_GroupType group

Page 51: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

51 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

) Service ID [hex]: 0x0D Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: Adc_Pointer Pointer to the last acquired value group

(Adc_PointerBufferType) Description: ADC213: Service for reading the last valid conversion result of the

requested group ADC214: This service shall return the pointer to the last converted value. All values stored in the buffer are left without further scaling. ADC215: Asking for a group buffer pointer prior to starting the conversion of the group, will return a default value null. ADC216: Asking for a group buffer pointer while a Gated Continuous conversion of the group is in progress will return null (data are available only at the end of conversion). ADC217: The buffer pointer is overwritten when the next conversion result on this group is available. ADC218: If development error detection is enabled for the ADC Driver, calling this function with a non-existing group ID will cause a development error (ADC_E_PARAM_CHANNEL, see9Table 5) and the desired functionality shall be left without any action. ADC219: To guarantee the read data consistency is up to the user the check the group conversion status calling Adc_GetGroupStatus .

Caveats: None Configuration: ADC264: This function shall be pre compile time configurable On/Off by

the configuration parameter: ADC_ENABLE_GATED_API See also chapter 10.2.7, “Configuration of optional API services”

8.3.15 Adc_GetGroupStatus Service name: Adc_GetGroupStatus Syntax: Adc_StatusType Adc_GetGroupStatus

( Adc_GroupType group )

Service ID [hex]: 0x0E Sync/Async : Synchronous Reentrancy: Re-entrant Parameters (in): group Selected numeric group ID Parameters (out): None Return value: Adc_StatusType Group Status Description: ADC220: Service for reading the Adc group status.

ADC221: This service shall return ADC_IDLE if the method is called before any conversion of the specified group is started.

Page 52: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

52 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC222: This service shall return ADC_BUSY_NO_VALUE if the method is called while the first conversion of the specified group (after Adc_Init method has been called) is on going. ADC223: This service shall return ADC_BUSY if the method is called while the specified group conversion is on going (except the first conversion). ADC224: This service shall return ADC_COMPLETED if the method is called when the conversion of the specified group is finished ADC225: If development error detection is enabled for the ADC Driver, calling this function with a non-existing group ID will cause a development error (ADC_E_PARAM_GROUP, see9Table 5) and the desired functionality shall be left without any action. ADC226: : The read function shall provide atomic access by the use of either atomic instruction or the masking of interrupts using OS interrupt masking functions

Caveats: None Configuration: None

8.3.16 Adc_GetVersionInfo Service name: Adc_GetVersionInfo Syntax: void Adc_GetVersionInfo {

Std_VersionInfoType *versioninfo }

Service ID [hex]: 0x0F Sync/Async : Synchronous Reentrancy: Non re-entrant Parameters (in): None Parameters (out): versioninfo Pointer to where to store the version information of this

module. Return value: none

Description: ADC236: This service returns the version information of this module. The version information includes:

- Module Id - Vendor Id - Vendor specific version numbers (BSW00407).

Hint: If source code for caller and callee of this function is available this function should be realized as a macro. The macro should be defined in the modules header file.

Caveats: -- Configuration: ADC237: This function shall be pre compile time configurable On/Off by the

configuration parameter: ADC_VERSION_INFO_API See also chapter 10.2.7, “Configuration of optional API services”

Page 53: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

53 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

8.4 Call-back Notifications Since the ADC is a driver module it doesn’t provide any call-back functions for lower layer modules. 8.5 Scheduled functions None. 8.6 Expected Interfaces In this chapter all interfaces required from other modules are listed. 8.6.1 Mandatory Interfaces API function Module Description Configuration parameter

(description see chapter 10) Dem_ReportErrorStatus Dem Production error

status Implementation Specific

Dem_ReportErrorEvent Dem Production error event reporting

Implementation Specific

8.6.2 Optional Interfaces This chapter defines all interfaces which are required to fulfill an optional functionality of the module. API function Module Description Configuration parameter

(description see chapter 10) Det_ReportError Det Development error

notification ADC_DEV_ERROR_DETECT

8.6.3 Configurable interfaces In this chapter all interfaces are listed where the target function could be configured. The target function is usually a call-back function. The names of these kind of interfaces is not fixed because they are configurable. ADC078: The ISR´s, providing the “conversion completed events”, shall be responsible for resetting the interrupt flags (if needed by hardware) and calling the associated notification function. ADC079: The call-back notifications shall be configurable as function pointers within the initialization data structure (Adc_ConfigType).

Page 54: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

54 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC080: If a call-back notification is configured as null pointer, no call-back shall be executed. ADC081: Each group shall provide its own notification if configured. ADC153: The call-back functions are running in the interrupt context. It’s the responsibility of the user to keep the code short inside this function. ADC270: The call-back notification shall have no parameters and no return value. Service name: <Adc_Notificationgroup> Syntax: void <Adc_Notificationgroup>

( void )

Reentrancy: Re-entrancy of this API call depends on the user code Parameters (in): None Parameters (out): None Return value: None Description: ADC082: Notification prototype for the notification call-back function. It

has to be implemented by the user. ADC104: The ADC Driver shall provide a notification per channel group (if capability is configured) that is called whenever the conversion for all channels of that group is completed. ADC083: When disabled, no notification will be sent. When re-enabled again, the user will not be notified of events, occurred while notifications have been disabled. ADC084: To avoid parameter values and to improve runtime efficiency, for every group, a particular notification call-back has to be declared for all notifications, not configured as NULL pointer. ADC085: The call-back notifications shall be configurable as pointers to user defined functions within the configuration structure

Caveats: None Configuration: For all available channel groups, call-back functions have to be declared

by the configuration tool.

Page 55: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

55 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

9 Sequence diagrams

9.1 Adc_Init()

sd Adc_Init()

EcuM::EcuM Adc::Adc

Adc_Init(ConfigPtr)

Adc_Init

9.2 Adc_DeInit()

sd Adc_Deinit()

EcuM::EcuM Adc::Adc

It's the responsability of the HW design that this state doesn't lead to undifined activities in the uC

a) all notifications are disabledb) all used interrupts are disabled

Adc_DeInit()

Adc_DeInit

Page 56: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

56 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

9.3 SW triggered One Shot conversion of one group without notification

sd Adc OneShotUsage

Adc::AdcGenericElements::User

«Peripheral»Hardware::ADCConversion Unit

Group 1:- Channel 1- Channel 2- One Shot Conversion Mode

Conversion of all channels of

Group 1 is completed.

Thereafter, the notification of that group is disabled no

notification is peformed

Adc_StartGroupConversion(group:=1)

start conversionGroup 1 in One Shot Conversion Mode

Adc_StartGroupConversion

end conversion

Adc_ValueType= Adc_SingleValueReadChannel(channel:=1)

Adc_SingleValueReadChannelConversion result of Channel 1

Adc_ValueType= Adc_SingleValueReadChannel(channel:=2)

Adc_SingleValueReadChannelConversion result of Channel 2

9.4 SW triggered conversion of two groups with notification In this example, two groups are configured (see legend in sequence diagram). The user wants to be notified, when the conversion of all channels of group 1 is completed. Since the notification capability is activated by static configuration, the user can enable notification for group 1 at runtime. This can be accomplished before or after starting the conversion of group 1. Since group 1 is configured in Continuous conversion mode the user is notified whenever the conversion of all channels of group 1 are completed. This can be used to synchronize read access of channel 1 and channel 2.

Page 57: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

57 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

sd SW-Triggered Conversion with two groups with notification

#2 :ADCConversion Unit

Adc::AdcGenericElements::User

Conversion of all

channels of Group 1 is

completed. Thereafter,

the notification

of that group is

disabled no notification is peformed

In this example, two groups are configured (see legend in sequence diagram).The user wants to be notified, when the conversion of all channels of group 1 is completed. Since the notification capability is activated by static configuration, the user can enable notification for group 1 at runtime. This canbe accomplished before or after starting the conversion of group 1. Since group 1 is configured in continuous conversion mode the user is notified whenever the conversion of all channels of group 1 are completed. This can be used to synchronize read access of channel 1 and channel 2.

#1 :ADCConversion Unit

Group 1 in continuous

mode

Group 2 is in One Shot

Mode

Conversion of all

channels of Group 1 is completed

and restarted

automatically

Conversion of all

channels of Group 1 is completed

and restarted

automatically

Conversion of all

channels of Group 1 is stopped

immediately

Group 1:- Channel 1- Channel 2- Continuous Conversion Mode- Notification Capability activated

Group 2:- Channel 3- One Shot Conversion Mode- API Software triggered

Adc_EnableGroupNotification(group:=1)

Adc_EnableGroupNotification

Adc_StartGroupConversion(group:=1)start conversion

Adc_StartGroupConversion

Adc_StartGroupConversion(group:=2)start conversion

Adc_StartGroupConversion

end conversion

end conversion

Adc_NotificationGroup1

Adc_ValueType= Adc_SingleValueReadChannel(channel:=1)

Adc_SingleValueReadChannelConversion result of Channel 1

Adc_ValueType= Adc_SingleValueReadChannel(channel:=2)

Adc_SingleValueReadChannelConversion result of Channel 2 end conversion

Adc_NotificationGroup1

Adc_ValueType= Adc_SingleValueReadChannel(channel:=3)

Adc_SingleValueReadChannelConversion result of Channel 3

Adc_StopGroupConversion(group:=1)

stop conversionAdc_StopGroupConversion

Page 58: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

58 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

9.5 HW triggered One Shot conversion of one group with notification

sd HW-Triggered Conversion of one group with notification

«Peripheral»Hardware::HWTrigger Source

Adc::AdcGenericElements::User

«Peripheral»Hardware::ADCConversion Unit

Group 1:- Channel 1- Channel 2- One Shot Conversion Mode- internal hardware trigger source- Notification Capability activated- Hardware Trigger Capability activated

triggersourceeventoccurred

triggersourceeventoccurred

Conversion of all channels of Group 1 is

completed

triggersourceeventoccurred

triggersourceeventoccurred

running conversion is NOT stopped

triggersourceeventoccurred

triggersourceeventoccurred

Conversion of all channels of Group 1 is

completed

triggersourceeventoccurred

triggersourceeventoccurredSince

Adc_DisableHardware Trigger has been calledno conversion is performed

Adc_EnableGroupNotification(group:=1)

Adc_EnableGroupNotification

Adc_EnableHardwareTrigger(group:=1)enable hardware trigger

Adc_EnableHardwareTrigger

trigger conversion

InterruptAdc_NotificationGroup1

Adc_ValueType= Adc_SingleValueReadChannel(channel:=1)

Adc_SingleValueReadChannelConversion result of Channel 1

trigger conversion

Adc_DisableHardwareTrigger(group:=1)

disable hardware triggerAdc_DisableHardwareTrigger

Interrupt

Adc_NotificationGroup1

Adc_ValueType= Adc_SingleValueReadChannel(channel:=2)

Adc_SingleValueReadConversion result of Channel 2

Page 59: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

59 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

9.6 SW triggered continuous conversion of two groups, sharing one channel

sd SW-Trigger Conversion of two groups, sharing one channel

#1 :ADCConversion Unit

Adc::AdcGenericElements::User

Group 1:- Channel 1- Channel 2- Continuous Conversion Mode- Notification capability activated

Group 2:- Channel 3- Channel 2- Continuous Conversion Mode- Notification capability activated

Group 1 conversions are stopped according to

ADC_TYPE_STOP_CONV parameter and results since interrupt are lost

Group 1 in continuous

mode

Group 2 in continuous

mode

Group 2 conversions continue...

Adc_EnableGroupNotification(group:=1)

Adc_EnableGroupNotification

Adc_StartGroupConversion(group:=1)

start conversion

Adc_StartGroupConversion

InterruptAdc_NotificationGroup1

Adc_StopGroupConversion(group:=1)stop conversion

Adc_StopGroupConversion

Adc_EnableGroupNotification(group:=2)

Adc_EnableGroupNotification

Adc_StartGroupConversion(group:=2)start conversion

Adc_StartGroupConversionInterrupt

Adc_NotificationGroup2

Page 60: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

60 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

9.7 HW-Triggered Conversion using an internal timer of one group with notification

sd HW-Triggered Conversion using an internal timer of one group with notification

«Peripheral»Hardware::HWTrigger Source

Adc::AdcGenericElements::User

«Peripheral»Hardware::ADCConversion Unit

Group 1:- Channel 1- Channel 2- One Shot Conversion Mode- internal hardware trigger source- Notification Capability activated- Hardware Trigger Capability activated- Use internal ADC timer

Conversion of all

channels of Group 1 is completed

Conversion of all

channels of Group 1 is completed

Adc_EnableGroupNotification(group:=1)

Adc_EnableGroupNotification

Adc_EnableHardwareTrigger(group:=1)enable hardware trigger

start internal timer

Adc_EnableHardwareTrigger

timer expires

end conversionAdc_NotificationGroup1

Adc_ValueType= Adc_SingleValueReadChannel(channel:=1)

Adc_SingleValueReadChannelConversoin result of Channel 1

Adc_EnableHardwareTrigger(group:=1)enable hardwaretrigger (re-arminternal timer)

start internal timer

Adc_EnableHardwareTrigger

timer expires

end conversion

Adc_NotificationGroup1

Adc_ValueType= Adc_SingleValueReadChannel(channel:=2)

Adc_SingleValueReadConversion result of Channel 2

Page 61: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

61 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10 Configuration specification In general, this chapter defines configuration parameters and their clustering into containers. In order to support the specification Chapter 10.1 describes fundamentals. It also specifies a template (table) you shall use for the parameter specification. We intend to leave Chapter 10.1 in the specification to guarantee comprehension. Chapter 10.2 specifies the structure (containers) and the parameters of the module ADC Driver. Chapter 10.3 specifies published information of the module ADC Driver. 10.1 How to read this chapter In addition to this section, it is highly recommended to read the documents:

- AUTOSAR Layered Software Architecture - AUTOSAR ECU Configuration Specification

This document describes the AUTOSAR configuration methodology and the AUTOSAR configuration metamodel in detail.

The following is only a short survey of the topic and it will not replace the ECU Configuration Specification document. 10.1.1 Configuration and configuration parameters Configuration parameters define the variability of the generic part(s) of an implementation of a module. This means that only generic or configurable module implementation can be adapted to the environment (software/hardware) in use during system and/or ECU configuration. The configuration of parameters can be achieved at different times during the software process: before compile time, before link time or after build time. In the following, the term “configuration class” (of a parameter) shall be used in order to refer to a specific configuration point in time. 10.1.2 Containers Containers structure the set of configuration parameters. This means:

- all configuration parameters are kept in containers. - (sub-) containers can reference (sub-) containers. It is possible to assign a

multiplicity to these references. The multiplicity then defines the possible number of instances of the contained parameters.

Page 62: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

62 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10.1.3 Specification template for configuration parameters The following tables consist of three sections:

- the general section - the configuration parameter section - the section of included/referenced containers

Pre-compile time - specifies whether the configuration parameter shall be

of configuration class Pre-compile time or not

Label Description x The configuration parameter shall be of configuration class Pre-compile time. -- The configuration parameter shall never be of configuration class Pre-compile time.

Link time - specifies whether the configuration parameter shall be

of configuration class Link time or not

Label Description x The configuration parameter shall be of configuration class Link time. -- The configuration parameter shall never be of configuration class Link time.

Post Build - specifies whether the configuration parameter shall be

of configuration class Post Build or not

Label Description

x The configuration parameter shall be of configuration class Post Build and no specific implementation is required.

L Loadable – the configuration parameter shall be of configuration class Post Build and only one configuration parameter set resides in the ECU.

M Multiple – the configuration parameter shall be of configuration class Post Build and is selected out of a set of multiple parameters by passing a dedicated pointer to the init function of the module.

-- The configuration parameter shall never be of configuration class Post Build. 10.2 Configuration and configuration parameters The following chapters summarize all configuration parameters. The detailed meanings of the parameters describe Chapter 7 and Chapter 8. 10.2.1 Variants Variant PC: This variant is limited to pre-compile-configuration parameters only. Variant PB: This variant allows a mix of pre-compile time and post-build multiple selectable configurable parameters. ADC275: The initialization function of this module shall always have a pointer as a parameter, even though for Variant PC no configuration set shall be given. Instead a NULL pointer shall be passed to the initialization function. This means that, in

Page 63: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

63 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

contradiction to BSW00414 only one interface for initialization shall be implemented and it shall not depend on the modules configuration, which interface the calling software module shall use. 10.2.2 AdcDriverGeneralConfiguration

Name ADC_DEV_ERROR_DETECT Description Switches the Development Error Detection and Notification

ON or OFF. Type #define Unit --

ON enabled Range OFF disabled

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope module Dependency none Name ADC_GRP_NOTIF_CAPABILITY Description ADC105: Determines, if the group notification mechanism is available

at runtime. Type #define Unit --

ON enabled Range OFF disabled

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope module Dependency none Name ADC_HW_TRIGGER_CAPABILITY Description ADC119: Determines, if the hardware trigger capability for One Shot

mode is available at runtime. Type #define Unit --

ON enabled Range OFF disabled

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope module Dependency none

SWS Item ADC027 Container Name AdcDriverGeneralConfiguration

Description This container contains the general configuration (parameters) of the ADC Driver software module.

Configuration Parameters

Page 64: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

64 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10.2.3 AdcHWUnitConfiguration

Name ADC_CLK_SRC Description ADC087: The ADC module specific clock input for the conversion unit

can be configured to select different clock sources if provided by hardware.

Type Adc_ClockSourceType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name ADC_PRESCALE Description ADC088: Optional ADC module specific clock prescale factor, if

supported by hardware Type Adc_PrescaleType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none

Included Containers

Container Name Multiplicity Scope Dependency AdcHWUnitConfiguration 1..*

SWS Item ADC242: Container Name AdcHWUnitConfiguration

Description

This container contains the Driver configuration (parameters) depending on grouping of channels The organization of this data structure could contain dependencies to the microcontroller so this is left up to the implementer and its location is left up to the configuration. ADC138: The ADC Driver shall support one or several ADC HW units. The selection of ADC HW unit shall be done by this configuration container.

Configuration Parameters

Included Containers

Container Name Multiplicity Scope Dependency AdcChannelConfiguration 1..* -- -- AdcGroupConfiguration 1..* -- --

Page 65: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

65 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10.2.4 AdcChannelConfiguration

Name ADC_CHANNEL_CONV_TIME Description ADC011: Configuration of conversion time, including sample time (in

clockcycles) for each channel, if supported by hardware. Type Adc_ConvTimeType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name ADC_CHANNEL_RESOLUTION Description ADC019: Channel resolution in bits

(optional) Type uint8 Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency ADC_MAX_CHANNEL_RESOLUTION Name ADC_CHANNEL_REF_VOLTSRC_LOW Description ADC023: Lower reference voltage source for each channel

(optional) Type Adc_VoltageSourceType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name ADC_CHANNEL_REF_VOLTSRC_HIGH Description ADC089: Upper reference voltage source for each channel (optional Type Adc_VoltageSourceType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB

SWS Item ADC268: Container Name AdcChannelConfiguration

Description

This container contains the channel configuration (parameters) depending on the hardware capability. The organization of this data structure could contain dependencies to the microcontroller so this is left up to the implementer and its location is left up to the configuration.

Configuration Parameters

Page 66: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

66 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Scope module Dependency none

10.2.5 AdcGroupConfiguration

Name ADC_GROUP_DEFINITION Description ADC014: Assignment of channels to a channel group.

ADC098: All channels of a group share the same group configuration (channels could have different specific parameters.

Type Adc_GroupDefType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name ADC_GROUP_TRIGG_SRC_ONESHOT Description Type of source event that starts a One-Shot conversion Type Adc_GroupTriggSrcOneShotType Unit --

ADC_TRIGG_SRC_SW_APIADC094: Group is triggered by a software API call. (mandatory)

ADC_TRIGG_SRC_HW_EXT_x

ADC095: Group is triggered by a hardware event on an I/O pin. (optional, if supported by hardware, only available in One Shot mode) only available, if hardware capability is configured as active

Range

ADC_TRIGG_SRC_HW_INT_x

ADC096: Group is triggered by one or more on chip hardware events (e.g. internal timer) (optional, if supported by hardware, only available in One Shot mode) only available, if hardware capability is configured as active

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB

Included Containers

Container Name Multiplicity Scope Dependency None -- -- --

SWS Item ADC028: Container Name AdcGroupConfiguration Description This container contains the Group configuration (parameters).

Configuration Parameters

Page 67: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

67 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Scope module Dependency none Name ADC_GROUP_CONV_MODE Description Type of conversion mode supported by the drver Type Adc_GroupConvModeType Unit --

ADC_CONV_MODE_ONESHOT

ADC001: The conversion of an ADC channel group is performed once after a trigger and the result is written to the assigned buffer. The One Shot conversions can be stopped by a software API call (stop).

ADC_CONV_MODE_CONTINUOUS

ADC002: The conversions of an ADC channel group are performed continuously after a software API call (start). The conversions itself are running automatically (hardware/interrupt controlled). The Continuous conversions can be stopped by a software API call (stop).

ADC_CONV_MODE_ON_DEMAND

ADC195: In order to permit to the ADC user to perform an immediate conversion in any time, an On Demand conversion is defined. It will suspend the group conversion and will resume it later at the end of On Demand activity.

Range

ADC_CONV_MODE_GATED

ADC196: The conversions of an ADC channel group are performed after a trigger until the buffer is full or until the gate is close and the result is written to the assigned buffer. A trigger can be a software API call or an internal or external hardware event.

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name Adc_Notification Description Call-back function for each group Type -- Unit -- Range Function pointer

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency This parameter is only available, if notification capability is configured

available by ADC_GRP_NOTIF_CAPABILITY

Page 68: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

68 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10.2.6 AdcStreamingConfiguration

Name ADC_GROUP Description ADC group Type Adc_GroupType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name ADC_GATED_BUFFER_POINTER Description ADC198: pointer to data buffer (destination for conversion results) Type Adc_PointerBufferType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name ADC_GATED_NUM_SAMPLES Description ADC199: number of ADC values to be acquired Type uint32 Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name ADC_GATED_GROUP_ACQ_TRIGG_SRC Description This parameter defines how the samples shall be acquired while the gate is

open Type Adc_GatedGroupAcqTriggSrcType Unit --

Included Containers

Container Name Multiplicity Scope Dependency AdcStreamingConfiguration 0..1 -- --

SWS Item ADC197: Container Name AdcStreamingConfiguration

Description This container contains the streaming configuration (parameters) of the group if ADC_GROUP_CONV_MODE has been set as ADC_CONV_MODE_GATED.

Configuration Parameters

Page 69: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

69 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

ADC_GATED_GROUP_ACQ_HW_EXT_x

ADC200: One group of samples is acquired at every external HW trigger. Group of sample means one sample for each channel configured in the group.

ADC_GATED_GROUP_ACQ_HW_INT_x

ADC274: One group of samples is acquired at every internal HW trigger. Group of sample means one sample for each channel configured in the group.

ADC_GATED_GROUP_ACQ_CONT

ADC201: Group of samples acquired continuosly (each sample after each other). Group of sample means one sample for each channel configured in the group.

Range

ADC_GATED_GROUP_ACQ_PERIOD

ADC202: One group of samples is acquired at every period time. Group of sample means one sample for each channel configured in the group.

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency none Name ADC_GATED_SAMPLE_PERIOD Description ADC203: acquisition period Type Adc_PeriodType Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency This parameter is significant only when

ADC_GATED_GROUP_ACQ_TRIGG_SRC is configured as ADC_GATED_GROUP_ACQ_PERIOD and the microcontroller provides a ADC internal timer.. Not significant or optional in other cases

Name ADC_DEFAULT_PRIORITY Description ADC245: possibility of enabling background conversion while he gated

conversion is in progress (see pictures). This parameter is optional, only if supported by hardware.

Type Boolean Unit -- Range --

Pre-compile X Variant PC Link time -- --

Configuration Class

Post Build M Variant PB Scope module Dependency ADC_HW_PRIORITY

Page 70: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

70 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10.2.7 Configuration of optional API services

Name ADC_VERSION_INFO_API Description Adds / removes the service Adc_GetVersionInfo() from the code. Type #define Unit --

ON Adc_GetVersionInfo() can be used Range OFF Adc_GetVersionInfo() can not be used

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope Module Dependency None Name ADC_DEINIT_API Description Adds / removes the service Adc_DeInit() from the code. Type #define Unit --

ON Adc_DeInit() can be used Range OFF Adc_DeInit() can not be used

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope Module Dependency None Name ADC_ENABLE_START_STOP_GROUP_API Description Adds / removes the services Adc_StartGroupConversion() and

Adc_StopGroupConversion() from the code. Type #define Unit --

ON Adc_StartGroupConversion ()and Adc_StopGroupConversion() can be used

Range

OFFAdc_StartGroupConversion ()and Adc_StopGroupConversion() cannot be used

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope Module Dependency None

SWS Item ADC238: Container Name Configuration of optional API services

Description This container contains all configuration switches for configuring optional API services of the ADC driver.

Configuration Parameters

Page 71: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

71 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

Name ADC_ENABLE_ON_DEMAND_API Description Adds / removes the services Adc_StartOnDemandConversion() and

Adc_OnDemandReadChannel() from the code. Type #define Unit --

ONAdc_StartOnDemandConversion() and Adc_OnDemandReadChannel() can be used

Range

OFFAdc_StartOnDemandConversion() and Adc_OnDemandReadChannel() cannot be used

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope Module Dependency None Name ADC_ENABLE_GATED_API Description Adds / removes the services Adc_StartGatedConversion() and

Adc_GetGatedLastPointer() from the code. Type #define Unit --

ON Adc_StartGatedConversion() and Adc_GetGatedLastPointer() can be used

Range

OFFAdc_StartGatedConversion() and Adc_GetGatedLastPointer() cannot be used

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope Module Dependency None Name ADC_HW_TRIGGER_API Description Adds / removes the services Adc_EnableHardwareTrigger() and

Adc_DisableHardwareTrigger() from the code. Type #define Unit --

ONAdc_EnableHardwareTrigger() and Adc_DisableHardwareTrigger() can be used

Range

OFFAdc_EnableHardwareTrigger() and Adc_DisableHardwareTrigger() cannot be used

Pre-compile X all Variants Link time -- --

Configuration Class

Post Build -- -- Scope Module Dependency ADC_HW_TRIGGER_CAPABILITY

Page 72: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

72 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10.3 Published information Published information contains data defined by the implementer of the SW module that does not change when the module is adapted (i.e. configured) to the actual HW/SW environment. It thus contains version and manufacturer information. SWS Item ADC030 Information elements Information element name

Type / Range

Information element description

ADC_VENDOR_ID uint16 / -- Vendor ID of the dedicated implementation of this module according to the AUTOSAR vendor list

ADC_MODULE_ID uint8 / -- Module ID of this module from Module List

ADC_AR_MAJOR_VERSION uint8 / -- Major version number of AUTOSAR specification where the appropriate implementation is based on.

ADC_AR_MINOR_VERSION uint8 / -- Minor version number of AUTOSAR specification where the appropriate implementation is based on.

ADC_AR_PATCH_VERSION uint8 / -- Patch level version number of AUTOSAR specification where the appropriate implementation is based on.

ADC_SW_MAJOR_VERSION uint8 / -- Major version number of the vendor specific implementation of the module. The numbering is vendor specific.

ADC_SW_MINOR_VERSION uint8 / -- Minor version number of the vendor specific implementation of the module. The numbering is vendor specific.

ADC_SW_PATCH_VERSION uint8 / -- Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific.

ADC_MAX_CHANNEL_RESOLUTION uint8 Maximum Channel resolution in bits. (does not specify

accuracy)

ADC_CHANNEL_VALUESIGNED

signed / unsigned

Information whether the result value of the ADC driver has sign information or not. If the result shall be interpreted as signed value it shall apply to “C”-language rules.

ADC_CHANNEL_RESULT uint8

Information to be supplied to identify whether the value in the buffer from an On Demand conversion is: • the value scanned when the On Demand

conversion was requested (0) • Either the value scanned when the On Demand

conversion was requested or possibly a more recent scan on the same ADC channel. (1)

ADC_TYPE_STOP_CONV uint8

Information to be supplied to identify the behavior of the ADC driver when request of finishing a conversion: • The ongoing conversion will be completed (0) • The ongoing conversion will be interrupted

immediately (1)

ADC_TYPE_SCAN_RESTART uint8

Information to be supplied to identify which channel is scanned next from the One Shot or Continuous scan channel group after being interrupted by an On Demand conversion: • The first channel in the channel group (0) • The channel in the group which was interrupted by

the On Demand conversion (1) • The channel in the group following the last

converted one (2)

ADC_HW_PRIORITY uint8 It specifies if microcontroller supports in HW priority mechanism

Page 73: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

73 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

10.4 Configuration of symbolic names This module does not provide the configuration of symbolic names for ADC channels and ADC channel groups. ADC099: The symbolic names of ADC channels and ADC channel groups for use by the upper layer shall be defined by the configurator; they are to be defined in the Cfg-File .

Page 74: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

74 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

11 Changes to Release 1

11.1 Deleted SWS Items SWS Item Rationale ADC029 According new template

11.2 Replaced SWS Items SWS Item of Release 1 replaced by

SWS Item Rationale

ADC070 ADC233, ADC234, ADC235

Required for new SWS template

ADC148 ADC246, ADC247, ADC248, ADC249, ADC250

New formulation for one-time writeable registers

ADC076 ADC244 Standardization of default value

11.3 Changed SWS Items SWS Item Rationale ADC001 Added stop functionality ADC030 Take in account the new template for published information and BSW003 ADC086, ADC107, ADC112, ADC115, ADC118, ADC125, ADC126, ADC128, ADC129, ADC130, ADC131, ADC132, ADC133, ADC134, ADC135, ADC136, ADC137, ADC152, ADC154

Modified requirements to align statement for DET

ADC112 Clarified behavior of Adc_Deinit function when call occurs while conversion is running

ADC108 Stop conversion depending by HW capability ADC087 According to the new template ADC090 Removed “Basic” definition ADC091 Removed “Basic” definition ADC092 Removed “Basic” definition ADC093 Removed “Basic” definition ADC027 According to the new template ADC028 According to the new template ADC138 New Driver structure and functionalities ADC139 Split in different requirement IDs (see ADC253) ADC140 New Driver structure and functionalities ADC067 According to the new template ADC150 Standardization of start-up code meaning ADC077 New Driver structure and functionalities ADC110 New formulation for shared registers ADC111 Clarification of functional perimeter of the ADC_DeInit function ADC127 New Driver structure and functionalities

Page 75: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

75 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

SWS Item Rationale ADC124 New Driver structure and functionalities ADC113 Standardization of result value ADC114 New Driver structure and functionalities ADC144 New Driver structure and functionalities

ADC142 New Driver structure and functionalities (Use of Adc_EnableHardwareTrigger to re-arm an internal timer)

ADC116 New Driver structure and functionalities ADC145 New Driver structure and functionalities ADC023 #4619 (Rfc#4198) ADC089 #4619 (Rfc#4198) ADC095 Notification capability corrected in hardware capability ADC096 Notification capability corrected in hardware capability ADC098 #4200: clarified definition of group configuration

11.4 Added SWS Items SWS Item Rationale ADC155 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC124) ADC156 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC125) ADC157 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC126) ADC158 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC128) ADC159 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC129) ADC160 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC130) ADC161 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC131) ADC162 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC132) ADC163 Added to substitute wrong duplicated ID in SWS ADC 1.0 (ADC138) ADC164 #4191 ADC165 #4194 ADC166 #4194 ADC167 New Driver structure and functionalities ADC168 #4192 ADC169 New Driver structure and functionalities ADC174 New Driver structure and functionalities ADC175 New DET error ADC176 New DET error ADC177 New Driver structure and functionalities ADC179 New Driver structure and functionalities ADC180 New Driver structure and functionalities ADC181 New Driver structure and functionalities ADC182 New Driver structure and functionalities ADC183 New Driver structure and functionalities ADC184 New DET error ADC185 New DET error ADC186 New Driver structure and functionalities ADC187 New Driver structure and functionalities ADC188 New Driver structure and functionalities ADC189 New Driver structure and functionalities ADC190 New Driver structure and functionalities ADC191 New Driver structure and functionalities ADC192 New Driver structure and functionalities ADC193 New DET error ADC194 New Driver structure and functionalities ADC195 New Driver structure and functionalities ADC196 New Driver structure and functionalities ADC197 New Driver structure and functionalities

Page 76: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

76 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

SWS Item Rationale ADC198 New Driver structure and functionalities ADC199 New Driver structure and functionalities ADC200 New Driver structure and functionalities ADC201 New Driver structure and functionalities ADC202 New Driver structure and functionalities ADC203 New Driver structure and functionalities ADC204 New Driver structure and functionalities ADC205 New Driver structure and functionalities ADC206 New Driver structure and functionalities ADC207 New Driver structure and functionalities ADC208 New DET error ADC209 New DET error ADC210 New Driver structure and functionalities ADC211 New Driver structure and functionalities ADC212 New DET error ADC213 New Driver structure and functionalities ADC214 New Driver structure and functionalities ADC215 New Driver structure and functionalities ADC216 New Driver structure and functionalities ADC217 New Driver structure and functionalities ADC218 New DET error ADC219 New Driver structure and functionalities ADC220 New Driver structure and functionalities ADC221 New Driver structure and functionalities ADC222 New Driver structure and functionalities ADC223 New Driver structure and functionalities ADC224 New Driver structure and functionalities ADC225 New DET error ADC226 New Driver structure and functionalities

ADC228 Required for new SWS template (API pre compile time configurable On/Off)

ADC229, ADC230, ADC233, ADC234, ADC235, ADC236, ADC237, ADC238, ADC239, ADC240

Required for new SWS template

ADC241 Missed DET error ADC242 Required for new SWS template ADC243 Configuration check

ADC244 Missing requirements: description already present but not tagged as requirement IDs

ADC246, ADC247, ADC248, ADC249, ADC250

Modified according BSW12461

ADC251, ADC252, ADC253, ADC254, ADC255, ADC256, ADC257, ADC258,

Missing requirements: description already present but not tagged as requirement IDs

ADC259, ADC260, ADC261, ADC262, ADC263, ADC264, ADC265, ADC266

Required for new SWS template (API pre compile time configurable On/Off)

ADC267, ADC268, ADC269, ADC270, ADC271

Missing requirements: description already present but not tagged as requirement IDs

ADC272 Constrains on Adc_EnableHardwareTrigger function

Page 77: Specification of ADC Driver - autosar.org · The ADC driver initializes and controls the internal Analogue Digital Converter unit of the microcontroller. The driver is equipped with

Specification of ADC Driver V2.0.1

77 of 77 AUTOSAR_SWS_ADC_Driver - AUTOSAR confidential -

SWS Item Rationale ADC273 Constrains on Adc_EnableHardwareTrigger function ADC274 Handling of multiple HW trigger for gated conversion ADC275 Added (SPAL decision, 41st meeting, minutes day2, issue 5)