void __init __attribute__((used)) l4dde26_init(void) { /* first, initialize DDEKit */ ddekit_init(); l4dde26_kmalloc_init(); /* Init Linux driver framework before trying to add PCI devs to the bus */ driver_init(); printk("Initialized DDELinux 2.6\n"); }
/*===========================================================================* * usbd_init * *===========================================================================*/ static void usbd_init(void) { /* No DEBUG_DUMP, threading unavailable yet */ /* Set one handler for all messages */ sef_setcb_init_fresh(usbd_sef_handler); sef_setcb_init_lu(usbd_sef_handler); sef_setcb_init_restart(usbd_sef_handler); /* Initialize DDEkit (involves sef_startup()) */ ddekit_init(); /* After threading initialization, add signal handler */ sef_setcb_signal_handler(usbd_signal_handler); }
int main(int argc, char **argv) { int i; int prio=0; struct task *tqtask; struct taskqueue *tq; ddekit_init(); bsd_dde_init(); tq = taskqueue_thread; // tq = taskqueue_swi; tqtask = malloc(sizeof(*tqtask), M_TST, M_ZERO|M_WAITOK); bzero(tqtask, sizeof(*tqtask)); TASK_INIT(tqtask, prio, tqfn, (void*) prio); printf("enqueueing 10 tasks, step by step\n"); for (i=1; i<=10; i++) { taskqueue_enqueue(tq, tqtask); l4thread_sleep(35); } l4thread_sleep(2000); printf("all enqueued tasks should be done now. testing now with prio's\n"); for (i=1; i<=10; i++) { prio = (2*(i%2)-1) * i + 10; printf("enqueueing task with prio=%d\n", prio); tqtask = malloc(sizeof(*tqtask), M_TST, M_ZERO|M_WAITOK); bzero(tqtask, sizeof(*tqtask)); TASK_INIT(tqtask, prio, tqfn, (void*) prio); taskqueue_enqueue(tq, tqtask); l4thread_sleep(35); } l4thread_sleep_forever(); return 0; }
int main(int argc, char **argv) { ddekit_init(); bsd_dde_init(); printf("cold=%d\n", cold); mtx_init(&mtx1, "test mutex", "test", MTX_DEF); cv_init(&cv1, "test condvar"); printf("----------------------------------------\n"); printf("wait for timeout\n"); l4thread_create(cond, (void*) 1, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); printf("----------------------------------------\n"); printf("calling signal too early\n"); cv_signal(&cv1); l4thread_create(cond, (void*) 2, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); printf("----------------------------------------\n"); printf("calling broadcast too early\n"); cv_broadcast(&cv1); l4thread_create(cond, (void*) 3, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); printf("----------------------------------------\n"); printf("waking up one of two threads by signal\n"); l4thread_create(cond, (void*) 4, L4THREAD_CREATE_ASYNC); l4thread_create(cond, (void*) 5, L4THREAD_CREATE_ASYNC); l4thread_sleep(30); cv_signal(&cv1); l4thread_sleep(200); printf("----------------------------------------\n"); printf("waking up two threads by signal\n"); l4thread_create(cond, (void*) 6, L4THREAD_CREATE_ASYNC); l4thread_create(cond, (void*) 7, L4THREAD_CREATE_ASYNC); l4thread_sleep(30); cv_signal(&cv1); l4thread_sleep(30); cv_signal(&cv1); l4thread_sleep(200); printf("----------------------------------------\n"); printf("waking up two threads by broadcast\n"); l4thread_create(cond, (void*) 8, L4THREAD_CREATE_ASYNC); l4thread_create(cond, (void*) 9, L4THREAD_CREATE_ASYNC); l4thread_sleep(30); cv_broadcast(&cv1); l4thread_sleep(200); printf("----------------------------------------\n"); l4thread_sleep_forever(); return 0; }
int main(int argc, char **argv) { ddekit_init(); bsd_dde_init(); printf("- uninitialized, mtx_initialized= %d\n", mtx_initialized(&m)); mtx_init(&m, "test mutex", "test", MTX_DEF|MTX_RECURSE); printf("- initialized, mtx_initialized= %d\n", mtx_initialized(&m)); printf(" mtx_name =\"%s\"\n", mtx_name(&m)); printf(" mtx_owned = %d\n", mtx_owned(&m)); printf(" mtx_recursed = %d\n", mtx_recursed(&m)); l4thread_create(mdwn, (void*) 1, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); mtx_lock(&m); printf("- locked mtx_owned = %d\n", mtx_owned(&m)); printf(" mtx_recursed = %d\n", mtx_recursed(&m)); l4thread_create(mdwn, (void*) 2, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); mtx_lock(&m); printf("- locked x2 mtx_owned = %d\n", mtx_owned(&m)); printf(" mtx_recursed = %d\n", mtx_recursed(&m)); l4thread_create(mdwn, (void*) 3, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); mtx_lock(&m); printf("- locked x3 mtx_owned = %d\n", mtx_owned(&m)); printf(" mtx_recursed = %d\n", mtx_recursed(&m)); l4thread_create(mdwn, (void*) 4, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); mtx_unlock(&m); printf("- unlocked x1 mtx_owned = %d\n", mtx_owned(&m)); printf(" mtx_recursed = %d\n", mtx_recursed(&m)); l4thread_create(mdwn, (void*) 5, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); mtx_unlock(&m); printf("- unlocked x2 mtx_owned = %d\n", mtx_owned(&m)); printf(" mtx_recursed = %d\n", mtx_recursed(&m)); l4thread_create(mdwn, (void*) 6, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); mtx_unlock(&m); printf("- unlocked x3 mtx_owned = %d\n", mtx_owned(&m)); printf(" mtx_recursed = %d\n", mtx_recursed(&m)); l4thread_create(mdwn, (void*) 7, L4THREAD_CREATE_ASYNC); l4thread_sleep(200); mtx_destroy(&m); printf("- destroyed, mtx_initialized= %d\n", mtx_initialized(&m)); l4thread_sleep_forever(); return 0; }