iLLD_TC27xC  1.0
IfxStdIf_Timer.h File Reference

Standard interface: Timer. More...

#include "Cpu/Std/Ifx_Types.h"
#include "Src/Std/IfxSrc.h"
#include "Port/Std/IfxPort.h"
#include "IfxStdIf.h"

Go to the source code of this file.

Data Structures

struct  IfxStdIf_Timer_
 Standard interface object. More...
 
struct  IfxStdIf_Timer_TrigConfig
 Trigger configuration. More...
 
struct  IfxStdIf_Timer_Config
 Timer configuration. More...
 

Typedefs

typedef struct IfxStdIf_Timer_ IfxStdIf_Timer
 Forward declaration. More...
 
typedef float32(* IfxStdIf_Timer_GetFrequency )(IfxStdIf_InterfaceDriver driver)
 Return the timer frequency in Hz. More...
 
typedef Ifx_TimerValue(* IfxStdIf_Timer_GetPeriod )(IfxStdIf_InterfaceDriver driver)
 Return the timer period in ticks. More...
 
typedef float32(* IfxStdIf_Timer_GetResolution )(IfxStdIf_InterfaceDriver driver)
 Return the timer resolution in seconds. More...
 
typedef Ifx_TimerValue(* IfxStdIf_Timer_GetTrigger )(IfxStdIf_InterfaceDriver driver)
 Return the timer trigger point. More...
 
typedef boolean(* IfxStdIf_Timer_SetFrequency )(IfxStdIf_InterfaceDriver driver, float32 frequency)
 Set the timer frequency in Hz. More...
 
typedef void(* IfxStdIf_Timer_UpdateInputFrequency )(IfxStdIf_InterfaceDriver driver)
 Indicates the driver that the imput frequency has changed and that it should be taken in account. More...
 
typedef void(* IfxStdIf_Timer_ApplyUpdate )(IfxStdIf_InterfaceDriver driver)
 Apply requested updates. More...
 
typedef void(* IfxStdIf_Timer_DisableUpdate )(IfxStdIf_InterfaceDriver driver)
 Disable updates. More...
 
typedef float32(* IfxStdIf_Timer_GetInputFrequency )(IfxStdIf_InterfaceDriver driver)
 Return the timer input frequency in Hz. More...
 
typedef void(* IfxStdIf_Timer_Run )(IfxStdIf_InterfaceDriver driver)
 Immediately start the timer. More...
 
typedef boolean(* IfxStdIf_Timer_SetPeriod )(IfxStdIf_InterfaceDriver driver, Ifx_TimerValue period)
 Set the timer period. More...
 
typedef void(* IfxStdIf_Timer_SetSingleMode )(IfxStdIf_InterfaceDriver driver, boolean enabled)
 Stop timer at the end of the period. More...
 
typedef void(* IfxStdIf_Timer_SetTrigger )(IfxStdIf_InterfaceDriver driver, Ifx_TimerValue triggerPoint)
 Set trigger point. More...
 
typedef void(* IfxStdIf_Timer_Stop )(IfxStdIf_InterfaceDriver driver)
 Immediately stops the timer. More...
 
typedef boolean(* IfxStdIf_Timer_AckTimerIrq )(IfxStdIf_InterfaceDriver driver)
 Return the timer interrupt flag and reset it. More...
 
typedef boolean(* IfxStdIf_Timer_AckTriggerIrq )(IfxStdIf_InterfaceDriver driver)
 Return the trigger interrupt flag and reset it. More...
 

Enumerations

enum  IfxStdIf_Timer_OutputEvent {
  IfxStdIf_Timer_Output_disabled,
  IfxStdIf_Timer_Output_enabled
}
 Output event enable / disable. More...
 
enum  IfxStdIf_Timer_CountDir {
  IfxStdIf_Timer_CountDir_up,
  IfxStdIf_Timer_CountDir_upAndDown,
  IfxStdIf_Timer_CountDir_down
}
 Timer increment direction. More...
 

Functions

IFX_INLINE float32 IfxStdIf_Timer_getFrequency (IfxStdIf_Timer *stdIf)
 Return the timer frequency in Hz. More...
 
IFX_INLINE Ifx_TimerValue IfxStdIf_Timer_getPeriod (IfxStdIf_Timer *stdIf)
 Return the timer period in ticks. More...
 
