Nios® V Processor Software Developer Handbook

ID 743810
Date 4/01/2024
Public
Document Table of Contents

6.7. Using Timer Devices

Timer devices are hardware peripherals that count clock ticks and can generate periodic interrupt requests. You can use a timer device to provide a number of time-related facilities, such as the HAL system clock, alarms, the time-of-day, and time measurement. To use the HAL timer facilities, the Nios® V processor system can either leverage the internal Nios® V processor timer or include a timer peripheral.

The HAL API provides two types of timer device drivers:

  • System clock driver—Supports alarms, such as you would use in a scheduler.
  • Timestamp driver—Supports high-resolution time measurement.

A timer peripheral can behave as either a system clock or a timestamp, but not both.

The Nios® V processor core provides an internal timer which can serve as both an interval timer and timestamp. If an external timer such as the Interval Timer core is used, it can only implement a timestamp or a system clock but not both.

For more information about where the HAL-specific API functions for accessing timer devices are defined, refer to the sys/alt_alarm.h and sys/alt_timestamp.h files.