Altera_Forum
Honored Contributor
21 years agoalt_alarm_start
I am trying to use alt_alarm_start() as a general purpose timer. My callback is not getting called at all. Status from my call is good. Could someone look at the following and give me some hints? Thanx
# include <stdlib.h># include "stdio.h"# include "sys/alt_alarm.h"# include "alt_types.h"# include "system.h" alt_alarm debug_timerTEST ; alt_u32 DebugTESTISR(int context) { printf("running...\n"); } int main() { int status=0; alt_u32 clocks_per_uS = (DEBUG_TIMER_FREQ / 1000); // 1K uS per msec. alt_u32 debugclockspercall = clocks_per_uS * 200;//0;//00; //status = alt_sysclk_init(DEBUG_TIMER_FREQ); if (alt_alarm_start(&debug_timerTEST, debugclockspercall, DebugTESTISR, NULL) != 0) fprintf(stdout, "Error: failed to start DEBUG timer\n"); while(1) { printf("."); usleep(1000); } }