84 uint32_t chanStartVal;
88 bool enableNotification;
95 #if (defined(TIMING_OVER_LPIT))
99 #define LPIT_COMPARE_MAX (LPIT_TMR_TVAL_TMR_VAL_MASK)
102 #if (defined(TIMING_OVER_LPTMR))
104 #define LPTMR_TMR_COUNT LPTMR_IRQS_CH_COUNT
114 #define LPTMR_COMPARE_MAX (LPTMR_CMR_COMPARE_MASK)
117 #if (defined(TIMING_OVER_FTM))
125 #define FTM_COMPARE_MAX (FTM_CNT_COUNT_MASK)
128 #if (defined(TIMING_OVER_PIT))
132 static clock_names_t s_pitClockName[PIT_INSTANCE_COUNT] = {PITRTI0_CLK};
134 #define PIT_COMPARE_MAX (PIT_LDVAL_TSV_MASK)
137 #if (defined(TIMING_OVER_STM))
140 #if FEATURE_STM_HAS_CLOCK_SELECTION
142 static stm_clock_source_t s_stmClockSource[STM_INSTANCE_COUNT];
145 static uint8_t s_stmPrescaler[STM_INSTANCE_COUNT];
147 #define STM_COMPARE_MAX (STM_CMP_CMP_MASK)
154 #if (defined(TIMING_OVER_LPIT))
160 static status_t TIMING_InitLpit(uint32_t instance,
179 channelConfig.
period = 0U;
190 for (index = 0U; index < config->
numChan; index++)
193 channelState = &s_lpitState[instance][chanIndex];
204 channelState->enableNotification =
false;
213 #if (defined(TIMING_OVER_LPTMR))
219 static status_t TIMING_InitLptmr(uint32_t instance,
237 lptmrConfig.
prescaler = ((extension_lptmr_for_timer_t*)(config->
extension))->prescaler;
244 s_lptmrClockSource[instance] = ((extension_lptmr_for_timer_t*)(config->
extension))->clockSelect;
246 s_lptmrPrescaler[instance] = ((extension_lptmr_for_timer_t*)(config->
extension))->prescaler;
248 s_lptmrBypassPrescaler[instance] = ((extension_lptmr_for_timer_t*)(config->
extension))->bypassPrescaler;
252 for (index = 0U; index < config->
numChan; index++)
256 channelState = &s_lptmrState[instance][chanIndex];
261 channelState->enableNotification =
false;
270 #if (defined(TIMING_OVER_FTM))
276 static status_t TIMING_InitFtm(uint32_t instance,
314 g_ftmChannelRunning[instance][index] =
false;
317 for (index = 0U; index < config->
numChan; index++)
335 for (index = 0U; index < config->
numChan; index++)
338 channelState = &s_ftmState[instance][chanIndex];
343 channelState->enableNotification =
false;
346 s_timingOverFtmIsr[instance][chanIndex], (
isr_t*)0);
360 #if (defined(TIMING_OVER_PIT))
366 static status_t TIMING_InitPit(uint32_t instance,
372 const IRQn_Type pitIrq[PIT_INSTANCE_COUNT][PIT_IRQS_CH_COUNT] = PIT_IRQS;
373 pit_config_t pitConfig;
374 pit_channel_config_t channelConfig;
380 #if FEATURE_PIT_HAS_RTI_CHANNEL
381 pitConfig.enableRTITimer =
false;
383 pitConfig.enableStandardTimers =
true;
384 pitConfig.stopRunInDebug =
true;
386 channelConfig.hwChannel = 0U;
387 channelConfig.periodUnit = PIT_PERIOD_UNITS_COUNTS;
388 channelConfig.period = 0U;
389 channelConfig.enableChain =
false;
390 channelConfig.enableInterrupt =
true;
393 PIT_DRV_Init(instance, &pitConfig);
395 for (index = 0U; index < config->
numChan; index++)
398 channelState = &s_pitState[instance][chanIndex];
400 channelConfig.hwChannel = chanIndex;
401 status = PIT_DRV_InitChannel(instance, &channelConfig);
410 channelState->enableNotification =
false;
419 #if (defined(TIMING_OVER_STM))
425 static status_t TIMING_InitStm(uint32_t instance,
431 const IRQn_Type stmIrq[STM_INSTANCE_COUNT][STM_CHANNEL_COUNT] = STM_IRQS;
432 stm_config_t stmConfig;
438 #if FEATURE_STM_HAS_CLOCK_SELECTION
439 stmConfig.clockSource = ((extension_stm_for_timer_t*)(config->
extension))->clockSelect;
441 s_stmClockSource[instance] = ((extension_stm_for_timer_t*)(config->
extension))->clockSelect;
443 stmConfig.clockPrescaler = ((extension_stm_for_timer_t*)(config->
extension))->prescaler;
444 stmConfig.stopInDebugMode =
true;
445 stmConfig.startValue = 0U;
447 s_stmPrescaler[instance] = ((extension_stm_for_timer_t*)(config->
extension))->prescaler;
449 STM_DRV_Init(instance, &stmConfig);
451 for (index = 0U; index < config->
numChan; index++)
454 channelState = &s_stmState[instance][chanIndex];
459 channelState->enableNotification =
false;
492 #if (defined (TIMING_OVER_LPIT))
496 status = TIMING_InitLpit(instance->
instIdx, config);
502 #if (defined (TIMING_OVER_LPTMR))
508 status = TIMING_InitLptmr(instance->
instIdx, config);
514 #if (defined (TIMING_OVER_FTM))
520 status = TIMING_InitFtm(instance->
instIdx, config);
526 #if (defined (TIMING_OVER_PIT))
527 if (instance->
instType == TIMING_INST_TYPE_PIT)
530 status = TIMING_InitPit(instance->
instIdx, config);
536 #if (defined (TIMING_OVER_STM))
537 if (instance->
instType == TIMING_INST_TYPE_STM)
542 status = TIMING_InitStm(instance->
instIdx, config);
567 #if (defined (TIMING_OVER_LPIT))
576 #if (defined (TIMING_OVER_LPTMR))
585 #if (defined (TIMING_OVER_FTM))
597 #if (defined (TIMING_OVER_PIT))
598 if (instance->
instType == TIMING_INST_TYPE_PIT)
600 PIT_DRV_Deinit(instance->
instIdx);
606 #if (defined (TIMING_OVER_STM))
607 if (instance->
instType == TIMING_INST_TYPE_STM)
609 STM_DRV_Deinit(instance->
instIdx);
633 const uint8_t channel,
634 const uint32_t periodTicks)
641 #if (defined (TIMING_OVER_LPIT))
644 uint32_t channelMask = 1UL << channel;
651 channelState = &s_lpitState[instance->
instIdx][channel];
653 channelState->period = periodTicks;
655 channelState->enableNotification =
true;
661 #if (defined (TIMING_OVER_LPTMR))
666 uint32_t lptmrInstance = instance->
instIdx;
677 channelState = &s_lptmrState[lptmrInstance][channel];
679 channelState->period = periodTicks;
681 channelState->enableNotification =
true;
687 #if (defined (TIMING_OVER_FTM))
690 uint32_t ftmInstance = instance->
instIdx;
691 FTM_Type *
const base = ftmBase[ftmInstance];
692 uint32_t currentCounter;
706 g_ftmChannelRunning[ftmInstance][channel] =
true;
709 channelState = &s_ftmState[ftmInstance][channel];
710 channelState->chanStartVal = currentCounter;
712 channelState->period = periodTicks;
714 channelState->enableNotification =
true;
720 #if (defined (TIMING_OVER_PIT))
721 if (instance->
instType == TIMING_INST_TYPE_PIT)
723 const uint32_t pitInstance = instance->
instIdx;
725 PIT_DRV_SetTimerPeriodByCount(pitInstance, channel, periodTicks);
727 PIT_DRV_StartChannel(pitInstance, channel);
729 channelState = &s_pitState[pitInstance][channel];
731 channelState->period = periodTicks;
733 channelState->enableNotification =
true;
739 #if (defined (TIMING_OVER_STM))
740 if (instance->
instType == TIMING_INST_TYPE_STM)
742 uint32_t stmInstance = instance->
instIdx;
743 uint32_t currentCounter;
744 uint32_t compareValue;
747 currentCounter = STM_DRV_GetCounterValue(stmInstance);
749 if ((STM_COMPARE_MAX - currentCounter) >= periodTicks)
752 compareValue = currentCounter + periodTicks;
757 compareValue = periodTicks - (STM_COMPARE_MAX - currentCounter);
760 STM_DRV_ConfigChannel(stmInstance, channel, compareValue);
762 STM_DRV_StartTimer(stmInstance);
764 channelState = &s_stmState[stmInstance][channel];
765 channelState->chanStartVal = currentCounter;
767 channelState->period = periodTicks;
769 channelState->enableNotification =
true;
789 const uint8_t channel)
796 #if (defined (TIMING_OVER_LPIT))
802 channelState = &s_lpitState[instance->
instIdx][channel];
804 channelState->enableNotification =
false;
810 #if (defined (TIMING_OVER_LPTMR))
818 channelState = &s_lptmrState[instance->
instIdx][channel];
820 channelState->enableNotification =
false;
826 #if (defined (TIMING_OVER_FTM))
832 g_ftmChannelRunning[instance->
instIdx][channel] =
false;
833 channelState = &s_ftmState[instance->
instIdx][channel];
835 channelState->enableNotification =
false;
841 #if (defined (TIMING_OVER_PIT))
842 if (instance->
instType == TIMING_INST_TYPE_PIT)
845 PIT_DRV_StopChannel(instance->
instIdx, channel);
847 channelState = &s_pitState[instance->
instIdx][channel];
849 channelState->enableNotification =
false;
855 #if (defined (TIMING_OVER_STM))
856 if (instance->
instType == TIMING_INST_TYPE_STM)
859 STM_DRV_DisableChannel(instance->
instIdx, channel);
862 channelState = &s_stmState[instance->
instIdx][channel];
864 channelState->enableNotification =
false;
885 const uint8_t channel)
889 uint32_t currentCounter = 0U;
890 uint32_t timeElapsed = 0U;
893 #if (defined (TIMING_OVER_LPIT))
900 lpitChannelState = &s_lpitState[instance->
instIdx][channel];
902 timeElapsed = lpitChannelState->period - currentCounter;
908 #if (defined (TIMING_OVER_LPTMR))
912 (void)currentCounter;
921 #if (defined (TIMING_OVER_FTM))
926 uint32_t ftmInstance = instance->
instIdx;
927 const FTM_Type *
const base = ftmBase[ftmInstance];
935 ftmChannelState = &s_ftmState[ftmInstance][channel];
937 if (currentCounter >= ftmChannelState->chanStartVal)
940 timeElapsed = currentCounter - ftmChannelState->chanStartVal;
945 timeElapsed = (finalValue - ftmChannelState->chanStartVal) + currentCounter;
952 #if (defined (TIMING_OVER_PIT))
953 if (instance->
instType == TIMING_INST_TYPE_PIT)
955 uint32_t pitInstance = instance->
instIdx;
959 currentCounter = PIT_DRV_GetCurrentTimerCount(pitInstance, channel);
961 pitChannelState = &s_pitState[pitInstance][channel];
963 timeElapsed = pitChannelState->period - currentCounter;
969 #if (defined (TIMING_OVER_STM))
970 if (instance->
instType == TIMING_INST_TYPE_STM)
972 uint32_t stmInstance = instance->
instIdx;
976 currentCounter = STM_DRV_GetCounterValue(stmInstance);
977 stmChannelState = &s_stmState[stmInstance][channel];
979 if (currentCounter >= (stmChannelState->chanStartVal))
982 timeElapsed = currentCounter - stmChannelState->chanStartVal;
987 timeElapsed = (STM_COMPARE_MAX - stmChannelState->chanStartVal) + currentCounter;
1010 const uint8_t channel)
1014 uint32_t timeElapsed = 0U;
1015 uint32_t timeRemain = 0U;
1018 #if (defined (TIMING_OVER_LPIT))
1029 #if (defined (TIMING_OVER_LPTMR))
1033 uint32_t lptmrInstance = instance->
instIdx;
1039 lptmrChannelState = &s_lptmrState[lptmrInstance][channel];
1041 timeRemain = lptmrChannelState->period - timeElapsed;
1047 #if (defined (TIMING_OVER_FTM))
1052 uint32_t ftmInstance = instance->
instIdx;
1053 const FTM_Type *
const base = ftmBase[ftmInstance];
1054 uint16_t ftmCurrentCounter = 0U;
1055 uint16_t finalValue;
1062 ftmChannelState = &s_ftmState[ftmInstance][channel];
1064 if (ftmCurrentCounter >= ftmChannelState->chanStartVal)
1067 timeElapsed = ftmCurrentCounter - ftmChannelState->chanStartVal;
1072 timeElapsed = (finalValue - ftmChannelState->chanStartVal) + ftmCurrentCounter;
1075 timeRemain = ftmChannelState->period - timeElapsed;
1081 #if (defined (TIMING_OVER_PIT))
1082 if (instance->
instType == TIMING_INST_TYPE_PIT)
1087 timeRemain = PIT_DRV_GetCurrentTimerCount(instance->
instIdx, channel);
1093 #if (defined (TIMING_OVER_STM))
1094 if (instance->
instType == TIMING_INST_TYPE_STM)
1096 uint32_t stmInstance = instance->
instIdx;
1100 uint32_t stmCurrentCounter = STM_DRV_GetCounterValue(stmInstance);
1101 stmChannelState = &s_stmState[stmInstance][channel];
1103 if ((stmCurrentCounter >= stmChannelState->chanStartVal))
1106 timeElapsed = stmCurrentCounter - stmChannelState->chanStartVal;
1111 timeElapsed = (STM_COMPARE_MAX - stmChannelState->chanStartVal) + stmCurrentCounter;
1114 timeRemain = stmChannelState->period - timeElapsed;
1134 const uint8_t channel)
1141 #if (defined (TIMING_OVER_LPIT))
1146 channelState = &s_lpitState[instance->
instIdx][channel];
1148 channelState->enableNotification =
true;
1154 #if (defined (TIMING_OVER_LPTMR))
1159 uint32_t lptmrInstance = instance->
instIdx;
1161 channelState = &s_lptmrState[lptmrInstance][channel];
1163 channelState->enableNotification =
true;
1170 #if (defined (TIMING_OVER_FTM))
1174 uint32_t ftmInstance = instance->
instIdx;
1176 channelState = &s_ftmState[ftmInstance][channel];
1178 channelState->enableNotification =
true;
1184 #if (defined (TIMING_OVER_PIT))
1185 if (instance->
instType == TIMING_INST_TYPE_PIT)
1188 uint32_t pitInstance = instance->
instIdx;
1190 channelState = &s_pitState[pitInstance][channel];
1192 channelState->enableNotification =
true;
1198 #if (defined (TIMING_OVER_STM))
1199 if (instance->
instType == TIMING_INST_TYPE_STM)
1202 uint32_t stmInstance = instance->
instIdx;
1204 channelState = &s_stmState[stmInstance][channel];
1206 channelState->enableNotification =
true;
1224 const uint8_t channel)
1231 #if (defined (TIMING_OVER_LPIT))
1236 channelState = &s_lpitState[instance->
instIdx][channel];
1238 channelState->enableNotification =
false;
1244 #if (defined (TIMING_OVER_LPTMR))
1250 channelState = &s_lptmrState[instance->
instIdx][channel];
1252 channelState->enableNotification =
false;
1259 #if (defined (TIMING_OVER_FTM))
1264 channelState = &s_ftmState[instance->
instIdx][channel];
1266 channelState->enableNotification =
false;
1272 #if (defined (TIMING_OVER_PIT))
1273 if (instance->
instType == TIMING_INST_TYPE_PIT)
1277 channelState = &s_pitState[instance->
instIdx][channel];
1279 channelState->enableNotification =
false;
1285 #if (defined (TIMING_OVER_STM))
1286 if (instance->
instType == TIMING_INST_TYPE_STM)
1290 channelState = &s_stmState[instance->
instIdx][channel];
1292 channelState->enableNotification =
false;
1312 uint64_t *
const resolution)
1318 static uint32_t clkFrequency = 0U;
1319 uint64_t prescaler = 1U;
1322 #if (defined (TIMING_OVER_LPIT))
1340 #if (defined (TIMING_OVER_LPTMR))
1346 uint32_t lptmrInstance = instance->
instIdx;
1349 switch(s_lptmrClockSource[lptmrInstance])
1375 if (!s_lptmrBypassPrescaler[lptmrInstance])
1377 prescaler = prescaler << ((uint8_t)s_lptmrPrescaler[lptmrInstance] + 1U);
1384 #if (defined (TIMING_OVER_FTM))
1389 uint32_t ftmInstance = instance->
instIdx;
1399 #if (defined (TIMING_OVER_PIT))
1400 if (instance->
instType == TIMING_INST_TYPE_PIT)
1405 uint32_t pitInstance = instance->
instIdx;
1417 #if (defined (TIMING_OVER_STM))
1418 if (instance->
instType == TIMING_INST_TYPE_STM)
1422 uint32_t stmInstance = instance->
instIdx;
1426 #if FEATURE_STM_HAS_CLOCK_SELECTION
1427 switch(s_stmClockSource[stmInstance])
1429 case STM_CLOCK_SYSTEM:
1430 inputClockName = FS80_CLK;
1432 case STM_CLOCK_FXOSC:
1433 inputClockName = FXOSC_CLK;
1441 inputClockName = PBRIDGEx_CLK;
1449 prescaler = (uint64_t)s_stmPrescaler[stmInstance] + 1UL;
1460 *resolution = ((1000000000U * prescaler) + ((uint64_t)clkFrequency >> 1U)) / clkFrequency;
1465 *resolution = ((1000000U * prescaler) + ((uint64_t)clkFrequency >> 1U)) / clkFrequency;
1470 *resolution = ((1000U * prescaler) + ((uint64_t)clkFrequency >> 1U)) / clkFrequency;
1473 if(*resolution == 0U)
1491 uint64_t *
const maxPeriod)
1497 static uint32_t clkFrequency = 0U;
1498 uint64_t prescaler = 1U;
1499 uint64_t maxCountValue = 0U;
1502 #if (defined (TIMING_OVER_LPIT))
1510 maxCountValue = (uint64_t)LPIT_COMPARE_MAX + 1UL;
1522 #if (defined (TIMING_OVER_LPTMR))
1528 uint32_t lptmrInstance = instance->
instIdx;
1532 maxCountValue = LPTMR_COMPARE_MAX + 1UL;
1534 switch(s_lptmrClockSource[lptmrInstance])
1560 if (!s_lptmrBypassPrescaler[lptmrInstance])
1562 prescaler = prescaler << ((uint8_t)s_lptmrPrescaler[lptmrInstance] + 1U);
1569 #if (defined (TIMING_OVER_FTM))
1572 uint32_t ftmInstance = instance->
instIdx;
1575 maxCountValue = FTM_COMPARE_MAX + 1UL;
1585 #if (defined (TIMING_OVER_PIT))
1586 if (instance->
instType == TIMING_INST_TYPE_PIT)
1591 uint32_t pitInstance = instance->
instIdx;
1594 maxCountValue = (uint64_t)PIT_COMPARE_MAX + 1UL;
1606 #if (defined (TIMING_OVER_STM))
1607 if (instance->
instType == TIMING_INST_TYPE_STM)
1612 uint32_t stmInstance = instance->
instIdx;
1616 maxCountValue = (uint64_t)STM_COMPARE_MAX + 1UL;
1618 #if FEATURE_STM_HAS_CLOCK_SELECTION
1620 switch(s_stmClockSource[stmInstance])
1622 case STM_CLOCK_SYSTEM:
1623 inputClockName = FS80_CLK;
1625 case STM_CLOCK_FXOSC:
1626 inputClockName = FXOSC_CLK;
1634 inputClockName = PBRIDGEx_CLK;
1642 prescaler = (uint64_t)s_stmPrescaler[stmInstance] + 1UL;
1654 *maxPeriod = (((1000000000U * prescaler) + ((uint64_t)clkFrequency >> 1U)) / clkFrequency) * maxCountValue;
1659 *maxPeriod = ((1000000U * prescaler * maxCountValue) + ((uint64_t)clkFrequency >> 1U)) / clkFrequency;
1663 *maxPeriod = ((1000U * prescaler * maxCountValue) + ((uint64_t)clkFrequency >> 1U)) / clkFrequency;
1666 if(*maxPeriod == 0U)
1674 #if (defined (TIMING_OVER_LPIT))
1683 void TIMING_Lpit_IrqHandler(uint32_t instance, uint8_t channel)
1687 if ((channelState->callback != NULL) && (channelState->enableNotification))
1690 (channelState->callback)(channelState->callbackParam);
1694 uint32_t channelMask = 1UL << channel;
1705 #if (defined (TIMING_OVER_LPTMR))
1714 void TIMING_Lptmr_IrqHandler(uint32_t instance, uint8_t channel)
1718 if ((channelState->callback != NULL) && (channelState->enableNotification))
1721 (channelState->callback)(channelState->callbackParam);
1734 #if (defined (TIMING_OVER_FTM))
1743 void TIMING_Ftm_IrqHandler(uint32_t instance, uint8_t channel)
1745 FTM_Type *
const base = ftmBase[instance];
1748 if ((channelState->callback != NULL) && (channelState->enableNotification))
1751 (channelState->callback)(channelState->callbackParam);
1759 g_ftmChannelRunning[instance][channel] =
false;
1764 uint32_t currentCmpValue = 0U;
1765 uint32_t currentPeriod = channelState->period;
1766 uint32_t nexCompareValue = 0U;
1767 uint32_t finalValue;
1774 if ((finalValue - currentCmpValue) > currentPeriod)
1776 nexCompareValue = currentCmpValue + currentPeriod;
1780 nexCompareValue = currentPeriod - (finalValue - currentCmpValue);
1786 channelState->chanStartVal = currentCmpValue;
1794 #if (defined (TIMING_OVER_PIT))
1803 void TIMING_Pit_IrqHandler(uint32_t instance, uint8_t channel)
1807 if ((channelState->callback != NULL) && (channelState->enableNotification))
1810 (channelState->callback)(channelState->callbackParam);
1815 PIT_DRV_StopChannel(instance, channel);
1818 PIT_DRV_ClearStatusFlags(instance, channel);
1823 #if (defined (TIMING_OVER_STM))
1832 void TIMING_Stm_IrqHandler(uint32_t instance, uint8_t channel)
1834 uint32_t currentCounter = 0U;
1838 currentCounter = STM_DRV_GetCounterValue(instance);
1840 if ((channelState->callback != NULL) && (channelState->enableNotification))
1843 (channelState->callback)(channelState->callbackParam);
1845 channelState->chanStartVal = currentCounter;
1851 STM_DRV_DisableChannel(instance, channel);
1856 STM_DRV_IncrementTicks(instance, channel, channelState->period);
1858 STM_DRV_ClearStatusFlags(instance, channel);
timer_chan_type_t
Type options available for timer channel notification.
ftm_reg_update_t initCounterSync
ftm_pwm_sync_t syncMethod
static uint16_t FTM_DRV_GetChnCountVal(const FTM_Type *ftmBase, uint8_t channel)
Gets the FTM peripheral timer channel counter value.
lptmr_workmode_t workMode
FlexTimer state structure of the driver.
void LPTMR_DRV_Init(const uint32_t instance, const lptmr_config_t *const config, const bool startCounter)
Initialize a LPTMR instance with values from an input configuration structure.
#define FTM_CONTROLS_COUNT
timer_callback_t callback
FlexTimer driver PWM parameters.
lpit_timer_modes_t timerMode
timer_chan_type_t chanType
status_t TIMING_GetMaxPeriod(const timing_instance_t *const instance, const timer_resolution_type_t type, uint64_t *const maxPeriod)
Get max period in engineering units.
Configuration structure that the user needs to set.
lptmr_pinpolarity_t pinPolarity
void TIMING_DisableNotification(const timing_instance_t *const instance, const uint8_t channel)
Disable channel notifications.
void LPTMR_DRV_StopCounter(const uint32_t instance)
Disable the LPTMR / Stop the counter.
void LPIT_DRV_SetTimerPeriodByCount(uint32_t instance, uint32_t channel, uint32_t count)
Sets the timer channel period in count unit.
lptmr_clocksource_t clockSelect
Defines the configuration structure for LPTMR.
void LPTMR_DRV_ClearCompareFlag(const uint32_t instance)
Clear the Compare Flag of a LPTMR instance.
ftm_output_cmp_ch_param_t * outputChannelConfig
lptmr_prescaler_t prescaler
lptmr_clocksource_t
Clock Source selection Implements : lptmr_clocksource_t_Class.
void TIMING_Deinit(const timing_instance_t *const instance)
De-initialize a timer instance.
void LPIT_DRV_StopTimerChannels(uint32_t instance, uint32_t mask)
Stops the timer channel counting.
ftm_output_compare_mode_t chMode
timing_inst_type_t instType
lpit_trigger_source_t triggerSource
lptmr_counter_units_t counterUnits
lptmr_pinselect_t pinSelect
#define LPTMR_INSTANCE_COUNT
Structure storing PAL instance information.
bool enableStopOnInterrupt
status_t FTM_DRV_InitOutputCompare(uint32_t instance, const ftm_output_cmp_param_t *param)
Configures the FTM to generate timed pulses(Output compare mode).
lptmr_prescaler_t
Prescaler Selection Implements : lptmr_prescaler_t_Class.
uint32_t FTM_DRV_GetFrequency(uint32_t instance)
Retrieves the frequency of the clock source feeding the FTM counter.
#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 TIMING_StartChannel(const timing_instance_t *const instance, const uint8_t channel, const uint32_t periodTicks)
Starts the timer channel counting.
void LPIT_DRV_Init(uint32_t instance, const lpit_user_config_t *userConfig)
Initializes the LPIT module.
uint32_t TIMING_GetElapsed(const timing_instance_t *const instance, const uint8_t channel)
Get elapsed ticks.
void LPTMR_DRV_Deinit(const uint32_t instance)
De-initialize a LPTMR instance.
Timer configuration structure.
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.
ftm_pwm_sync_mode_t syncPoint
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.
timer_resolution_type_t
Type options available for tick resolution.
uint32_t TIMING_GetRemaining(const timing_instance_t *const instance, const uint8_t channel)
Get remaining ticks.
#define FTM_INSTANCE_COUNT
uint16_t LPTMR_DRV_GetCounterValueByCount(const uint32_t instance)
Get the current counter value in counter tick units.
bool enableInitializationTrigger
void LPTMR_DRV_StartCounter(const uint32_t instance)
Enable the LPTMR / Start the counter.
Structure to configure the channel timer.
ftm_reg_update_t inverterSync
void TIMING_EnableNotification(const timing_instance_t *const instance, const uint8_t channel)
Enable channel notifications.
status_t FTM_DRV_EnableInterrupts(uint32_t instance, uint32_t interruptMask)
This function will enable the generation a list of interrupts. It includes the FTM overflow interrupt...
const timer_chan_config_t * chanConfigArray
ftm_config_mode_t ftmMode
FlexTimer driver PWM parameters.
bool enableExternalTrigger
status_t FTM_DRV_Deinit(uint32_t instance)
Shuts down the FTM driver.
void INT_SYS_EnableIRQ(IRQn_Type irqNumber)
Enables an interrupt for a given IRQ number.
Runtime state of the Timer channel.
ftm_reg_update_t maskRegSync
uint8_t nNumOutputChannels
static void FTM_DRV_ClearChnEventStatus(FTM_Type *const ftmBase, uint8_t channel)
Clears the FTM peripheral timer all channel event status.
static uint16_t FTM_DRV_GetMod(const FTM_Type *ftmBase)
Returns the FTM peripheral counter modulo value.
status_t FTM_DRV_Init(uint32_t instance, const ftm_user_config_t *info, ftm_state_t *state)
Initializes the FTM driver.
void LPIT_DRV_Deinit(uint32_t instance)
De-Initializes the LPIT module.
clock_names_t
Clock names.
void(* isr_t)(void)
Interrupt handler type.
status_t TIMING_GetResolution(const timing_instance_t *const instance, const timer_resolution_type_t type, uint64_t *const resolution)
Get tick resolution.
status_t FTM_DRV_UpdateOutputCompareChannel(uint32_t instance, uint8_t channel, uint16_t nextComparematchValue, ftm_output_compare_update_t update, bool softwareTrigger)
Sets the next compare match value based on the current counter value.
void(* timer_callback_t)(void *userData)
void FTM_DRV_DisableInterrupts(uint32_t instance, uint32_t interruptMask)
This function is used to disable some interrupts.
void LPIT_DRV_StartTimerChannels(uint32_t instance, uint32_t mask)
Starts the timer channel counting.
status_t TIMING_Init(const timing_instance_t *const instance, const timer_config_t *const config)
Initialize the timer instance and timer channels with value from input configuration structure...
ftm_clock_source_t ftmClockSource
bool enableReloadOnTrigger
void TIMING_StopChannel(const timing_instance_t *const instance, const uint8_t channel)
Stop the timer channel counting.
status_t LPTMR_DRV_SetCompareValueByCount(const uint32_t instance, const uint16_t compareValueByCount)
Set the compare value in counter tick units, for a LPTMR instance.
ftm_reg_update_t outRegSync
static uint16_t FTM_DRV_GetCounter(const FTM_Type *ftmBase)
Returns the FTM peripheral current counter value.
ftm_clock_ps_t ftmPrescaler
void INT_SYS_InstallHandler(IRQn_Type irqNumber, const isr_t newHandler, isr_t *const oldHandler)
Installs an interrupt handler routine for a given IRQ number.
uint32_t LPIT_DRV_GetCurrentTimerCount(uint32_t instance, uint32_t channel)
Gets the current timer channel counting value in count.