AUTOSAR SWS IOHardwareAbstraction
AUTOSAR SWS IOHardwareAbstraction
Disclaimer
This specification and the material contained in it, as released by AUTOSAR, is for
the purpose of information only. AUTOSAR and the companies that have contributed
to it shall not be liable for any use of the specification.
The material contained in this specification is protected by copyright and other types
of Intellectual Property Rights. The commercial exploitation of the material contained
in this specification requires a license to such Intellectual Property Rights.
This specification may be utilized or reproduced without any modification, in any form
or by any means, for informational purposes only. For any other purpose, no part of
the specification may be utilized or reproduced, in any form or by any means, without
permission in writing from the publisher.
The AUTOSAR specifications have been developed for automotive applications only.
They have neither been developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Any such exemplary items are contained in the specifications for illustration purposes
only, and they themselves are not part of the AUTOSAR Standard. Neither their
presence in such specifications, nor any later documentation of AUTOSAR
conformance 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.
Table of Contents
The I/O Hardware Abstraction shall not be considered as a single module, as it can
be implemented as more than one module. This specification for the I/O Hardware
Abstraction is not intended to standardize this module or group of modules. Instead,
it is intended to be a guideline for the implementation of its functional interfaces with
other modules.
The I/O Hardware Abstraction shall provide the service for initializing the whole I/O
Hardware Abstraction.
3 Related documentation
[5] Glossary
AUTOSAR_TR_Glossary.pdf
Thus, the specification SWS BSW General shall be considered as additional and
required specification for IO Hardware Abstraction.
4.1 Limitations
No limitations
5.1.1 Overview
The following picture shows the I/O Hardware Abstraction. It is located above MCAL
drivers. That means the I/O Hardware Abstraction will call the driver’s APIs for
managing on chip devices. The configuration of the MCAL drivers depends on the
quality of the ECU signals that is required by the SWCs. For instance, it could be
necessary to have notifications when a relevant change occurs on the pin level
(rising edge, falling edge). The system designer has to configure the MCAL drivers to
allow notifications for a given signal. Notifications are generated by MCAL drivers
and are handled within the I/O Hardware Abstraction.
Please notice that I/O Hardware Abstraction is not intended to abstract GPT
functionalities, but rather to use them to perform its own functionalities. The
interfacing with GPT driver is shown because it is part of the MCAL.
MCAL drivers
IoHwAb ADC OCU PWM ICU DIO PORT GPT
driver driver driver driver driver driver driver
Calls API of X X X X X X X
Receives
notifications X X X X - - X
from
The following picture shows the I/O Hardware Abstraction, where some signals come
from / are set via the SPI handler / driver.
According to the Layered Software Architecture [2] (ID03-16), the I/O Hardware
Abstraction contains dedicated drivers to manage external devices for instance:
A driver for external ADC driver, connected via SPI.
A driver for external I/O realized on an ASIC device, connected via SPI.
The prototypes of the interfaces provided to DCM shall be within a header file
IoHwAb_<ServiceComponentName_>Dcm.h, for each ServiceComponent.
For details of the interfaces, refer Section 8.6.
[SWS_IoHwAb_00097] ⌈The code file structure shall not be defined within this
specification. ⌋ (SRS_BSW_00158)
gives an example of an I/O Hardware Abstraction that has its ECU signals
Figure 5-4
categorized in three modules (the partitioning of the signals into separate modules is
implementation-specific):
«source»
«source» Pwm.c
SchM.c «source»
Adc.c
«source»
include
Ocu.c
«source» «sourc... «source»
SchM_IoHwAb_<ComponentName>.h Std_Types.h Rte_<ComponentName>.h
include
include
include
include
IoHwAbstraction
«source» «source»
IoHwAb_<ComponentName>_Types.h IoHwAb_<ComponentName>_Cbk.h
include
include
include
include
«source»
IoHwAb_<ComponentName>_Cfg.h
include
«source»
IoHwAb_<ComponentName>.h
6 Requirements traceability
handlers
SRS_SPAL_12056 All driver modules shall allow the SWS_IoHwAb_00032,
static configuration of notification SWS_IoHwAb_00033,
mechanism SWS_IoHwAb_00034
SRS_SPAL_12057 All driver modules shall implement SWS_IoHwAb_00145
an interface for initialization
SRS_SPAL_12063 All driver modules shall only SWS_IoHwAb_00145
support raw value mode
SRS_SPAL_12064 All driver modules shall raise an SWS_IoHwAb_00145
error if the change of the
operation mode leads to
degradation of running operations
SRS_SPAL_12067 All driver modules shall set their SWS_IoHwAb_00145
wake-up conditions depending on
the selected operation mode
SRS_SPAL_12068 The modules of the MCAL shall SWS_IoHwAb_00145
be initialized in a defined
sequence
SRS_SPAL_12069 All drivers of the SPAL that wake SWS_IoHwAb_00145
up from a wake-up interrupt shall
report the wake-up reason
SRS_SPAL_12075 All drivers with random streaming SWS_IoHwAb_00145
capabilities shall use application
buffers
SRS_SPAL_12077 All drivers shall provide a non SWS_IoHwAb_00145
blocking implementation
SRS_SPAL_12078 The drivers shall be coded in a SWS_IoHwAb_00145
way that is most efficient in terms
of memory and runtime resources
SRS_SPAL_12092 The driver's API shall be SWS_IoHwAb_00145
accessed by its handler or
manager
SRS_SPAL_12125 All driver modules shall only SWS_IoHwAb_00145
initialize the configured resources
SRS_SPAL_12129 The ISRs shall be responsible for SWS_IoHwAb_00145
resetting the interrupt flags and
calling the according notification
function
SRS_SPAL_12163 All driver modules shall implement SWS_IoHwAb_00145
an interface for de-initialization
SRS_SPAL_12169 All driver modules that provide SWS_IoHwAb_00145
different operation modes shall
provide a service for mode
selection
SRS_SPAL_12263 The implementation of all driver SWS_IoHwAb_00145
modules shall allow the
configuration of specific module
parameter types at link time
SRS_SPAL_12264 Specification of configuration SWS_IoHwAb_00145
items shall be provided
7 Functional specification
The following requirements for the I/O Hardware Abstraction are related to hardware
protection.
Hardware protection means, that the I/O Hardware Abstraction is able to cut off an
output signal, when a failure (short circuit to ground/power supply, over temperature,
overload ...) is detected on the certain output.
The internal behavior of the I/O Hardware Abstraction is project-specific and cannot
be standardized.
There is no I/O Hardware Abstraction scalability. The SWC specifies what is needed
(quality of signal) and the I/O Hardware Abstraction has to provide it.
Alternatively, these electrical signals may also come from other ECUs or be
addressed to other ECUs (e.g. via a CAN network).
Ports are entry points of AUTOSAR components. They are typified by an AUTOSAR
interface. These interfaces correspond to “ECU signals”.
The concept of ECU signals comes from the necessity to guarantee the
interchangeability of hardware platforms.
The I/O Hardware Abstraction handles all inputs and outputs directly connected to
the ECU (except those that have a dedicated driver, like CAN, see requirement
[SWS_IoHwAb_00063]).
It includes all inputs and outputs, directly mapped to microcontroller ports, or to an
onboard peripheral. All communication between the microcontroller and the
peripherals (except sensors and actuators and peripherals managed by complex
drivers) are hidden by the I/O Hardware Abstraction, while considering the provided
interfaces.
An ECU is connected to the rest of the system through networks and inputs and
output pins. Networks are out of scope of this document.
The software in this layer shall abstract the ECU pins. Looking from this place (for
example using an oscilloscope) inputs and outputs are only electrical signals. Hence,
all that is defined in this document is related to this concept of electrical signals. One
extension of this concept is diagnosis (electrical failure status). Diagnosis is not
visible from ECU connectors but is provided by the I/O Hardware Abstraction.
Electrical signals with similar behavior may form a class. Therefore, ECU signals,
which denote the software representation of electrical signals may have an
association to an implementation-specific class.
7.3 Attributes
Even though most of the characteristics of each ECU Signal are defined by the SWC,
some properties have to be added to each signal to provide the signal quality the
SWC expects.
[SWS_IoHwAb_00021] ⌈All ECU signals shall have an Age Attribute. The Age
Attribute has two specific names according to the direction of ECU signal (Input /
Output). Anyway, it always contains a maximum time value. Following descriptions
explain the meaning of this Attribute for each kind of ECU signals.
ECU Input signals: the specific functionality of this attribute is to limit the
signals lifetime. The value defines the maximum allowed age for data of this
signal. If the lifetime is 0, the signal has to be retrieved from the physical
register, immediately. If the lifetime is greater than 0, the signal is valid for the
specified time.
ECU Output signals: the specific functionality of this attribute is to limit the
signal output to a maximum delay. The value defines the maximum allowed
time until this signal is actually set. If delay is 0, then the signal has to be set
to the physical register, immediately. If the delay is greater than 0, the signal
can be set until the configured time has elapsed. ⌋ ( )
In the same manner as in any other Software Component, the I/O Hardware
Abstraction might be sub-structured, depending on the complexity of an ECU.
Indeed, the I/O Hardware Abstraction is a classical Component Prototype, that can
be atomic or composed and that provides and requires interfaces. Moreover, I/O
Hardware Abstraction may only interact by means of their PortPrototypes with other
Software Components above the RTE. Hidden dependencies that are not expressed
by means of PortPrototypes are not allowed.
However, the I/O Hardware Abstraction interfaces on one side the MCAL drivers via
Standardized Interfaces and on the other side the RTE. Hence, I/O Hardware
Abstraction shall respect the virtual ports concept.
This chapter gives an overview of the virtual ports concept and runnable entities
applied to the I/O Hardware Abstraction needs. The following chapters of this
document describe the points set out here in more detail.
7.4.2.1 Ports concept and I/O Hardware Abstraction
This is an overview of recommendations for defining Ports of I/O Hardware
Abstraction using the Software Component template.
Further chapters in this document go deeper in usage of ports for I/O Hardware
Abstraction. Nevertheless, it is advised to read the Software Component Template
document [[8]] to be aware of all terms and all concepts used.
The attributes described in chapter 7.3 shall be defined by annotating the ports of the
I/O Hardware Abstraction components with an IoHwAbstractionServerAnnotation
(see [[8]]).
The runnable entities are the smallest code-fragments, which can be activated
independently. They are provided by the Atomic Software Component and are
activated by the RTE. Runnables are for instance set up to respond to data exchange
or operation invocation on a server.
The runnable entities have three possible states: Suspended, Enabled and Running.
During run-time, each runnable of an atomic Software Component is (by being a
member of an OS task) in one of these states.
For a sight of available choices and attributes to define each runnables of the Atomic
Software Component, please refer to specification [[8]].
The I/O Hardware Abstraction may consist of several BSW modules (e.g. onboard
device driver).
Each of these BSW modules can provide BSW runnable entities (also called
BswModuleEntity in the RTE Specification (see [9]).
This means that the I/O Hardware Abstraction can use Runnable Scheduling and
BSW Scheduling simultaneously. The Runnable Scheduling handles the Runnable
Entities and is mandatory. Unlike the Runnable Scheduling, the BSW Scheduling is
optional and the interfacing with the BSW Scheduler has to be done manually.
In case of SWC runnable entities, these are called in AUTOSAR OS Tasks bodies.
Runnables are given in the SWC description. Activation of SWC runnables strongly
depends on RTE events.
In the same way than SWCs are most often activated by RTEEvents, the
schedulables BswModuleEntities can be activated by BswEvents. There is also a
kind of BswModuleEntity which can be activated in interrupt context. This leads to
two sub-classes: BswSchedulableEntity and BswInterruptEntity.
The I/O Hardware Abstraction may contain one or several callback functions. The
available callback functions need to be hooked up to the notification interfaces of the
MCAL drivers. Therefore, they have to respect the prototype definition of the MCAL
drivers (no passing parameter, no return parameter).
The I/O Hardware Abstraction may contain one or several initialization and de-
initialization functions (e.g. one for each device driver). Similar to the MCAL drivers
the initialization functions shall contain a parameter to be able to pass different
configurations to the device drivers. This function shall initialize all local and global
variables used by the I/O Hardware Abstraction driver to an initial state.
The ECU state manager is able to trigger a BswModuleEntry for initialization of the
ADC driver (Call of Adc_Init() with the Adc_ConfigType structure).
At the end of conversion, the converted result is available and the notification is set to
the Analog input manager to store the value inside a buffer, available for diagnosis
purpose.
Figure 7-4: Example of IoHwAb runnable – cyclic setting of output and diagnosis
The I/O Hardware Abstraction layer has some analogies with a Software Component,
especially regarding port definition for communication through the RTE. The main
difference is that the I/O Hardware Abstraction is below the RTE (in the ECU
Abstraction Layer). The I/O Hardware Abstraction is a kind of interface between
Basic Software modules and Application Software.
For the I/O Hardware Abstraction, but also for Services, the current methodology
requires filling out two different templates. For example, in order to integrate an
NVRAM Manager on an AUTOSAR ECU one would use the BSWMD to document its
needs for the BSW Scheduler, OS Resources and so on. In addition, one would use
the SWC to describe the ports towards the RTE.
However, it is agreed that ECU signal will be mapped to a VFB Port (See chapter 7.2
and chapter 7.4). Moreover, to describe the interfaces between an I/O Hardware
Abstraction implementation and applicative Software Components implementations
(above RTE), one shall use the Software Component Template.
7.10.2 Requirements
The I/O Hardware Abstraction proposes to create one Port for each ECU signal
identified, exception made for ECU Diagnosis signals that are connected to ECU
Output signals. A relationship between this ECU signal and the Port shall be created.
Example:
The ECU has 10 Analog input pins, 15 PWM output pins, 15 Digital output pins.
The I/O Hardware Abstraction defines at least one Port for each ECU signal. In this
simple example, Ports are instantiated 40 times.
The goal of the debugging module is to offer as much information as possible about
the runtime behavior of the systems, making it easier to spot the source of a problem
when the integrated software does not behave as expected.
7.11.2 Requirements
7.12 Examples
the maximum time between the occurrence of an “over current” and the switch of the
Power IC is 1 ms
One OEM requirement is that the reaction of a switch must be not later than 100 ms
One other OEM requirement is that each DI must be debounced by 3 of 5 voting.
However the practice shows that the kind of debouncing is not really important
because the mechanical switches and the power IC do not generate disturbing
signals
The solution today is that all DI (slow and fast) are read every 0,8 ms (cyclic task)
(The scan rate for the slow DI could be lower but the overhead for an additional task
is higher than the runtime savings)
The debouncing for the slow DI’s is 1 time in every loop (so the worst cast delay to
the debounced value is 3,2 ms)
If an overcurrent is detected the pin will read again several times but in the same
loop and the power IC will switched off immediately
The application runs every 10 ms and reads the debounced DI for the switches and
the diagnosis information's
MCAL driver DIO driver: address lines, 1 DIO driver: 1 feedback line from
data line power IC
PWM driver: 1 line to the power
IC
ECU hardware Multiplexer: Mapping of 8 Power IC: Controls the power
electrical signal supply of the multiplexer
In this example, a diagnostic output signal shall be defined with the diagnosis
attribute on the level of the I/O Hardware Abstraction.
Therefore, an input is used to perform the diagnosis of the output.
When the I/O Hardware Abstraction asks for positioning one output
(Dio_WriteChannel), a read-out of the channel is done via an ECU pin configured as
input.
Software Component can get the diagnosis value through the port using the
diagnosis operation.
A power stage driver provides the view of all outputs. It calls services of PWM, DIO
drivers and SPI handler. The signal abstraction makes all these outputs “visible” from
the point of view of Software Component (signals are mapped on Ports).
The “Power stage driver” can be configurable.
Diagnosis:
Every failure can be detected on the level of the power stage. The diagnosis data
flow goes through the SPI communication to the Power stage driver
Then, the diagnosis is provided to all Software Component via an S/R interface.
7.12.4 EXAMPLE 4: Setting sensor and controlling periphery in low power state
The ECU controls a sensor through its ADC and its DIO Peripherals. Under specific
circumstances, the ECU enters an operation mode in which the sensor is shut down
and the ADC is set in low power state.
Application Sensor
Power Mode SWC
Manager
RTE
BswM
Service Layer
I/O Drivers
DIO Driver ADC Driver
DIO ADC μC
External Sensor
The Application Power Mode Manager issues a Mode Request to BswM to switch to
“LowPowerMode”.
BswM evaluates the requests and, if the all pre-conditions are met, issues a mode
switch to the Power Mode Manager and to the Sensor SWC.
The sensor SWC stops reading the sensory data (i.e. doesn´t request any Get
operation to the IoHwAbs anymore)
The IoHwAbs deregisters its notifications from the ADC and eventually stop HW
cyclical acquisitions.
The IoHwAbs commands external sensory HW into a low power mode or shut it off.
The IoHwAbs calls its Low Power Mode preparation Callouts and then its Low Power
Mode setting Callouts, as defined in the configuration in order to attain the ADC (in
this case) power state related to the requested Application Low Power mode
“LowPowerMode”
The process can be controlled step by step by introducing more fine granular mode
requests and reacting on the acknowledgements and/or switches.
8 API specification
8.2.1 IoHwAb<Init_Id>_ConfigType
[SWS_IoHwAb_00157] ⌈
Name: IoHwAb<Init_Id>_ConfigType
Type: Structure
Range: implementation --
specific
Description: Configuration data structure of the IoHwAb module.
⌋ (SRS_BSW_00414)
8.3.1 IoHwAb_Init<Init_Id>
[SWS_IoHwAb_00119] ⌈
Service name: IoHwAb_Init<Init_Id>
Syntax: void IoHwAb_Init<Init_Id>(
const IoHwAb<Init_Id>_ConfigType* ConfigPtr
)
Service ID[hex]: 0x01
Sync/Async: Synchronous
Reentrancy: Non Reentrant
Parameters (in): ConfigPtr Pointer to the selected configuration set.
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: Initializes either all the IO Hardware Abstraction software or is a part of the IO
Hardware Abstraction.
⌋ ()
[SWS_IoHwAb_00059] ⌈This kind of function initializes either all the I/O Hardware
Abstraction software, or a part of the I/O Hardware Abstraction. ⌋ (SRS_BSW_00101)
[SWS_IoHwAb_00061] ⌈This kind of init function shall called by the ECU State
Manager. The ECU integrator is able to configure the init sequence order called by
the ECU State manager. ⌋ (SRS_BSW_00101)
8.3.2 IoHwAb_GetVersionInfo
[SWS_IoHwAb_00120] ⌈
Service name: IoHwAb_GetVersionInfo
Syntax: void IoHwAb_GetVersionInfo(
Std_VersionInfoType* versioninfo
)
Service ID[hex]: 0x10
Sync/Async: Synchronous
Reentrancy: Reentrant
Parameters (in): None
Parameters None
(inout):
versioninfo Pointer to where to store the version information of this implementation
Parameters (out):
of IO Hardware Abstraction.
Return value: None
Description: Returns the version information of this module.
⌋ ()
8.4.1 IoHwAb_AdcNotification<#groupID>
[SWS_IoHwAb_00121] ⌈
47 of 63 Document ID 047: AUTOSAR_SWS_IOHardwareAbstraction
- AUTOSAR confidential -
Specification of I/O Hardware Abstraction
AUTOSAR CP Release 4.3.0
8.4.2 IoHwAb_Pwm_Notification<#channel>
[SWS_IoHwAb_00122] ⌈
Service name: IoHwAb_PwmNotification<#channel>
Syntax: void IoHwAb_PwmNotification<#channel>(
void
)
Service ID[hex]: 0x30
Sync/Async: Synchronous
Reentrancy: Non Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: Will be called by the PWM Driver when a signal edge occurs on channel
<#channel>.
⌋ ()
[SWS_IoHwAb_00105] ⌈The function IoHwAb_PwmNotification<#channel> is
intended to be called by the PWM driver when a signal edge occurs on channel
<#channel>.⌋ ( )
8.4.3 IoHwAb_IcuNotification<#channel>
[SWS_IoHwAb_00123] ⌈
Service name: IoHwAb_IcuNotification<#channel>
Syntax: void IoHwAb_IcuNotification<#channel>(
void
)
Service ID[hex]: 0x40
Sync/Async: Synchronous
Reentrancy: Non Reentrant
48 of 63 Document ID 047: AUTOSAR_SWS_IOHardwareAbstraction
- AUTOSAR confidential -
Specification of I/O Hardware Abstraction
AUTOSAR CP Release 4.3.0
8.4.4 IoHwAb_GptNotification<#channel>
[SWS_IoHwAb_00124] ⌈
Service name: IoHwAb_GptNotification<#channel>
Syntax: void IoHwAb_GptNotification<#channel>(
void
)
Service ID[hex]: 0x50
Sync/Async: Synchronous
Reentrancy: Non Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: Will be called by the GPT driver when a timer value expires on channel
<#channel>.
⌋ ()
[SWS_IoHwAb_00107] ⌈The function IoHwAb_GptNotification<#channel> is
intended to be called by the GPT driver when a timer value expires on channel
<#channel>.⌋ ( )
8.4.5 IoHwAb_OcuNotification<#channel>
[SWS_IoHwAb_00155] ⌈
Service name: IoHwAb_OcuNotification<#channel>
Syntax: void IoHwAb_OcuNotification<#channel>(
void
)
Service ID[hex]: 0xa0
Sync/Async: Synchronous
Reentrancy: Non Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: Will be called by the OCU driver when the current value of the threshold matches
the threshold on the channel<#channel>.
49 of 63 Document ID 047: AUTOSAR_SWS_IOHardwareAbstraction
- AUTOSAR confidential -
Specification of I/O Hardware Abstraction
AUTOSAR CP Release 4.3.0
⌋ ()
[SWS_IoHwAb_00156] ⌈ The function IoHwAb_OcuNotification<#channel> is
intended to be called by the OCU driver when the current value of the counter
matches the threshold on channel <#channel>.⌋ ( )
8.4.6 IoHwAb_Pwm_NotifyReadyForPowerState<#MODE>
[SWS_Pwm_00198] ⌈
Service name: IoHwAb_Pwm_NotifyReadyForPowerState<#Mode>
Syntax: void IoHwAb_Pwm_NotifyReadyForPowerState<#Mode>(
void
)
Service ID[hex]: 0x60
Sync/Async: Synchronous
Reentrancy: Non Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: The API shall be invoked by the PWM Driver when the requested power state
preparation for mode <#Mode> is completed.
⌋ ()
This interface provided by CDD or IoHwAbs is needed if the PWM Driver is
configured to support power state control in asynchronous mode.
8.4.7 IoHwAb_Adc_NotifyReadyForPowerState<#MODE>
[SWS_IoHwAb_00154] ⌈
Service name: IoHwAb_Adc_NotifyReadyForPowerState<#Mode>
Syntax: void IoHwAb_Adc_NotifyReadyForPowerState<#Mode>(
void
)
Service ID[hex]: 0x70
Sync/Async: Synchronous
Reentrancy: Non Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: The API shall be invoked by the ADC Driver when the requested power state
preparation for mode <#Mode> is completed.
⌋ ()
This interface provided by CDD or IoHwAbs is needed if the ADC Driver is configured
to support power state control in asynchronous mode.
8.6.1 IoHwAb_Dcm_<EcuSignalName>
[SWS_IoHwAb_00135] ⌈
Service name: IoHwAb_Dcm_<EcuSignalName>
Syntax: void IoHwAb_Dcm_<EcuSignalName>(
uint8 action,
<EcuSignalDataType> signal
)
Service ID[hex]: --
Sync/Async: --
Reentrancy: --
action IOHWAB_RETURNCONTROLTOECU: Unlock the signal
IOHWAB_RESETTODEFAULT: Lock the signal and set it to a configured
default value
Parameters (in): IOHWAB_FREEZECURRENTSTATE: Lock the signal to the current value
IOHWAB_SHORTTERMADJUSTMENT: Lock the signal and adjust it to a
value given by the DCM module
signal Value to adjust the signal to (only used for 'short term adjustment').
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function provides control access to a certain ECU Signal to the DCM module
51 of 63 Document ID 047: AUTOSAR_SWS_IOHardwareAbstraction
- AUTOSAR confidential -
Specification of I/O Hardware Abstraction
AUTOSAR CP Release 4.3.0
(<EcuSignalname> is the symbolic name of an ECU Signal). The ECU signal can
be locked and unlocked by this function. Locking 'freezes' the ECU signal to the
current value, the configured default value or a value given by the parameter
'signal'.
⌋ (SRS_IoHwAb_00002)
[SWS_IoHwAb_00136] ⌈This function allows controlling the associated ECU Signal,
i.e. the ECU Signal can be locked, unlocked, and adjusted to a certain value. ⌋
(SRS_IoHwAb_00002)
Locking a signal means, that the certain signal is software-locked towards the SW-C,
i.e. the SW-C's requests have no effect on the hardware in the locked state. In case
C/S-communication is used for input signals, it might be necessary to have an
IoHwAb-internal buffer, whose value can be adjusted by the DCM.
8.6.2 IoHwAb_Dcm_Read<EcuSignalName>
[SWS_IoHwAb_00139] ⌈
Service name: IoHwAb_Dcm_Read<EcuSignalName>
Syntax: void IoHwAb_Dcm_Read<EcuSignalName>(
<EcuSignalDataType>* signal
)
Service ID[hex]: --
Sync/Async: --
Reentrancy: --
Parameters (in): None
Parameters None
(inout):
Parameters (out): signal Pointer to the variable where the current signal value shall be stored
Return value: None
Description: This function provides read access to a certain ECU Signal to the DCM module
(<EcuSignalname> is the symbolic name of an ECU Signal).
⌋ (SRS_IoHwAb_00002)
[SWS_IoHwAb_00140] ⌈This function provides read access to a certain ECU Signal
to the DCM module. The read access is independent from the ECU Signal's current
state (locked/unlocked) and shall always read the current physical value from the
hardware. ⌋ (SRS_IoHwAb_00002)
8.7.1 IoHwAb_PreparePowerState<#MODE>
[SWS_IoHwAb_00146] ⌈
Service name: IoHwAb_PreparePowerState<#Mode>
Syntax: void IoHwAb_PreparePowerState<#Mode>(
void
)
Service ID[hex]: 0x80
Sync/Async: Synchronous
Reentrancy: Non Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: The API shall be invoked by the IoHwAbs in order to prepare the transition to a
given power state. The aim of this API is to incapsulate all actions to prepare the
HW for a predefined power mode, decoupling application power definition from
HW power states.
⌋ ()
[SWS_IoHwAb_00149] ⌈
This API is a configurable callout and shall be defined per configuration once per
Power Mode to be managed. ⌋ ()
[SWS_IoHwAb_00150] ⌈
This callout shall be executed in the context of the IoHwAbs SWC, meaning that it
has full access to the MCAL. ⌋ ()
Many peripheral power state transition requests can be connected to a given Power
Mode transition to be implemented by this callout, along with any other action needed
to bring the peripherals in the desired power state (cross dependencies between
peripherals can be solved in this context).
[SWS_IoHwAb_00147] ⌈
Service name: IoHwAb_EnterPowerState<#Mode>
Syntax: void IoHwAb_EnterPowerState<#Mode>(
void
)
Service ID[hex]: 0x90
53 of 63 Document ID 047: AUTOSAR_SWS_IOHardwareAbstraction
- AUTOSAR confidential -
Specification of I/O Hardware Abstraction
AUTOSAR CP Release 4.3.0
Sync/Async: Asynchronous
Reentrancy: Non Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: The API shall be invoked by the IoHwAbs in order to effectively enter a power
state which was prepared by the API IoHwAb_PreparePowerState<#Mode>() .
The aim of this API is to incapsulate all actions to set the HW in a power state
corresponding to a predefined power mode, decoupling application power
definition from HW power states.
⌋ ()
[SWS_IoHwAb_00151]
⌈ This API is a configurable callout and shall be defined per configuration once per
Power Mode to be managed.⌋ ()
[SWS_IoHwAb_00152]
⌈ This callout shall be executed in the context of the IoHwAbs SWC, meaning that it
has full access to the MCAL.⌋ ()
[SWS_IoHwAb_00153]
⌈ This API executes all power state transition prepared by the preceding call to the
correposonding IoHwAb_PreparePowerState<#Mode>.⌋ ()
There are no mandatory interfaces for I/O Hardware Abstraction. Which interfaces
the I/O Hardware Abstraction uses depends on the expected functionality of the
channels that are defined by the SWC.
[] ⌈
API function Description
Adc_DisableGroupNotification Disables the notification mechanism for the requested ADC Channel
group.
Adc_DisableHardwareTrigger Disables the hardware trigger for the requested ADC Channel group.
Adc_EnableGroupNotification Enables the notification mechanism for the requested ADC Channel
group.
Adc_EnableHardwareTrigger Enables the hardware trigger for the requested ADC Channel group.
Adc_GetGroupStatus Returns the conversion status of the requested ADC Channel group.
Adc_GetStreamLastPointer Returns the number of valid samples per channel, stored in the result
buffer.
Reads a pointer, pointing to a position in the group result buffer. With
the pointer position, the results of all group channels of the last
completed conversion round can be accessed.
With the pointer and the return value, all valid group conversion results
can be accessed (the user has to take the layout of the result buffer into
account).
Adc_ReadGroup Reads the group conversion result of the last completed conversion
round of the requested group and stores the channel values starting at
the DataBufferPtr address. The group channel values are stored in
ascending channel number order ( in contrast to the storage layout of
the result buffer if streaming access is configured).
Adc_SetupResultBuffer Initializes ADC driver with the group specific result buffer start address
where the conversion results will be stored. The application has to
ensure that the application buffer, where DataBufferPtr points to, can
hold all the conversion results of the specified group. The initialization
with Adc_SetupResultBuffer is required after reset, before a group
conversion can be started.
Adc_StartGroupConversion Starts the conversion of all channels of the requested ADC Channel
group.
Adc_StopGroupConversion Stops the conversion of the requested ADC Channel group.
Dio_ReadChannel Returns the value of the specified DIO channel.
Dio_ReadChannelGroup This Service reads a subset of the adjoining bits of a port.
Dio_ReadPort Returns the level of all channels of that port.
Dio_WriteChannel Service to set a level of a channel.
Dio_WriteChannelGroup Service to set a subset of the adjoining bits of a port to a specified level.
Dio_WritePort Service to set a value of the port.
Gpt_CheckWakeup Checks if a wakeup capable GPT channel is the source for a wakeup
event and calls the ECU state manager service EcuM_SetWakeupEvent
in case of a valid GPT channel wakeup event.
Gpt_DisableWakeup Disables the wakeup interrupt of a channel (relevant in sleep mode).
Gpt_EnableWakeup Enables the wakeup interrupt of a channel (relevant in sleep mode).
Gpt_GetTimeElapsed Returns the time already elapsed.
Gpt_GetTimeRemaining Returns the time remaining until the target time is reached.
Gpt_SetMode Sets the operation mode of the GPT.
Icu_DisableEdgeCount This function disables the counting of edges of the given channel.
Icu_DisableNotification This function disables the notification of a channel.
Icu_DisableWakeup This function disables the wakeup capability of a single ICU channel.
Icu_EnableEdgeCount This function enables the counting of edges of the given channel.
Icu_EnableNotification This function enables the notification on the given channel.
Icu_EnableWakeup This function (re-)enables the wakeup capability of the given ICU
55 of 63 Document ID 047: AUTOSAR_SWS_IOHardwareAbstraction
- AUTOSAR confidential -
Specification of I/O Hardware Abstraction
AUTOSAR CP Release 4.3.0
channel.
Icu_GetDutyCycleValues This function reads the coherent active time and period time for the
given ICU Channel.
Icu_GetEdgeNumbers This function reads the number of counted edges.
Icu_GetInputState This function returns the status of the ICU input.
Icu_GetTimeElapsed This function reads the elapsed Signal Low Time for the given channel.
Icu_GetTimestampIndex This function reads the timestamp index of the given channel.
Icu_ResetEdgeCount This function resets the value of the counted edges to zero.
Icu_SetActivationCondition This function sets the activation-edge for the given channel.
Icu_StartSignalMeasurement This function starts the measurement of signals.
Icu_StartTimestamp This function starts the capturing of timer values on the edges.
Icu_StopSignalMeasurement This function stops the measurement of signals of the given channel.
Icu_StopTimestamp This function stops the timestamp measurement of the given channel.
Ocu_DisableNotification This service is used to disable notifications from an OCU channel.
Ocu_EnableNotification This service is used to enable notifications from an OCU channel.
Ocu_GetCounter Service to read the current value of the counter.
Ocu_SetAbsoluteThreshold Service to set the value of the channel threshold using an absolute input
data.
Ocu_SetPinState Service to set immediately the level of the pin associated to an OCU
channel.
Ocu_SetRelativeThreshold Service to set the value of the channel threshold relative to the current
value of the counter.
Ocu_StartChannel Service to start an OCU channel.
Ocu_StopChannel Service to stop an OCU channel.
Port_RefreshPortDirection Refreshes port direction.
Port_SetPinDirection Sets the port pin direction
Port_SetPinMode Sets the port pin mode.
Pwm_DisableNotification Service to disable the PWM signal edge notification.
Pwm_EnableNotification Service to enable the PWM signal edge notification according to
notification parameter.
Pwm_GetOutputState Service to read the internal state of the PWM output signal.
Pwm_SetDutyCycle Service sets the duty cycle of the PWM channel.
Pwm_SetOutputToIdle Service sets the PWM output to the configured Idle state.
Pwm_SetPeriodAndDuty Service sets the period and the duty cycle of a PWM channel
Spi_AsyncTransmit Service to transmit data on the SPI bus.
Spi_Cancel Service cancels the specified on-going sequence transmission.
Spi_GetHWUnitStatus This service returns the status of the specified SPI Hardware
microcontroller peripheral.
Spi_GetJobResult This service returns the last transmission result of the specified Job.
Spi_GetSequenceResult This service returns the last transmission result of the specified
Sequence.
Spi_GetStatus Service returns the SPI Handler/Driver software module status.
Spi_MainFunction_Handling --
Spi_ReadIB Service for reading synchronously one or more data from an IB SPI
Handler/Driver Channel specified by parameter.
Spi_SetAsyncMode Service to set the asynchronous mechanism mode for SPI busses
handled asynchronously.
Spi_SetupEB Service to setup the buffers and the length of data for the EB SPI
Handler/Driver Channel specified.
Spi_SyncTransmit Service to transmit data on the SPI bus
Spi_WriteIB Service for writing one or more data to an IB SPI Handler/Driver
Channel specified by parameter.
⌋ ()
This chapter defines all interfaces, which are required to fulfill an optional
functionality of the I/O Hardware Abstraction.
None
9 Sequence diagrams
In this example, the Sensor / Actuator Component is the client, the I/O Hardware
Abstraction is the server.
The Sensor/Actuator Component asks for a new value of the af_pressure AUTOSAR
signal that is an ECU signal on the level of the I/O Hardware Abstraction.
After Adc conversion is finished, a notification coming from MCAL driver is converted
into a RTE event for the Sensor / Actuator Component. Then, it can perform a
synchronous read of the value present in the af_pressure signal buffer.
Adc_Init(const
Adc_ConfigType*)
Adc_Init()
IoHwAb_Init<Init_Id>(const
IoHwAb<Init_Id>_ConfigType*)
IoHwAb_Init<Init_Id>()
Adc_EnableGroupNotification(Adc_GroupType)
Adc_EnableGroupNotification()
IoHwAb_GetVoltage(af_pressure)
Adc_StartGroupConversion(Adc_GroupType)
start conversion()
Adc_StartGroupConversion()
IoHwAb_GetVoltage()
Interrupt()
IoHwAb_Adc_Notification_Group1()
Adc_OnDemandReadChannel(Adc_ChannelType) :
Adc_ValueType
Adc_OnDemandReadChannel()
SetRTEEvent()
IoHwAb_ReadVoltage(af_pressue, &buffer))
IoHwAb_ReadVoltage()
Group 1:
- Channel 1
- Channel 2
Notes:
The diagram in this example is intended to show the runnables and is not intended to
show the server port to runnable mapping.
RTE/SchMSwitch(char)
OnEntryRunnable_LowPowerModeA()
IoHwAb_PreparePowerState_LowPowerModeA()
Adc_GetCurrentPowerState()
Pwm_GetCurrentPowerState()
Adc_PreparePowerState(PwrSts_1)
At the moment in witch the API <MSN>_PreparePowerState returns, the
preparation process is started and runs in background, driven by the
<MSN>_Main_PowerStateTransitionManager API.
Pwm_PreparePowerState(PwrSts_3)
IoHwAb_PollForResults()
IoHwAb_Pwm_NotifyReadyForPowerStateLowPowerModeA()
IoHwAb_Adc_NotifyReadyForPowerStateLowPowerModeA()
PeriodicTask()
IoHwAb_PollForResults()
IoHwAb_EnterPowerStateLP1()
Adc_SetPowerState()
Pwm_SetPowerState()
RTE/SchMSwitch(LowPowerModeA_Transition_End)
UpdateModePorts()
The sequence diagram in Figure 9-2 refers to a power state transition, where the
peripherals are configured for asynchronous power state transitions. After having
received a request to prepare a power state, the peripheral´s driver issues a
notification to the caller (in this case IoHwAbs) to inform it of being ready to transition
to the new power state.
60 of 63 Document ID 047: AUTOSAR_SWS_IOHardwareAbstraction
- AUTOSAR confidential -
Specification of I/O Hardware Abstraction
AUTOSAR CP Release 4.3.0
RTE/SchMSwitch()
OnEntryRunnable_LowPowerModeA()
IoHwAb_PreparePowerState_LowPowerModeA()
Adc_GetCurrentPowerState()
Pwm_GetCurrentPowerState()
Adc_PreparePowerState(PwrSts_1)
Pwm_PreparePowerState(PwrSrs_3)
Pwm_SetPowerState()
RTE/SchMSwitch(LowPowerModeA_Transition_End)
UpdateModePorts()
10 Configuration specification
The I/O Hardware Abstraction has no standardized configuration parameters and is
therefore not part of the AUTOSAR ECU-C Parameter Definition. All parameters are
vendor specific parameters.