RTEMS Logo

RTEMS 4.10.2 On-Line Library


Clock Driver Initialization

PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

9.3: Initialization

The initialization routine is responsible for programming the hardware that will periodically generate an interrupt. A programmable interval timer is commonly used as the source of the clock tick.

The device should be programmed such that an interrupt is generated every m microseconds, where m is equal to rtems_configuration_get_microseconds_per_tick(). Sometimes the periodic interval timer can use a prescaler so you have to look carefully at your user's manual to determine the correct value.

You must use the RTEMS primitive rtems_interrupt_catch to install your clock interrupt service routine:

rtems_interrupt_catch (Clock_ISR, CLOCK_VECTOR, &old_handler);

Since there is currently not a driver entry point invoked at system shutdown, many clock device drivers use the atexit routine to schedule their Clock_exit routine to execute when the system is shutdown.

By convention, many of the clock drivers do not install the clock tick if the ticks_per_timeslice field of the Configuration Table is 0.


PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

Copyright © 1988-2008 OAR Corporation