MCUSW
Loading...
Searching...
No Matches
GPT Configuration

Introduction

This files defines GPT MCAL configuration structures

Data Structures

struct  Gpt_ChannelConfigType
 Configuration per channel. More...
 
struct  Gpt_ChannelConfigType_PC
 SPI sequence config structure parameters Pre-Compile only. More...
 
struct  Gpt_ConfigType
 global configuration of the driver
More...
 
struct  Gpt_RegisterReadbackType
 GPT register readback structure. More...
 

Variables

Gpt_ChannelMode Gpt_ChannelConfigType::channelMode
 
uint32 Gpt_ChannelConfigType::tickValueMax
 
uint8 Gpt_ChannelConfigType::enableWakeupFlag
 
Gpt_NotifyType Gpt_ChannelConfigType::fnPtrNotifyFunction
 
EcuM_WakeupSourceType Gpt_ChannelConfigType::wakeupSourceRef
 
uint32 Gpt_ChannelConfigType::prescale
 
Gpt_ChannelType Gpt_ChannelConfigType_PC::channelId
 
const Gpt_ChannelConfigTypeGpt_ConfigType::ChannelCfgPtr
 
uint32 Gpt_ConfigType::channelCount
 
uint32 Gpt_RegisterReadbackType::gptRev
 
uint32 Gpt_RegisterReadbackType::gptTtgr
 
uint32 Gpt_RegisterReadbackType::gptTimerSynCtrl
 
uint32 Gpt_RegisterReadbackType::gptTiocpCfg
 
uint32 Gpt_RegisterReadbackType::gptTclr
 

Macros

#define GPT_CH_GPTIMER1   (0U)
 GP timer 1 instance.
 
#define GPT_CH_GPTIMER2   (1U)
 GP timer 2 instance.
 
#define GPT_CH_GPTIMER3   (2U)
 GP timer 3 instance.
 
#define GPT_CH_GPTIMER4   (3U)
 GP timer 4 instance.
 
#define GPT_CH_GPTIMER5   (4U)
 GP timer 5 instance.
 
#define GPT_CH_GPTIMER6   (5U)
 GP timer 6 instance.
 
#define GPT_CH_GPTIMER7   (6U)
 GP timer 7 instance.
 
#define GPT_CH_GPTIMER8   (7U)
 GP timer 8 instance.
 
#define GPT_CH_GPTIMER9   (8U)
 GP timer 9 instance.
 
#define GPT_CH_GPTIMER10   (9U)
 GP timer 10 instance.
 
#define GPT_CH_GPTIMER11   (10U)
 GP timer 11 instance.
 
#define GPT_CH_GPTIMER12   (11U)
 GP timer 12 instance.
 
#define GPT_CH_GPTIMER13   (12U)
 GP timer 13 instance.
 
#define GPT_CH_GPTIMER14   (13U)
 GP timer 14 instance.
 
#define GPT_CH_GPTIMER15   (14U)
 GP timer 15 instance.
 
#define GPT_CH_GPTIMER16   (15U)
 GP timer 16 instance.
 
#define GPT_CH_GPTIMER17   (16U)
 GP timer 17 instance.
 
#define GPT_CH_GPTIMER18   (17U)
 GP timer 18 instance.
 
#define GPT_CH_GPTIMER19   (18U)
 GP timer 19 instance.
 
#define GPT_CH_GPTIMER20   (19U)
 GP timer 20 instance.
 
#define GPT_CH_GPTIMER21   (20U)
 GP timer 21 instance.
 
#define GPT_CH_GPTIMER22   (21U)
 GP timer 22 instance.
 
#define GPT_CH_GPTIMER23   (22U)
 GP timer 23 instance.
 
#define GPT_CH_GPTIMER24   (23U)
 GP timer 24 instance.
 
#define GPT_CH_GPTIMER25   (24U)
 GP timer 25 instance.
 
#define GPT_CH_GPTIMER26   (25U)
 GP timer 26 instance.
 
#define GPT_CH_GPTIMER27   (26U)
 GP timer 27 instance.
 
#define GPT_CH_GPTIMER28   (27U)
 GP timer 28 instance.
 
#define GPT_CH_GPTIMER29   (28U)
 GP timer 29 instance.
 
#define GPT_CH_GPTIMER30   (29U)
 GP timer 30 instance.
 
#define GPT_CH_GPTIMER_MAX   (30U)
 maximum GP timer channels available
 
#define GPT_PRE_COMPILE_VARIANT   (STD_OFF)
 GPT Pre-Compile Build Variant flag. STD_ON for VariantPreCompile / STD_OFF for VariantPostBuild.
 

GPT Service Ids

The Service Id is one of the argument to Det_ReportError function and is used to identify the source of the error

enum  Gpt_ModeType { GPT_MODE_NORMAL = 0U , GPT_MODE_SLEEP = 1U , GPT_MODE_INVALID = 0xFFU }
 List of process modes
