59 #include "lpit_hw_access.h"
106 base = s_lpitBase[instance];
131 base = s_lpitBase[instance];
164 base = s_lpitBase[instance];
166 if ((channel == 0U) && (userChannelConfig->
chainChannel))
173 LPIT_SetTimerChannelChainCmd(base, channel, userChannelConfig->
chainChannel);
175 LPIT_SetTimerChannelModeCmd(base, channel, userChannelConfig->
timerMode);
191 LPIT_SetTriggerSourceCmd(base, channel, userChannelConfig->
triggerSource);
192 LPIT_SetTriggerSelectCmd(base, channel, userChannelConfig->
triggerSelect);
200 LPIT_EnableInterruptTimerChannels(base, (uint32_t)1U << channel);
206 LPIT_DisableInterruptTimerChannels(base, (uint32_t)1U << channel);
232 base = s_lpitBase[instance];
234 LPIT_StartTimerChannels(base, mask);
256 base = s_lpitBase[instance];
258 LPIT_StopTimerChannels(base, mask);
294 base = s_lpitBase[instance];
297 count = (count / 1000000U) - 1U;
299 timerMode = LPIT_GetTimerChannelModeCmd(base, channel);
327 LPIT_SetTimerPeriodByCount(base, channel, (uint32_t)count);
353 uint64_t periodHighCount;
354 uint64_t periodLowCount;
355 uint64_t periodCount;
367 base = s_lpitBase[instance];
370 periodHighCount = (periodHighCount / 1000000U) - 1U;
374 periodLowCount = (periodLowCount / 1000000U) - 1U;
382 periodCount = (periodHighCount << 16U) | periodLowCount;
383 LPIT_SetTimerPeriodByCount(base, channel, (uint32_t)periodCount);
404 uint64_t currentPeriod;
416 base = s_lpitBase[instance];
418 currentPeriod = LPIT_GetTimerPeriodByCount(base, channel);
420 timerMode = LPIT_GetTimerChannelModeCmd(base, channel);
440 return currentPeriod;
463 uint64_t currentTime = 0U;
468 base = s_lpitBase[instance];
470 currentTime = LPIT_GetCurrentTimerCount(base, channel);
472 timerMode = LPIT_GetTimerChannelModeCmd(base, channel);
513 base = s_lpitBase[instance];
515 LPIT_SetTimerPeriodByCount(base, channel, count);
543 base = s_lpitBase[instance];
545 period = ((uint32_t)periodHigh << 16U) | periodLow;
547 LPIT_SetTimerPeriodByCount(base, channel, period);
563 uint32_t currentPeriod;
568 base = s_lpitBase[instance];
570 currentPeriod = LPIT_GetTimerPeriodByCount(base, channel);
572 timerMode = LPIT_GetTimerChannelModeCmd(base, channel);
579 return currentPeriod;
597 uint32_t currentTime;
602 base = s_lpitBase[instance];
604 currentTime = LPIT_GetCurrentTimerCount(base, channel);
606 timerMode = LPIT_GetTimerChannelModeCmd(base, channel);
632 base = s_lpitBase[instance];
634 LPIT_EnableInterruptTimerChannels(base, mask);
653 base = s_lpitBase[instance];
655 LPIT_DisableInterruptTimerChannels(base, mask);
675 base = s_lpitBase[instance];
677 return LPIT_GetInterruptFlagTimerChannels(base, mask);
696 base = s_lpitBase[instance];
698 LPIT_ClearInterruptFlagTimerChannels(base, mask);
#define MAX_PERIOD_COUNT_IN_DUAL_16BIT_MODE
Max period in count of dual 16 bit periodic counter mode.
lpit_timer_modes_t timerMode
void LPIT_DRV_SetTimerPeriodByCount(uint32_t instance, uint32_t channel, uint32_t count)
Sets the timer channel period in count unit.
void LPIT_DRV_StopTimerChannels(uint32_t instance, uint32_t mask)
Stops the timer channel counting.
uint64_t LPIT_DRV_GetTimerPeriodByUs(uint32_t instance, uint32_t channel)
Gets the timer channel period in microseconds.
lpit_trigger_source_t triggerSource
uint64_t LPIT_DRV_GetCurrentTimerUs(uint32_t instance, uint32_t channel)
Gets the current timer channel counting value in microseconds.
static LPIT_Type *const s_lpitBase[]
void INT_SYS_DisableIRQ(IRQn_Type irqNumber)
Disables an interrupt for a given IRQ number.
bool enableStopOnInterrupt
status_t LPIT_DRV_SetTimerPeriodInDual16ModeByUs(uint32_t instance, uint32_t channel, uint16_t periodHigh, uint16_t periodLow)
Sets the timer channel period in microseconds.
#define LPIT_INSTANCE_COUNT
bool enableStartOnTrigger
status_t CLOCK_SYS_GetFreq(clock_names_t clockName, uint32_t *frequency)
Gets the clock frequency for a specific clock name.
void LPIT_DRV_Init(uint32_t instance, const lpit_user_config_t *userConfig)
Initializes the LPIT module.
void LPIT_DRV_SetTimerPeriodInDual16ModeByCount(uint32_t instance, uint32_t channel, uint16_t periodHigh, uint16_t periodLow)
Sets the timer channel period in count unit.
lpit_period_units_t periodUnits
status_t LPIT_DRV_InitChannel(uint32_t instance, uint32_t channel, const lpit_user_channel_config_t *userChannelConfig)
Initializes the LPIT channel.
void LPIT_DRV_ClearInterruptFlagTimerChannels(uint32_t instance, uint32_t mask)
Clears the interrupt flag of timer channels.
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
IRQn_Type
Defines the Interrupt Numbers definitions.
LPIT configuration structure.
static const clock_names_t s_lpitClkNames[LPIT_INSTANCE_COUNT]
#define MAX_PERIOD_COUNT
Max period in count of all operation mode except for dual 16 bit periodic counter mode...
Structure to configure the channel timer.
#define LPIT_CLOCK_NAMES
Clock names for LPIT.
lpit_timer_modes_t
Mode options available for the LPIT timer Implements : lpit_timer_modes_t_Class.
static uint32_t s_lpitSourceClockFrequency[LPIT_INSTANCE_COUNT]
void INT_SYS_EnableIRQ(IRQn_Type irqNumber)
Enables an interrupt for a given IRQ number.
uint32_t LPIT_DRV_GetTimerPeriodByCount(uint32_t instance, uint32_t channel)
Gets the current timer channel period in count unit.
void LPIT_DRV_EnableTimerChannelInterrupt(uint32_t instance, uint32_t mask)
Enables the interrupt generation of timer channel.
#define MAX_PERIOD_COUNT_16_BIT
Max count of 16 bit.
uint32_t LPIT_DRV_GetInterruptFlagTimerChannels(uint32_t instance, uint32_t mask)
Gets the current interrupt flag of timer channels.
status_t LPIT_DRV_SetTimerPeriodByUs(uint32_t instance, uint32_t channel, uint32_t periodUs)
Sets the timer channel period in microseconds.
void LPIT_DRV_Deinit(uint32_t instance)
De-Initializes the LPIT module.
clock_names_t
Clock names.
void LPIT_DRV_DisableTimerChannelInterrupt(uint32_t instance, uint32_t mask)
Disables the interrupt generation of timer channel.
void LPIT_DRV_StartTimerChannels(uint32_t instance, uint32_t mask)
Starts the timer channel counting.
bool enableReloadOnTrigger
uint32_t LPIT_DRV_GetCurrentTimerCount(uint32_t instance, uint32_t channel)
Gets the current timer channel counting value in count.