IFX_INLINE Ifx_TimerValue IfxStdIf_Timer_getTrigger (IfxStdIf_Timer *stdIf)
 Return the timer trigger point. More...
 
IFX_INLINE float32 IfxStdIf_Timer_getResolution (IfxStdIf_Timer *stdIf)
 Return the timer resolution in seconds. More...
 
IFX_INLINE boolean IfxStdIf_Timer_setFrequency (IfxStdIf_Timer *stdIf, float32 frequency)
 Set the timer frequency in Hz. More...
 
IFX_INLINE void IfxStdIf_Timer_updateInputFrequency (IfxStdIf_Timer *stdIf)
 Indicates the driver that the imput frequency has changed and that it should be taken in account. More...
 
IFX_INLINE void IfxStdIf_Timer_applyUpdate (IfxStdIf_Timer *stdIf)
 Apply requested updates. More...
 
IFX_INLINE void IfxStdIf_Timer_disableUpdate (IfxStdIf_Timer *stdIf)
 Disable updates. More...
 
IFX_INLINE float32 IfxStdIf_Timer_getInputFrequency (IfxStdIf_Timer *stdIf)
 Return the timer input frequency in Hz. More...
 
IFX_INLINE void IfxStdIf_Timer_run (IfxStdIf_Timer *stdIf)
 Immediately start the timer. More...
 
IFX_INLINE boolean IfxStdIf_Timer_setPeriod (IfxStdIf_Timer *stdIf, Ifx_TimerValue period)
 Set the timer period. More...
 
IFX_INLINE void IfxStdIf_Timer_setSingleMode (IfxStdIf_Timer *stdIf, boolean enabled)
 Stop timer at the end of the period. More...
 
IFX_INLINE void IfxStdIf_Timer_setTrigger (IfxStdIf_Timer *stdIf, Ifx_TimerValue triggerPoint)
 Set trigger point. More...
 
IFX_INLINE void IfxStdIf_Timer_stop (IfxStdIf_Timer *stdIf)
 Immediately stops the timer. More...
 
IFX_INLINE boolean IfxStdIf_Timer_ackTimerIrq (IfxStdIf_Timer *stdIf)
 Return the timer interrupt flag and reset it. More...
 
IFX_INLINE boolean IfxStdIf_Timer_ackTriggerIrq (IfxStdIf_Timer *stdIf)
 Return the trigger interrupt flag and reset it. More...
 
IFX_INLINE float32 IfxStdIf_Timer_tickToS (float32 clockFreq, Ifx_TimerValue ticks)
 Convert timer ticks to seconds. More...
 
IFX_INLINE Ifx_TimerValue IfxStdIf_Timer_sToTick (float32 clockFreq, float32 seconds)
 Convert seconds to timer ticks. More...
 
IFX_INLINE float32 IfxStdIf_Timer_getPeriodSecond (IfxStdIf_Timer *stdIf)
 Return the timer period in second. More...
 
void IfxStdIf_Timer_initConfig (IfxStdIf_Timer_Config *config)
 

Detailed Description

Standard interface: Timer.

Version
iLLD_1_0_0_11_0
                            IMPORTANT NOTICE

Infineon Technologies AG (Infineon) is supplying this file for use exclusively with Infineon's microcontroller products. This file can be freely distributed within development tools that are supporting such microcontroller products.

THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.

Definition in file IfxStdIf_Timer.h.


Data Structure Documentation

struct IfxStdIf_Timer_TrigConfig

Trigger configuration.

Definition at line 242 of file IfxStdIf_Timer.h.

Data Fields
boolean enabled If true, the trigger functionality is Initialised, else ignored.
Ifx_Priority isrPriority Interrupt isrPriority of the trigger interrupt, if 0 the interrupt is disable.
IfxSrc_Tos isrProvider Interrupt service provider for the trigger interrupt.
IfxPort_PadDriver outputDriver Output pad driver.
boolean outputEnabled If TRUE, the output pin is enabled, else disabled. In case the output is disabled, the output pin is not initialized.
IfxPort_OutputMode outputMode Output mode.
boolean risingEdgeAtPeriod Set the clock signal polarity, if TRUE, the rising edge is at the period, else at the trigger offset. When the timer is stopped, the output is set to high.
Ifx_TimerValue triggerPoint Trigger point in timer ticks.
struct IfxStdIf_Timer_Config

