![]() |
S32 SDK
|
Low Power Interrupt Timer module Hardware Abstraction Layer.
This HAL provides low-level access to all hardware features of the LPIT.
Data Structures | |
struct | lpit_module_information_t |
Hardware information of LPIT module Implements : lpit_module_information_t_Class. More... | |
Enumerations | |
enum | lpit_timer_modes_t { LPIT_PERIODIC_COUNTER = 0x00U, LPIT_DUAL_PERIODIC_COUNTER = 0x01U, LPIT_TRIGGER_ACCUMULATOR = 0x02U, LPIT_INPUT_CAPTURE = 0x03U } |
Mode options available for the LPIT timer Implements : lpit_timer_modes_t_Class. More... | |
enum | lpit_trigger_source_t { LPIT_TRIGGER_SOURCE_EXTERNAL = 0x00U, LPIT_TRIGGER_SOURCE_INTERNAL = 0x01U } |
Trigger source options. More... | |
Timer Initialization | |
void | LPIT_HAL_GetModuleInformation (const LPIT_Type *base, lpit_module_information_t *moduleInfomation) |
Gets the information of LPIT module. More... | |
static void | LPIT_HAL_Enable (LPIT_Type *const base) |
Enables the LPIT module. More... | |
static void | LPIT_HAL_Disable (LPIT_Type *const base) |
Disables the LPIT module. More... | |
static void | LPIT_HAL_Reset (LPIT_Type *const base) |
Resets the LPIT module. More... | |
Timer Start and Stop | |
static void | LPIT_HAL_StartTimerChannels (LPIT_Type *const base, uint32_t mask) |
Starts the timer channel counting. More... | |
static void | LPIT_HAL_StopTimerChannels (LPIT_Type *const base, uint32_t mask) |
Stops the timer channel from counting. More... | |
static bool | LPIT_HAL_IsTimerChannelRunning (const LPIT_Type *base, uint32_t channel) |
Checks timer channel operation status. More... | |
Timer Period | |
static void | LPIT_HAL_SetTimerPeriodByCount (LPIT_Type *const base, uint32_t channel, uint32_t count) |
Sets the timer channel period in count unit. More... | |
static uint32_t | LPIT_HAL_GetTimerPeriodByCount (const LPIT_Type *base, uint32_t channel) |
Gets the timer channel period in count unit. More... | |
static uint32_t | LPIT_HAL_GetCurrentTimerCount (const LPIT_Type *base, uint32_t channel) |
Gets the current timer channel counting value. More... | |
Timer Interrupt | |
static void | LPIT_HAL_EnableInterruptTimerChannels (LPIT_Type *const base, uint32_t mask) |
Enables the interrupt generation for timer channels. More... | |
static void | LPIT_HAL_DisableInterruptTimerChannels (LPIT_Type *const base, uint32_t mask) |
Disables the interrupt generation for timer channels. More... | |
static uint32_t | LPIT_HAL_GetInterruptFlagTimerChannels (const LPIT_Type *base, uint32_t mask) |
Gets the interrupt flag of timer channels. More... | |
static void | LPIT_HAL_ClearInterruptFlagTimerChannels (LPIT_Type *const base, uint32_t mask) |
Clears the interrupt flag of timer channels. More... | |
Timer Configuration | |
static void | LPIT_HAL_SetTimerChannelModeCmd (LPIT_Type *const base, uint32_t channel, lpit_timer_modes_t mode) |
Sets operation mode of timer channel. More... | |
static lpit_timer_modes_t | LPIT_HAL_GetTimerChannelModeCmd (const LPIT_Type *base, uint32_t channel) |
Gets current operation mode of timer channel. More... | |
static void | LPIT_HAL_SetTriggerSelectCmd (LPIT_Type *const base, uint32_t channel, uint32_t triggerChannelSelect) |
Sets internal trigger source for timer channel. More... | |
static void | LPIT_HAL_SetTriggerSourceCmd (LPIT_Type *const base, uint32_t channel, lpit_trigger_source_t triggerSource) |
Sets trigger source of timer channel. More... | |
static void | LPIT_HAL_SetReloadOnTriggerCmd (LPIT_Type *const base, uint32_t channel, bool isReloadOnTrigger) |
Sets timer channel reload on trigger. More... | |
static void | LPIT_HAL_SetStopOnInterruptCmd (LPIT_Type *const base, uint32_t channel, bool isStopOnInterrupt) |
Sets timer channel stop on interrupt. More... | |
static void | LPIT_HAL_SetStartOnTriggerCmd (LPIT_Type *const base, uint32_t channel, bool isStartOnTrigger) |
Sets timer channel start on trigger. More... | |
static void | LPIT_HAL_SetTimerChannelChainCmd (LPIT_Type *const base, uint32_t channel, bool isChannelChained) |
Sets timer channel chaining. More... | |
static void | LPIT_HAL_SetTimerRunInDebugCmd (LPIT_Type *const base, bool isRunInDebug) |
Sets operation of LPIT in debug mode. More... | |
static void | LPIT_HAL_SetTimerRunInDozeCmd (LPIT_Type *const base, bool isRunInDoze) |
Sets operation of LPIT in DOZE mode. More... | |
enum lpit_timer_modes_t |
Mode options available for the LPIT timer Implements : lpit_timer_modes_t_Class.
Definition at line 60 of file lpit_hal.h.
Trigger source options.
This is used for both internal and external trigger sources. The actual trigger options available is SoC specific, user should refer to the reference manual. Implements : lpit_trigger_source_t_Class
Enumerator | |
---|---|
LPIT_TRIGGER_SOURCE_EXTERNAL |
Use external trigger |
LPIT_TRIGGER_SOURCE_INTERNAL |
Use internal trigger |
Definition at line 75 of file lpit_hal.h.
|
inlinestatic |
Clears the interrupt flag of timer channels.
This function clears current interrupt flag of timer channels.
[in] | base | LPIT peripheral base address |
[in] | mask | The interrupt flag clearing mask that decides which channels will be cleared interrupt flag.
|
Definition at line 371 of file lpit_hal.h.
|
inlinestatic |
Disables the LPIT module.
This function disables functional clock of LPIT module (Note: it does not affect the system clock gating control).
[in] | base | LPIT peripheral base address Implements : LPIT_HAL_Disable_Activity |
Definition at line 132 of file lpit_hal.h.
|
inlinestatic |
Disables the interrupt generation for timer channels.
This function allows disabling interrupt generation for timer channels simultaneously.
[in] | base | LPIT peripheral base address |
[in] | mask | The interrupt disabling mask that decides which channels will be disabled interrupt.
|
Definition at line 330 of file lpit_hal.h.
|
inlinestatic |
Enables the LPIT module.
This function enables the functional clock of LPIT module (Note: this function does not un-gate the system clock gating control). It should be called before setup any timer channel.
[in] | base | LPIT peripheral base address Implements : LPIT_HAL_Enable_Activity |
Definition at line 118 of file lpit_hal.h.
|
inlinestatic |
Enables the interrupt generation for timer channels.
This function allows enabling interrupt generation for timer channels simultaneously.
[in] | base | LPIT peripheral base address |
[in] | mask | The interrupt enabling mask that decides which channels will be enabled interrupt.
|
Definition at line 310 of file lpit_hal.h.
|
inlinestatic |
Gets the current timer channel counting value.
This function returns the real-time timer channel counting value, the value in a range from 0 to timer channel period. Need to make sure the running time does not exceed the timer channel period.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
Definition at line 283 of file lpit_hal.h.
|
inlinestatic |
Gets the interrupt flag of timer channels.
This function gets current interrupt flag of timer channels.
[in] | base | LPIT peripheral base address |
[in] | mask | The interrupt flag getting mask that decides which channels will be got interrupt flag.
|
Definition at line 351 of file lpit_hal.h.
void LPIT_HAL_GetModuleInformation | ( | const LPIT_Type * | base, |
lpit_module_information_t * | moduleInfomation | ||
) |
Gets the information of LPIT module.
This function gets the informations of LPIT module as: major version number, minor version number, feature number, number of external trigger inputs, number of timer channels.
[in] | base | LPIT peripheral base address |
[out] | moduleInfomation | Pointer to lpit_module_information_t structure which is used to contain LPIT information. |
Definition at line 42 of file lpit_hal.c.
|
inlinestatic |
Gets current operation mode of timer channel.
This function gets current operation mode of the timer channel given as argument.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
Definition at line 418 of file lpit_hal.h.
|
inlinestatic |
Gets the timer channel period in count unit.
This function returns current period of timer channel given as argument.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
Definition at line 265 of file lpit_hal.h.
|
inlinestatic |
Checks timer channel operation status.
This function checks to see whether the timer channel given as argument is running.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
Definition at line 216 of file lpit_hal.h.
|
inlinestatic |
Resets the LPIT module.
This function sets all LPIT registers to reset value, except the Module Control Register.
[in] | base | LPIT peripheral base address Implements : LPIT_HAL_Reset_Activity |
Definition at line 146 of file lpit_hal.h.
|
inlinestatic |
Sets timer channel reload on trigger.
This function sets the timer channel to reload/don't reload on trigger.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
[in] | isReloadOnTrigger | Timer channel reload on trigger
|
Definition at line 497 of file lpit_hal.h.
|
inlinestatic |
Sets timer channel start on trigger.
This function sets the timer channel to starts/don't start on trigger.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
[in] | isStartOnTrigger | Timer channel start on trigger
|
Definition at line 538 of file lpit_hal.h.
|
inlinestatic |
Sets timer channel stop on interrupt.
This function sets the timer channel to stop or don't stop after it times out.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
[in] | isStopOnInterrupt | Timer channel stop on interrupt
|
Definition at line 517 of file lpit_hal.h.
|
inlinestatic |
Sets timer channel chaining.
This function sets the timer channel to be chained or not chained.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number(Note: The timer channel 0 cannot be chained) |
[in] | isChannelChained | Timer channel chaining
|
Definition at line 558 of file lpit_hal.h.
|
inlinestatic |
Sets operation mode of timer channel.
This function sets the timer channel operation mode which control how the timer channel decrements.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
[in] | mode | Operation mode of timer channel that is member of lpit_timer_modes_t Implements : LPIT_HAL_SetTimerChannelModeCmd_Activity |
Definition at line 400 of file lpit_hal.h.
|
inlinestatic |
Sets the timer channel period in count unit.
This function sets the timer channel period in count unit. The period range depends on the frequency of the LPIT functional clock and operation mode of timer channel. If the required period is out of range, use the suitable mode if applicable. Timer channel begins counting from the value that is set by this function. The counter period of a running timer channel can be modified by first setting a new load value, the value will be loaded after the timer channel expires. To abort the current cycle and start a timer channel period with the new value, the timer channel must be disabled and enabled again.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
[in] | count | Timer channel period in count unit Implements : LPIT_HAL_SetTimerPeriodByCount_Activity |
Definition at line 248 of file lpit_hal.h.
|
inlinestatic |
Sets operation of LPIT in debug mode.
When the device enters debug mode, the timer channels may or may not be frozen, based on the configuration of this function. This is intended to aid software development, allowing the developer to halt the processor, investigate the current state of the system (for example, the timer channel values), and continue the operation.
[in] | base | LPIT peripheral base address |
[in] | isRunInDebug | LPIT run in debug mode
|
Definition at line 580 of file lpit_hal.h.
|
inlinestatic |
Sets operation of LPIT in DOZE mode.
When the device enters debug mode, the timer channels may or may not be frozen, based on the configuration of this function. The LPIT must use an external or internal clock source which remains operating during DOZE modes(low power mode).
[in] | base | LPIT peripheral base address |
[in] | isRunInDoze | LPIT run in DOZE mode
|
Definition at line 600 of file lpit_hal.h.
|
inlinestatic |
Sets internal trigger source for timer channel.
This function selects one trigger from the set of internal triggers that is generated by other timer channels. The selected trigger is used for starting and/or reloading the timer channel.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
[in] | triggerChannelSelect | Number of the channel which is selected to be trigger source Implements : LPIT_HAL_SetTriggerSelectCmd_Activity |
Definition at line 459 of file lpit_hal.h.
|
inlinestatic |
Sets trigger source of timer channel.
This function sets trigger source of the timer channel to be internal or external trigger.
[in] | base | LPIT peripheral base address |
[in] | channel | Timer channel number |
[in] | triggerSource | Trigger source of timer channel(internal or external source) Implements : LPIT_HAL_SetTriggerSourceCmd_Activity |
Definition at line 477 of file lpit_hal.h.
|
inlinestatic |
Starts the timer channel counting.
This function allows starting timer channels simultaneously . After calling this function, timer channels are going operate depend on mode and control bits which controls timer channel start, reload and restart.
[in] | base | LPIT peripheral base address |
[in] | mask | Timer channels starting mask that decides which channels will be started
|
Definition at line 175 of file lpit_hal.h.
|
inlinestatic |
Stops the timer channel from counting.
This function allows stop timer channels simultaneously from counting. Timer channels reload their periods respectively after the next time they call the LPIT_DRV_StartTimerChannels. Note that: In 32-bit Trigger Accumulator mode, the counter will load on the first trigger rising edge.
[in] | base | LPIT peripheral base address |
[in] | mask | Timer channels stopping mask that decides which channels will be stopped
|
Definition at line 198 of file lpit_hal.h.