MCUSW
Loading...
Searching...
No Matches
GPT Driver API

Introduction

The GPT Driver MCAL provides low level access to GPT peripheral

present on AM62xx and TDA4XX

See also
GPT Configuration
Gpt Driver Interrupt Handlers
MCAL_GPT_DBG_API

Sub Modules

 GPT Configuration
 
 Gpt Driver Interrupt Handlers
 

GPT Driver Module SW Version Info

Defines for GPT Driver version used for compatibility checks

#define GPT_SW_MAJOR_VERSION   (9U)
 Driver Implementation Major Version.
 
#define GPT_SW_MINOR_VERSION   (2U)
 Driver Implementation Minor Version.
 
#define GPT_SW_PATCH_VERSION   (0U)
 Driver Implementation Patch Version.
 

GPT Driver Module AUTOSAR Version Info

Defines for GPT Driver AUTOSAR version used for compatibility checks

#define GPT_AR_RELEASE_MAJOR_VERSION   (4U)
 AUTOSAR Major version specification implemented by GPT Driver.
 
#define GPT_AR_RELEASE_MINOR_VERSION   (3U)
 AUTOSAR Minor version specification implemented by GPT Driver.
 
#define GPT_AR_RELEASE_REVISION_VERSION   (1U)
 AUTOSAR Patch version specification implemented by GPT Driver.
 

GPT Driver ID Info

#define GPT_VENDOR_ID   ((uint16) 44U)
 Texas Instruments Vendor ID.
 
#define GPT_MODULE_ID   ((uint16) 100U)
 GPT Driver Module ID.
 
#define GPT_INSTANCE_ID   ((uint8) 0U)
 GPT Driver Instance ID.
 
#define GPT_CH_ISR_MODE_CONTINUOUS   (0U)
 GPT continuous mode index.
 
#define GPT_CH_ISR_MODE_ONESHOT   (1U)
 GPT oneshot mode index.
 
#define GPT_CH_ISR_MODE_CONT_WAKEUP   (2U)
 GPT continuous wakeup mode index.
 
#define GPT_CH_ISR_MODE_ONESHOT_WAKEUP   (3U)
 GPT oneshot wakeup mode index.
 

GPT Error Codes

Error codes returned by GPT functions

#define GPT_E_UNINIT   (0x0AU)
 API service used without module initialization.
 
#define GPT_E_BUSY   (0x0BU)
 API service called during ongoing process (Timer is already running)
 
#define GPT_E_MODE   (0x0CU)
 API service called when driver is in wrong mode. Used primarily when PreDef Timers are used. Since PreDef Timer are not supported in this implementation, this error code is not used.
 
#define GPT_E_ALREADY_INITIALIZED   (0x0DU)
 API Gpt_Init is called but the module is already initialized.
 
#define GPT_E_INIT_FAILED   (0x0EU)
 API Gpt_Init is called but the module is already initialized.
 
#define GPT_E_PARAM_CHANNEL   (0x14U)
 API called with invalid channel.
 
#define GPT_E_PARAM_VALUE   (0x15U)
 API service called with invalid start timer parameter.
 
#define GPT_E_PARAM_POINTER   (0x16U)
 API service called with invalid(Null_Ptr) data buffer pointer.
 
#define GPT_E_PARAM_PREDEF_TIMER   (0x17U)
 API service called with invalid Predef Timer. Not supported in this implementation.
 
#define GPT_E_PARAM_MODE   (0x1FU)
 Gpt_SetMode is called with wrong mode parameter.
 
#define GPT_E_INVALID_ISR   (0x80U)
 Invalid entry to ISR.
 

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

#define GPT_SID_GET_VERSION_INFO   (0x00U)
 Gpt_GetVersionInfo() API Service ID.
 
#define GPT_SID_INIT   (0x01U)
 Gpt_Init() API Service ID.
 
#define GPT_SID_DEINIT   (0x02U)
 Gpt_DeInit() API Service ID.
 
#define GPT_SID_GET_TIME_ELAPSED   (0x03U)
 Gpt_GetTimeElapsed() API Service ID.
 