More...
 
enum  Gpt_PredefTimerType { GPT_PREDEF_TIMER_1US_16BIT = 0U , GPT_PREDEF_TIMER_1US_24BIT = 1U , GPT_PREDEF_TIMER_1US_32BIT = 2U , GPT_PREDEF_TIMER_100US_32BIT = 3U }
 Type for GPT Predef Timers. More...
 
enum  Gpt_PrescaleValueType {
  GPT_PRESCALER_CLK_DIV_BY_2 = 0x0U , GPT_PRESCALER_CLK_DIV_BY_4 = 0x1U , GPT_PRESCALER_CLK_DIV_BY_8 = 0x2U , GPT_PRESCALER_CLK_DIV_BY_16 = 0x3U ,
  GPT_PRESCALER_CLK_DIV_BY_32 = 0x4U , GPT_PRESCALER_CLK_DIV_BY_64 = 0x5U , GPT_PRESCALER_CLK_DIV_BY_128 = 0x6U , GPT_PRESCALER_CLK_DIV_BY_256 = 0x7U ,
  GPT_PRESCALER_NO_PRESCALE = 0xFFU
}
 List of Prescale values for General purpose timer channels The timer counter is prescaled with the value 2^(PTV+1). Example: PTV = 3, counter increases value (if started) after 16 functional clock periods Note: Not applicable to GPT Predef timers. More...
 
enum  Gpt_ChannelMode { GPT_CH_MODE_CONTINUOUS = 0U , GPT_CH_MODE_ONESHOT }
 GPT channel mode macros.
More...
 
enum  Gpt_ChannelStateType {
  GPT_UNINITIALIZED = 0U , GPT_INITIALIZED , GPT_RUNNING , GPT_STOPPED ,
  GPT_EXPIRED
}
 GPT channel state GPT will be in one of this state during its lifetime. More...
 
typedef uint32 Gpt_ChannelType
 Type describing the Gpt channel.
 
typedef uint32 Gpt_ValueType
 Type describing the timeout value

 
typedef void(* Gpt_NotifyType) (void)
 Notification callback function pointer

 
void Gpt_GetVersionInfo (Std_VersionInfoType *VersionInfoPtr)
 This service returns the version information of this module.
 
void Gpt_Init (const Gpt_ConfigType *CfgPtr)
 This service initializes all the configured Gpt channels. This will set the state of the each channel to"initialized", also set the Gpt driver state to "Normal".
 
void Gpt_DeInit (void)
 This service deinitializes the RTI used by Gpt driver to the power on reset state. The Gpt driver state is changed to "Uninitialized" state". All the channel registers are cleared to stop the timer channels. API will disable all interrupt notifications, wakeup interrupts.
 
Gpt_ValueType Gpt_GetTimeElapsed (Gpt_ChannelType Channel)
 Gpt_GetTimeElapsed will return the time elapsed for channel which is referenced. The user can configure the channel in two modes, One-shot and Continuous mode. In one shot mode, if the timer is in stopped state, the function will return time value at the moment of stopping. If the timer is expired, the function will return the target time configured for the channel. In Continuous Mode - The elapsed time value will be the value relative to last occurrence.
 
Gpt_ValueType Gpt_GetTimeRemaining (Gpt_ChannelType Channel)
 Gpt_GetTimeRemaining will return the timer value remaining until the target time will be reached next time. The remaining time is target time minus time already elapsed. In one shot mode, if the timer is in stopped state, the function will return remaining time value at the moment of stopping. If the timer is expired, the function will return 0.
 
void Gpt_StartTimer (Gpt_ChannelType Channel, Gpt_ValueType Value)
 Gpt_StartTimer will start the selected timer channel with defined target time. If the timer channel is enabled for interrupt notification, then interrupt notification will be triggered after expiration of the selected timer channel. In one shot mode, if the timer is expired then the channel will be stopped in interrupt subroutine. The selected channel will be moved to "Running" state after calling this function.
 
void Gpt_StopTimer (Gpt_ChannelType Channel)
 Gpt_StopTimer will stop the selected timer channel.This will clear all the registers corresponding to the selected channel. The state of the timer channel will be changed to "Stopped".If the channel is in state "Initialized","Expired","Stopped" before calling this function, the function will be left without any action.
 
void Gpt_EnableNotification (Gpt_ChannelType Channel)
 Gpt_EnableNotification will enable the interrupt notification for the selected channel. The SETINT bit in RTI Set interrupt register will be Set to enable the Compare interrupt. The interrupt is triggered when Free running counter value matches with compare register value.
 
void Gpt_DisableNotification (Gpt_ChannelType Channel)
 Gpt_DisableNotification will disable the compare interrupt notification for the selected channel. The SETINT bit in RTI Set interrupt register will be cleared to disable the Compare interrupt. The interrupt is triggered when Free running counter value matches with compare register value.
 
