static void init_timers() { // get an endpoint for the timer IRQ (interrupt handler) UNUSED int err = vka_alloc_async_endpoint(&vka, &timer_aep); assert(err == 0); // get the timer timer = sel4platsupport_get_default_timer(&vka, &vspace, &simple, timer_aep.cptr); assert(timer != NULL); // get a TSC timer (forward marching time); use // timer_get_time(tsc_timer) to get current time (in ns) tsc_timer = sel4platsupport_get_tsc_timer(timer); assert(tsc_timer != NULL); }
void init_timer(env_t env, test_init_data_t *init_data) { /* minimal simple implementation to get the platform * default timer off the ground */ env->simple.arch_simple.irq = get_irq; env->simple.data = (void *) init_data; env->simple.arch_simple.data = (void *) init_data; UNUSED int error; arch_init_simple(&env->simple); error = vka_alloc_notification(&env->vka, &env->timer_notification); if (error != 0) { ZF_LOGF("Failed to allocate notification object"); } env->timer = sel4platsupport_get_default_timer(&env->vka, &env->vspace, &env->simple, env->timer_notification.cptr); if (env->timer == NULL) { ZF_LOGF("Failed to initialise default timer"); } }