Timer configuration.

Definition at line 255 of file IfxStdIf_Timer.h.

Collaboration diagram for IfxStdIf_Timer_Config:
Data Fields
IfxStdIf_Timer_CountDir countDir Timer counting mode.
float32 frequency PWM frequency in Hz. This parameter is only used to initialise the timer structure. An additional cell is required to build the timer.
Ifx_Priority isrPriority Interrupt isrPriority of the timer interrupt, if 0 the interrupt is disable.
IfxSrc_Tos isrProvider Interrupt service provider for the timer interrupt.
float32 minResolution Minimum resolution of the timer in seconds. if 0, this parameter is ignored. If the configuration does not enable this setting a warning is given.
float32 startOffset FIXME make startOffset as Ifx_TimerValue. Timer initial offset in % of the period.
IfxStdIf_Timer_TrigConfig trigger Trigger configuration.

Typedef Documentation

Forward declaration.

Definition at line 76 of file IfxStdIf_Timer.h.

typedef boolean(* IfxStdIf_Timer_AckTimerIrq)(IfxStdIf_InterfaceDriver driver)

Return the timer interrupt flag and reset it.

Parameters
driverPointer to the interface driver object
Returns
Return the timer interrupt flag

Definition at line 210 of file IfxStdIf_Timer.h.

typedef boolean(* IfxStdIf_Timer_AckTriggerIrq)(IfxStdIf_InterfaceDriver driver)

Return the trigger interrupt flag and reset it.

Parameters
driverPointer to the interface driver object
Returns
Return the trigger interrupt flag

Definition at line 216 of file IfxStdIf_Timer.h.

typedef void(* IfxStdIf_Timer_ApplyUpdate)(IfxStdIf_InterfaceDriver driver)

Apply requested updates.

Such requested update are calls to:

It is important to note, that only one call to Timer_applyUpdate() is allowed within one timer period!!! In order to ensure correct update synchronisation, disableUpdate() should have been called previously.

Parameters
driverPointer to the interface driver object
Returns
None

Definition at line 135 of file IfxStdIf_Timer.h.

typedef void(* IfxStdIf_Timer_DisableUpdate)(IfxStdIf_InterfaceDriver driver)

Disable updates.

The following API action will not be taken in account before applyUpdate is called:

Parameters
driverPointer to the interface driver object
Returns
None

Definition at line 152 of file IfxStdIf_Timer.h.

typedef float32(* IfxStdIf_Timer_GetFrequency)(IfxStdIf_InterfaceDriver driver)

Return the timer frequency in Hz.

Parameters
driverPointer to the interface driver object
Returns
Return the timer frequency in Hz

Definition at line 82 of file IfxStdIf_Timer.h.

typedef float32(* IfxStdIf_Timer_GetInputFrequency)(IfxStdIf_InterfaceDriver driver)

Return the timer input frequency in Hz.

Parameters
driverPointer to the interface driver object
Returns
Return the timer input frequency in Hz

Definition at line 158 of file IfxStdIf_Timer.h.

typedef Ifx_TimerValue(* IfxStdIf_Timer_GetPeriod)(IfxStdIf_InterfaceDriver driver)

Return the timer period in ticks.

Parameters
driverPointer to the interface driver object
Returns
Return the timer period in ticks

Definition at line 88 of file IfxStdIf_Timer.h.

typedef float32(* IfxStdIf_Timer_GetResolution)(IfxStdIf_InterfaceDriver driver)

Return the timer resolution in seconds.

Parameters
driverPointer to the interface driver object
Returns
Return the timer resolution in seconds

Definition at line 94 of file IfxStdIf_Timer.h.

typedef Ifx_TimerValue(* IfxStdIf_Timer_GetTrigger)(IfxStdIf_InterfaceDriver driver)

Return the timer trigger point.

Parameters
driverPointer to the interface driver object
Returns
Return the timer timer point

Definition at line 100 of file IfxStdIf_Timer.h.

typedef void(* IfxStdIf_Timer_Run)(IfxStdIf_InterfaceDriver driver)

Immediately start the timer.