void Gpt_SetMode (Gpt_ModeType Mode)
 Gpt_SetMode will set the operation mode of the Gpt driver to the given set mode parameter. If the parameter mode = Normal, then the function will enable the interrupt notifications for all the channels which are configured for notification and notification is enabled. If the Mode = Sleep, the function will enable the wakeup interrupts for all channels which are configured for wakeup and disable all other channels. All the timer channels which are running will be stopped in this mode.
 
void Gpt_DisableWakeup (Gpt_ChannelType Channel)
 Gpt_DisableWakeup will disable the wakeup interrupt of the referenced channel. The function will save the attribute "wakeup disable" of the channel.
 
void Gpt_EnableWakeup (Gpt_ChannelType Channel)
 Gpt_EnableWakeup will enable the wakeup interrupt of the referenced channel. The function will save the attribute "wakeup enable" of the channel which only affects the wakeup interrupt when the driver is in Sleep mode.
 
void Gpt_CheckWakeup (EcuM_WakeupSourceType WakeupSource)
 Gpt_CheckWakeup will check if wakeup capable timer channel is source for a wakeup event and call EcuM_SetWakeupEvent to indicate the valid timer wakeup event to the EcuM.
 
Std_ReturnType Gpt_RegisterReadback (Gpt_ChannelType GptChannel, Gpt_RegisterReadbackType *RegRbPtr)
 This function reads the important registers of the hardware unit and returns the value in the structure.
 
Std_ReturnType Gpt_GetPredefTimerValue (Gpt_PredefTimerType PredefTimer, uint32 *TimeValuePtr)
 

GPT DEM Error codes to report

Pre-compile switches for enabling/disabling DEM events

const struct Gpt_ConfigType_s GptChannelConfigSet
 GPT Configuration.
 
const uint32 Gpt_TimerBaseAddr [GPT_CH_GPTIMER_MAX]
 Base Address of the timer peripherals.
 
void Gpt_Ch12Isr (void)
 GPT Channel ISR.
 
void Gpt_Ch7Isr (void)
 
void Gpt_Ch10Isr (void)
 
void Gpt_Ch16Isr (void)
 
void Gpt_Ch30Isr (void)
 
#define GPT_E_HARDWARE_ERROR
 Hardware failed.
 
#define GPT_REGISTER_READBACK_API   (STD_ON)
 Enable/disable GPT register read back API.
 
#define GptConf_GptChannelConfiguration_TIMER1   (11U)
 Channel ID Configured channel ID(s)
 
#define GptConf_GptChannelConfiguration_MCU_TIMER6   (6U)
 
#define GptConf_GptChannelConfiguration_MCU_TIMER9   (9U)
 
#define GptConf_GptChannelConfiguration_TIMER5   (15U)
 
#define GptConf_GptChannelConfiguration_TIMER19   (29U)
 

GPT Driver ISR category level

Definitions for GPT Driver ISR ISR category level.

#define GPT_ISR_VOID   (0x00U)
 void ISR type
 
#define GPT_ISR_CAT1   (0x01U)
 Category 1 ISR type.
 
#define GPT_ISR_CAT2   (0x02U)
 Category 2 ISR type.
 
#define GPT_DEV_ERROR_DETECT   (STD_ON)
 Enable/disable GPT dev detect error.
 
#define GPT_ISR_TYPE   (GPT_ISR_CAT1)
 ISR type.
 
#define GPT_REPORT_WAKEUP_SOURCE   (STD_ON)
 Enable/disable wakeup source in wakeup related APIs.
 

Pre-Compile Switches for API Services

#define GPT_VERSION_INFO_API   (STD_ON)
 Enable/disable GPT get version info API.
 
#define GPT_DEINIT_API   (STD_ON)
 Enable/disable GPT deinit API.
 
#define GPT_TIME_ELAPSED_API   (STD_ON)
 Enable/disable GPT get time elapsed API.
 
#define GPT_TIME_REMAINING_API   (STD_ON)
 Enable/disable GPT time remaining API.
 
#define GPT_ENABLE_DISABLE_NOTIFICATION_API   (STD_ON)
 Enable/disable GPT enable/disable GPT API.
 
#define GPT_WAKEUP_FUNCTIONALITY_API   (STD_ON)
 Enable/disable GPT wakeup functionality API.
 
#define GPT_MAX_CHANNELS   (5U)
 No. of channels configured for GPT driver.
 
#define GPT_PREDEF_TIMER_TYPE   (GPT_PREDEF_TIMER_DISABLED)
 Macro for enabling predefined timers This is in case to disable GPT Predef Timers if timers can not be supported by hardware reasons.
 
