0% found this document useful (0 votes)
29 views63 pages

AUTOSAR CP SWS GPTDriver

This document specifies the General Purpose Timer (GPT) driver in AUTOSAR. The GPT driver provides timer functionalities to other AUTOSAR modules. The document has undergone many revisions to update requirements, incorporate new features, and make editorial changes. It is part of the AUTOSAR Classic Platform and the current release is R23-11.

Uploaded by

Chaos Xia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views63 pages

AUTOSAR CP SWS GPTDriver

This document specifies the General Purpose Timer (GPT) driver in AUTOSAR. The GPT driver provides timer functionalities to other AUTOSAR modules. The document has undergone many revisions to update requirements, incorporate new features, and make editorial changes. It is part of the AUTOSAR Classic Platform and the current release is R23-11.

Uploaded by

Chaos Xia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

Specification of GPT Driver

AUTOSAR CP R23-11

Document Title Specification of GPT Driver


Document Owner AUTOSAR
Document Responsibility AUTOSAR
Document Identification No 30

Document Status published


Part of AUTOSAR Standard Classic Platform
Part of Standard Release R23-11

Document Change History


Date Release Changed by Description
AUTOSAR
2023-11-23 R23-11 Release • No content changes
Management
AUTOSAR
• Rename [SWS_Gpt_00381] into
2022-11-25 R22-11 Release
[SWS_Gpt_NA_00381].
Management
AUTOSAR
• Update optional interfaces relative to
2021-11-25 R21-11 Release
EcuM.
Management
• Delete requirement [SWS_Gpt_00270].

AUTOSAR • Replace requirements defined for each


2020-11-30 R20-11 Release error by global requirement for each
Management error table defined in §7.4.

• Move chapter Error detection in §8.


AUTOSAR
2019-11-28 R19-11 Release • editorial changes
Management
AUTOSAR • Incorporation of concept MCAL
2018-10-31 4.4.0 Release Multicore Distribution (Draft).
Management • Header File Cleanup.
• Ensure consistency between default
AUTOSAR error tracer and development errors.
2017-12-08 4.3.1 Release • Add support of runtime errors and
Management change type of errors GPT_E_MODE
and GPT_E_BUSY.
5

1 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
• Variant chapter reworked.
AUTOSAR
• Remove redundant requirement
2016-11-30 4.3.0 Release
[SWS_Gpt_00342].
Management
• Remove any reference to Dem.
• Det renaming and extension
incorporation.
AUTOSAR
2015-07-31 4.2.2 Release • Debugging support marked as obsolete.
Management
• Remove duplicated requirements in
traceability.
• Init pointer check harmonized with
BSW_General, redundant
AUTOSAR [SWS_GPT_00294],
2014-10-31 4.2.1 Release [SWS_GPT_00340] items removed.
Management
• Added new error code
GPT_E_INIT_FAILED.
AUTOSAR
2013-10-31 4.1.2 Release • editorial changes
Management
• GPT Predef Timer functionality added

AUTOSAR • Gpt_GetTimeElapsed and


2013-03-15 4.1.1 Release Gpt_GetTimeRemaining are fully
Management reentrant now

• MemMap.h renamed to Gpt_MemMap.h


• Range added to [ECUC_Gpt_00331].

AUTOSAR • module short name replaced by module


2011-12-22 4.0.3 Release abbreviation.
Management
• Chapter 6 revised and chapter 13 added
due to new traceability mechanism.
• GPT208, GPT376 and GPT378
removed.

• Multiplicity changed in
AUTOSAR [ECUC_Gpt_00312] (chapter 10.2.6
2011-04-15 4.0.2 Release updated).
Management
• [SWS_Gpt_00256] rephrased.

• [SWS_Gpt_00256] changed according


to changed [SRS_BSW_00004].
5

2 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
• Revised completely, a lot of SWS items
deleted, replaced, changed and added.

• Gpt_Cbk_CheckWakeup renamed to
Gpt_CheckWakeup.

• Parameter names of API services


renamed.

AUTOSAR • Configuration parameters renamed,


2009-12-18 4.0.1 Release deleted and added.
Management
• Debugging Concept incorporated.

• ClockReferencePoint mechanism
incorporated.

• Traceability tables updated.

• Legal disclaimer revised.

• Chapter 10.3 revised.


AUTOSAR
2008-08-13 3.1.1 Release • legal disclaimer revised.
Management
• Introduction of consistent description of
wakeup concept (as evaluated in
Startup/ Wakeup Taskforce). This
includes modifications and extensions of
textual descriptions as well as the
modification of sequence charts related
to wakeup.
AUTOSAR
2007-12-21 3.0.1 Release • SWS Improvement: improvement of
Management wording, alignment of API description.

• Introduction of additional development


error in case of already initialized
module.

• Document meta information extended.

• Small layout adaptations made.


5

3 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
• Header file structure changed
significantly.

• Return values and development errors


for Gpt_GetTimeRemaining() and
Gpt_GetTimeElapsed() changed.

• Development error checking of ConfigPtr


in Gpt_Init() changed.
AUTOSAR
• Configuration container structure and
2007-01-24 2.1.15 Release
configuration parameters.
Management
• Interface Dem_ReportErrorEvent()
removed.

• Legal disclaimer revised.

• Release Notes added.

• Advice for users revised.

• Revision Information added.


• Document structure adapted to common
AUTOSAR Release 2.0 SWS Template.
2006-05-16 2.0 Release
• Added wake-up functionality.
Management
• For more details see chapter 11.
AUTOSAR
2005-05-31 1.0 Release • Initial release.
Management

4 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

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 intel-
lectual 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.

5 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Contents
1 Introduction and functional overview 8

2 Acronyms and Abbreviations 9

3 Related documentation 10
3.1 Input documents & related standards and norms . . . . . . . . . . . . . 10
3.2 Related specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4 Constraints and assumptions 11
4.1 Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3 Applicability to car domains . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 Dependencies to other modules 12

6 Requirements Tracing 13

7 Functional specification 16
7.1 GPT Predef Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.2 Version checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7.3 Error Classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7.3.1 Development Errors . . . . . . . . . . . . . . . . . . . . . . . . 21
7.3.2 Runtime Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.3.3 Transient Faults . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.3.4 Production Errors . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.3.5 Extended Production Errors . . . . . . . . . . . . . . . . . . . . 22
8 API specification 23
8.1 Imported types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.2 Type definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.2.1 Gpt_ConfigType . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.2.2 Gpt_ChannelType . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.2.3 Gpt_ValueType . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.2.4 Gpt_ModeType . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8.2.5 Gpt_PredefTimerType . . . . . . . . . . . . . . . . . . . . . . . 25
8.3 Function definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
8.3.1 Gpt_GetVersionInfo . . . . . . . . . . . . . . . . . . . . . . . . 25
8.3.2 Gpt_Init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
8.3.3 Gpt_DeInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.3.4 Gpt_GetTimeElapsed . . . . . . . . . . . . . . . . . . . . . . . 28
8.3.5 Gpt_GetTimeRemaining . . . . . . . . . . . . . . . . . . . . . 29
8.3.6 Gpt_StartTimer . . . . . . . . . . . . . . . . . . . . . . . . . . 31
8.3.7 Gpt_StopTimer . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
8.3.8 Gpt_EnableNotification . . . . . . . . . . . . . . . . . . . . . . 33
8.3.9 Gpt_DisableNotification . . . . . . . . . . . . . . . . . . . . . . 34

6 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8.3.10 Gpt_SetMode . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
8.3.11 Gpt_DisableWakeup . . . . . . . . . . . . . . . . . . . . . . . . 37
8.3.12 Gpt_EnableWakeup . . . . . . . . . . . . . . . . . . . . . . . 38
8.3.13 Gpt_CheckWakeup . . . . . . . . . . . . . . . . . . . . . . . . 39
8.3.14 Gpt_GetPredefTimerValue . . . . . . . . . . . . . . . . . . . . 40
8.4 Callback notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8.5 Scheduled functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8.6 Expected interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8.6.1 Mandatory interfaces . . . . . . . . . . . . . . . . . . . . . . . 41
8.6.2 Optional interfaces . . . . . . . . . . . . . . . . . . . . . . . . . 42
8.6.3 Configurable interfaces . . . . . . . . . . . . . . . . . . . . . . 42
8.6.3.1 GPT Notification . . . . . . . . . . . . . . . . . . . . . 42
8.7 Error detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
9 Sequence diagrams 44
9.1 Gpt_Init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.2 GPT continuous mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.3 GPT one-shot mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9.4 Disable/Enable Notifications . . . . . . . . . . . . . . . . . . . . . . . . . 46
9.5 Wakeup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
10 Configuration specification 48
10.1 How to read this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.2 Containers and configuration parameters . . . . . . . . . . . . . . . . . . 48
10.2.1 Gpt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
10.2.2 GptDriverConfiguration . . . . . . . . . . . . . . . . . . . . . . 49
10.2.3 GptClockReferencePoint . . . . . . . . . . . . . . . . . . . . . 53
10.2.4 GptChannelConfigSet . . . . . . . . . . . . . . . . . . . . . . . 54
10.2.5 GptChannelConfiguration . . . . . . . . . . . . . . . . . . . . . 55
10.2.6 GptWakeupConfiguration . . . . . . . . . . . . . . . . . . . . . 59
10.2.7 GptConfigurationOfOptApiServices . . . . . . . . . . . . . . . 59
10.3 Published Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
A Not applicable requirements 63

7 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

1 Introduction and functional overview


This specification describes the functionality, API and the configuration for the AU-
TOSAR Basic Software module GTP driver.
The GPT driver is part of the microcontroller abstraction layer (MCAL). It initializes and
controls the internal General Purpose Timer(s) (GPT) of the microcontroller.
The GPT driver provides services and configuration parameters for
• Starting and stopping hardware timers
• Getting timer values
• Controlling time triggered interrupt notifications, if supported by hardware
• Controlling time triggered wakeup interrupts, if supported by hardware
The tick duration of a timer channel depends on channel specific settings (part of GPT
driver) as well as on system clock and settings of the clock tree controlled by the MCU
module. The tick duration is not limited by this specification.
Not all hardware timers must be controlled by the GPT module. Some timers may be
controlled by AUTOSAR Operating System or Complex Drivers directly. The number
of timer channels controlled by the GPT driver depends on hardware, implementation
and system configuration.
Beside the possibility to configure individual timer channels with individual properties,
some free running up counters - so-called GPT Predef Timers - are defined. These
timers have predefined tick durations and predefined number of bits (physical time
units and ranges). The GPT Predef Timers are used by the Time Service module.
The GPT driver only generates time bases. Further time based functionality on driver
level is covered by other MCAL modules like:
• PWM Driver (driver for pulse width modulation)
• ICU Driver (driver for input capture unit)
• OCU Driver (driver for output compare unit)

8 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

2 Acronyms and Abbreviations


The glossary below includes acronyms and abbreviations relevant to the GPT driver
module that are not included in the [1, AUTOSAR glossary].

Abbreviation / Acronym: Description:


BSW Basic Software
DET Default Error Tracer
ECU Electronic Control Unit
GPT General Purpose Timer
ICU Input Capture Unit
MCU Micro Controller Unit
NOP, nop Null Operation
OS Operating System

Table 2.1: Acronyms and abbreviations used in the scope of this Document

Term: Description:
Timer channel Represents a logical timer entity assigned to a timer hardware
Target time Time, something shall occur, when the value is reached. The behavior depends
on the configuration and the enabled functionality.
Tick Defines the timer resolution, the duration of a timer increment
GPT Predef Timer A GPT Predef Timer is a free running up counter provided by the GPT driver.
Which GPT Predef Timer(s) are available depends on hardware (clock, hardware
timers, prescaler, width of timer register, ...) and configuration. A GPT Predef
Timer has predefined physical time unit and range.

