MCUSW
Loading...
Searching...
No Matches
Pwm.h File Reference

Introduction

This file contains interface header for PWM MCAL driver.

Go to the source code of this file.

PWM Driver State Values

The PWM Driver State Values

#define PWM_STATUS_UNINIT   ((uint8)(0U))
 PWM driver Status uninitialized.
 
#define PWM_STATUS_INIT   ((uint8)(1U))
 PWM driver Status Initialized.
 
#define PWM_DUTY_0_PERCENT   (0x0U)
 16bit value representing 0% of a period value
 
#define PWM_DUTY_100_PERCENT   (0x8000U)
 16 bit value representing 100% of a period value
 
#define PWM_DUTY_50_PERCENT   (0x4000U)
 16 bit value representing 50% of a period value
 
enum  Pwm_OutputStateType { PWM_LOW = 0U , PWM_HIGH }
 Possible output states of a PWM channel. More...
 
enum  Pwm_EdgeNotificationType { PWM_RISING_EDGE = 1U , PWM_FALLING_EDGE = 2U , PWM_BOTH_EDGES = 3U }
 Possible edge notification
More...
 
enum  Pwm_ChannelClassType { PWM_FIXED_PERIOD = 0U , PWM_FIXED_PERIOD_SHIFTED , PWM_VARIABLE_PERIOD }
 Period type for pwm channels. Fixed periods prohibit changes to the period length with Pwm_SetPeriod( ). PWM_FIXED_PERIOD_SHIFTED type is not supported due to hardware restrictions of the PWM unit. More...
 
enum  Pwm_epwmOutputCh_t { EPWM_OUTPUT_CH_A = 0U , EPWM_OUTPUT_CH_B = 1U , EPWM_OUTPUT_CH_BOTH_A_AND_B = 2U }
 EPWM outputs in a single epwm channel. More...
 
typedef uint32 Pwm_PeriodType
 typedef of period value
 
typedef uint32 Pwm_ChannelType
 PWM Channel type.

 
typedef uint32 Pwm_FrequencyType
 typedef of frequency value (Frequency in Hz)
 
typedef void(* Pwm_NotifyFuncType) (void)
 Notification callback function pointer

 
void Pwm_Init (const Pwm_ConfigType *CfgPtr)
 Service for PWM initialization.
 
void Pwm_DeInit (void)
 Service for PWM de-initialization.
 
void Pwm_SetDutyCycle (Pwm_ChannelType ChannelNumber, uint16 DutyCycle)
 Service for setting Duty Cycle.
 
void Pwm_SetPeriodAndDuty (Pwm_ChannelType ChannelNumber, Pwm_PeriodType Period, uint16 DutyCycle)
 Service for setting Period and Duty Cycle.
 
void Pwm_SetOutputToIdle (Pwm_ChannelType ChannelNumber)
 Service to set the output of a channel immediately to idle.
 
Pwm_OutputStateType Pwm_GetOutputState (Pwm_ChannelType ChannelNumber)
 
void Pwm_DisableNotification (Pwm_ChannelType ChannelNumber)
 Service to disable the Edge Notification.
 
void Pwm_EnableNotification (Pwm_ChannelType ChannelNumber, Pwm_EdgeNotificationType Notification)
 Service to enable the Edge Notification.
 
void Pwm_GetVersionInfo (Std_VersionInfoType *versioninfo)
 This service returns the version information of this module.
 
Std_ReturnType Pwm_RegisterReadback (Pwm_ChannelType ChannelNumber, Pwm_RegisterReadbackType *RegRbPtr)
 This function reads the important registers of the hardware unit and returns the value in the structure.
 

Data Structures

struct  Pwm_ChannelConfigType_PC
 Pwm channel configuration. More...
 
struct  Pwm_ConfigType_PC
 Pwm configuration structure. More...
 
struct  Pwm_ChannelConfigType
 Pwm channel configuration. More...
 
struct  Pwm_ConfigType
 Pwm configuration structure. More...
 
struct  Pwm_RegisterReadbackType
 PWM register readback structure. More...
 

Macros

PWM Driver Module SW Version Info

Defines for PWM Driver version used for compatibility checks

#define PWM_SW_MAJOR_VERSION   (10U)
 Driver Implementation Major Version.
 
#define PWM_SW_MINOR_VERSION   (2U)
 Driver Implementation Minor Version.
 
#define PWM_SW_PATCH_VERSION   (0U)
 Driver Implementation Patch Version.
 
PWM Driver Module AUTOSAR Version Info

Defines for PWM Driver AUTOSAR version used for compatibility checks

#define PWM_AR_RELEASE_MAJOR_VERSION   (4U)
 AUTOSAR Major version specification implemented by PWM Driver.
 
#define PWM_AR_RELEASE_MINOR_VERSION   (3U)
 AUTOSAR Minor version specification implemented by PWM Driver.
 
#define PWM_AR_RELEASE_REVISION_VERSION   (1U)
 AUTOSAR Patch version specification implemented by PWM Driver.
 
PWM Driver ID Info
#define PWM_VENDOR_ID   ((uint16) 44U)
 Texas Instruments Vendor ID.
 
#define PWM_MODULE_ID   ((uint16) 121U)
 PWM Driver Module ID.
 
PWM Error Codes

PWM Driver Instance ID

Error codes returned by PWM functions

#define PWM_E_INIT_FAILED   ((uint8)(0x10U))
 PWM driver configuration parameter error.
 
#define PWM_E_UNINIT   ((uint8)(0x11U))
 PWM driver Not initialized error.
 
#define PWM_E_PARAM_CHANNEL   ((uint8)(0x12U))
 PWM driver Invalid param.
 
#define PWM_E_PERIOD_UNCHANGEABLE   ((uint8)(0x13U))
 PWM driver Fixed period channel.
 
#define PWM_E_ALREADY_INITIALIZED   ((uint8)(0x14U))
 PWM driver Already initialized.
 
#define PWM_E_PARAM_POINTER   ((uint8)(0x15U))
 PWM driver pointer paramter error.
 
#define PWM_E_NOT_DISENGAGED   ((uint8)(0x16U))
 RunTime Error: API Pwm_SetPowerState is called while the PWM module is still in use.
 
PWM 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 PWM_SID_INIT   ((uint8)(0x0U))
 PWM driver service ID for Initialization API.
 
#define PWM_SID_DEINIT   ((uint8)(0x1U))
 PWM driver service ID for De-Initialization API.
 
#define PWM_SID_SET_DUTY_CYCLE   ((uint8)(0x2U))
 PWM driver service ID for set duty cycle API.
 
#define PWM_SID_SET_PERIOD_AND_DUTY   ((uint8)(0x3U))
 PWM driver service ID for set duty cycle and period API.
 
#define PWM_SID_SET_OUTPUT_TO_IDLE   ((uint8)(0x4U))
 PWM driver service ID for set output state to idle API.
 
#define PWM_SID_GET_OUTPUT_STATE   ((uint8)(0x5U))
 PWM driver service ID for get output state API.
 
#define PWM_SID_DISABLE_NOTIFICATION   ((uint8)(0x6U))
 PWM driver service ID for disable notification API.
 
#define PWM_SID_ENABLE_NOTIFICATION   ((uint8)(0x7U))
 PWM driver service ID for Enable notification API.
 
#define PWM_SID_GET_VERSION_INFO   ((uint8)(0x8U))
 PWM driver service ID for Get version info API.
 
#define PWM_SID_REGISTER_READBACK   ((uint8)(0xDU))
 PWM driver service ID for Critical register read back API.