void check_tasklets(void) { int i; if (n_tasklets == 0) return; irq_off(); for (i = 0; i < MAX_TASKLETS; i++) { if (tasklet_array[i].exe) { tasklet_array[i].exe(tasklet_array[i].arg); tasklet_array[i].exe = NULL; tasklet_array[i].arg = NULL; n_tasklets--; } } irq_on(); }
void samcoupe_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TIMER_IRQ_OFF: irq_off(ptr, param); break; case TIMER_MOUSE_RESET: samcoupe_mouse_reset(ptr, param); break; case TIMER_VIDEO_UPDATE: sam_video_update_callback(ptr, param); break; default: assert_always(false, "Unknown id in samcoupe_state::device_timer"); } }
void check_tasklets(void) { struct tasklet *t, *n; irq_off(); t = tasklet_list_head; tasklet_list_head = NULL; tasklet_list_tail = NULL; irq_on(); while(t) { n = t->next; if (t->exe) { t->exe(t->arg); } //memset(t, 0x0a, sizeof(struct tasklet)); /* For testing... */ kfree(t); t = n; } }
void tasklet_add(void (*exe)(void*), void *arg) { int i; if (!task_in_syscall()) irq_off(); for (i = 0; i < MAX_TASKLETS; i++) { if (!tasklet_array[i].exe) { tasklet_array[i].exe = exe; tasklet_array[i].arg = arg; n_tasklets++; if (n_tasklets > max_tasklets) max_tasklets = n_tasklets; if (!task_in_syscall()) irq_on(); return; } } while(1) { /* Too many tasklets. */; } }
void tasklet_add(void (*exe)(void*), void *arg) { struct tasklet *t, *x; irq_off(); t = kalloc(sizeof(struct tasklet)); x = tasklet_list_tail; if (!t) return; t->exe = exe; t->arg = arg; t->next = NULL; if (!x) { tasklet_list_head = t; tasklet_list_tail = t; } else { x->next = t; tasklet_list_tail = t; } systick_counter_enable(); irq_on(); }