Table 2.2: Terms used in the scope of this Document

9 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

3 Related documentation

3.1 Input documents & related standards and norms

[1] Glossary
AUTOSAR_FO_TR_Glossary
[2] General Specification of Basic Software Modules
AUTOSAR_CP_SWS_BSWGeneral
[3] Specification of Default Error Tracer
AUTOSAR_CP_SWS_DefaultErrorTracer
[4] Specification of MCU Driver
AUTOSAR_CP_SWS_MCUDriver
[5] Specification of ECU State Manager
AUTOSAR_CP_SWS_ECUStateManager
[6] Requirements on GPT Driver
AUTOSAR_CP_SRS_GPTDriver
[7] List of Basic Software Modules
AUTOSAR_CP_TR_BSWModuleList

3.2 Related specification


AUTOSAR provides a General Specification on Basic Software modules [2, SWS BSW
General], which is also valid for GPT driver.
Thus, the specification SWS BSW General shall be considered as additional and re-
quired specification for GPT driver.

10 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4 Constraints and assumptions

4.1 Assumptions
No assumptions.

4.2 Limitations
No limitations.

4.3 Applicability to car domains


No restrictions.

11 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

5 Dependencies to other modules


Module DET

In development mode the Error hook-function of module DET [3] will be called.

Module MCU

The GPT depends on the system clock, prescaler(s) and PLL. Thus, changes of the
system clock (e.g. PLL on PLL off) also affect the clock settings of the GPT hardware.
Module GPT will not take care of settings which configure the clock, prescaler(s) and
PLL in its init function. This has to be done by the MCU module [4].
Hence the conversions between time and ticks shall be part of an upper layer.

Module EcuM

The GPT driver reports the wakeup interrupts to the ECU State Manager [5] for further
processing.

File structure

The file structure is not defined within this specification completely. It depends on
the implementation. The GPT driver shall provide at least the following files, if the
conditions described are fulfilled:
[SWS_Gpt_00261] dGpt_Irq.c shall include Gpt.h for the prototype declaration of the
notification functions.c(SRS_BSW_00164)
[SWS_Gpt_00375] dGpt.c shall include Det.h in any case to be able to raise runtime
error.c()

12 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

6 Requirements Tracing
The following tables reference the requirements specified in [6, SRS documents] and
links to the fulfillment of these. Please note that if column “Satisfied by” is empty for a
specific requirement this means that this requirement is not fulfilled by this document.
Requirement Description Satisfied by
[SRS_BSW_00101] The Basic Software Module shall be [SWS_Gpt_00006] [SWS_Gpt_00280]
able to initialize variables and
hardware in a separate initialization
function
[SRS_BSW_00164] The Implementation of interrupt [SWS_Gpt_00261]
service routines shall be done by the
Operating System, complex drivers or
modules
[SRS_BSW_00171] Optional functionality of a Basic-SW [SWS_Gpt_00194] [SWS_Gpt_00195]
component that is not required in the [SWS_Gpt_00196] [SWS_Gpt_00199]
ECU shall be configurable at [SWS_Gpt_00200] [SWS_Gpt_00201]
pre-compile-time [SWS_Gpt_00202] [SWS_Gpt_00203]
[SRS_BSW_00305] Data types naming convention [SWS_Gpt_00357] [SWS_Gpt_00358]
[SWS_Gpt_00359] [SWS_Gpt_00360]
[SRS_BSW_00323] All AUTOSAR Basic Software [SWS_Gpt_00218] [SWS_Gpt_00338]
Modules shall check passed API [SWS_Gpt_00399] [SWS_Gpt_00403]
parameters for validity
[SRS_BSW_00336] Basic SW module shall be able to [SWS_Gpt_00008] [SWS_Gpt_00281]
shutdown
[SRS_BSW_00348] All AUTOSAR standard types and [SWS_Gpt_00278]
constants shall be placed and
organized in a standard type header
file
[SRS_BSW_00358] The return type of init() functions [SWS_Gpt_00280]
implemented by AUTOSAR Basic
Software Modules shall be void
[SRS_BSW_00369] All AUTOSAR Basic Software [SWS_Gpt_00403]
Modules shall not return specific
development error codes via the API
[SRS_BSW_00375] Basic Software Modules shall report [SWS_Gpt_00209] [SWS_Gpt_00292]
wake-up reasons
[SRS_BSW_00404] BSW Modules shall support [SWS_Gpt_00280] [SWS_Gpt_00357]
post-build configuration
[SRS_BSW_00405] BSW Modules shall support multiple [SWS_Gpt_00280] [SWS_Gpt_00357]
configuration sets
[SRS_BSW_00406] A static status variable denoting if a [SWS_Gpt_00220] [SWS_Gpt_00222]
BSW module is initialized shall be [SWS_Gpt_00223] [SWS_Gpt_00224]
initialized with value 0 before any [SWS_Gpt_00225] [SWS_Gpt_00226]
APIs of the BSW module is called [SWS_Gpt_00227] [SWS_Gpt_00228]
[SWS_Gpt_00229] [SWS_Gpt_00230]
[SWS_Gpt_00325] [SWS_Gpt_00398]
[SWS_Gpt_00402]
[SRS_BSW_00407] Each BSW module shall provide a [SWS_Gpt_00279]
function to read out the version
information of a dedicated module
implementation
[SRS_BSW_00414] Init functions shall have a pointer to a [SWS_Gpt_00280] [SWS_Gpt_00357]
configuration structure as single
parameter
[SRS_BSW_00438] Configuration data shall be defined in [SWS_Gpt_00280] [SWS_Gpt_00357]
a structure
5

13 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
Requirement Description Satisfied by
[SRS_BSW_00441] Naming convention for type, macro [SWS_Gpt_00360]
and function
[SRS_Gpt_12116] The GPT Driver shall provide the [SWS_Gpt_00008] [SWS_Gpt_00162]
functionality to deinitialize timer [SWS_Gpt_00281] [SWS_Gpt_00308]
channels to their power on reset state
[SRS_Gpt_12117] The GPT Driver shall provide a [SWS_Gpt_00010] [SWS_Gpt_00083]
synchronous service for reading the [SWS_Gpt_00282] [SWS_Gpt_00283]
current timer value of each timer
channel
[SRS_Gpt_12119] The GPT driver shall provide the [SWS_Gpt_00013] [SWS_Gpt_00285]
service for stopping each channel of
the timer
[SRS_Gpt_12120] The GPT Driver shall provide a [SWS_Gpt_00233]
notification per channel that is called
when the time period has elapsed
[SRS_Gpt_12121] The GPT Driver shall provide the [SWS_Gpt_00014] [SWS_Gpt_00286]
functionality to enable the call of a
notification function per channel
during the runtime
[SRS_Gpt_12122] The GPT Driver shall provide the [SWS_Gpt_00015] [SWS_Gpt_00287]
functionality to disable the call of a
notification function per channel
during the runtime
[SRS_Gpt_12128] The GPT driver shall provide a [SWS_Gpt_00274] [SWS_Gpt_00275]
service for starting a timer with [SWS_Gpt_00284]
specific parameters
[SRS_Gpt_12328] The GPT driver shall use the time [SWS_Gpt_00359]
unit ticks for all API services which
are related to GPT timer channels
[SRS_Gpt_13601] The GPT Driver shall be capable of [SWS_Gpt_00127]
performing wakeup events, whenever
a predefined wakeup period has
expired
[SRS_Gpt_13602] The GPT driver shall provide a [SWS_Gpt_00159] [SWS_Gpt_00160]
service for enabling / disabling the [SWS_Gpt_00289] [SWS_Gpt_00290]
wake-up capability of single timer
channels
[SRS_Gpt_13603] The GPT driver shall provide a [SWS_Gpt_00151] [SWS_Gpt_00152]
service for selecting the Wake-up [SWS_Gpt_00153] [SWS_Gpt_00288]
mode
[SRS_Gpt_13604] The GPT driver shall support special [SWS_Gpt_00382]
free running up counters, so-called
GPT Predef Timers
[SRS_Gpt_13605] Different types of GPT Predef Timers [SWS_Gpt_00383] [SWS_Gpt_00389]
shall be supported by the GPT driver
[SRS_Gpt_13606] The GPT driver shall make it possible [SWS_Gpt_00385]
to configure statically which GPT
Predef Timers are enabled
[SRS_Gpt_13607] The GPT Predef Timers shall be [SWS_Gpt_00390] [SWS_Gpt_00391]
started/stopped automatically by the [SWS_Gpt_00392] [SWS_Gpt_00393]
GPT driver
[SRS_Gpt_13608] The GPT driver shall provide a [SWS_Gpt_00394] [SWS_Gpt_00395]
synchronous service for reading the [SWS_Gpt_00397]
current timer value of each GPT
Predef Timer
5

14 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
Requirement Description Satisfied by
[SRS_SPAL_00157] All drivers and handlers of the [SWS_Gpt_00014] [SWS_Gpt_00015]
AUTOSAR Basic Software shall [SWS_Gpt_00405] [SWS_Gpt_00406]
implement notification mechanisms of
drivers and handlers
[SRS_SPAL_12057] All driver modules shall implement an [SWS_Gpt_00006] [SWS_Gpt_00280]
interface for initialization
[SRS_SPAL_12063] All driver modules shall only support [SWS_Gpt_00359]
raw value mode
[SRS_SPAL_12064] All driver modules shall raise an error [SWS_Gpt_00405]
if the change of the operation mode
leads to degradation of running
operations
[SRS_SPAL_12067] All driver modules shall set their [SWS_Gpt_00014] [SWS_Gpt_00015]
wake-up conditions depending on the [SWS_Gpt_00233]
selected operation mode
[SRS_SPAL_12069] All drivers of the SPAL that wake up [SWS_Gpt_00209] [SWS_Gpt_00292]
from a wake-up interrupt shall report
the wake-up reason
[SRS_SPAL_12125] All driver modules shall only initialize [SWS_Gpt_00068]
the configured resources
[SRS_SPAL_12129] The ISRs shall be responsible for [SWS_Gpt_00206] [SWS_Gpt_00327]
resetting the interrupt flags and
calling the according notification
function
[SRS_SPAL_12163] All driver modules shall implement an [SWS_Gpt_00008] [SWS_Gpt_00281]
interface for de-initialization
[SRS_SPAL_12169] All driver modules that provide [SWS_Gpt_00151] [SWS_Gpt_00288]
different operation modes shall
provide a service for mode selection
[SRS_SPAL_12263] The implementation of all driver [SWS_Gpt_00357]
modules shall allow the configuration
of specific module parameter types at
link time
[SRS_SPAL_12448] All driver modules shall have a [SWS_Gpt_00332]
specific behavior after a development
error detection
[SRS_SPAL_12461] Specific rules regarding initialization [SWS_Gpt_00352] [SWS_Gpt_00353]
of controller registers shall apply to all [SWS_Gpt_00354] [SWS_Gpt_00355]
driver implementations [SWS_Gpt_00356]

Table 6.1: RequirementsTracing

15 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

7 Functional specification
The GPT driver provides services for starting and stopping timer channels (logical timer
instances assigned to a timer hardware), individual for each channel by calling of:
• Gpt_StartTimer
• Gpt_StopTimer
The "target time" is passed as a parameter to Gpt_StartTimer. So, for each start
of a timer channel, the target time can be set individually. The states and the state
transitions of a timer channel are shown in 7.1

Figure 7.1: Channel states and state transitions

A timer channel can be configured in "one-shot mode" or in "continuous mode".


[SWS_Gpt_00329] dA timer channel starts counting at value zero.c()
[SWS_Gpt_00185] dIf a timer channel is configured in "one-shot mode":
If the timer has reached the target time (timer value = target time), the timer shall stop
automatically and maintain its timer value unchanged. The channel state shall change
from "running" to "expired".c()

16 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Figure 7.2: Timer channel in "one-shot mode"

