#include "otdefs.h"
Defines | |
#define | StartTimer(tim) TimerSetAsCounter(tim); TimerEnable(tim, true) |
Simple macro to use the timer as counter. | |
#define | ElapsedTimeMs(st, et) (ElapsedTimeUs(st, et) / 1000) |
Enumerations | |
enum | TimerId { TIMER0, TIMER1, TIMER2, TIMER3, TIMER4, TIMER5, TIMER6, TIMER7 } |
Functions | |
void | DelayUs (U32 dly) |
Delay. Not accurate! | |
void | DelayMs (U32 dlyMs) |
Delay. Not accurate! | |
void | CoreTimerSetInterruptService (int prescaler, U32 countValue, bool autoReload, void(*pCallback)()) |
Set the interrupt service for the CORE timer. The core timer is a programmable 32-bit interval timer which can generate periodic interrupts. Unlike other peripherals, the core timer resides inside the Blackfin core and runs at the core clock (CCLK) rate. Usage example: // Prescaler action 400MHz / 40 (39+1) = 10MHz (100ns) // Period: 5000000 * 100ns = 0.5s CoreTimerSetInterruptService(39, 5000000, true, _coreTimerCallBack); | |
void | CoreTimerEnable (bool ena) |
Enable CORE timer. Enable or disable CORE timer. | |
void | TimerSetInterruptCallBack (int timer, void(*pCallback)()) |
Change the callback of the specified timer. TimerEnable(TIMER0, false); TimerSetInterruptService(TIMER0, _newTimer0CallBack); TimerEnable(TIMER0, true); | |
void | TimerSetInterruptService (int timer, void(*pCallback)(), U32 countValue) |
Set the interrupt service for a timer. With this procedure is possible to set an interrupt service routine called at every terminal count of the timer. Typical usage: TimerSetInterruptService(TIMER0, _timer0CallBack, TimerRateMs(1000)); TimerEnable(TIMER0, true); | |
void | TimerClrInterruptService (int timer) |
Clear the interrupt service for a timer. | |
void | TimerSetSquareWave (int timer, U32 width, U32 period) |
TBD. | |
void | TimerSetAsCounter (int timer) |
Period measure. Preset a timer to be used for elapsed time. | |
U32 | TimerGetCounts (int timer) |
Return timer counts. Return the timer counts. Used for time measure. // Init timer 0 TimerSetAsCounter(TIMER0); TimerEnable(TIMER0, true); U32 st = TimerGetCounts(TIMER0); // Grab start time // Do your process ... U32 et = TimerGetCounts(TIMER0); // Grab end time printf("Elapsed time: %u mS\n", ElapsedTimeUs(st, et) / 1000); | |
void | TimerEnable (int timer, bool ena) |
Timer enable. Enable or disable selected timer. | |
float | CoreGetPeripheralClock () |
Get peripheral clock as MHz. Return SCLCK frequency used by peripherals. | |
float | CoreGetClock () |
Get core clock as MHz. Return the CCLK frequency used by the core. | |
void | WatchDogSetTimeout (U32 count) |
Preset watch dog timer. A software watchdog can improve system reliability by generating an event to the processor core if the watchdog expires before being updated by software. The 32-bit watchdog timer counts downward every SCLK cycle. If it becomes 0, an event requests can be issued (RESET). | |
void | WatchDogEnable (bool enable) |
Enable or disable watch dog. | |
U32 | ElapsedTime (U32 st, U32 et) |
Calculation of the elapsed time from the timer count values. | |
U32 | ElapsedTimeUs (U32 st, U32 et) |
Calculation of the elapsed time from the timer count values. | |
U32 | ElapsedTimeNs (U32 st, U32 et) |
Calculation of the elapsed time from the timer count values. | |
U32 | TimerRateHz (double Hz) |
Calculates the count value of a timer to obtain the desired frequency (Hertz). | |
U32 | TimerRateMs (double Ms) |
Calculates the count value of a timer to obtain the desired period (mS). | |
U32 | TimerRateUs (double Us) |
Calculates the count value of a timer to obtain the desired period (uS). | |
void | ElapsedTimeStart (int timer) |
starts the measurement of time (ms). | |
U32 | ElapsedTimeEnd (int timer) |
Ends the measurement of time (ms). | |
U32 | ElapsedTimeEndUs (int timer) |
bool | ElapsedTimeCheck (U32 target, int timer) |
Check if the "target" time has been reached. | |
bool | ElapsedTimeCheckUs (U32 target, int timer) |
Check if the "target" time has been reached. | |
bool | ElapsedTimeCheckUsMark (U32 target, int timer) |
Check if the "target" time has been reached and if it is done store a new value for next check. | |
void | TimerDelayUs (int timer, U32 dly) |
void | LongTimerTick (U16 id) |
U64 | LongTimerTickValue (U16 id) |
U64 | LongTimerTickRead (U16 id) |