из NIOS II Software Developer`s Handbook
Цитата
The callback function can reset the alarm. The return value of the registered callback
function is the number of ticks until the next call to callback. A return value of zero
indicates that the alarm should be stopped. You can manually cancel an alarm by
calling alt_alarm_stop().
ну, и пример там же:
Код
/*Example 6–8. Using a Periodic Alarm Callback Function*/
#include <stddef.h>
#include <stdio.h>
#include "sys/alt_alarm.h"
#include "alt_types.h"
/*
* The callback function.
*/
alt_u32 my_alarm_callback (void* context)
{
/* This function is called once per second */
return alt_ticks_per_second();
}
...
/* The alt_alarm must persist for the duration of the alarm. */
static alt_alarm alarm;
...
if (alt_alarm_start (&alarm,
alt_ticks_per_second(),
my_alarm_callback,
NULL) < 0)
{
printf ("No system clock available\n");
}
обратите внимание, что должен возвращать
callback