[SWS_Gpt_00186] dIf a timer channel is configured in "continuous mode":


If the timer has reached the target time (timer value = target time), the timer shall con-
tinue running with the value "0" at next timer tick. So, the time interval of the recurrence
is: target time + 1. This interval shall be independently of implementation, e.g. interrupt
delays.c()
[SWS_Gpt_00330] dIf a timer channel is configured in "continuous mode":
If supported by hardware, it shall be possible to realize a free running timer. This
means: A timer which rolls over automatically by hardware, if the target time is set to
the maximum value the timer is able to count (max value = 2n -1, n=number of bits).c()

Figure 7.3: Timer channel in "continuous mode"

Both, the relative time elapsed and the time remaining can be queried by calling:
• Gpt_GetTimeElapsed
• Gpt_GetTimeRemaining

17 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Figure 7.4: of time elapsed / time remaining for a timer channel in "continuous mode"

[SWS_Gpt_00331] dIf supported by hardware, a timer channel shall be able to be con-


figured to call a notification function. If enabled, the function is called when the target
time is reached (timer value = target time).c() Interrupt notifications can be enabled and
disabled at runtime individually for each channel by calling of:
• Gpt_EnableNotification
• Gpt_DisableNotification
[SWS_Gpt_00127] dIf supported by hardware, a timer channel shall be able to be
configured as wakeup source of the ECU. If enabled, the wakeup occurs when the
target time is reached (timer value = target time).c(SRS_Gpt_13601) Wakeup interrupts
can be enabled and disabled at runtime individually for each channel by calling of:
• Gpt_EnableWakeup
• Gpt_DisableWakeup
After initialization the GPT driver is in "normal mode". A wakeup interrupt can only
occur when the driver is switched to "sleep mode". The operation mode can be set by
calling of:
• Gpt_SetMode
For a detailled description on wakeup handling please refer to the ECU State Manager
specification [5]. The operation modes and the possible mode transitions of the GPT
driver are shown in 7.5.

18 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Figure 7.5: GPT driver modes

7.1 GPT Predef Timers


Beside the possibility to configure individual timer channels with individual properties,
some GPT Predef Timers are defined. The API specified for "GPT timer channels" can
not be used for GPT Predef Timers.
[SWS_Gpt_00382] dA GPT Predef Timer is a free running up counter (user point of
view). If the timer has reached the maximum value (max value = 2n -1, n=number of
bits), the timer shall continue running with the value "0" at next timer tick.c(SRS_Gpt_-
13604)
[SWS_Gpt_00383] d
Name of GPT Predef Timer Tick duration Maximum tick Number of Maximum time
value bits span (circa
values)
GPT_PREDEF_TIMER_1US_16BIT 1 µs 65535 16 bit 65 ms
GPT_PREDEF_TIMER_1US_24BIT 16777215 24 bit 16 s
GPT_PREDEF_TIMER_1US_32BIT 4294967295 32 bit 71 minutes
GPT_PREDEF_TIMER_100US_32BIT 100 µs 4294967295 32 bit 4.9 days

Table 7.1: Types of GPT Predef Timers

c(SRS_Gpt_13605)
[SWS_Gpt_00384] dA GPT Predef Timer shall have a maximum tick tolerance of +/- 1
tick to ensure accuracy of time based functionality.c()
Which GPT Predef Timer(s) can be enabled depends on clock and available timer
hardware (prescaler, width of timer register). It is recommended to enable all GPT
Predef Timers to ensure compatibility of time based functionality for all platforms.

19 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

It is recommended to use one hardware timer per tick duration and to supply the hard-
ware timer directly with the clock source "fclock = 1 / (tick duration)" by good choice of
clock and prescaler(s). By this, the values of the timer counter register can be used di-
rectly without any need of adaptation (computation) for performance reasons. A lower
bit timer can be derived from a higher bit timer by a simple software mask operation.
For implementation of GPT Predef Timers, special hardware features may be used:
• Timers may be cascaded asynchronously to use a timer as a prescaler
• Timers may be cascaded synchronously to extend the timer range (number of
bits)
• Timers with bit number greater than 32 bit may be used
• Assembler code may be used to perform 64 bit arithmetic, if necessary GPT
internal, e.g. if a 48 bit timer with tick duration 250 ns or 1 µs is used for all GPT
Predef Timers
[SWS_Gpt_00385] dIt shall be possible to configure which GPT Predef Timers are
enabled.c(SRS_Gpt_13606)
[SWS_Gpt_00386] dIf a GPT Predef Timer is enabled, the timer(s) with the same tick
duration and lower bit number(s) shall be enabled also.c()
Implementation specific configuration parameters are allowed if needed, e.g. to select
the used hardware unit. All enabled GPT Predef Timers run after calling of:
• Gpt_Init ([SWS_Gpt_00390])
• Gpt_SetMode(GPT_MODE_NORMAL) ([SWS_Gpt_00392])
All enabled GPT Predef Timers are stopped by calling of:
• Gpt_DeInit ([SWS_Gpt_00391])
• Gpt_SetMode(GPT_MODE_SLEEP) ([SWS_Gpt_00393])
The current time value of the GPT Predef Timers can be got by calling of:
• Gpt_GetPredefTimerValue ([SWS_Gpt_00394])

7.2 Version checking


For details refer to the chapter 5.1.8 "Version Check" in SWS_BSWGeneral.

7.3 Error Classification


Section "Error Handling" of the document [2] "General Specification of Basic Software
Modules" describes the error handling of the Basic Software in detail. Above all, it

20 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

constitutes a classification scheme consisting of five error types which may occur in
BSW modules.
Based on this foundation, the following section specifies particular errors arranged in
the respective subsections below.

7.3.1 Development Errors

[SWS_Gpt_91000] Definiton of development errors in module Gpt d


Type of error Related error code Error value
API service called without module initialization GPT_E_UNINIT 0x0A
API service for initialization called when already GPT_E_ALREADY_INITIALIZED 0x0D
initialized
API error return code: Init function failed GPT_E_INIT_FAILED 0x0E
API parameter checking: invalid channel GPT_E_PARAM_CHANNEL 0x14
API parameter checking: invalid value GPT_E_PARAM_VALUE 0x15
API parameter checking: invalid pointer GPT_E_PARAM_POINTER 0x16
API parameter checking: invalid Predef Timer GPT_E_PARAM_PREDEF_TIMER 0x17
API parameter checking: invalid mode GPT_E_PARAM_MODE 0x1F

c()

7.3.2 Runtime Errors

[SWS_Gpt_91001] Definiton of runtime errors in module Gpt d


Type of error Related error code Error value
API service called when timer channel is still busy GPT_E_BUSY 0x0B
(running)
API service called when driver is in wrong mode GPT_E_MODE 0x0C

c()

7.3.3 Transient Faults

There are no transient faults.

7.3.4 Production Errors

There are no production errors.

21 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

7.3.5 Extended Production Errors

There are no extended production errors.

22 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8 API specification

8.1 Imported types


In this chapter all types included from the following files are listed.
[SWS_Gpt_00278] Definition of imported datatypes of module Gpt d
Module Header File Imported Type
EcuM EcuM.h EcuM_WakeupSourceType
Std Std_Types.h Std_ReturnType
Std_Types.h Std_VersionInfoType

c(SRS_BSW_00348)

8.2 Type definitions

8.2.1 Gpt_ConfigType

[SWS_Gpt_00357] Definition of datatype Gpt_ConfigType d


Name Gpt_ConfigType
Kind Structure
Elements –
Type –
Comment Implementation specific configuration data structure, see chapter 10
for configurable parameters.
Description This is the type of the data structure including the configuration set required for initializing the
GPT timer unit.
Available via Gpt.h

c(SRS_BSW_00404, SRS_BSW_00405, SRS_BSW_00438, SRS_BSW_00305,


SRS_BSW_00414, SRS_SPAL_12263)

8.2.2 Gpt_ChannelType

[SWS_Gpt_00358] Definition of datatype Gpt_ChannelType d


Name Gpt_ChannelType
Kind Type
Derived from uint
5

23 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
Range – – Implementation specific. But not
all values may be valid within this
type. This type shall be chosen in
order to have the most efficient
implementation on a specific
micro controller platform.
Description Numeric ID of a GPT channel.
Available via Gpt.h

c(SRS_BSW_00305)

8.2.3 Gpt_ValueType

[SWS_Gpt_00359] Definition of datatype Gpt_ValueType d


Name Gpt_ValueType
Kind Type
Derived from uint
Range – – The range of this type is µC
dependent (width of the timer
register) and has to be described
by the supplier.
Description Type for reading and setting the timer values (in number of ticks).
Available via Gpt.h

c(SRS_BSW_00305, SRS_SPAL_12063, SRS_Gpt_12328)

8.2.4 Gpt_ModeType

[SWS_Gpt_00360] Definition of datatype Gpt_ModeType d


Name Gpt_ModeType
Kind Enumeration
Range GPT_MODE_NORMAL 0x00 Normal operation mode of the GPT
GPT_MODE_SLEEP 0x01 Operation for reduced power operation mode.
In sleep mode only wakeup capable channels
are available.
Description Modes of the GPT driver.
Available via Gpt.h

c(SRS_BSW_00441, SRS_BSW_00305)

24 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8.2.5 Gpt_PredefTimerType

[SWS_Gpt_00389] Definition of datatype Gpt_PredefTimerType d


Name Gpt_PredefTimerType
Kind Enumeration
Range GPT_PREDEF_ 0x00 GPT Predef Timer with tick duration 1µs and
TIMER_1US_16BIT range 16bit
GPT_PREDEF_ 0x01 GPT Predef Timer with tick duration 1µs and
TIMER_1US_24BIT range 24bit
GPT_PREDEF_ 0x02 GPT Predef Timer with tick duration 1µs and
TIMER_1US_32BIT range 32bit
GPT_PREDEF_ 0x03 GPT Predef Timer with tick duration 100µs
TIMER_100US_32BIT and range 32bit
Description Type for GPT Predef Timers
Available via Gpt.h

c(SRS_Gpt_13605)

8.3 Function definitions


This is a list of functions provided for upper layer modules.

8.3.1 Gpt_GetVersionInfo

[SWS_Gpt_00279] Definition of API function Gpt_GetVersionInfo d


Service Name Gpt_GetVersionInfo
Syntax void Gpt_GetVersionInfo (
Std_VersionInfoType* VersionInfoPtr
)
Service ID [hex] 0x00
Sync/Async Synchronous
Reentrancy Reentrant
Parameters (in) None
Parameters (inout) None
Parameters (out) VersionInfoPtr Pointer to where to store the version information of this module.
Return value None
Description Returns the version information of this module.
Available via Gpt.h

c(SRS_BSW_00407)
[SWS_Gpt_00338] dIf development error detection is enabled for the GPT module:
If the parameter VersionInfoPtr is a null pointer, the function Gpt_GetVersion-
Info shall raise the error GPT_E_PARAM_POINTER.c(SRS_BSW_00323)

25 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8.3.2 Gpt_Init

[SWS_Gpt_00280] Definition of API function Gpt_Init d


Service Name Gpt_Init
Syntax void Gpt_Init (
const Gpt_ConfigType* ConfigPtr
)
Service ID [hex] 0x01
Sync/Async Synchronous
Reentrancy Non Reentrant
Parameters (in) ConfigPtr Pointer to a selected configuration structure
Parameters (inout) None
Parameters (out) None
Return value None
Description Initializes the GPT driver.
Available via Gpt.h

