AUTOSAR SWS ICUDriver
AUTOSAR SWS ICUDriver
Disclaimer
This work (specification and/or software implementation) 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
work.
The material contained in this work is protected by copyright and other types of
intellectual property rights. The commercial exploitation of the material contained in
this work requires a license to such intellectual property rights.
This work 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
work may be utilized or reproduced, in any form or by any means, without permission
in writing from the publisher.
The work has been developed for automotive applications only. It has neither been
developed, nor tested for non-automotive applications.
The word AUTOSAR and the AUTOSAR logo are registered trademarks.
Table of Contents
3 Related documentation...................................................................................... 12
3.1 Input documents ......................................................................................... 12
3.2 Related standards and norms .................................................................... 12
3.3 Related specification .................................................................................. 12
4 Constraints and assumptions ............................................................................ 14
4.1 Limitations .................................................................................................. 14
4.2 Applicability to car domains ........................................................................ 14
5 Dependencies to other modules ........................................................................ 15
5.1 Module DET (Default Error Tracer) ............................................................ 15
5.2 Module MCU .............................................................................................. 15
5.3 OS (Operating System) .............................................................................. 15
5.4 Module PORT ............................................................................................ 15
5.5 Module EcuM ............................................................................................. 15
6 Requirements traceability .................................................................................. 16
The ICU driver is a module using the input capture unit (ICU) for demodulation of a
PWM signal, counting pulses, measuring of frequency and duty cycle, generating
simple interrupts and also wakeup interrupts.
3 Related documentation
Thus, the specification SWS BSW General shall be considered as additional and
required specification for ICU Driver.
4.1 Limitations
No limitations.
The detailed description of the detected errors can be found in chapter 7.2 and
chapter 8.⌋ ()
The ICU driver will not take care of setting the registers which configure the global
clock, global prescaler(s) and PLL in its Init function. This has to be done by the MCU
module. The ICU driver only configures local (ICU peripheral specific) clocks,
prescalers and so on.
The ICU driver will not take care of setting the registers for interrupt association in its
Init function. The overall assignment and activation of the interrupt system is done by
the Operating System.
[SWS_Icu_00244] ⌈The ICU driver will do the reporting of wakeup interrupts to the
EcuM.⌋ ()
6 Requirements traceability
enabling/disabling of detection
and reporting of development
errors.
SRS_BSW_00353 All integer type definitions of SWS_Icu_00380
target and compiler specific
scope shall be placed and
organized in a single type
header
SRS_BSW_00357 For success/failure of an API SWS_Icu_00380
call a standard return type shall
be defined
SRS_BSW_00358 The return type of init() SWS_Icu_00380
functions implemented by
AUTOSAR Basic Software
Modules shall be void
SRS_BSW_00359 All AUTOSAR Basic Software SWS_Icu_00187
Modules callback functions shall
avoid return types other than
void if possible
SRS_BSW_00360 AUTOSAR Basic Software SWS_Icu_00380
Modules callback functions are
allowed to have parameters
SRS_BSW_00361 All mappings of not SWS_Icu_00380
standardized keywords of
compiler specific scope shall be
placed and organized in a
compiler specific type and
keyword header
SRS_BSW_00369 All AUTOSAR Basic Software SWS_Icu_00049
Modules shall not return specific
development error codes via the
API
SRS_BSW_00371 The passing of function pointers SWS_Icu_00380
as API parameter is forbidden
for all AUTOSAR Basic
Software Modules
SRS_BSW_00373 The main processing function of SWS_Icu_00380
each AUTOSAR Basic Software
Module shall be named
according the defined
convention
SRS_BSW_00377 A Basic Software Module can SWS_Icu_00380
return a module specific types
SRS_BSW_00378 AUTOSAR shall provide a SWS_Icu_00380
boolean type
SRS_BSW_00379 All software modules shall SWS_Icu_00380
provide a module identifier in
the header file and in the
module XML description file.
SRS_BSW_00383 The Basic Software Module SWS_Icu_00380
specifications shall specify
which other configuration files
from other modules they use at
19 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
interrupts
SRS_BSW_00440 The callback function invocation SWS_Icu_00380
by the BSW module shall follow
the signature provided by RTE
to invoke servers via Rte_Call
API
SRS_BSW_00441 Naming convention for type, SWS_Icu_00380
macro and function
SRS_BSW_00450 A Main function of a un- SWS_Icu_00380
initialized module shall return
immediately
SRS_Icu_12305 The ICU driver shall allow to SWS_Icu_00009, SWS_Icu_00010,
enable/disable the notification SWS_Icu_00042, SWS_Icu_00044
for an ICU channel at runtime
SRS_Icu_12368 The ICU driver shall support SWS_Icu_00039
basic static configurations per
channel
SRS_Icu_12369 The ICU driver shall provide SWS_Icu_00021
notification for an ICU Channel
at the configured signal edge
SRS_Icu_12370 The ICU driver shall provide a SWS_Icu_00008
service for selecting the sleep
mode
SRS_Icu_12371 The ICU driver shall provide a SWS_Icu_00030, SWS_Icu_00031,
synchronous service that SWS_Icu_00032
returns the status of the ICU
input
SRS_Icu_12407 After initialization of the ICU SWS_Icu_00040, SWS_Icu_00061
driver all notifications shall be
disabled
SRS_Icu_12408 The ICU driver shall provide a SWS_Icu_00013, SWS_Icu_00014
service for enabling / disabling
the wake-up capability of single
ICU channels
SRS_Icu_12425 For each ICU Channel the SWS_Icu_00039, SWS_Icu_00088
'property' that could be
measured shall be configurable
SRS_Icu_12429 The ICU Driver shall provide the SWS_Icu_00036
functionality to deinitialize ICU
channels to their power on reset
state
SRS_Icu_12430 The ICU driver shall provide an SWS_Icu_00063, SWS_Icu_00066
asynchronous service for
starting the timestamp
measurement on an ICU
channel
SRS_Icu_12431 The ICU driver shall provide a SWS_Icu_00067
synchronous service for
canceling the timestamp
measurement on an ICU
channel
SRS_Icu_12432 Edge counting service shall be SWS_Icu_00078
22 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
7 Functional specification
7.1.2 Requirements
[SWS_Icu_00050] ⌈The Icu module functions for different channel numbers shall be
re-entrant, except for:
Icu_Init()
Icu_DeInit()
Icu_SetMode()
Icu_GetVersionInfo()⌋ ()
[SWS_Icu_00149] ⌈The Icu module’s environment shall check the integrity if several
calls for the same ICU channel are used during runtime in different tasks or ISRs.⌋ ()
[SWS_Icu_00150] ⌈The Icu module shall not check the integrity if several calls for
the same ICU channel are used during runtime in different tasks or ISRs. ⌋ ()
In ICU_MODE_SLEEP mode
[SWS_Icu_00012] ⌈only those wakeup events are available which are
configured as wakeup capable, enabled via Icu_EnableWakeup() after
Icu_Init() and which are not disabled via service
Icu_DisableWakeup()⌋ (SRS_SPAL_12067)
26 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
[SWS_Icu_00088] ⌈The module Icu shall allow the configuration per channel of the
definition on which edge the period starts.⌋ (SRS_Icu_12425)
To get times out of register values it is necessary to know the oscillator frequency,
prescalers and so on. Since these settings are made in the MCU module and/or in
other modules it is not possible to calculate such times.
Hence the conversions between time and ticks shall be part of an upper layer.
7.1.3.2 Requirements
All time units used within the API services of the ICU driver are unit ticks.
This chapter shall list all Development Errors that can be detected within this
software module. For each error, a value shall be defined.
Value
Type or error Relevance Related error code
[hex]
API IS called with invalid pointer.⌋ Development ICU_E_PARAM_POINTER 0x0A
API service used with an invalid
channel identifier or channel was not Development ICU_E_PARAM_CHANNEL 0x0B
configured for the functionality of the
27 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
Value
Type or error Relevance Related error code
[hex]
calling API.⌋ ()
API service used with an invalid or not
Development ICU_E_PARAM_ACTIVATION 0x0C
feasible activation.⌋ ()
Init function failed.⌋ () Development ICU_E_INIT_FAILED 0x0D
API service used with an invalid buffer
Development ICU_E_PARAM_BUFFER_SIZE 0x0E
size.⌋ ()
API service Icu_SetMode used
Development ICU_E_PARAM_MODE 0x0F
with an invalid mode.⌋ ()
API service used without module
Development ICU_E_UNINIT 0x14
initialization.⌋ ()
API service Icu_SetMode is called
Development ICU_E_BUSY_OPERATION 0x16
while a running operation.⌋ ()
API Icu_Init service is called and
when the ICU driver and the Hardware Development ICU_E_ALREADY_INITIALIZED 0x17
are already initialized.⌋ ()
API Icu_StartTimeStamp is called
and the parameter NotifyInterval
Development ICU_E_PARAM_NOTIFY_INTERVAL 0x18
is invalid (e.g.”0”, NotifyInterval <
1) ⌋ ()
API Icu_GetVersionInfo is called
and the parameter versioninfo Development ICU_E_PARAM_VINFO 0x19
is is invalid ( e.g. NULL ) ⌋ ()
Value
Type or error Relevance Related error code
[hex]
API service Icu_StopTimestamp
called on a channel which was not Runtime ICU_E_NOT_STARTED 0x15
started or already stopped⌋ ()
[SWS_Icu_00022] ⌈If development error detection for the Icu module is enabled: All
Icu module functions, except for Icu_Init and Icu_GetVersionInfo, shall raise
development error ICU_E_UNINIT when the function Icu_Init has not been
called. ⌋ (SRS_BSW_00323, SRS_BSW_00406)
8 API specification
[SWS_Icu_00276] ⌈
Module Header File Imported Type
EcuM EcuM.h EcuM_WakeupSourceType
Std_Types StandardTypes.h Std_ReturnType
StandardTypes.h Std_VersionInfoType
⌋ ()
8.2.1 Icu_ModeType
[SWS_Icu_00277] ⌈
Name: Icu_ModeType
Type: Enumeration
Range: ICU_MODE_NORMAL -- Normal operation, all used interrupts are enabled according
to the notification requests.
ICU_MODE_SLEEP -- Reduced power operation. In sleep mode only those
notifications are available which are configured as wakeup
capable.
Description: Allow enabling / disabling of all interrupts which are not required for the ECU
wakeup.
Available via: Icu.h
⌋ ()
8.2.2 Icu_ChannelType
[SWS_Icu_00278] ⌈
Name: Icu_ChannelType
Type: uint
Range: -- -- This is implementation specific but not all values may be
valid within the type.
This type shall be chosen in order to have the most
efficient implementation on a specific microcontroller
platform.
Description: Numeric identifier of an ICU channel
Available via: Icu.h
⌋ ()
8.2.3 Icu_InputStateType
[SWS_Icu_00279] ⌈
Name: Icu_InputStateType
Type: Enumeration
Range: ICU_ACTIVE -- An activation edge has been detected
ICU_IDLE -- No activation edge has been detected since the last call of
Icu_GetInputState() or Icu_Init().
Description: Input state of an ICU channel
Available via: Icu.h
⌋ ()
8.2.4 Icu_ConfigType
[SWS_Icu_00280] ⌈
Name: Icu_ConfigType
Type: Structure
Range: -- Hardware and implementation dependent structure.
The contents of the initialization data structure are
microcontroller specific.
Description: This type contains initialization data.
Available via: Icu.h
⌋ ()
Specific parameters
⌋ (SRS_Icu_12368, SRS_Icu_12425, SRS_Icu_12455, SRS_Icu_12456)
[SWS_Icu_00283] ⌈If the measurement mode for each Channel within the
Icu_ConfigType is configured as “signal edge detection” the notification function
for signal notification shall be configurable.⌋ ()
[SWS_Icu_00284] ⌈If the measurement mode for each Channel within the
Icu_ConfigType is configured as “signal measurement”, the property that could be
measured shall be configurable. The values shall be as specified in
SWS_Icu_00295.⌋ ()
[SWS_Icu_00285] ⌈If the measurement mode for each Channel within the
Icu_ConfigType is configured as “timestamp measurement”, buffer handling shall
be configurable. The values shall be as specified in SWS_Icu_00296.⌋ ()
[SWS_Icu_00378] ⌈If the measurement mode for each Channel within the
Icu_ConfigType is configured as “timestamp measurement”, the notification
function for notifying the number of requested timestamps shall be configurable. ⌋ ()
[SWS_Icu_00286] ⌈If the measurement mode for each Channel within the
Icu_ConfigType is configured as “edge counter”, the counting mode (activation
edge) shall be configurable. The values shall be as specified in SWS_Icu_00289.⌋ ()
[SWS_Icu_00287] ⌈If in the definition for each Channel within the Icu_ConfigType
the channel is configured as wakeup capable then the callout function for validation
of wakeup reason shall be EcuM_CheckWakeup.⌋ ()
8.2.5 Icu_ActivationType
[SWS_Icu_00289] ⌈
Name: Icu_ActivationType
Type: Enumeration
Range: ICU_RISING_EDGE -- An appropriate action shall be executed when a rising edge
occurs on the ICU input signal.
ICU_FALLING_EDGE -- An appropriate action shall be executed when a falling
edge occurs on the ICU input signal.
ICU_BOTH_EDGES -- An appropriate action shall be executed when either a
rising or falling edge occur on the ICU input signal.
Description: Definition of the type of activation of an ICU channel.
Available via: Icu.h
⌋ ()
8.2.6 Icu_ValueType
[SWS_Icu_00290] ⌈
Name: Icu_ValueType
Type: uint
Range: 0 ... <width of -- Implementation specific. This type shall be chosen in order
the timer to have the most efficient implementation on a specific
register> microcontroller platform.
Description: Width of the buffer for timestamp ticks and measured elapsed timeticks.
Available via: Icu.h
⌋ ()
8.2.7 Icu_DutyCycleType
[SWS_Icu_00291] ⌈
Name: Icu_DutyCycleType
Type: Structure
Element: Icu_ValueType ActiveTime This shall be the coherent active-time
measured on a channel
Icu_ValueType PeriodTime This shall be the coherent period-time
measured on a channel
Description: Type which shall contain the values, needed for calculating duty cycles.
Available via: Icu.h
⌋ ()
8.2.8 Icu_IndexType
[SWS_Icu_00292] ⌈
Name: Icu_IndexType
Type: uint
Range: -- -- Implementation specific. This type shall be chosen in
order to have the most efficient implementation on a
specific microcontroller platform.
Description: Type, to abstract the return value of the service Icu_GetTimestampIndex().Since
circular buffer handling is supported and Icu_GetTimestampIndex can return '0' as
a legally true value ( not as an error according to ICU107 and ICU135),
Icu_IndexType may be implemented to have values 1..xyz.
Available via: Icu.h
⌋ ()
8.2.9 Icu_EdgeNumberType
[SWS_Icu_00293] ⌈
Name: Icu_EdgeNumberType
Type: uint
Range: -- -- Implementation specific. This type shall be chosen in order
to have the most efficient implementation on a specific
microcontroller platform.
Description: Type, to abstract the return value of the service Icu_GetEdgeNumbers().
Available via: Icu.h
⌋ ()
8.2.10 Icu_MeasurementModeType
[SWS_Icu_00294] ⌈
33 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
Name: Icu_MeasurementModeType
Type: Enumeration
Range: ICU_MODE_SIGNAL_EDGE_DETECT -- Mode for detecting edges
ICU_MODE_SIGNAL_MEASUREMENT -- Mode for measuring different times between
various configurable edges
ICU_MODE_TIMESTAMP -- Mode for capturing timer values on
configurable edges
ICU_MODE_EDGE_COUNTER -- Mode for counting edges on configurable
edges
Description: Definition of the measurement mode type
Available via: Icu.h
⌋ ()
8.2.11 Icu_SignalMeasurementPropertyType
[SWS_Icu_00295] ⌈
Name: Icu_SignalMeasurementPropertyType
Type: Enumeration
Range: ICU_LOW_TIME -- The channel is configured for reading the elapsed Signal
Low Time
ICU_HIGH_TIME -- The channel is configured for reading the elapsed Signal
High Time
ICU_PERIOD_TIME -- The channel is configured for reading the elapsed Signal
Period Time
ICU_DUTY_CYCLE -- The channel is configured to read values which are needed
for calculating the duty cycle (coherent Active and Period
Time).
Description: Definition of the measurement property type
Available via: Icu.h
⌋ ()
8.2.12 Icu_TimestampBufferType
[SWS_Icu_00296] ⌈
Name: Icu_TimestampBufferType
Type: Enumeration
Range: ICU_LINEAR_BUFFER -- The buffer will just be filled once
ICU_CIRCULAR_BUFFER -- After reaching the end of the buffer, the driver restarts at
the beginning of the buffer
Description: Definition of the timestamp measurement property type
Available via: Icu.h
⌋ ()
8.3 Function definitions
This is a list of functions provided for upper layer modules.
8.3.1 Icu_Init
[SWS_Icu_00191] ⌈
34 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
[SWS_Icu_00006] ⌈The function Icu_Init shall initialize all relevant registers of the
configured hardware with the values of the structure referenced by the parameter
ConfigPtr. ⌋ (SRS_BSW_00344, SRS_BSW_00404, SRS_BSW_00405,
SRS_BSW_00101, SRS_SPAL_12057, SRS_SPAL_12461)
The following rules regarding initialization of controller registers shall apply to this
driver implementation:
[SWS_Icu_00051] ⌈If the hardware allows for only one usage of the register, the
driver module implementing that functionality is responsible for initializing the
register.⌋ (SRS_SPAL_12461)
[SWS_Icu_00052] ⌈If the register can affect several hardware modules and if it is
an I/O register it shall be initialized by the PORT driver.⌋ (SRS_SPAL_12461)
[SWS_Icu_00053] ⌈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.⌋ (SRS_SPAL_12461)
[SWS_Icu_00040] ⌈The function Icu_Init shall set all used ICU channels to status
ICU_IDLE.⌋ (SRS_SPAL_12057, SRS_Icu_12407)
[SWS_Icu_00054] ⌈The function Icu_Init shall only set the resources that are
configured in the configuration file (including clearing of pending interrupt flags).
The Icu module’s environment shall not call Icu_Init during a running operation (e.
g. timestamp measurement or edge counting).⌋ (SRS_SPAL_12125)
[SWS_Icu_00220] ⌈If development error detection for the ICU module is enabled
and the function Icu_Init is called when the ICU driver and hardware are already
initialized, the function Icu_Init shall raise development error
ICU_E_ALREADY_INITIALIZED and return without any action.⌋ ()
Note: Parameter checking for the initialization function is specified within BSW
General.
8.3.2 Icu_DeInit
[SWS_Icu_00193] ⌈
Service name: Icu_DeInit
Syntax: void Icu_DeInit(
void
)
Service ID[hex]: 0x01
Sync/Async: Synchronous
Reentrancy: Non Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function de-initializes the ICU module.
Available via: Icu.h
⌋ ()
[SWS_Icu_00036] ⌈The function Icu_DeInit shall set the state of the peripherals
used by configuration as the same after power on reset.⌋ (SRS_SPAL_12163,
SRS_Icu_12429)
[SWS_Icu_00300] ⌈Values of registers which are not writeable are excluded from
setting the state by the function Icu_DeInit.⌋ ()
[SWS_Icu_00037] ⌈The function Icu_DeInit shall disable all used interrupts and
notifications.⌋ (SRS_BSW_00336, SRS_SPAL_12163)
[SWS_Icu_00152] ⌈The Icu module’s environment shall not call Icu_DeInit during
a running operation (e. g. timestamp measurement or edge counting)⌋ ()
8.3.3 Icu_SetMode
[SWS_Icu_00194] ⌈
Service name: Icu_SetMode
Syntax: void Icu_SetMode(
Icu_ModeType Mode
)
Service ID[hex]: 0x02
Sync/Async: Synchronous
37 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
This function influences the functionality of the ICU channels. Therefore the mode
switching of the module shall be compatible to the overall state of the ECU.⌋ ()
[SWS_Icu_00125] ⌈If development error detection is enabled for the module Icu the
function Icu_SetMode shall check the parameter Mode and shall raise the error
ICU_E_PARAM_MODE if the parameter Mode is not within the allowed range set in
the configuration.⌋ (SRS_BSW_00323)
8.3.4 Icu_DisableWakeup
[SWS_Icu_00195] ⌈
Service name: Icu_DisableWakeup
Syntax: void Icu_DisableWakeup(
Icu_ChannelType Channel
)
Service ID[hex]: 0x03
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function disables the wakeup capability of a single ICU channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00013] ⌈The function Icu_DisableWakeup shall disable the wakeup
capability of a single ICU channel.⌋ (SRS_Icu_12408)
The settings done by this function are only relevant after the ICU_MODE_SLEEP is
set.⌋ ()
8.3.5 Icu_EnableWakeup
[SWS_Icu_00196] ⌈
Service name: Icu_EnableWakeup
Syntax: void Icu_EnableWakeup(
Icu_ChannelType Channel
)
Service ID[hex]: 0x04
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function (re-)enables the wakeup capability of the given ICU channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00307] ⌈The function Icu_EnableWakeup shall be re-entrant.⌋ ()
To make the selection effective a call of the function Icu_SetMode, requesting the
mode ICU_MODE_SLEEP is required.⌋ (SRS_Icu_12408)
8.3.6 Icu_CheckWakeup
[SWS_Icu_00358] ⌈
Service name: Icu_CheckWakeup
Syntax: void Icu_CheckWakeup(
EcuM_WakeupSourceType WakeupSource
)
Service ID[hex]: 0x15
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
WakeupSource Informatin on wakeup source to be checked.
Parameters (in): The associated ICU channel can be determined from
configuration data.
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: Checks if a wakeup capable ICU channel is the source for a wakeup event and
calls the ECU state manager service EcuM_SetWakeupEvent in case of a valid
ICU channel wakeup event.
Available via: Icu.h
⌋ ()
[SWS_Icu_00359] ⌈The function Icu_CheckWakeup shall check if a wakeup
capable ICU channel is the source for a wakeup event and call
EcuM_SetWakeupEvent to indicate a valid timer wakeup event to the ECU State
Manager.⌋ ()
[SWS_Icu_00361] ⌈The ICU module’s environment shall only use the re-entrant
capability of the function Icu_CheckWakeup if the ICU module’s environment takes
care that there is no simultaneous usage of the same channel.⌋ ()
[SWS_Icu_00363] ⌈If development error detection for the ICU module is enabled: if the
function Icu_CheckWakeup is called before the ICU module was initialized, the
function Icu_CheckWakeup shall raise the development error ICU_E_UNINIT⌋ ()
8.3.7 Icu_SetActivationCondition
[SWS_Icu_00197] ⌈
Service name: Icu_SetActivationCondition
Syntax: void Icu_SetActivationCondition(
Icu_ChannelType Channel,
Icu_ActivationType Activation
)
Service ID[hex]: 0x05
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Channel Numeric identifier of the ICU channel
Activation Type of activation (if supported by hardware)
Parameters (in): - ICU_RISING_EDGE
- ICU_FALLING_EDGE
- ICU_BOTH_EDGES
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function sets the activation-edge for the given channel.
Available via: Icu.h
⌋ ()
8.3.8 Icu_DisableNotification
[SWS_Icu_00198] ⌈
Service name: Icu_DisableNotification
Syntax: void Icu_DisableNotification(
Icu_ChannelType Channel
)
Service ID[hex]: 0x06
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function disables the notification of a channel.
Available via: Icu.h
⌋ ()
8.3.9 Icu_EnableNotification
[SWS_Icu_00199] ⌈
Service name: Icu_EnableNotification
Syntax: void Icu_EnableNotification(
Icu_ChannelType Channel
)
Service ID[hex]: 0x07
Sync/Async: Synchronous
43 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
8.3.10 Icu_GetInputState
[SWS_Icu_00200] ⌈
Service name: Icu_GetInputState
Syntax: Icu_InputStateType Icu_GetInputState(
Icu_ChannelType Channel
)
Service ID[hex]: 0x08
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Icu_InputStateType ICU_ACTIVE: An activation edge has been detected
Return value: ICU_IDLE: No activation edge has been detected since the
last call of Icu_GetInputState() or Icu_Init().
Description: This function returns the status of the ICU input.
Available via: Icu.h
⌋ ()
[SWS_Icu_00313] ⌈Icu_GetInputState shall return Icu_InputStateType
which will have value ICU_IDLE when no activation edge has been detected since
the last call of Icu_GetInputState() or Icu_Init().⌋ ()
8.3.11 Icu_StartTimestamp
[SWS_Icu_00201] ⌈
Service name: Icu_StartTimestamp
45 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
[SWS_Icu_00064] ⌈If circular buffer handling is configured (for the given channel),
when the capture functionality reaches the end of the buffer, the Icu module shall
start at the beginning of the buffer.⌋ ()
[SWS_Icu_00318] ⌈The Icu module shall only call a notification function if the
notification has been enabled by the call of Icu_EnableNotification().⌋ ()
[SWS_Icu_00320] ⌈The Icu module shall only call a notification function if the
number of events specified by NotifyInterval has been captured. ⌋ ()
8.3.12 Icu_StopTimestamp
[SWS_Icu_00202] ⌈
Service name: Icu_StopTimestamp
Syntax: void Icu_StopTimestamp(
Icu_ChannelType Channel
)
Service ID[hex]: 0x0a
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function stops the timestamp measurement of the given channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00067] ⌈The function Icu_StopTimestamp shall stop the timestamp
measurement of the given channel.⌋ (SRS_Icu_12431)
8.3.13 Icu_GetTimestampIndex
[SWS_Icu_00203] ⌈
Service name: Icu_GetTimestampIndex
Syntax: Icu_IndexType Icu_GetTimestampIndex(
Icu_ChannelType Channel
)
Service ID[hex]: 0x0b
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: Icu_IndexType Abstract return type to cover different microcontrollers.
Description: This function reads the timestamp index of the given channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00071] ⌈The function Icu_GetTimestampIndex shall read the
timestamp index of the given channel, which is the next to be written.⌋
(SRS_Icu_12453)
8.3.14 Icu_ResetEdgeCount
[SWS_Icu_00204] ⌈
Service name: Icu_ResetEdgeCount
Syntax: void Icu_ResetEdgeCount(
Icu_ChannelType Channel
)
Service ID[hex]: 0x0c
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function resets the value of the counted edges to zero.
Available via: Icu.h
⌋ ()
[SWS_Icu_00072] ⌈The function Icu_ResetEdgeCount shall reset the value of the
counted edges to zero.⌋ (SRS_Icu_12439, SRS_Icu_13100)
8.3.15 Icu_EnableEdgeCount
[SWS_Icu_00205] ⌈
Service name: Icu_EnableEdgeCount
Syntax: void Icu_EnableEdgeCount(
Icu_ChannelType Channel
)
Service ID[hex]: 0x0d
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function enables the counting of edges of the given channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00078] ⌈The function Icu_EnableEdgeCount shall enable the counting
of edges of the given channel.⌋ (SRS_Icu_12432)
8.3.16 Icu_EnableEdgeDetection
[SWS_Icu_00364] ⌈
Service name: Icu_EnableEdgeDetection
Syntax: void Icu_EnableEdgeDetection(
Icu_ChannelType Channel
)
Service ID[hex]: 0x16
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function enables / re-enables the detection of edges of the given channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00365] ⌈The function Icu_EnableEdgeDetection shall enable the
detection of edges for the given channel.⌋ ()
1
Configured edge after the call of Icu_Init() (default-edge) or Icu_SetActivationCondition().
52 of 108 Document ID 023: AUTOSAR_SWS_ICUDriver
- AUTOSAR confidential -
Specification of ICU Driver
AUTOSAR CP Release 4.4.0
8.3.17 Icu_DisableEdgeDetection
[SWS_Icu_00377] ⌈
Service name: Icu_DisableEdgeDetection
Syntax: void Icu_DisableEdgeDetection(
Icu_ChannelType Channel
)
Service ID[hex]: 0x17
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function disables the detection of edges of the given channel.
Available via: Icu.h
⌋ ()
8.3.18 Icu_DisableEdgeCount
[SWS_Icu_00206] ⌈
Service name: Icu_DisableEdgeCount
Syntax: void Icu_DisableEdgeCount(
Icu_ChannelType Channel
)
Service ID[hex]: 0x0e
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function disables the counting of edges of the given channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00079] ⌈The function Icu_DisableEdgeCount shall disable the
counting of edges of the given channel.⌋ (SRS_Icu_12433)
8.3.19 Icu_GetEdgeNumbers
[SWS_Icu_00207] ⌈
Service name: Icu_GetEdgeNumbers
Syntax: Icu_EdgeNumberType Icu_GetEdgeNumbers(
Icu_ChannelType Channel
)
Service ID[hex]: 0x0f
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: Icu_EdgeNumberType Abstract return type to cover different microcontrollers.
Description: This function reads the number of counted edges.
Available via: Icu.h
⌋ ()
[SWS_Icu_00080] ⌈The function Icu_GetEdgeNumbers shall read the number of
counted edges after the last call of Icu_ResetEdgeCount().⌋ (SRS_Icu_12434)
8.3.20 Icu_StartSignalMeasurement
[SWS_Icu_00208] ⌈
Service name: Icu_StartSignalMeasurement
Syntax: void Icu_StartSignalMeasurement(
Icu_ChannelType Channel
)
Service ID[hex]: 0x13
Sync/Async: Asynchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function starts the measurement of signals.
Available via: Icu.h
⌋ ()
[SWS_Icu_00334] ⌈The function Icu_StartSignalMeasurement shall be re-
entrant.⌋ ()
8.3.21 Icu_StopSignalMeasurement
[SWS_Icu_00209] ⌈
Service name: Icu_StopSignalMeasurement
Syntax: void Icu_StopSignalMeasurement(
Icu_ChannelType Channel
)
Service ID[hex]: 0x14
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function stops the measurement of signals of the given channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00336] ⌈The function Icu_StopSignalMeasurement shall be Re-
entrant.⌋ ()
8.3.22 Icu_GetTimeElapsed
[SWS_Icu_00210] ⌈
Service name: Icu_GetTimeElapsed
Syntax: Icu_ValueType Icu_GetTimeElapsed(
Icu_ChannelType Channel
)
Service ID[hex]: 0x10
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
Parameters (out): None
Return value: Icu_ValueType see Description
Description: This function reads the elapsed Signal Low Time for the given channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00338] ⌈The function Icu_GetTimeElapsed shall be re-entrant.⌋ ()
rising edge and the consecutive falling edge of the channel.⌋ (SRS_SPAL_12063,
SRS_Icu_12435)
Icu_Init(ConfigPtr)
return()
start
A
Icu_GetTimeElapsed(Channel
#1)
200 ticks
return(0)
B
Icu_GetTimeElapsed(Channel
#1)
D
return(0)
Icu_GetTimeElapsed(Channel
#1)
return(200)
Icu_GetTimeElapsed(Channel
#1)
return(0)
Icu_Init(ConfigPtr)
return()
start
A
Icu_GetTimeElapsed(Channel
#1)
200 ticks
return(0)
B
Icu_GetTimeElapsed(Channel
#1)
D
return(0)
Icu_GetTimeElapsed(Channel
#1)
return(200)
Icu_GetTimeElapsed(Channel
#1)
return(0)
again (see
EcuM ICU User ICU Driver
Icu_Init(ConfigPtr)
return()
start
A
Icu_GetTimeElapsed(Channel
#1)
200 ticks
return(0)
B
Icu_GetTimeElapsed(Channel
#1)
D
return(0)
Icu_GetTimeElapsed(Channel
#1)
return(200)
Icu_GetTimeElapsed(Channel
#1)
return(0)
8.3.23 Icu_GetDutyCycleValues
[SWS_Icu_00211] ⌈
Service name: Icu_GetDutyCycleValues
Syntax: void Icu_GetDutyCycleValues(
Icu_ChannelType Channel,
Icu_DutyCycleType* DutyCycleValues
)
Service ID[hex]: 0x11
Sync/Async: Synchronous
Reentrancy: Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel
Parameters None
(inout):
DutyCycleValues Pointer to a buffer where the results (high time and period time)
Parameters (out):
shall be placed.
Return value: None
Description: This function reads the coherent active time and period time for the given ICU
Channel.
Available via: Icu.h
⌋ ()
[SWS_Icu_00342] ⌈The function Icu_GetDutyCycleValues shall be re-entrant. ⌋
()
Icu_Init(ConfigPtr)
return()
start
A
Icu_GetTimeElapsed(Channel
#1)
200 ticks
return(0)
B
Icu_GetTimeElapsed(Channel
#1)
D
return(0)
Icu_GetTimeElapsed(Channel
#1)
return(200)
Icu_GetTimeElapsed(Channel
#1)
return(0)
the captured value shall be stored until a new value is captured) (similar to
EcuM ICU User ICU Driver
Icu_Init(ConfigPtr)
return()
start
A
Icu_GetTimeElapsed(Channel
#1)
200 ticks
return(0)
B
Icu_GetTimeElapsed(Channel
#1)
D
return(0)
Icu_GetTimeElapsed(Channel
#1)
return(200)
Icu_GetTimeElapsed(Channel
#1)
return(0)
Icu_Init(ConfigPtr)
return()
start
A
Icu_GetTimeElapsed(Channel
#1)
200 ticks
return(0)
B
Icu_GetTimeElapsed(Channel
#1)
D
return(0)
Icu_GetTimeElapsed(Channel
#1)
return(200)
Icu_GetTimeElapsed(Channel
#1)
return(0)
8.3.24 Icu_GetVersionInfo
[SWS_Icu_00212] ⌈
Service name: Icu_GetVersionInfo
Syntax: void Icu_GetVersionInfo(
Std_VersionInfoType* versioninfo
)
Service ID[hex]: 0x12
Sync/Async: Synchronous
Reentrancy: Reentrant
Parameters (in): None
Parameters None
(inout):
Parameters (out): versioninfo Pointer to where to store the version information of this module.
Return value: None
Description: This function returns the version information of this module.
Available via: Icu.h
⌋ ()
[SWS_Icu_00356] ⌈If development error detection for the Icu module is enabled: The
function Icu_GetVersionInfo shall check the parameter versioninfo for not
being NULL and shall raise the development error code ICU_E_PARAM_VINFO if the
check fails.⌋ ()
8.3.25 Icu_DisableNotificationAsync
[SWS_Icu_91002] ⌈
Service name: Icu_DisableNotificationAsync (draft)
Syntax: void Icu_DisableNotificationAsync(
Icu_ChannelType Channel
)
Service ID[hex]: 0x18
Sync/Async: Asynchronous
8.3.26 Icu_EnableNotificationAsync
[SWS_Icu_91003] ⌈
Service name: Icu_EnableNotificationAsync (draft)
Syntax: void Icu_EnableNotificationAsync(
Icu_ChannelType Channel
)
Service ID[hex]: 0x19
Sync/Async: Asynchronous
Reentrancy: Non Reentrant Reentrant (limited according to ICU050)
Parameters (in): Channel Numeric identifier of the ICU channel.
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This function enables the notification on the given channel.
Tags:
atp.Status=draft
Available via: Icu.h
⌋ ()
This chapter defines all interfaces, which are required, in order to fulfill the core
functionality of the module.
[SWS_Icu_91001] ⌈
API function Header Description
File
Det_ReportRuntimeError Det.h Service to report runtime errors. If a callout has been
configured then this callout shall be called.
⌋ ()
This chapter defines all interfaces which are required to fulfil an optional functionality
of the module.
[SWS_Icu_00213] ⌈
API function Header File Description
Det_ReportError Det.h Service to report development errors.
EcuM_CheckWakeup EcuM_Externals.h This callout is called by the EcuM to poll a wakeup
source. It shall also be called by the ISR of a wakeup
source to set up the PLL and check other wakeup
sources that may be connected to the same interrupt.
EcuM_SetWakeupEvent EcuM.h Sets the wakeup event.
⌋ ()
The service EcuM_CheckWakeup will be called if all of the following are true:
[SWS_Icu_00055] ⌈The static configuration parameter
IcuReportWakeupSource is set to “ON” ⌋ (SRS_SPAL_12069,
SRS_BSW_00410)
[SWS_Icu_00056] ⌈The module is in mode ICU_MODE_SLEEP⌋
(SRS_SPAL_12069)
[SWS_Icu_00057] ⌈A wakeup event occurs on a wakeup capable ICU channel.⌋
(SRS_SPAL_12069)
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 kinds of
interfaces are not fixed because they are configurable.
[SWS_Icu_00119] ⌈The ISRs shall reset the interrupt flags (if needed by hardware)
and call the corresponding notification functions.⌋ (SRS_SPAL_12129)
[SWS_Icu_00214] ⌈
Service name: Icu_SignalNotification_<Channel>
Syntax: void Icu_SignalNotification_<Channel>(
void
)
Sync/Async: Synchronous
Reentrancy: Reentrancy of interface not relevant for this module. (in general it is in this case
not reentrant).
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: According to the last call of Icu_EnableNotification, this notification function to be
called if the requested signal edge (rising / falling / both edges) occurs (once per
edge).
Available via: Icu_Externals.h
⌋ ()
[SWS_Icu_00042] ⌈After a call of Icu_DisableNotification , the Icu module shall not call
the notification function Icu_SignalNotification_<Channel>.⌋ (SRS_Icu_12305)
[SWS_Icu_00215] ⌈
Service name: Icu_TimestampNotification_<Channel>
Syntax: void Icu_TimestampNotification_<Channel>(
void
)
Sync/Async: Synchronous
Reentrancy: Reentrancy of interface not relevant for this module. (in general it is in this case
not reentrant).
Parameters (in): None
Parameters None
(inout):
Parameters (out): None
Return value: None
Description: This notification to be called if the number of requested timestamps (Notification
interval > 0) are acquired and if the notification has been enabled by the call of
Icu_EnableNotification().
Available via: Icu_Externals.h
⌋ (SRS_Icu_12444)
9 Sequence diagrams
9.1 Icu_Init
Icu_Int(ConfigPtr)
return()
9.2 Icu_DeInit
Icu_DeInit()
return()
9.4 Icu_SetMode
EcuM Icu User (e.g. SW-C) Icu Driver
Icu_Init(ConfigPtr)
return()
Icu_SetActivationCondition(Channel #1,
ICU_FALLING_EDGE)
Icu_SetActivationCondition(Channel #2,
ICU_RISING_EDGE)
Icu_EnableNotification(Channel
#1)
Icu_EnableNotification(Channel
#2)
Icu_SignalNotification_Channel1
Falling edge notification
(void)
Channel #1
Icu_SignalNotification_Channel2
Rising edge notification (void)
Channel #2
Icu_SetMode(ICU_MODE_SLEEP)
Channel #1
Icu_Cbk_CheckWakeup(Channel #2)
EcuM_SetWakeupEvent(Channel #2)
EcuM_SetWakeupEvent(Channel #2)
Icu_Cbk_CheckWakeup(Channel #2)
EcuM_CheckWakeup(Channel #2)
Icu_SetMode(Mode:= ICU_MODE_NORMAL)
Icu_SetMode()
Icu_Init(ConfigPtr)
Icu_SetActivationCondition(Channel #1,
ICU_FALLING_EDGE)
Icu_SetActivationCondition(Channel #2,
ICU_RISING_EDGE)
Icu_EnableNotification(Channel
#1)
Icu_EnableNotification(Channel
#2)
Icu_SignalNotification_Channel1
Falling edge notification
(void)
Channel #1
Icu_SignalNotification_Channel2
Rising edge notification
(void)
Channel #2
Icu_SetMode(ICU_MODE_SLEEP)
Icu_Init(ConfigPtr)
return()
Icu_SetActivationCondition(Channel #1,
ICU_FALLING_EDGE)
Icu_SetActivationCondition(Channel #2,
ICU_RISING_EDGE)
Icu_EnableNotification(Channel
#1)
Icu_EnableNotification(Channel
#2)
Icu_SignalNotification_Channel1
Falling edge notification (void)
Channel #1
Icu_SignalNotification_Channel2
Rising edge notification
(void)
Channel #2
Icu_DisableNotification(Channel
#2)
Icu_SetMode(ICU_MODE_SLEEP)
Channel #2
EcuM_CheckWakeup(Channel#2)
Valid wakeup event detected
Icu_Cbk_CheckWakeup(Channel#2)
EcuM_SetWakeupEvent(Channel#2)
EcuM_SetWakeupEvent(Channel#2)
Icu_Cbk_CheckWakeup(Channel#2)
EcuM_CheckWakeup(Channel#2)
Icu_Init(&configPtr)
return()
Icu_SetActivationCondition(Channel #2,
ICU_RISING_EDGE)
Icu_EnableNotification(Channel
#1)
Icu_EnableWakeup(Channel #2)
Icu_SignalNotification_Channel1
Falling edge notification
(void)
Channel #1
Channel #2 Icu_SetMode(ICU_MODE_SLEEP)
Channel #1
No notification for Channel #1 is called because of sleep mode.
Icu_Cbk_CheckWakeup(Channel#2)
EcuM_SetWakeupEvent(Channel#2)
EcuM_SetWakeupEvent(Channel#2)
Icu_Cbk_CheckWakeup(Channel#2)
EcuM_CheckWakeup(Channel#2)
No rising-edge-notification for Channel #2 is called because this notification was NOT enabled.
9.5 Icu_DisableWakeup
Icu_Init(ConfigPtr)
ICU driver is initialized:
a) Module operates in Mode ICU_MODE_NORMAL
b) Channel #1, wake up capable, default start edge = ICU_RISING_EDGE
c) Channel #2, wake up capable, default start edge = ICU_RISING_EDGE
d) Channel #1 notification in wake-up = disabled
e) Channel #2 notification in wake-up = disabled
f) ICU_NOTIFY_WAKEUP_REASON = ON return()
Icu_EnableWakeup(Channel #1)
Icu_EnableNotification(Channel
#1)
Icu_EnableNotification(Channel
#2)
Icu_DisableWakeup(Channel #1)
Request for disableing the wake-up capability of ICU
channel #1 is stored
Icu_SetMode(ICU_MODE_SLEEP)
Wakeup capability of ICU channel #1 will be disabled.
Channel #2
EcuM_CheckWakeup(WakeupSource)
Wake-up notification is called.
Icu_SignalNotification_Channel2
Rising edge notification (void)
9.6 Icu_EnableWakeup
Icu_Init(ConfigPtr)
return()
ICU driver is initialized: Icu input signal #1 and #2 are on low level.
a) Module operates in Mode ICU_MODE_NORMAL
b) Channel #1, wake up capable, default start edge = ICU_RISING_EDGE Icu_EnableNotification(Channel
c) Channel #2, wake up capable, default start edge = ICU_RISING_EDGE #1)
d) Channel #1 notification in wake-up = disabled
e) Channel #2 notification in wake-up = disabled
f) ICU_NOTIFY_WAKEUP_REASON = ON
Icu_EnableNotification(Channel
#2)
Icu_EnableWakeup(Channel #2)
Request for enabling the wake-up capability of ICU
channel #2 is stored
Icu_SetMode(ICU_MODE_SLEEP)
Wakeup capability of ICU channel #1 will be disabled.
Channel #2 EcuM_CheckWakeup(WakeupSource)
Wake-up notification is called.
Icu_SignalNotification_Channel2
Rising edge notification
(void)
Icu_EnableWakeup(Channel #1)
Re-enable the wake-up capability of Channel #1.
Icu_SetMode(ICU_MODE_SLEEP)
Channel #1 EcuM_CheckWakeup(WakeupSource)
Wakeup notification is called.
Icu_SignalNotification_Channel1
Rising edge notification (void)
9.7 Icu_SetActivationCondition
Icu_Init(ConfigPtr)
return()
Icu_EnableNotification(Channel
ICU driver is initialized:
#1)
Channel #1, wake up capable,
default start edge = ICU_BOTH_EDGES
Channel #1
Icu_SignalNotification_Channel1
Rising edge notification (void)
Icu_SignalNotification_Channel1
Falling edge notification (void)
Icu_SetActivationCondition(Channel #1,
ICU_FALLING_EDGE)
Channel #1
Icu_SignalNotification_Channel1
Falling edge notification
(void)
Icu_SetActivationCondition(Channel #1,
ICU_RISING_EDGE)
Channel #1
Icu_SignalNotification_Channel1
Rising edge notification ()
9.8 Icu_DisableNotification
Icu_Init(ConfigPtr)
return()
Icu_EnableNotification(Channel #1)
Channel #1
Icu_SignalNotification_Channel1()
Falling Edge Notification
Channel #1
Icu_SignalNotification_Channel1()
Rising Edge Notification
Icu_DisableNotification(Channel #1)
Disables all notifications
for this channel
Channel #1
No Notifications are called.
9.9 Icu_EnableNotification
EcuM ICU User ICU Driver
Used HW is configured according to
referenced configuration structure.
All notifications are disabled.
Icu_Init(ConfigPtr)
return()
Icu_SetActivationCondition(Channel,
ICU_BOTH_EDGES)
Icu_EnableNotification
(Channel)
Icu_SignalNotification_<Channel>
Falling Edge Notification
(void)
Icu_SignalNotification_<Channel>
Rising Edge Notification (void)
Icu_SetActivationCondition(Channel,
ICU_RISING_EDGE)
Icu_SignalNotification_<Channel>
Rising Edge Notification
(void)
Icu_SetActivationCondition(Channel,
ICU_FALLING_EDGE)
Icu_SignalNotification_<Channel>
Falling Edge notification (void)
Icu_Init(ConfigPtr)
return()
Icu_SetActivationCondition(Channel,
ICU_BOTH_EDGES)
Used HW is configured according to
referenced configuration structure.
All notifications are disabled.
Icu_EnableNotification
(Channel)
Icu_SignalNotification_<Channel>
Falling Edge Notification
(void)
Icu_SignalNotification_<Channel>
Rising Edge Notification (void)
Icu_DisableNotification
(Channel)
Icu_EnableNotification
Re-enabling of the edge- (Channel)
notification....
Icu_SignalNotification_<Channel>
Falling Edge notification (void)
Icu_SignalNotification_<Channel>
Rising Edge Notification
(void)
9.10 Icu_GetInputState
Icu_Init(ConfigPtr)
return()
Icu_SetActivationCondition(Channel,
ICU_FALLING_EDGE)
Icu_EnableNotification
(Channel)
Icu_GetInputState(Channel)
return(ICU_ACTIVE)
Icu_GetInputState(Channel)
return(ICU_IDLE)
Icu_Init(ConfigPtr)
return()
Channel #1
Interrupt()
capture value()
ISR
Channel #1
Interrupt()
capture value()
ISR
Interrupt()
capture value()
ISR
Icu_StopTimestamp(Channel #1)
Channel #1
Icu_GetTimestampIndex(Channel #1)
return(3)
0 xF F F F
T im e s ta m p
T im e r
0
t
H ig h
In p u t
S ig n a l
Low
t
In p u t S ig n a l T im e sta m p
L e ve l T im e r
H ig h 5461
Low 10922
H ig h 22937
Low 32767
H ig h 43690
Low 49151
H ig h 58981
Low 6553
Icu_Init(ConfigPtr)
return()
Icu_EnableEdgeCount(Channel #1)
Channel #1
Interrupt()
count edge()
ISR
Channel #1
Interrupt()
count edge()
ISR
Interrupt()
count edge()
ISR
Icu_DisableEdgeCount(Channel #1)
Channel #1
Icu_GetEdgeNumbers(Channel #1)
return(3)
Icu_GetEdgeNumbers(Channel #1)
return (3)
Counter hasn't
been reseted.
Icu_ResetEdgeCount(Channel #1)
Icu_GetEdgeNumbers(Channel #1)
return(0)
9.13 Icu_GetTimeElapsed
Icu_Init(ConfigPtr)
return()
Channel #1
1 5 0 tic k s
Icu_GetTimeElapsed(Channel #1)
Read the elapsed low time
return(150)
Icu_GetTimeElapsed(Channel #1)
Read again the elapsed low time
return(0)
Returns "0" because
a) the signal is still low-level and
b) there was no following rising
edge detected
Icu_Init(ConfigPtr)
return()
Channel #1
1 0 0 tic k s
Icu_GetTimeElapsed(Channel #1)
Read the period time,
started with a falling edge
return(100)
Channel #1
210 ticks
Icu_GetTimeElapsed(Channel #1)
Read the period time,
started with a falling edge
return(210)
The following example shows the exemplary behaviour before, while and after
capturing the “high time” of a signal.
Icu_Init(ConfigPtr)
return()
start
A
Icu_GetTimeElapsed(Channel
#1)
200 ticks
return(0)
B
Icu_GetTimeElapsed(Channel
#1)
D
return(0)
Icu_GetTimeElapsed(Channel
#1)
return(200)
Icu_GetTimeElapsed(Channel
#1)
return(0)
9.14 Icu_GetDutyCycleValues
EcuM DCValueBuffer ICU User ICU Driver
Icu_Init(ConfigPtr)
Icu_Init(ConfigPtr)
Channel #1
40
1 1 0 tic k s
Icu_GetDutyCycleValues(Channel #1,
DCValueBuffer_p)
Read the values needed
for duty cycle calculation
to an application buffer.
write to buffer(ActiveTime =
40, PeriodTime = 110)
Channel #1
60
110 ticks
Icu_GetDutyCycleValues(Channel #1,
DCValueBuffer_p)
Read the values needed
for duty cycle calculation
write to buffer(ActiveTime =
to an application buffer.
50, PeriodTime = 110)
Figure 9.20: Measure the values needed for calculation of duty cycles
Icu_Init(ConfigPtr)
Icu_Init()
Icu_SetActivationCondition(Channel,
Activation)
Icu_SignalNotification_<Channel>
()
Icu_EnableNotification
(Channel)
Icu input signal turns to low level
Icu_EnableNotification()
Channel #1
Interrupt()
ISR
Set Flag()
11
Icu_SignalNotification_<Channel>
()
Icu_SignalNotification_Channel1
()
Icu_GetInputState(return, Channel)
check and
reset Flag()
00
Icu_GetInputState=ICU_ACTIVE()
Icu_GetInputState(return, Channel)
Check and
(reset) Flag
00
Icu_GetInputState=ICU_IDLE()
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.
10.2.1 Icu
Included Containers
Container Name Multiplicity Scope / Dependency
This container contains the configuration parameters and sub
IcuConfigSet 1
containers of the AUTOSAR Icu module.
IcuGeneral 1 Configuration of general ICU parameters.
This container contains all configuration switches for
IcuOptionalApis 1
configuring optional API services of the ICU driver.
+container IcuOptionalApis:
EcucParamConfContainerDef
10.2.2 IcuGeneral
No Included Containers
+parameter IcuReportWakeupSource:
EcucBooleanParamDef
IcuEcucPartitionRef: EcucPartition:
+reference EcucReferenceDef +destination EcucParamConfContainerDef
lowerMultiplicity = 0 lowerMultiplicity = 0
upperMultiplicity = * upperMultiplicity = *
IcuKernelEcucPartitionRef:
+reference +destination
EcucReferenceDef
lowerMultiplicity = 0
upperMultiplicity = 1
10.2.3 IcuOptionalApis
Post-build time --
Scope / Dependency scope: local
Link time --
Post-build time --
Scope / Dependency scope: local
dependency: If IcuSignalMeasurementApi==false this switch shall also be
set to false.
No Included Containers
Icu: EcucModuleDef
upperMultiplicity = 1
lowerMultiplicity = 0
+container
IcuGetInputStateApi: +parameter +parameter IcuDeInitApi:
EcucBooleanParamDef IcuOptionalApis:
EcucBooleanParamDef
EcucParamConfContainerDef
IcuSignalMeasurementApi: +parameter
+parameter IcuSetModeApi:
EcucBooleanParamDef
EcucBooleanParamDef
IcuGetTimeElapsedApi: +parameter
+parameter IcuDisableWakeupApi:
EcucBooleanParamDef
EcucBooleanParamDef
IcuGetDutyCycleValuesApi: +parameter
+parameter IcuEnableWakeupApi:
EcucBooleanParamDef
EcucBooleanParamDef
+parameter
IcuEdgeDetectApi:
EcucBooleanParamDef
10.2.4 IcuChannel
mode:
- Icu_GetTimeElapsed()
- Icu_GetDutyCycleValues()
- Icu_GetInputState()
This mode can only be configured if at
least one of the following switches are
set to "true":
- IcuGetDutyCycleValuesApi
- IcuGetTimeElapsedApi
ICU_MODE_TIMESTAMP The channel is used to capture timer
values on the edges which are
configured by the call of the service
Icu_SetActivationCondition().
The following API services support this
mode:
- Icu_StartTimestamp()
- Icu_StopTimestamp()
- Icu_GetTimestampIndex()
This mode can only be configured if
IcuTimeStampApi is switched on.
Post-Build
true
Variant Value
Value Pre-compile time X VARIANT-PRE-COMPILE
Configuration Link time --
Class Post-build time X VARIANT-POST-BUILD
Scope / scope: local
Dependency dependency: The possible measurement modes are depending on the pre-processor
switches, which enable/disable optional API services.
Included Containers
Container Name Multiplicity Scope / Dependency
This container contains the configuration (parameters) in case
IcuSignalEdgeDetection 0..1
the measurement mode is "IcuSignalEdgeDetection"
This container contains the configuration (parameters) in case
IcuSignalMeasurement 0..1
the measurement mode is "IcuSignalMeasurement"
This container contains the configuration (parameters) in case
IcuTimestampMeasurement 0..1
the measurement mode is "IcuTimestamp"
This container contains the configuration (parameters) needed
IcuWakeup 0..1
to configure a wakeup capable channel
+subContainer
IcuChannelId:
IcuChannel: EcucIntegerParamDef
EcucParamConfContainerDef +parameter
IcuSignalEdgeDetection: min = 0
EcucParamConfContainerDef +subContainer upperMultiplicity = * max = 65535
lowerMultiplicity = 1 symbolicNameValue = true
upperMultiplicity = 1
lowerMultiplicity = 0
+parameter
IcuWakeupCapability:
EcucBooleanParamDef
IcuSignalMeasurement:
EcucParamConfContainerDef +subContainer
IcuDefaultStartEdge: +literal
upperMultiplicity = 1 ICU_RISING_EDGE:
lowerMultiplicity = 0 EcucEnumerationParamDef
EcucEnumerationLiteralDef
+literal
IcuTimestampMeasurement: ICU_FALLING_EDGE:
EcucParamConfContainerDef +subContainer
EcucEnumerationLiteralDef
upperMultiplicity = 1
lowerMultiplicity = 0
+parameter +literal
ICU_BOTH_EDGES:
EcucEnumerationLiteralDef
IcuWakeup:
EcucParamConfContainerDef +subContainer
upperMultiplicity = 1
IcuMeasurementMode: +literal
lowerMultiplicity = 0 ICU_MODE_SIGNAL_EDGE_DETECT:
EcucEnumerationParamDef
EcucEnumerationLiteralDef
+literal
IcuChannelEcucPartitionRef: ICU_MODE_SIGNAL_MEASUREMENT:
EcucReferenceDef +reference
+parameter EcucEnumerationLiteralDef
lowerMultiplicity = 0
upperMultiplicity = * +literal
ICU_MODE_TIMESTAMP:
EcucEnumerationLiteralDef
+destination
EcucPartition: +literal
ICU_MODE_EDGE_COUNTER:
EcucParamConfContainerDef
EcucEnumerationLiteralDef
lowerMultiplicity = 0
upperMultiplicity = *
10.2.5 IcuSignalEdgeDetection
No Included Containers
10.2.6 IcuSignalMeasurement
No Included Containers
10.2.7 IcuTimestampMeasurement
regularExpression --
Post-Build Variant
true
Multiplicity
Post-Build Variant Value true
Multiplicity ConfigurationPre-compile time X VARIANT-PRE-COMPILE
Class Link time --
Post-build time X VARIANT-POST-BUILD
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time --
Post-build time X VARIANT-POST-BUILD
Scope / Dependency scope: local
dependency: IcuTimestampApi
No Included Containers
10.2.8 IcuWakeup
No Included Containers
10.2.9 IcuConfigSet
Included Containers
Container Name Multiplicity Scope / Dependency
IcuChannel 1..* Configuration of an individual ICU channel.
[SWS_Icu_00131] ⌈The ICU driver shall describe which other modules (in which
versions) are required. This description shall be done by the implementer.⌋
(SRS_BSW_00384)