Nios® V Processor Software Developer Handbook

ID 743810
Date 10/12/2024
Public
Document Table of Contents

8.7.3.1. System Clock Driver

A system clock device model requires a driver to generate the periodic clock tick. There can be only one system clock driver in a system. You implement a system clock driver as an interrupt service routine (ISR) for a timer peripheral that generates a periodic interrupt. The driver must provide periodic calls to the following function:

void alt_tick (void)

The expectation is that alt_tick() is called in exception context.

To register the presence of a system clock driver, call the following function:

int alt_sysclk_init (alt_u32 nticks)

The input argument nticks is the number of system clock ticks per second, which is determined by your system clock driver. The return value of this function is zero on success, and nonzero otherwise.

For more information about writing interrupt service routines, refer to the Exception Handling section.