c(SRS_BSW_00404, SRS_BSW_00405, SRS_BSW_00438, SRS_BSW_00101,


SRS_BSW_00358, SRS_BSW_00414, SRS_SPAL_12057)
[SWS_Gpt_00006] dThe function Gpt_Init shall initialize the hardware timer mod-
ule according to a configuration set referenced by ConfigPtr.c(SRS_BSW_00101,
SRS_SPAL_12057)
[SWS_Gpt_00107] dThe function Gpt_Init shall disable all interrupt notifications,
controlled by the GPT driver.c()
[SWS_Gpt_00068] dThe function Gpt_Init shall only initialize the configured re-
sources. Resources that are not configured in the configuration file shall not be
touched.c(SRS_SPAL_12125)
The following rules regarding initialization of controller registers shall apply to this driver
implementation:
• [SWS_Gpt_00352] dIf the hardware allows for only one usage of the register,
the driver module implementing that functionality is responsible for initializing the
register.c(SRS_SPAL_12461)
• [SWS_Gpt_00353] dIf the register can affect several hardware modules and if it
is an I/O register it shall be initialized by the PORT driver.c(SRS_SPAL_12461)
• [SWS_Gpt_00354] dIf the register can affect several hardware modules and if it
is not an I/O register it shall be initialized by the MCU driver.c(SRS_SPAL_12461)
• [SWS_Gpt_00355] dOne-time writable registers that require initialization directly
after reset shall be initialized by the startup code.c(SRS_SPAL_12461)
• [SWS_Gpt_00356] dAll other registers shall be initialized by the startup code.c
(SRS_SPAL_12461)
[SWS_Gpt_00307] dIf development error detection is enabled for the GPT module:

26 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

If the GPT driver is not in operation mode "uninitialized", the function Gpt_Init shall
raise the error GPT_E_ALREADY_INITIALIZED.c()
[SWS_Gpt_00258] dThe function Gpt_Init shall disable all wakeup interrupts, con-
trolled by the GPT driver.c()
[SWS_Gpt_00339] dThe function Gpt_Init shall set the operation mode of the GPT
driver to "normal mode". This leads to a behavior like Gpt_SetMode is called with
parameter GPT_MODE_NORMAL.c()
[SWS_Gpt_00309] dA re-initialization of the GPT driver by executing the Gpt_Init
function requires a de-initialization before by executing a Gpt_DeInit.c()
[SWS_Gpt_00390] dThe function Gpt_Init shall start all enabled GPT Predef Timers
at value "0".c(SRS_Gpt_13607)

8.3.3 Gpt_DeInit

[SWS_Gpt_00281] Definition of API function Gpt_DeInit d


Service Name Gpt_DeInit
Syntax void Gpt_DeInit (
void
)
Service ID [hex] 0x02
Sync/Async Synchronous
Reentrancy Non Reentrant
Parameters (in) None
Parameters (inout) None
Parameters (out) None
Return value None
Description Deinitializes the GPT driver.
Available via Gpt.h

c(SRS_BSW_00336, SRS_SPAL_12163, SRS_Gpt_12116)


[SWS_Gpt_00008] dThe function Gpt_DeInit shall deinitialize the hardware used
by the GPT driver (depending on configuration to the power on reset state. Values of
registers which are not writeable are excluded. It’s the responsibility of the hardware
design that the state does not lead to undefined activities in the µC.c(SRS_BSW_-
00336, SRS_SPAL_12163, SRS_Gpt_12116)
[SWS_Gpt_00105] dThe function Gpt_DeInit shall disable all interrupt notifications
and wakeup interrupts, controlled by the GPT driver.c()
[SWS_Gpt_00162] dThe function Gpt_DeInit shall influence only the peripherals,
which are allocated by the static configuration.c(SRS_Gpt_12116)
[SWS_Gpt_00308] dIf a postbuild multiple selectable configuration variant was used,
the function Gpt_DeInit shall further influence only the peripherals, which are al-

27 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

located by the runtime configuration set passed by the previous call of the function
Gpt_Init.c(SRS_Gpt_12116)
[SWS_Gpt_00194] dThe function Gpt_DeInit shall be pre compile time configurable
On/Off by the configuration parameter: GptDeInitApi.c(SRS_BSW_00171)
[SWS_Gpt_00363] dThe function Gpt_DeInit shall set the operation mode of the
GPT driver to "uninitialized".c()
[SWS_Gpt_00234] dIf any timer channel is in state "running", the function Gpt_-
DeInit shall raise the runtime error GPT_E_BUSY.c()
[SWS_Gpt_00220] dIf development error detection is enabled for the GPT module:
If the driver is not initialized, the function Gpt_DeInit shall raise the error GPT_E_-
UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00391] dThe function Gpt_DeInit shall stop all enabled GPT Predef
Timers.c(SRS_Gpt_13607)

8.3.4 Gpt_GetTimeElapsed

[SWS_Gpt_00282] Definition of API function Gpt_GetTimeElapsed d


Service Name Gpt_GetTimeElapsed
Syntax Gpt_ValueType Gpt_GetTimeElapsed (
Gpt_ChannelType Channel
)
Service ID [hex] 0x03
Sync/Async Synchronous
Reentrancy Reentrant
Parameters (in) Channel Numeric identifier of the GPT channel.
Parameters (inout) None
Parameters (out) None
Return value Gpt_ValueType Elapsed timer value (in number of ticks)
Description Returns the time already elapsed.
Available via Gpt.h

c(SRS_Gpt_12117)
[SWS_Gpt_00010] dThe function Gpt_GetTimeElapsed shall return the time al-
ready elapsed. When the Channel is in mode "one-shot mode", this is the value
relative to the point in time, the Channel has been started.c(SRS_Gpt_12117)
[SWS_Gpt_00361] dWhen the Channel is in mode "continuous mode", the return
value of Gpt_GetTimeElapsed is the value relative to the last recurrence (target
time reached) or to the start of the Channel before the first recurrence occurs.c()
[SWS_Gpt_00295] dIf the function Gpt_GetTimeElapsed is called on a timer Chan-
nel in state "initialized" (Channel started never before), the function shall return the
value "0".c()

28 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

[SWS_Gpt_00297] dIf the function Gpt_GetTimeElapsed is called on a timer Chan-


nel in state "stopped", the function shall return the time value at the moment of stop-
ping.c()
[SWS_Gpt_00299] dIf the function Gpt_GetTimeElapsed is called on a Channel
configured for "one-shot mode" in state "expired" (timer has reached the target time),
the function shall return the target time.c()
[SWS_Gpt_00113] dThe function Gpt_GetTimeElapsed shall be fully reentrant, this
means even for the same timer channel.c()
[SWS_Gpt_00195] dThe function Gpt_GetTimeElapsed shall be pre compile time
configurable On/Off by the configuration parameter: GptTimeElapsedApi.c(SRS_-
BSW_00171)
[SWS_Gpt_00222] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_GetTimeElapsed shall raise the error
GPT_E_UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00210] dIf development error detection is enabled for GPT module:
If the parameter Channel is invalid (not within the range specified by configuration),
the function Gpt_GetTimeElapsed shall raise the error GPT_E_PARAM_CHANNEL.c
()
State / Circumstance Timer channel state Return value Development error (if
enabled)
Driver uninitialized - 0 GPT_E_UNINIT
Driver initialized initialized 0 -
running elapsed time -
stopped elapsed time at moment of -
stopping
expired (only one-shot target time -
mode)
Invalid parameter "Channel" all 0 GPT_E_PARAM_CHANNEL

Table 8.1: Return values and DET errors of Gpt_GetTimeElapsed

8.3.5 Gpt_GetTimeRemaining

[SWS_Gpt_00283] Definition of API function Gpt_GetTimeRemaining d


Service Name Gpt_GetTimeRemaining
Syntax Gpt_ValueType Gpt_GetTimeRemaining (
Gpt_ChannelType Channel
)
Service ID [hex] 0x04
5

29 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
Sync/Async Synchronous
Reentrancy Reentrant
Parameters (in) Channel Numeric identifier of the GPT channel.
Parameters (inout) None
Parameters (out) None
Return value Gpt_ValueType Remaining timer value (in number of ticks)
Description Returns the time remaining until the target time is reached.
Available via Gpt.h

c(SRS_Gpt_12117)
[SWS_Gpt_00083] dThe function Gpt_GetTimeRemaining shall return the timer
value remaining until the target time will be reached next time. The remaining time
is the "target time" minus the time already elapsed.c(SRS_Gpt_12117)
[SWS_Gpt_00301] dIf the function Gpt_GetTimeRemaining is called on a timer
Channel in state "initialized" (Channel started never before), the function shall return
the value "0".c()
[SWS_Gpt_00303] dIf the function Gpt_GetTimeRemaining is called on a timer
Channel in state "stopped", the function shall return the remaining time value at the
moment of stopping.c()
[SWS_Gpt_00305] dIf the function Gpt_GetTimeRemaining is called on a Channel
configured for "one-shot mode" in state "expired" (timer has reached the target time),
the function shall return the value "0".c()
[SWS_Gpt_00114] dThe function Gpt_GetTimeRemaining shall be fully reentrant,
this means even for the same timer Channel.c()
[SWS_Gpt_00196] dThe function Gpt_GetTimeRemaining shall be pre compile
time configurable On/Off by the configuration parameter: GptTimeRemainingApi.c
(SRS_BSW_00171)
[SWS_Gpt_00223] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_GetTimeRemaining shall raise the
error GPT_E_UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00211] dIf development error detection is enabled for GPT module:
If the parameter Channel is invalid (not within the range specified by configuration), the
function Gpt_GetTimeRemaining shall raise the error GPT_E_PARAM_CHANNEL.c()
State / Circumstance Timer channel state Return value Development error (if
enabled)
Driver uninitialized - 0 GPT_E_UNINIT
Driver initialized initialized 0 -
running remaining time -
5

30 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
State / Circumstance Timer channel state Return value Development error (if
enabled)
stopped remaining time at moment of -
stopping
expired (only one-shot 0 -
mode)
Invalid parameter "Channel" all 0 GPT_E_PARAM_CHANNEL

Table 8.2: Return values and DET errors of Gpt_GetTimeRemaining

8.3.6 Gpt_StartTimer

[SWS_Gpt_00284] Definition of API function Gpt_StartTimer d


Service Name Gpt_StartTimer
Syntax void Gpt_StartTimer (
Gpt_ChannelType Channel,
Gpt_ValueType Value
)
Service ID [hex] 0x05
Sync/Async Synchronous
Reentrancy Reentrant (but not for the same timer channel)
Parameters (in) Channel Numeric identifier of the GPT channel.
Value Target time in number of ticks.
Parameters (inout) None
Parameters (out) None
Return value None
Description Starts a timer channel.
Available via Gpt.h

c(SRS_Gpt_12128)
[SWS_Gpt_00274] dThe function Gpt_StartTimer shall start the selected timer
Channel with a defined target time.c(SRS_Gpt_12128)
[SWS_Gpt_00275] dIf configured and enabled, an interrupt notification or a wakeup
interrupt occurs, when the target time is reached.c(SRS_Gpt_12128)
[SWS_Gpt_00115] dThe function Gpt_StartTimer shall be reentrant, if the timer
Channels used in concurrent calls are different.c()
[SWS_Gpt_00364] dThe state of the selected timer Channel shall be changed to
"running" if Gpt_StartTimer is called.c()
[SWS_Gpt_00212] dIf development error detection is enabled for GPT module:
If the parameter Channel is invalid (not within the range specified by configuration),
the function Gpt_StartTimer shall raise the error GPT_E_PARAM_CHANNEL.c()
[SWS_Gpt_00218] dIf development error detection is enabled for GPT module:

31 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

The function Gpt_StartTimer shall raise the error GPT_E_PARAM_VALUE if the pa-
rameter Value is "0" or not within the allowed range (exceeding the maximum timer
resolution).c(SRS_BSW_00323)
[SWS_Gpt_00224] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_StartTimer shall raise the error GPT_-
E_UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00084] dIf the function Gpt_StartTimer is called on a Channel in state
"running", the function shall raise the runtime error GPT_E_BUSY.c()

8.3.7 Gpt_StopTimer

