ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fsl_pit_hal.c File Reference
#include "fsl_pit_hal.h"
#include "BM_pit_instance.h"
#include "fsl_pit_features.h"
#include "isf_fsl_TU_PEx.h"
#include "PIT_PDD.h"
Include dependency graph for fsl_pit_hal.c:

Go to the source code of this file.

Functions

void pit_hal_enable (void)
 Enable PIT module. More...
 
void pit_hal_disable (void)
 Disable PIT module. More...
 
void pit_hal_configure_timer_run_in_debug (bool timerRun)
 Configure timers to continue to run or stop in debug mode. More...
 
void pit_hal_timer_start (uint32_t timer)
 Start timer counting. More...
 
void pit_hal_timer_stop (uint32_t timer)
 Stop timer counting. More...
 
void pit_hal_timer_reset (uint32_t timer)
 Start timer counting. More...
 
void pit_hal_set_timer_period_count (uint32_t timer, uint32_t count)
 Set timer period in units of count. More...
 
uint32_t pit_hal_read_timer_period_count (uint32_t timer)
 Return current timer period in units of count. More...
 
uint32_t pit_hal_read_timer_count (uint32_t timer)
 Read current timer counting value. More...
 
void pit_hal_configure_interrupt (uint32_t timer, bool enable)
 Enable or disable timer interrupt. More...
 
void pit_hal_clear_interrupt_flag (uint32_t timer)
 Clear timer interrupt flag. More...
 
bool pit_hal_is_timeout_occurred (uint32_t timer)
 Read current timer timeout flag. More...
 

Function Documentation

void pit_hal_clear_interrupt_flag ( uint32_t  timer)

Clear timer interrupt flag.

This function clears the timer interrupt flag after a timeout event occurs.

Parameters
timerTimer channel number.

Definition at line 105 of file fsl_pit_hal.c.

Referenced by bm_start(), bm_timer_init(), and pit_init().

Here is the caller graph for this function:

void pit_hal_configure_interrupt ( uint32_t  timer,
bool  enable 
)

Enable or disable timer interrupt.

If enabled, an interrupt happens when a timeout event occurs (Note: NVIC should be called to enable pit interrupt in system level).

Parameters
timerTimer channel number.
enableEnable or disable interrupt.
  • true: Generate interrupt when timer counts to 0.
  • false: No interrupt is generated.

Definition at line 92 of file fsl_pit_hal.c.

Referenced by pit_init_channel().

Here is the caller graph for this function:

void pit_hal_configure_timer_run_in_debug ( bool  timerRun)

Configure timers to continue to run or stop in debug mode.

In debug mode, the timers will or will 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 values) and then continue the operation.

Parameters
timerRunTimers run or stop in debug mode.
  • true: Timers continue to run in debug mode.
  • false: Timers stop in debug mode.

Definition at line 51 of file fsl_pit_hal.c.

Referenced by pit_init_module().

Here is the caller graph for this function:

void pit_hal_disable ( void  )

Disable PIT module.

This function disables all PIT timer clocks(Note: it will not affect SIM clock gating control).

Definition at line 46 of file fsl_pit_hal.c.

Referenced by pit_shutdown().

Here is the caller graph for this function:

void pit_hal_enable ( void  )

Enable PIT module.

This function enables PIT timer clock (Note: this function will not un-gate the system clock gating control). It should be called before any other timer related setup.

Definition at line 41 of file fsl_pit_hal.c.

Referenced by pit_init_module().

Here is the caller graph for this function:

bool pit_hal_is_timeout_occurred ( uint32_t  timer)

Read current timer timeout flag.

Every time the timer counts to 0, this flag is set.

Parameters
timerTimer channel number.
Returns
Current status of timeout flag.
  • true: Timeout has occurred.
  • false: Timeout has not yet occurred.

Definition at line 112 of file fsl_pit_hal.c.

uint32_t pit_hal_read_timer_count ( uint32_t  timer)

Read current timer counting value.

This function returns the real-time timer counting value, in a range from 0 to timer period.

Parameters
timerTimer channel number.
Returns
Current timer counting value.

Definition at line 83 of file fsl_pit_hal.c.

References TU_instance_PEx_t::fnTULDDGetCounter, TU_instance_PEx_t::fnTULDDGetPeriod, and TU_instance_tbl.

Referenced by pit_read_timer_us().

Here is the caller graph for this function:

uint32_t pit_hal_read_timer_period_count ( uint32_t  timer)

Return current timer period in units of count.

Parameters
timerTimer channel number.
Returns
Timer period in units of count.

Definition at line 76 of file fsl_pit_hal.c.

References TU_instance_PEx_t::fnTULDDGetPeriod, and TU_instance_tbl.

void pit_hal_set_timer_period_count ( uint32_t  timer,
uint32_t  count 
)

Set timer period in units of count.

Timers begin counting from the value set by this function. The counter period of a running timer can be modified by first stopping the timer, setting a new load value, and then starting the timer again. If timers are not restarted, the new value is loaded after the next trigger event.

Parameters
timerTimer channel number.
countTimer period in units of count.

Definition at line 71 of file fsl_pit_hal.c.

References TU_instance_PEx_t::fnTULDDSetPeriod, and TU_instance_tbl.

Referenced by pit_set_timer_period_us().

Here is the caller graph for this function:

void pit_hal_timer_reset ( uint32_t  timer)

Start timer counting.

After calling this function, timers load the start value as specified by function pit_hal_set_timer_period_count(uint32_t timer, uint32_t count), count down to 0 and then load the respective start value again. Each time a timer reaches 0, it generates a trigger pulse and set the timeout interrupt flag.

Parameters
timerTimer channel number.

Definition at line 66 of file fsl_pit_hal.c.

References TU_instance_PEx_t::fnTULDDResetCounter, and TU_instance_tbl.

Referenced by bm_start().

Here is the caller graph for this function:

void pit_hal_timer_start ( uint32_t  timer)

Start timer counting.

After calling this function, timers load the start value as specified by function pit_hal_set_timer_period_count(uint32_t timer, uint32_t count), count down to 0 and then load the respective start value again. Each time a timer reaches 0, it generates a trigger pulse and set the timeout interrupt flag.

Parameters
timerTimer channel number.

Definition at line 56 of file fsl_pit_hal.c.

References TU_instance_PEx_t::fnTULDDEnable, and TU_instance_tbl.

Referenced by pit_timer_start().

Here is the caller graph for this function:

void pit_hal_timer_stop ( uint32_t  timer)

Stop timer counting.

This function stops every timer counting. Timers reload their periods respectively after they call pit_hal_timer_start the next time.

Parameters
timerTimer channel number.

Definition at line 61 of file fsl_pit_hal.c.

References TU_instance_PEx_t::fnTULDDDisable, and TU_instance_tbl.

Referenced by pit_timer_stop().

Here is the caller graph for this function: