timer.h File Reference

Handle timers. More...

#include "alarm.h"

Go to the source code of this file.

Defines

#define CLOCK_BASE_MS   100
 resulution of the auxilary timer
#define SECONDS(s)   (((s)*1000)/CLOCK_BASE_MS)
#define MS(s)   (s/CLOCK_BASE_MS)

Functions

void Timer_Interrupt ()
void _os_init_timers ()

Variables

t_counter T1_counter


Detailed Description

Handle timers.

Introduction

This module contains all timer related code. The kernel tick timer is implemented by means of timer 2. Since timer 1 and timer 3 are are sharing the same reset the from the CPP module, only timer 1 is available for programming.

All timers are derived from the CPU clock and a counter which is reset when a certain counter value cnt is reached and some sort of pre and post scaler.

               t * Fclock * 1000
    cnt = --------------------------
            prescale * postscale


    t = timer value [ms]
    Fclock = timer base in Mhz
    postscale / prescale factors according your hardware conf.

The value Fclock depends on your oscillator configuration and is normally Fxtal / 4.

Kernel Tick

The generate the kernel tick, timer 2 will be used. The counter allows values from 1..255 with postscale = 8,prescale = 16.

Auxilary Timer

The kernel provides an additional timer which utilizes the timer 1. This timer has a resolution of CLOCK_BASE_MS (default 100ms, max. 104 ms).

Restrictions

Since the timer interrupt causes no rescheduling wakeup, Task_Send have no efect till the next tick interrupt.

Definition in file timer.h.


Generated on Mon Sep 29 19:56:48 2008 for mKernel by  doxygen 1.4.6