#define GPT_SID_GET_TIME_REMAINING   (0x04U)
 Gpt_GetTimeRemaining() API Service ID.
 
#define GPT_SID_START_TIMER   (0x05U)
 Gpt_StartTimer() API Service ID.
 
#define GPT_SID_STOP_TIMER   (0x06U)
 Gpt_StopTimer() API Service ID.
 
#define GPT_SID_ENABLE_NOTIFY   (0x07U)
 Gpt_EnableNotification() API Service ID.
 
#define GPT_SID_DISABLE_NOTIFY   (0x08U)
 Gpt_DisableNotification() API Service ID.
 
#define GPT_SID_SET_MODE   (0x09U)
 Gpt_SetMode() API Service ID.
 
#define GPT_SID_DISABLE_WAKEUP   (0x0AU)
 Gpt_DisableWakeup() API Service ID.
 
#define GPT_SID_ENABLE_WAKEUP   (0x0BU)
 Gpt_EnableWakeup() API Service ID.
 
#define GPT_SID_CHECK_WAKEUP   (0x0CU)
 Gpt_CheckWakeup() API Service ID.
 
#define GPT_SID_GET_PREDEFTIMERVALUE   (0x0DU)
 Gpt_GetPredefTimerValue() API Service ID.
 
#define GPT_SID_GET_GETHWUNITOBJ   (0x0EU)
 GPT Get Hw Unit Obj API Service ID.
 
#define GPT_SID_REGISTER_READBACK   (0x0FU)
 GPT Critical register read back API Service ID.
 
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)
 

Macro Definition Documentation

◆ GPT_SW_MAJOR_VERSION

#define GPT_SW_MAJOR_VERSION   (9U)

Driver Implementation Major Version.

◆ GPT_SW_MINOR_VERSION

#define GPT_SW_MINOR_VERSION   (2U)

Driver Implementation Minor Version.

◆ GPT_SW_PATCH_VERSION

#define GPT_SW_PATCH_VERSION   (0U)

Driver Implementation Patch Version.

◆ GPT_AR_RELEASE_MAJOR_VERSION

#define GPT_AR_RELEASE_MAJOR_VERSION   (4U)

AUTOSAR Major version specification implemented by GPT Driver.

◆ GPT_AR_RELEASE_MINOR_VERSION

#define GPT_AR_RELEASE_MINOR_VERSION   (3U)

AUTOSAR Minor version specification implemented by GPT Driver.

◆ GPT_AR_RELEASE_REVISION_VERSION

#define GPT_AR_RELEASE_REVISION_VERSION   (1U)

AUTOSAR Patch version specification implemented by GPT Driver.

◆ GPT_VENDOR_ID

#define GPT_VENDOR_ID   ((uint16) 44U)

Texas Instruments Vendor ID.

◆ GPT_MODULE_ID

#define GPT_MODULE_ID   ((uint16) 100U)

GPT Driver Module ID.

◆ GPT_INSTANCE_ID

#define GPT_INSTANCE_ID   ((uint8) 0U)

GPT Driver Instance ID.

◆ GPT_CH_ISR_MODE_CONTINUOUS

#define GPT_CH_ISR_MODE_CONTINUOUS   (0U)

GPT continuous mode index.

◆ GPT_CH_ISR_MODE_ONESHOT

#define GPT_CH_ISR_MODE_ONESHOT   (1U)

GPT oneshot mode index.

◆ GPT_CH_ISR_MODE_CONT_WAKEUP

#define GPT_CH_ISR_MODE_CONT_WAKEUP   (2U)

GPT continuous wakeup mode index.

◆ GPT_CH_ISR_MODE_ONESHOT_WAKEUP

#define GPT_CH_ISR_MODE_ONESHOT_WAKEUP   (3U)

GPT oneshot wakeup mode index.

◆ GPT_E_UNINIT

#define GPT_E_UNINIT   (0x0AU)

API service used without module initialization.

◆ GPT_E_BUSY

#define GPT_E_BUSY   (0x0BU)

API service called during ongoing process (Timer is already running)

◆ GPT_E_MODE

#define GPT_E_MODE   (0x0CU)