[SWS_Gpt_00285] Definition of API function Gpt_StopTimer d


Service Name Gpt_StopTimer
Syntax void Gpt_StopTimer (
Gpt_ChannelType Channel
)
Service ID [hex] 0x06
Sync/Async Synchronous
Reentrancy Reentrant (but not for the same timer channel)
Parameters (in) Channel Numeric identifier of the GPT channel.
Parameters (inout) None
Parameters (out) None
Return value None
Description Stops a timer channel.
Available via Gpt.h

c(SRS_Gpt_12119)
[SWS_Gpt_00013] dThe function Gpt_StopTimer shall stop the selected timer
Channel.c(SRS_Gpt_12119)
[SWS_Gpt_00343] dThe state of the selected timer Channel shall be changed to
"stopped" if Gpt_StopTimer is called.c()
[SWS_Gpt_00099] dIf development error detection is enabled for GPT module:
If the function Gpt_StopTimer is called on a Channel in state "initialized", "stopped"
or "expired", the function shall not raise a development error.c()
[SWS_Gpt_00344] dIf the function Gpt_StopTimer is called on a Channel in state
"initialized", "stopped" or "expired", the function shall leave without any action (no
change of the Channel state).c()
[SWS_Gpt_00116] dThe function Gpt_StopTimer shall be reentrant, if the timer
Channels used in concurrent calls are different.c()
[SWS_Gpt_00213] dIf development error detection is enabled for GPT module:

32 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

If the parameter Channel is invalid (not within the range specified by configuration),
the function Gpt_StopTimer shall raise the error GPT_E_PARAM_CHANNEL.c()
[SWS_Gpt_00225] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_StopTimer shall raise the error GPT_-
E_UNINIT.c(SRS_BSW_00406)

8.3.8 Gpt_EnableNotification

[SWS_Gpt_00286] Definition of API function Gpt_EnableNotification d


Service Name Gpt_EnableNotification
Syntax void Gpt_EnableNotification (
Gpt_ChannelType Channel
)
Service ID [hex] 0x07
Sync/Async Synchronous
Reentrancy Reentrant (but not for the same timer channel)
Parameters (in) Channel Numeric identifier of the GPT channel.
Parameters (inout) None
Parameters (out) None
Return value None
Description Enables the interrupt notification for a channel (relevant in normal mode).
Available via Gpt.h

c(SRS_Gpt_12121)
[SWS_Gpt_00014] dThe function Gpt_EnableNotification shall enable the in-
terrupt notification of the referenced Channel configured for notification (see also
[SWS_Gpt_00233]). The function shall save an attribute like "notification enabled" of
the Channel.c(SRS_SPAL_00157, SRS_SPAL_12067, SRS_Gpt_12121) Comment:
This attribute affects the interrupt notification always when the driver is in "normal
mode". In "sleep mode" the attribute has no influence.
[SWS_Gpt_00117] dThe function Gpt_EnableNotification shall be reentrant, if
the timer Channels used in concurrent calls are different.c()
[SWS_Gpt_00199] dThe function Gpt_EnableNotification shall be pre compile
time configurable On/Off by the configuration parameter: GptEnableDisableNoti-
ficationApi.c(SRS_BSW_00171)
[SWS_Gpt_00226] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_EnableNotification shall raise the
error GPT_E_UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00214] dIf development error detection is enabled for GPT module:

33 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

If the parameter Channel is invalid (not within the range specified by configuration), the
function Gpt_EnableNotification shall raise the error GPT_E_PARAM_CHANNEL.c
()
[SWS_Gpt_00377] dIf development error detection is enabled for GPT module:
If no valid notification function is configured (GptNotification), the function Gpt_En-
ableNotification shall raise the error GPT_E_PARAM_CHANNEL.c()

8.3.9 Gpt_DisableNotification

[SWS_Gpt_00287] Definition of API function Gpt_DisableNotification d


Service Name Gpt_DisableNotification
Syntax void Gpt_DisableNotification (
Gpt_ChannelType Channel
)
Service ID [hex] 0x08
Sync/Async Synchronous
Reentrancy Reentrant (but not for the same timer channel)
Parameters (in) Channel Numeric identifier of the GPT channel.
Parameters (inout) None
Parameters (out) None
Return value None
Description Disables the interrupt notification for a channel (relevant in normal mode).
Available via Gpt.h

c(SRS_Gpt_12122)
[SWS_Gpt_00015] dThe function Gpt_DisableNotification shall disable the in-
terrupt notification of the referenced Channel configured for notification (see also
[SWS_Gpt_00233]). The function shall save an attribute like "notification disabled" of
the Channel.c(SRS_SPAL_00157, SRS_Gpt_12122, SRS_SPAL_12067) Comment:
This attribute affects the interrupt notification always when the driver is in "normal
mode". In "sleep mode" the attribute has no influence.
[SWS_Gpt_00118] dThe function Gpt_DisableNotification shall be reentrant, if
the timer Channels used in concurrent calls are different.c()
[SWS_Gpt_00200] dThe function Gpt_DisableNotification shall be pre compile
time configurable On/Off by the configuration parameter: GptEnableDisableNotifica-
tionApi.c(SRS_BSW_00171)
[SWS_Gpt_00227] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_DisableNotification shall raise the
error GPT_E_UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00217] dIf development error detection is enabled for GPT module:

34 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

If the parameter Channel is invalid (not within the range specified by configuration), the
function Gpt_DisableNotification shall raise the error GPT_E_PARAM_CHAN-
NEL.c()
[SWS_Gpt_00379] dIf development error detection is enabled for GPT module:
If no valid notification function is configured (GptNotification), the function Gpt_Dis-
ableNotification shall raise the error GPT_E_PARAM_CHANNEL.c()

8.3.10 Gpt_SetMode

[SWS_Gpt_00288] Definition of API function Gpt_SetMode d


Service Name Gpt_SetMode
Syntax void Gpt_SetMode (
Gpt_ModeType Mode
)
Service ID [hex] 0x09
Sync/Async Synchronous
Reentrancy Non Reentrant
Parameters (in) Mode GPT_MODE_NORMAL: Normal operation mode of the GPT
driver.
GPT_MODE_SLEEP: Sleep mode of the GPT driver (wakeup
capable).
See also Gpt_ModeType.
Parameters (inout) None
Parameters (out) None
Return value None
Description Sets the operation mode of the GPT.
Available via Gpt.h

c(SRS_SPAL_12169, SRS_Gpt_13603)
[SWS_Gpt_00151] dThe function Gpt_SetMode shall set the operation mode of the
GPT driver to the given Mode parameter.c(SRS_SPAL_12169, SRS_Gpt_13603)
[SWS_Gpt_00255] dThe function Gpt_SetMode is only available if the configuration
parameter GptReportWakeupSource is enabled.c()
[SWS_Gpt_00152] dIf the parameter Mode has the value GPT_MODE_NORMAL:
The function Gpt_SetMode shall enable the interrupt notification for all channels which
are configured for notification and the notification is enabled (stored attribute) via the
function Gpt_EnableNotification prior. All other interrupt notifications shall be
disabled.c(SRS_Gpt_13603)
[SWS_Gpt_00153] dIf the parameter Mode has the value GPT_MODE_SLEEP:
The function Gpt_SetMode shall enable the wakeup interrupts for all channels which
are configured for wakeup and the wakeup is enabled (stored attribute) via the function

35 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Gpt_EnableWakeup prior. All other wakeup interrupts shall be disabled.c(SRS_Gpt_-


13603)
[SWS_Gpt_00164] dIf the function Gpt_SetMode is called with parameter Mode has
the value GPT_MODE_SLEEP: All timer channels in state "running" which are not
configured for wakeup or not enabled for wakeup interruption (stored attribute) via
Gpt_EnableWakeup shall be stopped and their state shall be changed to "stopped".c
()
[SWS_Gpt_00165] dIf the parameter Mode has the value GPT_MODE_NORMAL, the
function Gpt_SetMode shall not restart automatically the timer channels which have
been stopped by entering the sleep Mode.c()
[SWS_Gpt_00341] dIf the parameter has the value GPT_MODE_SLEEP the function
Gpt_SetMode shall not start a wakeup timer automatically. First, the user shall call
Gpt_StartTimer to start a wakeup timer, after this the user shall call Gpt_SetMode
with parameter GPT_MODE_SLEEP.c()
[SWS_Gpt_00228] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_SetMode shall raise the error GPT_E_-
UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00231] dIf development error detection is enabled for GPT module:
The function Gpt_SetMode shall raise the error GPT_E_PARAM_MODE if the parameter
Mode is invalid.c()
[SWS_Gpt_00201] dThe function Gpt_SetMode shall be pre compile time config-
urable On/Off by the configuration parameter: GptWakeupFunctionalityApi.c
(SRS_BSW_00171)
[SWS_Gpt_00392] dIf the parameter Mode has the value GPT_MODE_NORMAL:
If the driver is in "sleep mode", the function Gpt_SetMode shall restart all enabled
GPT Predef Timers at value "0".c(SRS_Gpt_13607)
[SWS_Gpt_00393] dIf the parameter Mode has the value GPT_MODE_SLEEP:
The function Gpt_SetMode shall stop all enabled GPT Predef Timers.c(SRS_Gpt_-
13607)

36 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8.3.11 Gpt_DisableWakeup

[SWS_Gpt_00289] Definition of API function Gpt_DisableWakeup d


Service Name Gpt_DisableWakeup
Syntax void Gpt_DisableWakeup (
Gpt_ChannelType Channel
)
Service ID [hex] 0x0a
Sync/Async Synchronous
Reentrancy Reentrant (but not for the same timer channel)
Parameters (in) Channel Numeric identifier of the GPT channel.
Parameters (inout) None
Parameters (out) None
Return value None
Description Disables the wakeup interrupt of a channel (relevant in sleep mode).
Available via Gpt.h

c(SRS_Gpt_13602)
[SWS_Gpt_00159] dThe function Gpt_DisableWakeup shall disable the wakeup in-
terrupt of the referenced Channel configured for wakeup. The function shall save an
attribute like "wakeup disabled" of the Channel.c(SRS_Gpt_13602) Comment: This
attribute affects the wakeup interrupt always when the driver is in "sleep mode". In
"normal mode" the attribute has no influence.
[SWS_Gpt_00157] dThe function Gpt_DisableWakeup is only feasible, if GptReport-
WakeupSource is statically configured available.c()
[SWS_Gpt_00155] dThe function Gpt_DisableWakeup shall be reentrant, if the timer
channels used in concurrent calls are different.c()
[SWS_Gpt_00202] dThe function Gpt_DisableWakeup shall be pre compile time
configurable On/Off by the configuration parameter: GptWakeupFunctional-
ityApi.c(SRS_BSW_00171)
[SWS_Gpt_00215] dIf development error detection is enabled for GPT module:
If the parameter Channel is invalid (not within the range specified by configuration)
or channel wakeup is not enabled by configuration (GptEnableWakeup), the function
Gpt_DisableWakeup shall raise the error GPT_E_PARAM_CHANNEL.c()
[SWS_Gpt_00229] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_DisableWakeup shall raise the error
GPT_E_UNINIT.c(SRS_BSW_00406)

37 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8.3.12 Gpt_EnableWakeup

[SWS_Gpt_00290] Definition of API function Gpt_EnableWakeup d


Service Name Gpt_EnableWakeup
Syntax void Gpt_EnableWakeup (
Gpt_ChannelType Channel
)
Service ID [hex] 0x0b
Sync/Async Synchronous
Reentrancy Reentrant (but not for the same timer channel)
Parameters (in) Channel Numeric identifier of the GPT channel.
Parameters (inout) None
Parameters (out) None
Return value None
Description Enables the wakeup interrupt of a channel (relevant in sleep mode).
Available via Gpt.h

