Go to the source code of this file.
Defines | |
#define | NUT_TICK_NFREQ 1024L |
Nominal number of system ticks per second. | |
#define | NUT_TIMER_CRYSTAL 32768L |
#define | NUT_TIMER_PRESCALE 1 |
#define | OCR_VALUE (((2 * NUT_TIMER_CRYSTAL / (NUT_TIMER_PRESCALE * NUT_TICK_NFREQ) + 1) / 2) - 1) |
#define | NUT_TICK_FREQ ((2 * NUT_TIMER_CRYSTAL / (OCR_VALUE + 1) / NUT_TIMER_PRESCALE + 1) / 2) |
#define | TCCRx TCCR0 |
#define | TCNTx TCNT0 |
#define | OCRx OCR0 |
#define | TIFR_OCFx _BV(OCF0) |
#define | TIFR_TOVx _BV(TOV0) |
#define | sig_TIMER sig_OUTPUT_COMPARE0 |
Functions | |
void | NutRegisterTimer (void(*handler)(void *)) |
Initialize system timer hardware. | |
u_long | NutGetCpuClock (void) |
Return the CPU clock in Hertz. | |
u_long | NutGetTickClock (void) |
Return the number of system ticks per second. | |
u_long | NutTimerMillisToTicks (u_long ms) |
Calculate system ticks for a given number of milliseconds. |
#define NUT_TICK_NFREQ 1024L |
#define OCR_VALUE (((2 * NUT_TIMER_CRYSTAL / (NUT_TIMER_PRESCALE * NUT_TICK_NFREQ) + 1) / 2) - 1) |
#define NUT_TICK_FREQ ((2 * NUT_TIMER_CRYSTAL / (OCR_VALUE + 1) / NUT_TIMER_PRESCALE + 1) / 2) |
#define TCCRx TCCR0 |
#define TCNTx TCNT0 |
#define OCRx OCR0 |
#define TIFR_OCFx _BV(OCF0) |
#define sig_TIMER sig_OUTPUT_COMPARE0 |
void NutRegisterTimer | ( | void(*)(void *) | handler | ) |
Initialize system timer hardware.
This function is automatically called by Nut/OS during system initialization.
handler | System timer interrupt handler. |
Definition at line 295 of file ostimer.c.
References inb, NUT_CPU_FREQ, NutDisableTimerIrq, NutRegisterIrqHandler(), OCR_VALUE, OCRx, outb, sbi, sig_TIMER, TCCRx, TCNTx, and TIFR_OCFx.
u_long NutGetCpuClock | ( | void | ) |
u_long NutGetTickClock | ( | void | ) |
Return the number of system ticks per second.
Definition at line 350 of file ostimer.c.
References NUT_TICK_FREQ.
Calculate system ticks for a given number of milliseconds.
Definition at line 358 of file ostimer.c.
References NutGetTickClock().