update to GINT_CALL() callbacks
This commit is contained in:
parent
5586985a3d
commit
a088ab503f
|
@ -237,7 +237,7 @@ static uint32_t test_speed(void)
|
|||
int volatile flag = 0;
|
||||
prof = prof_make();
|
||||
|
||||
rtc_start_timer(RTC_16Hz, speed_callback, &flag);
|
||||
rtc_periodic_enable(RTC_16Hz, GINT_CALL(speed_callback, &flag));
|
||||
|
||||
while(flag != 2) sleep();
|
||||
return prof_time(prof);
|
||||
|
@ -548,15 +548,6 @@ static void edit_date(void)
|
|||
// Main screen with lazy update
|
||||
//---
|
||||
|
||||
static volatile int frame_done = 0;
|
||||
|
||||
static int rtc_timer_callback(void)
|
||||
{
|
||||
frame_done = 0;
|
||||
return TIMER_CONTINUE;
|
||||
}
|
||||
|
||||
/* gintctl_gint_rtc(): Configure RTC and check timer speed */
|
||||
void gintctl_gint_rtc(void)
|
||||
{
|
||||
key_event_t ev;
|
||||
|
@ -566,23 +557,18 @@ void gintctl_gint_rtc(void)
|
|||
int tab = 1;
|
||||
|
||||
uint32_t elapsed = test_speed();
|
||||
volatile int frame_needed = 1;
|
||||
|
||||
rtc_start_timer(RTC_1Hz, rtc_timer_callback);
|
||||
rtc_periodic_enable(RTC_1Hz, GINT_CALL_SET(&frame_needed));
|
||||
|
||||
while(run_loop)
|
||||
{
|
||||
if(!frame_done) rtc_get_time(&time);
|
||||
|
||||
/* Redraw only when a second elapses */
|
||||
if(!frame_done && tab == 1)
|
||||
if(frame_needed)
|
||||
{
|
||||
draw_rtc(&time);
|
||||
frame_done = 1;
|
||||
}
|
||||
else if(!frame_done && tab == 2)
|
||||
{
|
||||
draw_speed(&time, elapsed);
|
||||
frame_done = 1;
|
||||
rtc_get_time(&time);
|
||||
if(tab == 1) draw_rtc(&time);
|
||||
if(tab == 2) draw_speed(&time, elapsed);
|
||||
frame_needed = 0;
|
||||
}
|
||||
|
||||
/* Handle keyboard events */
|
||||
|
@ -599,13 +585,13 @@ void gintctl_gint_rtc(void)
|
|||
else if(ev.key == KEY_F6 && tab == 1) edit_time();
|
||||
else action = 0;
|
||||
|
||||
if(action) frame_done = 0;
|
||||
if(action) frame_needed = 1;
|
||||
}
|
||||
|
||||
/* Wait for either keyboard or RTC to produce an event, except
|
||||
if we already have work to do */
|
||||
if(frame_done) sleep();
|
||||
if(!frame_needed) sleep();
|
||||
}
|
||||
|
||||
rtc_stop_timer();
|
||||
rtc_periodic_disable();
|
||||
}
|
||||
|
|
|
@ -145,8 +145,8 @@ void gintctl_gint_timer(void)
|
|||
/* On F1, pretend to sleep and just see what happens */
|
||||
if(key == KEY_F1)
|
||||
{
|
||||
int free = timer_setup(tid, timer_delay(tid, 1000000,
|
||||
TIMER_Pphi_4), NULL);
|
||||
int free = timer_configure(tid, timer_delay(tid, 1000000,
|
||||
TIMER_Pphi_4), GINT_CALL_NULL);
|
||||
if(free == tid) timer_start(tid);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ void gintctl_gint_timer_callbacks(void)
|
|||
if(!callback) continue;
|
||||
|
||||
/* Allocate a first timer to run the callback */
|
||||
int t = timer_setup(TIMER_ANY, 40000, callback, arg);
|
||||
int t = timer_configure(TIMER_ANY, 40000, GINT_CALL(callback, arg));
|
||||
if(t < 0)
|
||||
{
|
||||
status = 2;
|
||||
|
@ -114,7 +114,7 @@ void gintctl_gint_timer_callbacks(void)
|
|||
if(key == KEY_F2 || key == KEY_F3)
|
||||
{
|
||||
/* Request a TMU (higher priority) */
|
||||
auxiliary_timer = timer_setup(TIMER_TMU, 10000, NULL);
|
||||
auxiliary_timer = timer_configure(TIMER_TMU,10000,GINT_CALL_NULL);
|
||||
if(auxiliary_timer < 0)
|
||||
{
|
||||
status = 2;
|
||||
|
|
|
@ -419,8 +419,8 @@ void gintctl_gint_tlb(void)
|
|||
}
|
||||
if(key == KEY_F6 && next_miss != 0xffffffff)
|
||||
{
|
||||
int timer = timer_setup(TIMER_ANY, 10000,
|
||||
generate_tlb_miss, next_miss);
|
||||
int timer = timer_configure(TIMER_ANY, 10000,
|
||||
GINT_CALL(generate_tlb_miss, next_miss));
|
||||
if(timer >= 0)
|
||||
{
|
||||
timer_start(timer);
|
||||
|
|
|
@ -19,7 +19,8 @@ int stress_callback(int *counter)
|
|||
uint32_t stress_interrupts(void)
|
||||
{
|
||||
int counter = 0;
|
||||
int timer = timer_setup(TIMER_ANY, 1, stress_callback, &counter);
|
||||
int timer = timer_configure(TIMER_ANY, 1,
|
||||
GINT_CALL(stress_callback, &counter));
|
||||
if(timer < 0) return 0;
|
||||
|
||||
return prof_exec({
|
||||
|
|
|
@ -12,7 +12,7 @@ static uint32_t run_sleep(int us)
|
|||
{
|
||||
/* We can't use sleep_us() as we want a TMU */
|
||||
volatile int flag = 0;
|
||||
int timer = timer_setup(TIMER_TMU, us, timer_timeout, &flag);
|
||||
int timer = timer_configure(TIMER_TMU, us, GINT_CALL_SET_STOP(&flag));
|
||||
if(timer < 0) return 0;
|
||||
|
||||
return prof_exec({
|
||||
|
|
Loading…
Reference in New Issue