#define GPT_PREDEF_TIMER_1US_ENABLING_GRADE   (GPT_PREDEF_TIMER_1US_DISABLED)
 : Specifies the grade of enabling the GPT Predef Timers with 1us tick duration
 
#define GPT_OS_COUNTER_ID   ((CounterType)OsCounter_0)
 Counter ID for counter used to count wait ticks.
 
#define GPT_TIMEOUT_DURATION   (32000U)
 ETH timeout. Each tick is 31.25us (for 32K Counter). Wait for 5s which comes to below value.
 

Macro Definition Documentation

◆ GPT_CH_GPTIMER1

#define GPT_CH_GPTIMER1   (0U)

GP timer 1 instance.

◆ GPT_CH_GPTIMER2

#define GPT_CH_GPTIMER2   (1U)

GP timer 2 instance.

◆ GPT_CH_GPTIMER3

#define GPT_CH_GPTIMER3   (2U)

GP timer 3 instance.

◆ GPT_CH_GPTIMER4

#define GPT_CH_GPTIMER4   (3U)

GP timer 4 instance.

◆ GPT_CH_GPTIMER5

#define GPT_CH_GPTIMER5   (4U)

GP timer 5 instance.

◆ GPT_CH_GPTIMER6

#define GPT_CH_GPTIMER6   (5U)

GP timer 6 instance.

◆ GPT_CH_GPTIMER7

#define GPT_CH_GPTIMER7   (6U)

GP timer 7 instance.

◆ GPT_CH_GPTIMER8

#define GPT_CH_GPTIMER8   (7U)

GP timer 8 instance.

◆ GPT_CH_GPTIMER9

#define GPT_CH_GPTIMER9   (8U)

GP timer 9 instance.

◆ GPT_CH_GPTIMER10

#define GPT_CH_GPTIMER10   (9U)

GP timer 10 instance.

◆ GPT_CH_GPTIMER11

#define GPT_CH_GPTIMER11   (10U)

GP timer 11 instance.

◆ GPT_CH_GPTIMER12

#define GPT_CH_GPTIMER12   (11U)

GP timer 12 instance.

◆ GPT_CH_GPTIMER13

#define GPT_CH_GPTIMER13   (12U)

GP timer 13 instance.

◆ GPT_CH_GPTIMER14

#define GPT_CH_GPTIMER14   (13U)

GP timer 14 instance.

◆ GPT_CH_GPTIMER15

#define GPT_CH_GPTIMER15   (14U)

GP timer 15 instance.

◆ GPT_CH_GPTIMER16

#define GPT_CH_GPTIMER16   (15U)

GP timer 16 instance.

◆ GPT_CH_GPTIMER17

#define GPT_CH_GPTIMER17   (16U)

GP timer 17 instance.

◆ GPT_CH_GPTIMER18

#define GPT_CH_GPTIMER18   (17U)

GP timer 18 instance.

◆ GPT_CH_GPTIMER19

#define GPT_CH_GPTIMER19   (18U)

GP timer 19 instance.

◆ GPT_CH_GPTIMER20

#define GPT_CH_GPTIMER20   (19U)

GP timer 20 instance.

◆ GPT_CH_GPTIMER21

#define GPT_CH_GPTIMER21   (20U)

GP timer 21 instance.

◆ GPT_CH_GPTIMER22

#define GPT_CH_GPTIMER22   (21U)

GP timer 22 instance.

◆ GPT_CH_GPTIMER23

#define GPT_CH_GPTIMER23   (22U)

GP timer 23 instance.

◆ GPT_CH_GPTIMER24

#define GPT_CH_GPTIMER24   (23U)

GP timer 24 instance.

◆ GPT_CH_GPTIMER25

#define GPT_CH_GPTIMER25   (24U)

GP timer 25 instance.

◆ GPT_CH_GPTIMER26

#define GPT_CH_GPTIMER26   (25U)

GP timer 26 instance.

◆ GPT_CH_GPTIMER27

#define GPT_CH_GPTIMER27   (26U)

GP timer 27 instance.

◆ GPT_CH_GPTIMER28

#define GPT_CH_GPTIMER28   (27U)

GP timer 28 instance.

◆ GPT_CH_GPTIMER29

#define GPT_CH_GPTIMER29   (28U)

GP timer 29 instance.

◆ GPT_CH_GPTIMER30

#define GPT_CH_GPTIMER30   (29U)

GP timer 30 instance.

◆ GPT_CH_GPTIMER_MAX

#define GPT_CH_GPTIMER_MAX   (30U)

maximum GP timer channels available

◆ GPT_PRE_COMPILE_VARIANT

#define GPT_PRE_COMPILE_VARIANT   (STD_OFF)

GPT Pre-Compile Build Variant flag. STD_ON for VariantPreCompile / STD_OFF for VariantPostBuild.

◆ GPT_ISR_VOID

#define GPT_ISR_VOID   (0x00U)

void ISR type