c(SRS_Gpt_13602)
[SWS_Gpt_00160] dThe function Gpt_EnableWakeup shall enable the wakeup in-
terrupt of the referenced Channel configured for wakeup. The function shall save
an attribute like "wakeup enabled" of the channel.c(SRS_Gpt_13602) Comment: This
attribute affects the wakeup interrupt always when the driver is in "sleep mode". In
"normal mode" the attribute has no influence.
[SWS_Gpt_00158] dThe function Gpt_EnableWakeup is only feasible, if GptReport-
WakeupSource is statically configured available.c()
[SWS_Gpt_00156] dThe function Gpt_EnableWakeup shall be reentrant, if the timer
Channels used in concurrent calls are different.c()
[SWS_Gpt_00203] dThe function Gpt_EnableWakeup shall be pre compile time con-
figurable On/Off by the configuration parameter: GptWakeupFunctionalityApi.c
(SRS_BSW_00171)
[SWS_Gpt_00230] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_EnableWakeup shall raise the error
GPT_E_UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00216] dIf development error detection is enabled for GPT module:
If the parameter Channel is invalid (not within the range specified by configuration)
or channel wakeup is not enabled by configuration (GptEnableWakeup), the function
Gpt_EnableWakeup shall raise the error GPT_E_PARAM_CHANNEL.c()

38 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8.3.13 Gpt_CheckWakeup

[SWS_Gpt_00328] Definition of API function Gpt_CheckWakeup d


Service Name Gpt_CheckWakeup
Syntax void Gpt_CheckWakeup (
EcuM_WakeupSourceType WakeupSource
)
Service ID [hex] 0x0c
Sync/Async Synchronous
Reentrancy Reentrant
Parameters (in) WakeupSource Information on wakeup source to be checked. The associated
GPT channel can be determined from configuration data.
Parameters (inout) None
Parameters (out) None
Return value None
Description 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.
Available via Gpt.h

c()
[SWS_Gpt_00321] dThe function Gpt_CheckWakeup shall check if a wakeup capable
GPT channel is the source for a wakeup event and call EcuM_SetWakeupEvent to
indicate a valid timer wakeup event to the ECU State Manager [5].c()
[SWS_Gpt_00322] dThe function Gpt_CheckWakeup is only feasible, if GptReport-
WakeupSource is statically configured available.c()
[SWS_Gpt_00323] dThe function Gpt_CheckWakeup shall be reentrant, by reason of
possible usage in concurrent interrupt service routines.c()
[SWS_Gpt_00324] dThe function Gpt_CheckWakeup shall be pre compile time con-
figurable On/Off by the configuration parameter: GptWakeupFunctionalityApi.c
()
[SWS_Gpt_00325] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_CheckWakeup shall raise the error
GPT_E_UNINIT.c(SRS_BSW_00406)

39 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8.3.14 Gpt_GetPredefTimerValue

[SWS_Gpt_00394] Definition of API function Gpt_GetPredefTimerValue d


Service Name Gpt_GetPredefTimerValue
Syntax Std_ReturnType Gpt_GetPredefTimerValue (
Gpt_PredefTimerType PredefTimer,
uint32* TimeValuePtr
)
Service ID [hex] 0x0d
Sync/Async Synchronous
Reentrancy Reentrant
Parameters (in) PredefTimer GPT Predef Timer
Parameters (inout) None
Parameters (out) TimeValuePtr Pointer to time value destination data in RAM
Return value Std_ReturnType E_OK: no error has been detected
E_NOT_OK: aborted due to errors
Description Delivers the current value of the desired GPT Predef Timer.
Available via Gpt.h

c(SRS_Gpt_13608) Note: It is strongly recommended to check the return value of the


function Gpt_GetPredefTimerValue on user software level. When E_NOT_OK is
returned the time value - pointed by TimeValuePtr - may be invalid and must not be
used.
[SWS_Gpt_00395] dThe function Gpt_GetPredefTimerValue shall return the cur-
rent value of the GPT Predef Timer passed by PredefTimer.c(SRS_Gpt_13608)
[SWS_Gpt_00396] dIf the timer value of the function Gpt_GetPredefTimerValue
is less than 32 bit (16bit or 24bit timer), the upper bits shall be filled with zero.c()
[SWS_Gpt_00397] dThe function Gpt_GetPredefTimerValue shall be fully reen-
trant, this means even for the same GPT Predef Timer.c(SRS_Gpt_13608)
[SWS_Gpt_00402] dIf the GPT driver is not initialized, in "sleep mode" or the GPT
Predef Timer is not enabled, the function Gpt_GetPredefTimerValue shall return
E_NOT_OK.c(SRS_BSW_00406)
Note: This is to inform user software if the hardware timer is not running, independent
of development error detection is enabled for GPT module enabled/disabled for the
GPT module. The function Gpt_GetPredefTimerValue is used by the Time Service
module which is part of the Services Layer. The user of the Time Service module shall
have a chance to cope with missed timer support.
[SWS_Gpt_00398] dIf development error detection is enabled for GPT module:
If the driver is not initialized, the function Gpt_GetPredefTimerValue shall raise the
error GPT_E_UNINIT.c(SRS_BSW_00406)
[SWS_Gpt_00399] dIf development error detection is enabled for GPT module:

40 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

If the parameter PredefTimer is invalid, the function Gpt_GetPredefTimer-


Value shall raise the development error GPT_E_PARAM_PREDEF_TIMER.c(SRS_-
BSW_00323)
[SWS_Gpt_00400] dIf development error detection is enabled for GPT module:
If the GPT Predef Timer passed by the parameter PredefTimer is not enabled, the
function Gpt_GetPredefTimerValue shall raise the development error GPT_E_-
PARAM_PREDEF_TIMER.c()
[SWS_Gpt_00401] dIf the driver is in "sleep mode", the function Gpt_GetPredef-
TimerValue shall raise the runtime error GPT_E_MODE.c()
[SWS_Gpt_00403] dIf development error detection is enabled for GPT module:
If the parameter TimeValuePtr is a null pointer, the function Gpt_GetPredef-
TimerValue shall raise the error GPT_E_PARAM_POINTER.c(SRS_BSW_00369,
SRS_BSW_00323)

8.4 Callback notifications


Since the GPT is a driver module it doesn’t provide any callback functions for lower
layer modules.

8.5 Scheduled functions


None.

8.6 Expected interfaces


In this chapter all interfaces required from other modules are listed.

8.6.1 Mandatory interfaces

Note: This section defines all interfaces, which are required to fulfill the core function-
ality of the module.
[SWS_Gpt_00405] d
API function Description
Det_ReportRuntimeError Service to report runtime errors.

c(SRS_SPAL_00157, SRS_SPAL_12064)

41 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

8.6.2 Optional interfaces

This section defines all interfaces, which are required to fulfill an optional functionality
of the module.
[SWS_Gpt_00406] Definition of optional interfaces in module Gpt d
API Function Header File Description
Det_ReportError Det.h Service to report development errors.
EcuM_CheckWakeup EcuM.h This function can be called to check the given
wakeup sources. It will pass the argument to the
integrator function EcuM_CheckWakeupHook. It can
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.

c(SRS_SPAL_00157)
[SWS_Gpt_00326] dEcuM_CheckWakeup shall be called within the Interrupt Service
Routine, servicing the GPT channel wakeup event on wakeup-capable channels.c()
[SWS_Gpt_00327] dThe ISR’s, providing the wakeup events, shall be responsible for
resetting the interrupt flags (if needed by hardware).c(SRS_SPAL_12129)

8.6.3 Configurable interfaces

In this section, all interfaces are listed where the target function could be configured.
The target function is usually a callback function. The names of this kind of interfaces
are not fixed because they are configurable.

8.6.3.1 GPT Notification

[SWS_Gpt_00292] Definition of configurable interface Gpt_Notifica-


tion_<channel> d
Service Name Gpt_Notification_<channel>
Syntax void Gpt_Notification_<channel> (
void
)
Sync/Async Synchronous
Reentrancy GPT user implementation dependant.
Parameters (in) None
Parameters (inout) None
Parameters (out) None
Return value None
Description –
Available via Gpt.h

42 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

c(SRS_BSW_00375, SRS_SPAL_12069)
The notification prototype Gpt_Notification_<channel> is for the notification call-
back function and shall be implemented by the user.
The GPT module’s environment shall declare a separate notification for each channel
to avoid parameters in notification services and to improve run time efficiency.
[SWS_Gpt_00086] dThe callback notifications Gpt_Notification_<channel>
shall be configurable as pointers to user defined functions within the configuration
structure.c()
[SWS_Gpt_00209] dEach channel shall provide its own notification if configured.c
(SRS_BSW_00375, SRS_SPAL_12069)
[SWS_Gpt_00093] dWhen disabled, the GPT Driver will send no notification.c()
[SWS_Gpt_00233] dThe GPT Driver shall invoke a notification whenever the defined
target time of the channel is reached.c(SRS_SPAL_12067, SRS_Gpt_12120)
[SWS_Gpt_00206] dThe ISR’s, providing the timer events, shall be responsible for re-
setting the interrupt flags (if needed by hardware) and calling the according notification
function.c(SRS_SPAL_12129)
[SWS_Gpt_00362] dFor all available channels, callback functions have to be declared
by the configuration tool.c()

8.7 Error detection


[SWS_Gpt_00332] dIf the GptDevErrorDetect switch is enabled:
When a development error occurs the corresponding GPT function shall skip the de-
sired functionality (leave service without any action).c(SRS_SPAL_12448)

43 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

9 Sequence diagrams
All functions except Gpt_Init, Gpt_DeInit, Gpt_GetVersionInfo and Gpt_SetMode are
synchronous and re-entrant.

9.1 Gpt_Init
The ECU State Manager (EcuM) is responsible for calling the init function.
«module» «module»
EcuM Gpt

Gpt_Init(const
Gpt_ConfigType*)

Gpt_Init()

Figure 9.1: Sequence Diagram - Gpt_Init

9.2 GPT continuous mode


Channel 2 is configured as "Continuous Mode"

44 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Gpt User «module» «Peripheral»


Gpt GPT Hardware

Gpt_EnableNotification(Gpt_ChannelType)

Gpt_EnableNotification()

Gpt_StartTimer(Gpt_ChannelType,
Gpt_ValueType)
  
Gpt_StartTimer()
Timer has reached
target time (set by
Gpt_StartTimer) and
continuous running.

   
  
Gpt_Notification_Channel2()

Gpt_Notification_Channel2()

Gpt_GetTimeElapsed(Gpt_ValueType,
Gpt_ChannelType): Gpt_ValueType   

Gpt_GetTimeElapsed()
Timer has reached
target time (set by
Gpt_StartTimer) and
continuous running.

   
   
Gpt_Notification_Channel2()

Gpt_Notification_Channel2()

Timer has reached


target time (set by
Gpt_StartTimer) and
continuous running.

   
  
Gpt_Notification_Channel2()

Gpt_Notification_Channel2()

Gpt_StopTimer(Gpt_ChannelType)

   

Gpt_StopTimer()

       

Figure 9.2: Sequence Diagram - GPT continuous mode

9.3 GPT one-shot mode


Channel 1 is configured for "One-shot Mode"

45 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Gpt User «module» «Peripheral»


Gpt GPT Hardware

Gpt_EnableNotification(Gpt_ChannelType)

Gpt_EnableNotification()

Gpt_StartTimer(Gpt_ChannelType,
Gpt_ValueType)
  
Gpt_StartTimer()
Timer has reached target time
(set by Gpt_StartTimer)

  
Gpt_Notification_Channel1()

Gpt_Notification_Channel1()

 
          

Gpt_StartTimer(Gpt_ChannelType,
Gpt_ValueType)
  
Gpt_StartTimer()

Gpt_GetTimeRemaining(Gpt_ValueType,
Gpt_ChannelType): Gpt_ValueType

  


Gpt_GetTimeRemaining()

Gpt_StopTimer(Gpt_ChannelType)
   

