I just wrote a small test program, and using alt_nticks works perfectly in this program:
#include "sys/alt_alarm.h"
# include "sys/alt_timestamp.h"
static alt_alarm my_alarm;
static alt_u32 ticks_per_250ms;
static volatile unsigned char callback_called;
alt_u32 alarm_callback(void* context){
callback_called = 1;
return ticks_per_250ms;
}
int main(void){
ticks_per_250ms = alt_ticks_per_second() / 4;
callback_called = 0;
alt_alarm_start(&my_alarm, ticks_per_250ms, alarm_callback, NULL);
int current_ticks = 0;
while(1){
current_ticks = alt_nticks();
}
}
So it seems, that it can run with interrupts enabled and in normal program code.
But I have another, bigger project, which also uses the lwIP stack and FreeRTOS, and in this project, alt_nticks() returns zero all the time. This drives me crazy... the BSP is exactly the same for both projects and I did not call any FreeRTOS or lwip specific code before making the call to alt_nticks() (btw: in my freeRTOS project, the alt_alarm doesn't work either for some kind of reason... maybe this is related to the alt_nticks problem?)
regards
*edit*:
btw, I was using a hardware design provided by my board manufacturer (DE2-115 board and the rgmii-enet0 webserver hardware config)