◆ GPT_ISR_CAT1

#define GPT_ISR_CAT1   (0x01U)

Category 1 ISR type.

◆ GPT_ISR_CAT2

#define GPT_ISR_CAT2   (0x02U)

Category 2 ISR type.

◆ GPT_DEV_ERROR_DETECT

#define GPT_DEV_ERROR_DETECT   (STD_ON)

Enable/disable GPT dev detect error.

◆ GPT_ISR_TYPE

#define GPT_ISR_TYPE   (GPT_ISR_CAT1)

ISR type.

◆ GPT_REPORT_WAKEUP_SOURCE

#define GPT_REPORT_WAKEUP_SOURCE   (STD_ON)

Enable/disable wakeup source in wakeup related APIs.

◆ GPT_VERSION_INFO_API

#define GPT_VERSION_INFO_API   (STD_ON)

Enable/disable GPT get version info API.

◆ GPT_DEINIT_API

#define GPT_DEINIT_API   (STD_ON)

Enable/disable GPT deinit API.

◆ GPT_TIME_ELAPSED_API

#define GPT_TIME_ELAPSED_API   (STD_ON)

Enable/disable GPT get time elapsed API.

◆ GPT_TIME_REMAINING_API

#define GPT_TIME_REMAINING_API   (STD_ON)

Enable/disable GPT time remaining API.

◆ GPT_ENABLE_DISABLE_NOTIFICATION_API

#define GPT_ENABLE_DISABLE_NOTIFICATION_API   (STD_ON)

Enable/disable GPT enable/disable GPT API.

◆ GPT_WAKEUP_FUNCTIONALITY_API

#define GPT_WAKEUP_FUNCTIONALITY_API   (STD_ON)

Enable/disable GPT wakeup functionality API.

◆ GPT_MAX_CHANNELS

#define GPT_MAX_CHANNELS   (5U)

No. of channels configured for GPT driver.

◆ GPT_PREDEF_TIMER_TYPE

#define GPT_PREDEF_TIMER_TYPE   (GPT_PREDEF_TIMER_DISABLED)

Macro for enabling predefined timers This is in case to disable GPT Predef Timers if timers can not be supported by hardware reasons.

◆ GPT_PREDEF_TIMER_1US_ENABLING_GRADE

#define GPT_PREDEF_TIMER_1US_ENABLING_GRADE   (GPT_PREDEF_TIMER_1US_DISABLED)

: Specifies the grade of enabling the GPT Predef Timers with 1us tick duration

◆ GPT_OS_COUNTER_ID

#define GPT_OS_COUNTER_ID   ((CounterType)OsCounter_0)

Counter ID for counter used to count wait ticks.

◆ GPT_TIMEOUT_DURATION

#define GPT_TIMEOUT_DURATION   (32000U)

ETH timeout. Each tick is 31.25us (for 32K Counter). Wait for 5s which comes to below value.

◆ GPT_E_HARDWARE_ERROR

#define GPT_E_HARDWARE_ERROR
Value:
(\
DemConf_DemEventParameter_GPT_E_HARDWARE_ERROR \
)

Hardware failed.

◆ GPT_REGISTER_READBACK_API

#define GPT_REGISTER_READBACK_API   (STD_ON)

Enable/disable GPT register read back API.

◆ GptConf_GptChannelConfiguration_TIMER1

#define GptConf_GptChannelConfiguration_TIMER1   (11U)

Channel ID Configured channel ID(s)

Channel identifiers

◆ GptConf_GptChannelConfiguration_MCU_TIMER6

#define GptConf_GptChannelConfiguration_MCU_TIMER6   (6U)

Channel identifiers

◆ GptConf_GptChannelConfiguration_MCU_TIMER9

#define GptConf_GptChannelConfiguration_MCU_TIMER9   (9U)

Channel identifiers

◆ GptConf_GptChannelConfiguration_TIMER5

#define GptConf_GptChannelConfiguration_TIMER5   (15U)

Channel identifiers

◆ GptConf_GptChannelConfiguration_TIMER19

#define GptConf_GptChannelConfiguration_TIMER19   (29U)

Channel identifiers

Typedef Documentation

◆ Gpt_ChannelType

typedef uint32 Gpt_ChannelType

Type describing the Gpt channel.

◆ Gpt_ValueType

typedef uint32 Gpt_ValueType

Type describing the timeout value

◆ Gpt_NotifyType

typedef void(* Gpt_NotifyType) (void)

Notification callback function pointer

Enumeration Type Documentation

◆ Gpt_ModeType

List of process modes

Enumerator
GPT_MODE_NORMAL 

Normal operation mode of the GPT

GPT_MODE_SLEEP 

Operation for reduced power operation mode. In sleep mode only wakeup capable channels are available.

GPT_MODE_INVALID 

Mode end marker

◆ Gpt_PredefTimerType