Gpt_StopTimer()

Gpt_DeInit()        
      

Gpt_DeInit()

Figure 9.3: Sequence Diagram - GPT one-shot mode

9.4 Disable/Enable Notifications


The sequence diagram shown in this chapter explains the behavior of the driver, when
the notification is disabled, while the timer is still running in continuous mode. If the
notification is disabled, the user will not be informed, when the timer reaches the target
time the 2nd time (period 2).
This notification is discarded and not made up again, when the notification is re-
enabled.

46 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Gpt User «module» «Peripheral»


Gpt GPT Hardware

Gpt_EnableNotification(Gpt_ChannelType)

Gpt_EnableNotification()

Gpt_StartTimer(Gpt_ChannelType,
Gpt_ValueType)
  
Gpt_StartTimer()

Timer has reached


target time (set by
Gpt_StartTimer) and
continuous running.

  


    
Gpt_Notification_<channel>()

Gpt_Notification_<channel>()

Gpt_DisableNotification(Gpt_ChannelType)
Timer has reached
target time (set by
 Gpt_DisableNotification() Gpt_StartTimer) and
    continuous running.
    

  


     

 Gpt_EnableNotification(Gpt_ChannelType)
       
Timer has reached
Gpt_EnableNotification() target time (set by
Gpt_StartTimer) and
continuous running.

  


Gpt_Notification_<channel>()     

Gpt_Notification_<channel>()


    
       
 

Figure 9.4: Sequence Diagram - Disable/Enable Notifications

9.5 Wakeup
Note: Sequence charts on timer wakeup can be found in the ECU state manager
specification [5].

47 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

10 Configuration specification
In general, this chapter defines configuration parameters and their clustering into con-
tainers. In order to support the specification Chapter 10.1 describes fundamentals.
It also specifies a template (table) you shall use for the parameter specification. We
intend to leave Chapter 10.1 in the specification to guarantee comprehension.
Chapter 10.2 specifies the structure (containers) and the parameters of the module
GPT.
Chapter 10.3 specifies published information of the module GPT.

10.1 How to read this chapter


For details refer to the chapter 10.1 “Introduction to configuration specification” in
SWS_BSWGeneral.

10.2 Containers and configuration parameters


The following chapters summarize all configuration parameters. The detailed meanings
of the parameters describe Chapter 7 and Chapter 8.
[SWS_Gpt_00407] dThe GPT module shall reject configurations with partition map-
pings which are not supported by the implementation.c()

10.2.1 Gpt

SWS Item [ECUC_Gpt_00336]


Module Name Gpt
Description Configuration of the Gpt (General Purpose Timer) module.
Post-Build Variant Support true
Supported Config Variants VARIANT-POST-BUILD, VARIANT-PRE-COMPILE

Included Containers
Container Name Multiplicity Scope / Dependency
GptChannelConfigSet 1 This container is the base of a Configuration Set which contains
the configured GPT channels. This way, different configuration
sets can be defined for post-build process.
GptConfigurationOfOptApiServices 1 This container contains all configuration switches for configuring
optional API services of the GPT driver.
GptDriverConfiguration 1 This container contains the module-wide configuration
(parameters) of the GPT Driver

48 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

10.2.2 GptDriverConfiguration

SWS Item [ECUC_Gpt_00183]


Container Name GptDriverConfiguration
Parent Container Gpt
Description This container contains the module-wide configuration (parameters) of the GPT Driver
Configuration Parameters

SWS Item [ECUC_Gpt_00321]


Parameter Name GptDevErrorDetect
Parent Container GptDriverConfiguration
Description Switches the development error detection and notification on or off.
• true: detection and notification is enabled.
• false: detection and notification is disabled.
Multiplicity 1
Type EcucBooleanParamDef
Default value false
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00335]


Parameter Name GptPredefTimer100us32bitEnable
Parent Container GptDriverConfiguration
Description Enables/disables the GPT Predef Timer 100µs32bit.
Multiplicity 1
Type EcucBooleanParamDef
Default value –
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: ECU

SWS Item [ECUC_Gpt_00334]


Parameter Name GptPredefTimer1usEnablingGrade
Parent Container GptDriverConfiguration
Description Specifies the grade of enabling the GPT Predef Timers with 1µs tick duration.
Multiplicity 1
Type EcucEnumerationParamDef
Range GPT_PREDEF_ 16bit timer enabled
TIMER_1US_16BIT_ENABLED
GPT_PREDEF_ 16 and 24bit timers enabled
TIMER_1US_16_24BIT_
ENABLED
5

49 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
GPT_PREDEF_ 16, 24 and 32bit timers enabled
TIMER_1US_16_24_32BIT_
ENABLED
GPT_PREDEF_TIMER_1US_ disabled
DISABLED
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: ECU

SWS Item [ECUC_Gpt_00322]


Parameter Name GptReportWakeupSource
Parent Container GptDriverConfiguration
Description Enables/Disables wakeup source reporting.
Multiplicity 1
Type EcucBooleanParamDef
Default value –
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00337]


Parameter Name GptEcucPartitionRef
Parent Container GptDriverConfiguration
Description Maps the GPT driver to zero or multiple ECUC partitions to make the driver API
available in the according partition. Depending on the addressed timer resource the
interfaces operate as follows:
a) In case of partition local timer resources (n:1 mapping) the API operates as an
independent instance in the according ECUC partition.
b) In case of global timer resources (1:m mapping) the API operates on the global timer
resource either by protected access to the resource or by implementing an according
kernel.
Multiplicity 0..*
Type Reference to EcucPartition
Post-Build Variant Multiplicity true
Post-Build Variant Value true
Multiplicity Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: ECU

50 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

SWS Item [ECUC_Gpt_00338]


Parameter Name GptKernelEcucPartitionRef
Parent Container GptDriverConfiguration
Description Maps the GPT kernel to zero or one ECUC partitions to assign the driver kernel to a
certain core. The ECUC partition referenced is a subset of the ECUC partitions where
the GPT driver is mapped to.
Note: The kernel reference shall not be set in case the GPT driver is implemented
without a kernel (refer to definition of GptEcucPartitionRef).
Multiplicity 0..1
Type Reference to EcucPartition
Post-Build Variant Multiplicity true
Post-Build Variant Value true
Multiplicity Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: ECU

Included Containers
Container Name Multiplicity Scope / Dependency
GptClockReferencePoint 1..* This container contains a parameter, which represents a
reference to a container of the type McuClockReferencePoint
(defined in module MCU).

51 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

GptConfigurationOfOptApiServices:
EcucParamConfContainerDef
+container GptChannelConfigSet:
Gpt: EcucModuleDef upperMultiplicity = 1 GptChannelConfiguration:
EcucParamConfContainerDef +subContainer EcucParamConfContainerDef
upperMultiplicity = 1 lowerMultiplicity = 1
lowerMultiplicity = 0 lowerMultiplicity = 1 upperMultiplicity = *
+container upperMultiplicity = 1 lowerMultiplicity = 1

GptChannelEcucPartitionRef:
EcucReferenceDef +reference

lowerMultiplicity = 0
upperMultiplicity = *

+destination
+container
GptEcucPartitionRef: EcucPartition:
GptDriverConfiguration: +reference EcucReferenceDef +destination EcucParamConfContainerDef
EcucParamConfContainerDef
lowerMultiplicity = 0 lowerMultiplicity = 0
lowerMultiplicity = 1 upperMultiplicity = * upperMultiplicity = *
upperMultiplicity = 1
+destination
GptKernelEcucPartitionRef:
+reference
EcucReferenceDef

lowerMultiplicity = 0
upperMultiplicity = 1 GPT_PREDEF_TIMER_1US_DISABLED:
EcucEnumerationLiteralDef
+literal
GptPredefTimer1usEnablingGrade:
EcucEnumerationParamDef
+literal GPT_PREDEF_TIMER_1US_16BIT_ENABLED:
EcucEnumerationLiteralDef

+parameter

+literal GPT_PREDEF_TIMER_1US_16_24BIT_ENABLED:
EcucEnumerationLiteralDef

+literal
GPT_PREDEF_TIMER_1US_16_24_32BIT_ENABLED:
EcucEnumerationLiteralDef
+parameter GptPredefTimer100us32bitEnable:
EcucBooleanParamDef

GptDevErrorDetect:
+parameter EcucBooleanParamDef

defaultValue = false

+parameter
GptReportWakeupSource:
EcucBooleanParamDef

+subContainer GptClockReferencePoint:
EcucParamConfContainerDef

lowerMultiplicity = 1
upperMultiplicity = *

Figure 10.1: Scope of the GPT Driver configuration

52 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Figure 10.2: Scope of the GPT Clock Configuration

[SWS_Gpt_CONSTR_00001] dThe ECUC partitions referenced by GptKernelEcuc-


PartitionRef shall be a subset of the ECUC partitions referenced by GptEcucPartition-
Ref.c()
[SWS_Gpt_CONSTR_00003] dIf GptEcucPartitionRef references one or more ECUC
partitions, GptKernelEcucPartitionRef shall have a multiplicity of one and reference one
of these ECUC partitions as well.c()
[SWS_Gpt_CONSTR_00005] dIn case of partition local timer resources, the module
will operate as an independent instance in each of the partitions, means the called API
will only target the partition it is called in.c()

10.2.3 GptClockReferencePoint

SWS Item [ECUC_Gpt_00329]


Container Name GptClockReferencePoint
Parent Container GptDriverConfiguration
Description This container contains a parameter, which represents a reference to a container of the
type McuClockReferencePoint (defined in module MCU). A container is needed to
support multiple clock references (hardware dependent).
Configuration Parameters

53 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

SWS Item [ECUC_Gpt_00330]


Parameter Name GptClockReference
Parent Container GptClockReferencePoint
Description Reference to a container of the type McuClockReferencePoint, to select an input clock.
The configuration editor for the GPT module can support the integrator by only allowing
a selection of those clock reference points that can be connected physically to the GPT
hardware peripheral. The desired frequency (desired by GPT) has to be the same as
the selected and provided frequency of the MCU configuration. This has to be checked
automatically.
Multiplicity 1
Type Reference to McuClockReferencePoint
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

No Included Containers

GptClockReferencePoint: McuClockReferencePoint:
EcucParamConfContainerDef +reference GptClockReference: +destination EcucParamConfContainerDef
EcucReferenceDef
lowerMultiplicity = 1 upperMultiplicity = *
upperMultiplicity = * lowerMultiplicity = 1

Figure 10.3: GptClockreferencePoint

10.2.4 GptChannelConfigSet

SWS Item [ECUC_Gpt_00269]


Container Name GptChannelConfigSet
Parent Container Gpt
Description This container is the base of a Configuration Set which contains the configured GPT
channels. This way, different configuration sets can be defined for post-build process.
Configuration Parameters

Included Containers
Container Name Multiplicity Scope / Dependency
GptChannelConfiguration 1..* This container contains the channel specific configuration of the
GPT Driver.

54 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

10.2.5 GptChannelConfiguration

SWS Item [ECUC_Gpt_00184]


Container Name GptChannelConfiguration
Parent Container GptChannelConfigSet
Description Configuration of an individual GPT channel.
Configuration Parameters

SWS Item [ECUC_Gpt_00308]


Parameter Name GptChannelId
Parent Container GptChannelConfiguration
Description Channel Id of the GPT channel. This value will be assigned to the symbolic name
derived of the GptChannelConfiguration container short name.
Multiplicity 1
Type EcucIntegerParamDef (Symbolic Name generated for this parameter)
Range 0 .. 4294967295
Default value –
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: ECU

SWS Item [ECUC_Gpt_00309]


