h6. [[Hardware Abstraction Layer]] h6(. » [[List of HAL APIs]] h6((. » HAL timer API The HAL must supply at least one timer capable of generating periodic interrupts. Each timer should generate a separate logical interrupt, and the interrupt must be latched (either in the timer, the main interrupt controller, or both). h4. Terminology * *Granularity* - The base clock rate of the timer - i.e. how many times per second the timer value changes. * *Period* - Controls how often the timer will generate interrupts. If a timer is programmed with a period of @N@, its interrupt rate will be @granularity/N@ Hz. h4. Notes The HAL API does not allow or expect the granularity of a timer to change while the system is running - if multiple clock sources are available then the HAL must pick a suitable clock source on startup and stick to it. The timers must either be variable rate (period is a multiple of a basic granularity), or be fixed rate (period is fixed at 1). Optionally, the timer should be capable of reporting the time until the next interrupt, in units of the granularity ([[HAL_TimerReadCountdown]]). RISC OS expects timer 0 to be capable of generating interrupts at a rate of 100Hz (preferably with the ability to fine-tune the value, so that the [[RTC]] module can smoothly adjust the real-time clock). It's recommended that timers have granularities of at least 1MHz or greater, so that they can be used for timing events at much greater precision than the 100Hz RISC OS system timer allows for. h4. Entry points * [[HAL_Timers]] * [[HAL_TimerDevice]] * [[HAL_TimerGranularity]] * [[HAL_TimerMaxPeriod]] * [[HAL_TimerSetPeriod]] * [[HAL_TimerPeriod]] * [[HAL_TimerReadCountdown]] * [[HAL_TimerIRQClear]] * [[HAL_TimerIRQStatus]] h4. See also * [[HAL counter API]] h6. Information source: Kernel.Docs.HAL.HAL_API in CVS