Type for GPT Predef Timers.

Enumerator
GPT_PREDEF_TIMER_1US_16BIT 

GPT Predef Timer with tick duration 1µs and range 16bit

GPT_PREDEF_TIMER_1US_24BIT 

GPT Predef Timer with tick duration 1µs and range 24bit

GPT_PREDEF_TIMER_1US_32BIT 

GPT Predef Timer with tick duration 1µs and range 32bit

GPT_PREDEF_TIMER_100US_32BIT 

GPT Predef Timer with tick duration 100µs and range 32bit

◆ Gpt_PrescaleValueType

List of Prescale values for General purpose timer channels The timer counter is prescaled with the value 2^(PTV+1). Example: PTV = 3, counter increases value (if started) after 16 functional clock periods Note: Not applicable to GPT Predef timers.

Enumerator
GPT_PRESCALER_CLK_DIV_BY_2 

Value used to divide timer clock by 2

GPT_PRESCALER_CLK_DIV_BY_4 

Value used to divide timer clock by 4

GPT_PRESCALER_CLK_DIV_BY_8 

Value used to divide timer clock by 8

GPT_PRESCALER_CLK_DIV_BY_16 

Value used to divide timer clock by 16

GPT_PRESCALER_CLK_DIV_BY_32 

Value used to divide timer clock by 32

GPT_PRESCALER_CLK_DIV_BY_64 

Value used to divide timer clock by 64

GPT_PRESCALER_CLK_DIV_BY_128 

Value used to divide timer clock by 128

GPT_PRESCALER_CLK_DIV_BY_256 

Value used to divide timer clock by 256

GPT_PRESCALER_NO_PRESCALE 

Prescale disabled

◆ Gpt_ChannelMode

GPT channel mode macros.

Enumerator
GPT_CH_MODE_CONTINUOUS 

GPT initialized

GPT_CH_MODE_ONESHOT 

Normal operation mode of the GPT

◆ Gpt_ChannelStateType

GPT channel state GPT will be in one of this state during its lifetime.

Enumerator
GPT_UNINITIALIZED 

GPT is uninitialized

GPT_INITIALIZED 

GPT is initialized

GPT_RUNNING 

GPT is running

GPT_STOPPED 

GPT is stopped

GPT_EXPIRED 

GPT is expired

Function Documentation

◆ Gpt_GetVersionInfo()

void Gpt_GetVersionInfo ( Std_VersionInfoType * VersionInfoPtr)

This service returns the version information of this module.

*  Service name        : Gpt_GetVersionInfo
*  Syntax              : void Gpt_GetVersionInfo(Std_VersionInfoType*
*                                                          VersionInfoPtr)
*  Mode                : User Mode (Non-Privileged Mode)
*  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
*  

◆ Gpt_Init()

void Gpt_Init ( const Gpt_ConfigType * CfgPtr)

This service initializes all the configured Gpt channels. This will set the state of the each channel to"initialized", also set the Gpt driver state to "Normal".

*  Service name        : Gpt_Init
*  Syntax              : void Gpt_Init(const Gpt_ConfigType* CfgPtr)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x01
*  Sync/Async          : Synchronous
*  Reentrancy          : Non Reentrant
*  Parameters (in)     : Gpt_ConfigType* CfgPtr - configuration structure
*                        for initializing the module.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Initializes the GPT driver.
*  

◆ Gpt_DeInit()

void Gpt_DeInit ( void )

This service deinitializes the RTI used by Gpt driver to the power on reset state. The Gpt driver state is changed to "Uninitialized" state". All the channel registers are cleared to stop the timer channels. API will disable all interrupt notifications, wakeup interrupts.

*  Service name        : Gpt_DeInit
*  Syntax              : void Gpt_DeInit(void)
*  Mode                : Supervisor Mode (Privileged Mode)
*  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.
*  

◆ Gpt_GetTimeElapsed()

Gpt_ValueType Gpt_GetTimeElapsed ( Gpt_ChannelType Channel)

Gpt_GetTimeElapsed will return the time elapsed for channel which is referenced. The user can configure the channel in two modes, One-shot and Continuous mode. In one shot mode, if the timer is in stopped state, the function will return time value at the moment of stopping. If the timer is expired, the function will return the target time configured for the channel. In Continuous Mode - The elapsed time value will be the value relative to last occurrence.

*  Service name        : Gpt_GetTimeElapsed
*  Syntax              : Gpt_ValueType Gpt_GetTimeElapsed(Gpt_ChannelType
*                                                                      Channel)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x03
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Channel - ChannelId 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.
*  

◆ Gpt_GetTimeRemaining()

Gpt_ValueType Gpt_GetTimeRemaining ( Gpt_ChannelType Channel)

