ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
bm_timer.h File Reference

Bus managment internal header file. More...

#include "bm_internal.h"
Include dependency graph for bm_timer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TPM_IRQ_VECTOR   INT_TPM0
 
#define TPM_INDEX   0
 
#define TPM_BASE_ADDR   TPM0_BASE_PTR
 
#define TPM_CLK_SRC   TPM_PDD_SYSTEM
 
#define TPM_COUNTER_CLK_SRC   TPM_COUNTER_CLKSRC_DISABLE
 
#define BM_TIMER_STOP()   TPM_TIMER_STOP(TPM_BASE_ADDR)
 
#define BM_TIMER_START()   TPM_TIMER_START(TPM_BASE_ADDR, TPM_CLK_SRC)
 
#define BM_TIMER_CLEAR_IRQ()   TPM_TIMER_CLEAR_IRQ(TPM_BASE_ADDR)
 
#define BM_TIMER_SAVE_RUN_STATE()   TPM_TIMER_SAVE_RUN_STATE(TPM_BASE_ADDR, TPM_INDEX)
 
#define BM_TIMER_RESTORE_RUN_STATE()   TPM_TIMER_RESTORE_RUN_STATE(TPM_BASE_ADDR, TPM_INDEX)
 
#define BM_TIMER_SAVE_STOP()   { BM_TIMER_SAVE_RUN_STATE() BM_TIMER_STOP() }
 
#define BM_TIMER_GET_MODULO()   TPM_TIMER_GET_MODULO(TPM_BASE_ADDR)
 
#define BM_TIMER_SET_MODULO(x)   TPM_TIMER_SET_MODULO(TPM_BASE_ADDR, x)
 
#define BM_TIMER_GET_COUNT()   TPM_TIMER_GET_COUNT(TPM_BASE_ADDR)
 
#define BM_TIMER_COUNTER_RESET()   TPM_TIMER_COUNTER_RESET(TPM_BASE_ADDR)
 
#define BM_TIMER_GET_TIME_REMAINING()   TPM_TIMER_GET_TIME_REMAINING(TPM_BASE_ADDR)
 
#define BM_TIMER_SET_PRESCALER(x)   TPM_TIMER_SET_PRESCALER(TPM_BASE_ADDR, x)
 
#define BM_TIMER_ENABLE_IRQ()   TPM_TIMER_ENABLE_TOF_IRQ(TPM_BASE_ADDR)
 
#define BM_TIMER_INSTALL_ISR(isr, ptr)   tpm_install_isr(isr, ptr, TPM_INDEX)
 
#define TIMER_TPM_GET_CNT()   ((uint32)TPM0_CNT)
 
#define TIMER_TPM_CLEAR_OVF_FLAG()   { TPM0_SC &= ~0x80; }
 
#define TIMER_TPM_START()   { TPM0_CNT = (uint_16)0xffff; }
 
#define TIMER_TPM_STOP()   { TPM0_SC &= ~0x18; }
 
#define TIMER_TPM_RESTORE_RUNSTATE()   { TPM0_SC &= ~0x18; TPM0_SC |= (0x18 & tpm_TPM0_SC); }
 
#define TIMER_TPM_INIT()   { TPM0_SC = 0x00; TPM0_MOD = 0xffff; TPM0_SC = (1 << 3) | 3; TPM0_CNT = (uint_16)0xffff; }
 

Functions

void bm_timer_init (boolean bEnableirq, uint32 usec)
 Timer initialization
. More...
 

Variables

BM_VOLATILE uint8 gBm_timer_run_state
 

Detailed Description

Bus managment internal header file.

Definition in file bm_timer.h.

Macro Definition Documentation

#define BM_TIMER_CLEAR_IRQ ( )    TPM_TIMER_CLEAR_IRQ(TPM_BASE_ADDR)

Definition at line 59 of file bm_timer.h.

#define BM_TIMER_COUNTER_RESET ( )    TPM_TIMER_COUNTER_RESET(TPM_BASE_ADDR)

Definition at line 73 of file bm_timer.h.

#define BM_TIMER_ENABLE_IRQ ( )    TPM_TIMER_ENABLE_TOF_IRQ(TPM_BASE_ADDR)

Definition at line 80 of file bm_timer.h.

#define BM_TIMER_GET_COUNT ( )    TPM_TIMER_GET_COUNT(TPM_BASE_ADDR)

Definition at line 71 of file bm_timer.h.