API service called when driver is in wrong mode. Used primarily when PreDef Timers are used. Since PreDef Timer are not supported in this implementation, this error code is not used.

◆ GPT_E_ALREADY_INITIALIZED

#define GPT_E_ALREADY_INITIALIZED   (0x0DU)

API Gpt_Init is called but the module is already initialized.

◆ GPT_E_INIT_FAILED

#define GPT_E_INIT_FAILED   (0x0EU)

API Gpt_Init is called but the module is already initialized.

◆ GPT_E_PARAM_CHANNEL

#define GPT_E_PARAM_CHANNEL   (0x14U)

API called with invalid channel.

◆ GPT_E_PARAM_VALUE

#define GPT_E_PARAM_VALUE   (0x15U)

API service called with invalid start timer parameter.

◆ GPT_E_PARAM_POINTER

#define GPT_E_PARAM_POINTER   (0x16U)

API service called with invalid(Null_Ptr) data buffer pointer.

◆ GPT_E_PARAM_PREDEF_TIMER

#define GPT_E_PARAM_PREDEF_TIMER   (0x17U)

API service called with invalid Predef Timer. Not supported in this implementation.

◆ GPT_E_PARAM_MODE

#define GPT_E_PARAM_MODE   (0x1FU)

Gpt_SetMode is called with wrong mode parameter.

◆ GPT_E_INVALID_ISR

#define GPT_E_INVALID_ISR   (0x80U)

Invalid entry to ISR.

◆ GPT_SID_GET_VERSION_INFO

#define GPT_SID_GET_VERSION_INFO   (0x00U)

Gpt_GetVersionInfo() API Service ID.

◆ GPT_SID_INIT

#define GPT_SID_INIT   (0x01U)

Gpt_Init() API Service ID.

◆ GPT_SID_DEINIT

#define GPT_SID_DEINIT   (0x02U)

Gpt_DeInit() API Service ID.

◆ GPT_SID_GET_TIME_ELAPSED

#define GPT_SID_GET_TIME_ELAPSED   (0x03U)

Gpt_GetTimeElapsed() API Service ID.

◆ GPT_SID_GET_TIME_REMAINING

#define GPT_SID_GET_TIME_REMAINING   (0x04U)

Gpt_GetTimeRemaining() API Service ID.

◆ GPT_SID_START_TIMER

#define GPT_SID_START_TIMER   (0x05U)

Gpt_StartTimer() API Service ID.

◆ GPT_SID_STOP_TIMER

#define GPT_SID_STOP_TIMER   (0x06U)

Gpt_StopTimer() API Service ID.

◆ GPT_SID_ENABLE_NOTIFY

#define GPT_SID_ENABLE_NOTIFY   (0x07U)

Gpt_EnableNotification() API Service ID.

◆ GPT_SID_DISABLE_NOTIFY

#define GPT_SID_DISABLE_NOTIFY   (0x08U)

Gpt_DisableNotification() API Service ID.

◆ GPT_SID_SET_MODE

#define GPT_SID_SET_MODE   (0x09U)

Gpt_SetMode() API Service ID.

◆ GPT_SID_DISABLE_WAKEUP

#define GPT_SID_DISABLE_WAKEUP   (0x0AU)

Gpt_DisableWakeup() API Service ID.

◆ GPT_SID_ENABLE_WAKEUP

#define GPT_SID_ENABLE_WAKEUP   (0x0BU)

Gpt_EnableWakeup() API Service ID.

◆ GPT_SID_CHECK_WAKEUP

#define GPT_SID_CHECK_WAKEUP   (0x0CU)

Gpt_CheckWakeup() API Service ID.

◆ GPT_SID_GET_PREDEFTIMERVALUE

#define GPT_SID_GET_PREDEFTIMERVALUE   (0x0DU)

Gpt_GetPredefTimerValue() API Service ID.

◆ GPT_SID_GET_GETHWUNITOBJ

#define GPT_SID_GET_GETHWUNITOBJ   (0x0EU)

GPT Get Hw Unit Obj API Service ID.

◆ GPT_SID_REGISTER_READBACK

#define GPT_SID_REGISTER_READBACK   (0x0FU)

GPT Critical register read back API Service ID.

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 )