Gpt_GetTimeRemaining will return the timer value remaining until the target time will be reached next time. The remaining time is target time minus time already elapsed. In one shot mode, if the timer is in stopped state, the function will return remaining time value at the moment of stopping. If the timer is expired, the function will return 0.

*  Service name        : Gpt_GetTimeRemaining
*  Syntax              : Gpt_ValueType Gpt_GetTimeRemaining(Gpt_ChannelType
*                                                                      Channel)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x04
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Channel - ChannelId of the Gpt channel.
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : Gpt_ValueType Remaining timer value (in number o
*                        ticks)
*  Description         : Returns the time remaining until the target time is
*                        reached.
*  

◆ Gpt_StartTimer()

void Gpt_StartTimer ( Gpt_ChannelType Channel,
Gpt_ValueType Value )

Gpt_StartTimer will start the selected timer channel with defined target time. If the timer channel is enabled for interrupt notification, then interrupt notification will be triggered after expiration of the selected timer channel. In one shot mode, if the timer is expired then the channel will be stopped in interrupt subroutine. The selected channel will be moved to "Running" state after calling this function.

*  Service name        : Gpt_StartTimer
*  Syntax              : void Gpt_StartTimer(Gpt_ChannelType Channel,
*                                            Gpt_ValueType Value)
*  Mode                : Supervisor Mode (Privileged Mode)
*  Service ID[hex]     : 0x05
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : Channel - ChannelId 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.
*  

◆ Gpt_StopTimer()

void Gpt_StopTimer ( Gpt_ChannelType Channel)

Gpt_StopTimer will stop the selected timer channel.This will clear all the registers corresponding to the selected channel. The state of the timer channel will be changed to "Stopped".If the channel is in state "Initialized","Expired","Stopped" before calling this function, the function will be left without any action.

*  Service name        : Gpt_StopTimer
*  Syntax              : void Gpt_StopTimer( Gpt_ChannelType Channel )
*  Mode                : Supervisor Mode (Privileged Mode)
*  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.
*  

◆ Gpt_EnableNotification()

void Gpt_EnableNotification ( Gpt_ChannelType Channel)

Gpt_EnableNotification will enable the interrupt notification for the selected channel. The SETINT bit in RTI Set interrupt register will be Set to enable the Compare interrupt. The interrupt is triggered when Free running counter value matches with compare register value.

*  Service name        : Gpt_EnableNotification
*  Syntax              : void Gpt_EnableNotification( Gpt_ChannelType Channel)
*  Mode                : Supervisor Mode (Privileged Mode)
*  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).
*  

◆ Gpt_DisableNotification()

void Gpt_DisableNotification ( Gpt_ChannelType Channel)

Gpt_DisableNotification will disable the compare interrupt notification for the selected channel. The SETINT bit in RTI Set interrupt register will be cleared to disable the Compare interrupt. The interrupt is triggered when Free running counter value matches with compare register value.

*  Service name        : Gpt_DisableNotification
*  Syntax              : void Gpt_DisableNotification( Gpt_ChannelType Channel)
*  Mode                : Supervisor Mode (Privileged Mode)
*  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).
*  

◆ Gpt_SetMode()

void Gpt_SetMode ( Gpt_ModeType Mode)

Gpt_SetMode will set the operation mode of the Gpt driver to the given set mode parameter. If the parameter mode = Normal, then the function will enable the interrupt notifications for all the channels which are configured for notification and notification is enabled. If the Mode = Sleep, the function will enable the wakeup interrupts for all channels which are configured for wakeup and disable all other channels. All the timer channels which are running will be stopped in this mode.

*  Service name        : Gpt_SetMode
*  Syntax              : void Gpt_SetMode( Gpt_ModeType Mode )
*  Mode                : Supervisor Mode (Privileged 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).
*  Parameters (inout)  : None
*  Parameters (out)    : None
*  Return value        : None
*  Description         : Sets the operation mode of the GPT.
*  

◆ Gpt_DisableWakeup()

void Gpt_DisableWakeup ( Gpt_ChannelType Channel)

Gpt_DisableWakeup will disable the wakeup interrupt of the referenced channel. The function will save the attribute "wakeup disable" of the channel.

*  Service name        : Gpt_DisableWakeup
*  Syntax              : void Gpt_DisableWakeup( Gpt_ChannelType Channel )
*  Mode                : Supervisor Mode (Privileged Mode)
*  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).
*  

◆ Gpt_EnableWakeup()

void Gpt_EnableWakeup ( Gpt_ChannelType Channel)

Gpt_EnableWakeup will enable the wakeup interrupt of the referenced channel. The function will save the attribute "wakeup enable" of the channel which only affects the wakeup interrupt when the driver is in Sleep mode.

*  Service name        : Gpt_EnableWakeup
*  Syntax              : void Gpt_EnableWakeup( Gpt_ChannelType Channel )
*  Mode                : Supervisor Mode (Privileged Mode)
*  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).
*  