#define BM_TIMER_GET_MODULO ( )    TPM_TIMER_GET_MODULO(TPM_BASE_ADDR)

Definition at line 68 of file bm_timer.h.

#define BM_TIMER_GET_TIME_REMAINING ( )    TPM_TIMER_GET_TIME_REMAINING(TPM_BASE_ADDR)

Definition at line 76 of file bm_timer.h.

#define BM_TIMER_INSTALL_ISR (   isr,
  ptr 
)    tpm_install_isr(isr, ptr, TPM_INDEX)

Definition at line 82 of file bm_timer.h.

#define BM_TIMER_RESTORE_RUN_STATE ( )    TPM_TIMER_RESTORE_RUN_STATE(TPM_BASE_ADDR, TPM_INDEX)

Definition at line 63 of file bm_timer.h.

#define BM_TIMER_SAVE_RUN_STATE ( )    TPM_TIMER_SAVE_RUN_STATE(TPM_BASE_ADDR, TPM_INDEX)

Definition at line 61 of file bm_timer.h.

#define BM_TIMER_SAVE_STOP ( )    { BM_TIMER_SAVE_RUN_STATE() BM_TIMER_STOP() }

Definition at line 66 of file bm_timer.h.

#define BM_TIMER_SET_MODULO (   x)    TPM_TIMER_SET_MODULO(TPM_BASE_ADDR, x)

Definition at line 69 of file bm_timer.h.

#define BM_TIMER_SET_PRESCALER (   x)    TPM_TIMER_SET_PRESCALER(TPM_BASE_ADDR, x)

Definition at line 78 of file bm_timer.h.

#define BM_TIMER_START ( )    TPM_TIMER_START(TPM_BASE_ADDR, TPM_CLK_SRC)

Definition at line 57 of file bm_timer.h.

#define BM_TIMER_STOP ( )    TPM_TIMER_STOP(TPM_BASE_ADDR)

Definition at line 55 of file bm_timer.h.

#define TIMER_TPM_CLEAR_OVF_FLAG ( )    { TPM0_SC &= ~0x80; }

Definition at line 106 of file bm_timer.h.

#define TIMER_TPM_GET_CNT ( )    ((uint32)TPM0_CNT)

Definition at line 105 of file bm_timer.h.

Referenced by isr_bm_callback_tmr(), and task_bm().

#define TIMER_TPM_INIT ( )    { TPM0_SC = 0x00; TPM0_MOD = 0xffff; TPM0_SC = (1 << 3) | 3; TPM0_CNT = (uint_16)0xffff; }

Definition at line 115 of file bm_timer.h.

Referenced by bm_init().

#define TIMER_TPM_RESTORE_RUNSTATE ( )    { TPM0_SC &= ~0x18; TPM0_SC |= (0x18 & tpm_TPM0_SC); }

Definition at line 112 of file bm_timer.h.

#define TIMER_TPM_START ( )    { TPM0_CNT = (uint_16)0xffff; }

Definition at line 108 of file bm_timer.h.

Referenced by isr_bm_callback_tmr().

#define TIMER_TPM_STOP ( )    { TPM0_SC &= ~0x18; }

Definition at line 109 of file bm_timer.h.

#define TPM_BASE_ADDR   TPM0_BASE_PTR

Definition at line 23 of file bm_timer.h.

#define TPM_CLK_SRC   TPM_PDD_SYSTEM

Definition at line 24 of file bm_timer.h.

#define TPM_COUNTER_CLK_SRC   TPM_COUNTER_CLKSRC_DISABLE

Definition at line 41 of file bm_timer.h.

#define TPM_INDEX   0

Definition at line 22 of file bm_timer.h.

#define TPM_IRQ_VECTOR   INT_TPM0

Definition at line 21 of file bm_timer.h.

Function Documentation

void bm_timer_init ( boolean  bEnableirq,
uint32  usec 
)

Timer initialization
.

Parameters
bEnableirq- [in] TRUE to enable timer interrupt
usec- [in] Initial time in usec to program in timer
Returns

Errors:

Constraints:

Reentrant: No.
Link Libraries:

See also

Definition at line 31 of file bm_timer.c.

References FALSE, ISF_BM_PIT_INSTANCE, PitUserConfig::isInterruptEnabled, pit_hal_clear_interrupt_flag(), pit_init(), pit_init_channel(), pit_init_module(), pit_set_timer_period_us(), and pit_timer_stop().

Referenced by bm_init().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

BM_VOLATILE uint8 gBm_timer_run_state