MCUSW
Gpt.h File Reference

Introduction

This file contains interface header for GPT MCAL driver.

Go to the source code of this file.

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. More...
 
#define GPT_SID_INIT   (0x01U)
 Gpt_Init() API Service ID. More...
 
#define GPT_SID_DEINIT   (0x02U)
 Gpt_DeInit() API Service ID. More...
 
#define GPT_SID_GET_TIME_ELAPSED   (0x03U)
 Gpt_GetTimeElapsed() API Service ID. More...
 
#define GPT_SID_GET_TIME_REMAINING   (0x04U)
 Gpt_GetTimeRemaining() API Service ID. More...
 
#define GPT_SID_START_TIMER   (0x05U)
 Gpt_StartTimer() API Service ID. More...
 
#define GPT_SID_STOP_TIMER   (0x06U)
 Gpt_StopTimer() API Service ID. More...
 
#define GPT_SID_ENABLE_NOTIFY   (0x07U)
 Gpt_EnableNotification() API Service ID. More...
 
#define GPT_SID_DISABLE_NOTIFY   (0x08U)
 Gpt_DisableNotification() API Service ID. More...
 
#define GPT_SID_SET_MODE   (0x09U)
 Gpt_SetMode() API Service ID. More...
 
#define GPT_SID_DISABLE_WAKEUP   (0x0AU)
 Gpt_DisableWakeup() API Service ID. More...
 
#define GPT_SID_ENABLE_WAKEUP   (0x0BU)
 Gpt_EnableWakeup() API Service ID. More...
 
#define GPT_SID_CHECK_WAKEUP   (0x0CU)
 Gpt_CheckWakeup() API Service ID. More...
 
#define GPT_SID_GET_PREDEFTIMERVALUE   (0x0DU)
 Gpt_GetPredefTimerValue() API Service ID. More...
 
#define GPT_SID_GET_GETHWUNITOBJ   (0x0EU)
 GPT Get Hw Unit Obj API Service ID. More...
 
#define GPT_SID_REGISTER_READBACK   (0x0FU)
 GPT Critical register read back API Service ID. More...
 
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. More...
 
typedef uint32 Gpt_ValueType
 Type describing the timeout value
More...
 
typedef void(* Gpt_NotifyType) (void)
 Notification callback function pointer
More...
 
 AUTOMATIC
 
GPT_APPL_DATA VersionInfoPtr
 
GPT_CONST CfgPtr
 
Gpt_ValueType Value
 
uint32 * TimeValuePtr
 
 FUNC (void, GPT_CODE) Gpt_GetVersionInfo(P2VAR(Std_VersionInfoType
 This service returns the version information of this module. More...
 
 FUNC (Gpt_ValueType, GPT_CODE) 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. More...
 
 FUNC (Std_ReturnType, GPT_CODE) Gpt_RegisterReadback(Gpt_ChannelType GptChannel
 This function reads the important registers of the hardware unit and returns the value in the structure. More...
 
 P2VAR (Gpt_RegisterReadbackType, AUTOMATIC, GPT_APPL_DATA) RegRbPtr)
 

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

Macros

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. More...
 
#define GPT_SW_MINOR_VERSION   (2U)
 Driver Implementation Minor Version. More...
 
#define GPT_SW_PATCH_VERSION   (1U)
 Driver Implementation Patch Version. More...
 
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. More...
 
#define GPT_AR_RELEASE_MINOR_VERSION   (3U)
 AUTOSAR Minor version specification implemented by GPT Driver. More...
 
#define GPT_AR_RELEASE_REVISION_VERSION   (1U)
 AUTOSAR Patch version specification implemented by GPT Driver. More...
 
GPT Driver ID Info
#define GPT_VENDOR_ID   ((uint16) 44U)
 Texas Instruments Vendor ID. More...
 
#define GPT_MODULE_ID   ((uint16) 100U)
 GPT Driver Module ID. More...
 
#define GPT_INSTANCE_ID   ((uint8) 0U)
 GPT Driver Instance ID. More...
 
#define GPT_CH_ISR_MODE_CONTINUOUS   (0U)
 GPT continuous mode index. More...
 
#define GPT_CH_ISR_MODE_ONESHOT   (1U)
 GPT oneshot mode index. More...
 
#define GPT_CH_ISR_MODE_CONT_WAKEUP   (2U)
 GPT continuous wakeup mode index. More...
 
#define GPT_CH_ISR_MODE_ONESHOT_WAKEUP   (3U)
 GPT oneshot wakeup mode index. More...
 
GPT Error Codes

Error codes returned by GPT functions

#define GPT_E_UNINIT   (0x0AU)
 API service used without module initialization. More...
 
#define GPT_E_BUSY   (0x0BU)
 API service called during ongoing process (Timer is already running) More...
 
#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. More...
 
#define GPT_E_ALREADY_INITIALIZED   (0x0DU)
 API Gpt_Init is called but the module is already initialized. More...
 
#define GPT_E_INIT_FAILED   (0x0EU)
 API Gpt_Init is called but the module is already initialized. More...
 
#define GPT_E_PARAM_CHANNEL   (0x14U)
 API called with invalid channel. More...
 
#define GPT_E_PARAM_VALUE   (0x15U)
 API service called with invalid start timer parameter. More...
 
#define GPT_E_PARAM_POINTER   (0x16U)
 API service called with invalid(Null_Ptr) data buffer pointer. More...
 
#define GPT_E_PARAM_PREDEF_TIMER   (0x17U)
 API service called with invalid Predef Timer. Not supported in this implementation. More...
 
#define GPT_E_PARAM_MODE   (0x1FU)
 Gpt_SetMode is called with wrong mode parameter. More...
 
#define GPT_E_INVALID_ISR   (0x80U)
 Invalid entry to ISR. More...