Nios® V Processor Software Developer Handbook

ID 743810
Date 5/26/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

13.1.1.13. alt_alarm_start()

Prototype

int alt_alarm_start

( alt_alarm* alarm,

alt_u32 nticks,

alt_u32 (*callback) (void* context),

void* context )

Commonly Called By

C/C++ programs

Device drivers

Thread-safe

Yes.

Available from ISR

Yes.

Include

<sys/alt_alarm.h>

Description

The alt_alarm_start() function schedules an alarm callback.

The HAL waits nticks system clock ticks before calling the callback() function. When the HAL calls callback(), it passes it the input argument context. The HAL does not use the context parameter. It only passes it as a parameter to the callback() function.

The alarm argument is a pointer to a structure that represents this alarm. You must create it, and it must have a lifetime that is at least as long as that of the alarm. However, you are not responsible for initializing the contents of the structure pointed to by alarm. This action is done by the call to alt_alarm_start().

One alarm is created for each call to alt_alarm_start(). Multiple alarms can run simultaneously.

Return

The return value for alt_alarm_start() is zero on success, and negative otherwise. This function fails if there is no system clock available.