◆ Gpt_CheckWakeup()

void Gpt_CheckWakeup ( EcuM_WakeupSourceType WakeupSource)

Gpt_CheckWakeup will check if wakeup capable timer channel is source for a wakeup event and call EcuM_SetWakeupEvent to indicate the valid timer wakeup event to the EcuM.

*  Service name        : Gpt_CheckWakeup
*  Syntax              : void Gpt_CheckWakeup
*                                  ( EcuM_WakeupSourceType wakeupSource )
*  Mode                : User Mode (Non-Privileged Mode)
*  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.
*  

◆ Gpt_RegisterReadback()

Std_ReturnType Gpt_RegisterReadback ( Gpt_ChannelType GptChannel,
Gpt_RegisterReadbackType * RegRbPtr )

This function reads the important registers of the hardware unit and returns the value in the structure.

This API should be called after Gpt_Init is called. Otherwise this API will return E_NOT_OK.

This API could be used to readback the register contents after Gpt_Init and then the readback value could be compared during GPT execution to check the correctness of the HW unit. Since this API is used for this purpose, the register returned are the ones which doesn't change after init based on conv or channel config.

*  Service name        : Gpt_RegisterReadback
*  Mode                : Supervisor Mode (Privileged Mode)
*  Sync/Async          : Synchronous
*  Reentrancy          : Reentrant
*  Parameters (in)     : GptChannel - Numeric identifier of the GPT channel.
*                        If this is invalid, then the API will
*                        return E_NOT_OK.
*  Parameters (inout)  : RegRbPtr - Pointer to where to store the readback
*                        values. If this pointer is NULL_PTR, then the API
*                        will return E_NOT_OK.
*  Return value        : Std_ReturnType
*                        E_OK: Register read back has been done
*                        E_NOT_OK: Register read back failed
*  

◆ Gpt_GetPredefTimerValue()

Std_ReturnType Gpt_GetPredefTimerValue ( Gpt_PredefTimerType PredefTimer,
uint32 * TimeValuePtr )

◆ Gpt_Ch12Isr()

void Gpt_Ch12Isr ( void )

GPT Channel ISR.

Channel ISR

◆ Gpt_Ch7Isr()

void Gpt_Ch7Isr ( void )

Channel ISR

◆ Gpt_Ch10Isr()

void Gpt_Ch10Isr ( void )

Channel ISR

◆ Gpt_Ch16Isr()

void Gpt_Ch16Isr ( void )

Channel ISR

◆ Gpt_Ch30Isr()

void Gpt_Ch30Isr ( void )

Channel ISR

Variable Documentation

◆ channelMode

Gpt_ChannelMode Gpt_ChannelConfigType::channelMode

Channel mode

◆ tickValueMax

uint32 Gpt_ChannelConfigType::tickValueMax

Maximum value in ticks, the timer channel is able to count. With the next tick, the timer rolls over to zero

◆ enableWakeupFlag

uint8 Gpt_ChannelConfigType::enableWakeupFlag

Enables wakeup capability of MCU for a channel

◆ fnPtrNotifyFunction

Gpt_NotifyType Gpt_ChannelConfigType::fnPtrNotifyFunction

Function pointer to callback function (for non-wakeup notification)

◆ wakeupSourceRef

EcuM_WakeupSourceType Gpt_ChannelConfigType::wakeupSourceRef

Channel wakeup source, in case the wakeup-capability is true this value is transmitted to the EcuState Manager

◆ prescale

uint32 Gpt_ChannelConfigType::prescale

The input GPT clock will be divided by this value

◆ channelId

Gpt_ChannelType Gpt_ChannelConfigType_PC::channelId

Channel Id

◆ ChannelCfgPtr

const Gpt_ChannelConfigType* Gpt_ConfigType::ChannelCfgPtr

Pointer to Channel list

◆ channelCount

uint32 Gpt_ConfigType::channelCount

Number of channels configured

◆ gptRev

uint32 Gpt_RegisterReadbackType::gptRev

IP revision identifier

◆ gptTtgr

uint32 Gpt_RegisterReadbackType::gptTtgr

Reg read always 0xFFFFFFFF

◆ gptTimerSynCtrl

uint32 Gpt_RegisterReadbackType::gptTimerSynCtrl

Timer synchronous interface control register

◆ gptTiocpCfg

uint32 Gpt_RegisterReadbackType::gptTiocpCfg

CBASS0 Configuration register

◆ gptTclr

uint32 Gpt_RegisterReadbackType::gptTclr

Timer control register

◆ GptChannelConfigSet

const struct Gpt_ConfigType_s GptChannelConfigSet
extern

GPT Configuration.

◆ Gpt_TimerBaseAddr

const uint32 Gpt_TimerBaseAddr[GPT_CH_GPTIMER_MAX]
extern

Base Address of the timer peripherals.