Please note that other mechanism may avoid the timer to tick, such as when the global (input) clock to the timer block is inactive.

Parameters
driverPointer to the interface driver object
Returns
none

Definition at line 167 of file IfxStdIf_Timer.h.

typedef boolean(* IfxStdIf_Timer_SetFrequency)(IfxStdIf_InterfaceDriver driver, float32 frequency)

Set the timer frequency in Hz.

Parameters
driverPointer to the interface driver object
frequencyRequested timer frequency in Hz
Return values
TRUEThe requested frequency could be set
FALSEThe requested frequency is out of range

Definition at line 108 of file IfxStdIf_Timer.h.

typedef boolean(* IfxStdIf_Timer_SetPeriod)(IfxStdIf_InterfaceDriver driver, Ifx_TimerValue period)

Set the timer period.

Timer_applyUpdate() shall be invoked in order this to take effect.

Parameters
driverPointer to the interface driver object
periodPeriod value in ticks
Return values
TRUEThe requested period could be set
FALSEThe requested period is out of range

Definition at line 177 of file IfxStdIf_Timer.h.

typedef void(* IfxStdIf_Timer_SetSingleMode)(IfxStdIf_InterfaceDriver driver, boolean enabled)

Stop timer at the end of the period.

Timer_applyUpdate() shall be invoked in order this to take effect.

Parameters
driverPointer to the interface driver object
enabledIf TRUE, enable the single mode, else disable the single mode (continuous mode)
Returns
none

Definition at line 186 of file IfxStdIf_Timer.h.

typedef void(* IfxStdIf_Timer_SetTrigger)(IfxStdIf_InterfaceDriver driver, Ifx_TimerValue triggerPoint)

Set trigger point.

See Also
Timer_OutputEvent for the definition of the output level. Active state is defined by Timer_Config::outputActiveState.

Timer_applyUpdate() shall be invoked in order this to take effect.

Parameters
driverPointer to the interface driver object
triggerPointTrigger point in ticks from the period start.
Returns
none

Definition at line 198 of file IfxStdIf_Timer.h.

typedef void(* IfxStdIf_Timer_Stop)(IfxStdIf_InterfaceDriver driver)

Immediately stops the timer.

Parameters
driverPointer to the interface driver object
Returns
none

Definition at line 204 of file IfxStdIf_Timer.h.

typedef void(* IfxStdIf_Timer_UpdateInputFrequency)(IfxStdIf_InterfaceDriver driver)

Indicates the driver that the imput frequency has changed and that it should be taken in account.

Parameters
driverPointer to the interface driver object
Returns
None

Definition at line 114 of file IfxStdIf_Timer.h.

Enumeration Type Documentation

Timer increment direction.

Enumerator
IfxStdIf_Timer_CountDir_up 

Timer is counting up.

IfxStdIf_Timer_CountDir_upAndDown 

Timer is counting up and down.

IfxStdIf_Timer_CountDir_down 

Timer is counting down.

Definition at line 68 of file IfxStdIf_Timer.h.

Output event enable / disable.

Enumerator
IfxStdIf_Timer_Output_disabled 

Timer output is set to the inactive, no change in the output.

IfxStdIf_Timer_Output_enabled 

In case the trigger is enabled, the output is set to active between time 0 to the trigger point, and is set to inactive between the trigger point and the period. In case the trigger is disabled and counting direction if IfxStdIf_Timer_CountDir_up, the output is toggled when the timer is reset In case the trigger is disabled and counting direction if IfxStdIf_Timer_CountDir_down, the output is toggled when the timer is reloaded In case the trigger is disabled and counting direction if IfxStdIf_Timer_CountDir_upAndDown, the output is toggled when the timer reach 0 In case the trigger is enabled the trigger is active before the trigger point and inactive after the trigger point.

Definition at line 54 of file IfxStdIf_Timer.h.

Function Documentation

void IfxStdIf_Timer_initConfig ( IfxStdIf_Timer_Config config)

Initialize the configuration structure to default

Parameters
configTimer configuration. This parameter is initialised by the function

Definition at line 28 of file IfxStdIf_Timer.c.

Referenced by IfxCcu6_TimerWithTrigger_initConfig(), IfxGtm_Atom_Timer_initConfig(), and IfxGtm_Tom_Timer_initConfig().