Parameter Name GptChannelMode
Parent Container GptChannelConfiguration
Description Specifies the behavior of the timer channel after the target time is reached.
Multiplicity 1
Type EcucEnumerationParamDef
Range GPT_CH_MODE_CONTINUOUS After reaching the target time, the timer
continues running with the value "zero" again.
GPT_CH_MODE_ONESHOT After reaching the target time, the timer stops
automatically (timer expired).
Post-Build Variant Value true
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time –
Post-build time X VARIANT-POST-BUILD
Scope / Dependency scope: ECU

SWS Item [ECUC_Gpt_00331]


Parameter Name GptChannelTickFrequency
Parent Container GptChannelConfiguration
Description Specifies the tick frequency of the timer channel in Hz.
Multiplicity 1
Type EcucFloatParamDef
Range [0 .. INF]
Default value –
5

55 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
Post-Build Variant Value true
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time –
Post-build time X VARIANT-POST-BUILD
Scope / Dependency scope: ECU

SWS Item [ECUC_Gpt_00332]


Parameter Name GptChannelTickValueMax
Parent Container GptChannelConfiguration
Description Maximum value in ticks, the timer channel is able to count. With the next tick, the timer
rolls over to zero.
Multiplicity 1
Type EcucIntegerParamDef
Range 0 .. 18446744073709551615
Default value –
Post-Build Variant Value true
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time –
Post-build time X VARIANT-POST-BUILD
Scope / Dependency scope: ECU

SWS Item [ECUC_Gpt_00311]


Parameter Name GptEnableWakeup
Parent Container GptChannelConfiguration
Description Enables wakeup capability of MCU for a channel.
Multiplicity 1
Type EcucBooleanParamDef
Default value –
Post-Build Variant Value true
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time –
Post-build time X VARIANT-POST-BUILD
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00312]


Parameter Name GptNotification
Parent Container GptChannelConfiguration
Description Function pointer to callback function (for non-wakeup notification)
Multiplicity 0..1
Type EcucFunctionNameDef
Default value –
Regular Expression –
Post-Build Variant Multiplicity true
Post-Build Variant Value true
Multiplicity Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time –
Post-build time X VARIANT-POST-BUILD
5

56 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time –
Post-build time X VARIANT-POST-BUILD
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00333]


Parameter Name GptChannelClkSrcRef
Parent Container GptChannelConfiguration
Description Reference to the GptClockReferencePoint from which the channel clock is derived.
Multiplicity 1
Type Reference to GptClockReferencePoint
Post-Build Variant Value true
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time –
Post-build time X VARIANT-POST-BUILD
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00339]


Parameter Name GptChannelEcucPartitionRef
Parent Container GptChannelConfiguration
Description Maps a GPT channel to zero or multiple ECUC partitions to limit the access to this
channel group. The ECUC partitions referenced are a subset of the ECUC partitions
where the GPT driver is mapped to.
Multiplicity 0..*
Type Reference to EcucPartition
Post-Build Variant Multiplicity true
Post-Build Variant Value true
Multiplicity Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: ECU

Included Containers
Container Name Multiplicity Scope / Dependency
GptWakeupConfiguration 0..1 Function pointer to callback function (for non-wakeup
notification).

57 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

Gpt: EcucModuleDef +container GptDriverConfiguration:


upperMultiplicity = 1 EcucParamConfContainerDef
lowerMultiplicity = 0
lowerMultiplicity = 1
upperMultiplicity = 1

+container +subContainer

GptChannelConfigSet: GptClockReferencePoint:
EcucParamConfContainerDef EcucParamConfContainerDef

lowerMultiplicity = 1 lowerMultiplicity = 1
upperMultiplicity = 1 upperMultiplicity = *

+destination

+subContainer

GptChannelConfiguration: +reference GptChannelClkSrcRef:


EcucParamConfContainerDef EcucReferenceDef

upperMultiplicity = *
lowerMultiplicity = 1

GptChannelId:
+parameter EcucIntegerParamDef

min = 0
max = 4294967295
symbolicNameValue = true

GptEnableWakeup:
+parameter EcucBooleanParamDef

GptNotification:
+parameter EcucFunctionNameDef

lowerMultiplicity = 0
upperMultiplicity = 1

GPT_CH_MODE_CONTINUOUS:
+literal
GptChannelMode: EcucEnumerationLiteralDef
+parameter EcucEnumerationParamDef

+literal GPT_CH_MODE_ONESHOT:
EcucEnumerationLiteralDef

GptWakeupConfiguration: GptWakeupSourceRef:
+reference
+subContainer EcucParamConfContainerDef EcucReferenceDef

lowerMultiplicity = 0 requiresSymbolicNameValue = true


upperMultiplicity = 1
+destination

GptChannelTickFrequency: EcuMWakeupSource:
+parameter EcucFloatParamDef EcucParamConfContainerDef

min = 0 lowerMultiplicity = 1
max = INF upperMultiplicity = 32

GptChannelTickValueMax:
+parameter EcucIntegerParamDef

min = 0
max = 18446744073709551615

GptChannelEcucPartitionRef: EcucPartition:
+reference +destination
EcucReferenceDef EcucParamConfContainerDef
lowerMultiplicity = 0 lowerMultiplicity = 0
upperMultiplicity = * upperMultiplicity = *

Figure 10.4: GptChannelConfiguration

[SWS_Gpt_CONSTR_00002] dThe ECUC partitions referenced by GptGroupEcuc-


PartitionRef shall be a subset of the ECUC partitions referenced by GptEcucPartition-
Ref.c()
[SWS_Gpt_CONSTR_00004] dIf GptEcucPartitionRef references one or more ECUC
partitions, GptKernelEcucPartitionRef shall have a multiplicity of greater than zero and
reference one or several of these ECUC partitions as well.c()

58 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

10.2.6 GptWakeupConfiguration

SWS Item [ECUC_Gpt_00235]


Container Name GptWakeupConfiguration
Parent Container GptChannelConfiguration
Description Function pointer to callback function (for wakeup notification).
Configuration Parameters

SWS Item [ECUC_Gpt_00313]


Parameter Name GptWakeupSourceRef
Parent Container GptWakeupConfiguration
Description In case the wakeup-capability is true this value is transmitted to the Ecu State Manager.
Implementation Type: reference to EcuM_WakeupSourceType
Multiplicity 1
Type Symbolic name reference to EcuMWakeupSource
Post-Build Variant Value true
Value Configuration Class Pre-compile time X VARIANT-PRE-COMPILE
Link time –
Post-build time X VARIANT-POST-BUILD
Scope / Dependency scope: local

No Included Containers

10.2.7 GptConfigurationOfOptApiServices

SWS Item [ECUC_Gpt_00193]


Container Name GptConfigurationOfOptApiServices
Parent Container Gpt
Description This container contains all configuration switches for configuring optional API services
of the GPT driver.
Configuration Parameters

SWS Item [ECUC_Gpt_00314]


Parameter Name GptDeinitApi
Parent Container GptConfigurationOfOptApiServices
Description Adds / removes the service Gpt_DeInit() from the code.
Multiplicity 1
Type EcucBooleanParamDef
Default value –
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

59 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

SWS Item [ECUC_Gpt_00315]


Parameter Name GptEnableDisableNotificationApi
Parent Container GptConfigurationOfOptApiServices
Description Adds / removes the services Gpt_EnableNotification() and Gpt_DisableNotification
from the code.
Multiplicity 1
Type EcucBooleanParamDef
Default value –
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00317]


Parameter Name GptTimeElapsedApi
Parent Container GptConfigurationOfOptApiServices
Description Adds / removes the service Gpt_GetTimeElapsed() from the code
Multiplicity 1
Type EcucBooleanParamDef
Default value –
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00318]


Parameter Name GptTimeRemainingApi
Parent Container GptConfigurationOfOptApiServices
Description Adds / removes the service Gpt_GetTimeRemaining() from the code.
Multiplicity 1
Type EcucBooleanParamDef
Default value –
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00319]


Parameter Name GptVersionInfoApi
Parent Container GptConfigurationOfOptApiServices
Description Adds / removes the service Gpt_GetVersionInfo() from the code.
Multiplicity 1
Type EcucBooleanParamDef
Default value false
5

60 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

4
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

SWS Item [ECUC_Gpt_00320]


Parameter Name GptWakeupFunctionalityApi
Parent Container GptConfigurationOfOptApiServices
Description Adds / removes the services Gpt_SetMode(), Gpt_EnableWakeup() Gpt_Disable
Wakeup() and Gpt_CheckWakeup() from the code.
Multiplicity 1
Type EcucBooleanParamDef
Default value –
Post-Build Variant Value false
Value Configuration Class Pre-compile time X All Variants
Link time –
Post-build time –
Scope / Dependency scope: local

No Included Containers

Gpt: EcucModuleDef GptConfigurationOfOptApiServices:


+container EcucParamConfContainerDef
upperMultiplicity = 1
lowerMultiplicity = 0 upperMultiplicity = 1
lowerMultiplicity = 1

+parameter GptDeinitApi:
EcucBooleanParamDef
GptEnableDisableNotificationApi:
EcucBooleanParamDef +parameter

+parameter GptTimeElapsedApi:
EcucBooleanParamDef
GptWakeupFunctionalityApi: +parameter
EcucBooleanParamDef

GptTimeRemainingApi:
GptVersionInfoApi: +parameter +parameter EcucBooleanParamDef
EcucBooleanParamDef

defaultValue = false

Figure 10.5: GptConfigurationOfOptApiServices

10.3 Published Information


For details refer to the chapter 10.3 “Published Information” in SWS_BSWGeneral.
[SWS_Gpt_00380] dThe standardized common published parameters as required by
[SRS_BSW_00402] in the SRS General on Basic Software Modules [7] shall be pub-

61 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

lished within the header file of this module and need to be provided in the BSW Module
Description. The according module abbreviation can be found in the List of Basic Soft-
ware Modules [7].c()
Additional module-specific published parameters are listed below if applicable.

62 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver


Specification of GPT Driver
AUTOSAR CP R23-11

A Not applicable requirements


[SWS_Gpt_NA_00381] dThese requirements are not applicable to this specifica-
tion.c(SRS_BSW_00344, SRS_BSW_00159, SRS_BSW_00167, SRS_BSW_00170,
SRS_BSW_00398, SRS_BSW_00416, SRS_BSW_00437, SRS_BSW_00168, SRS_-
BSW_00423, SRS_BSW_00424, SRS_BSW_00425, SRS_BSW_00426, SRS_-
BSW_00427, SRS_BSW_00428, SRS_BSW_00429, SRS_BSW_00432, SRS_-
BSW_00433, SRS_BSW_00422, SRS_BSW_00417, SRS_BSW_00161, SRS_-
BSW_00162, SRS_BSW_00005, SRS_BSW_00415, SRS_BSW_00325, SRS_-
BSW_00342, SRS_BSW_00160, SRS_BSW_00007, SRS_BSW_00413, SRS_-
BSW_00347, SRS_BSW_00307, SRS_BSW_00373, SRS_BSW_00335, SRS_-
BSW_00348, SRS_BSW_00353, SRS_BSW_00328, SRS_BSW_00006, SRS_-
BSW_00439, SRS_BSW_00357, SRS_BSW_00377, SRS_BSW_00378, SRS_-
BSW_00306, SRS_BSW_00308, SRS_BSW_00309, SRS_BSW_00359, SRS_-
BSW_00360, SRS_BSW_00440, SRS_BSW_00330, SRS_BSW_00331, SRS_-
BSW_00009, SRS_BSW_00172, SRS_BSW_00010, SRS_BSW_00333, SRS_-
BSW_00321, SRS_BSW_00341, SRS_BSW_00334, SRS_SPAL_12462, SRS_-
SPAL_12463, SRS_SPAL_12068, SRS_SPAL_12075, SRS_SPAL_12064, SRS_-
SPAL_12077, SRS_SPAL_12078, SRS_SPAL_12092, SRS_SPAL_12265)

63 of 63 Document ID 30: AUTOSAR_CP_SWS_GPTDriver

You might also like