int xntbase_switch(const char *name, u_long period, xntbase_t **basep) { xntbase_t *oldbase = *basep, *newbase; int err = 0; if (!*basep) /* Switching from no time base to a valid one is ok, we only need to assume that the old time base was the master one. */ oldbase = &nktbase; if (period == XN_APERIODIC_TICK) { if (xntbase_periodic_p(oldbase)) { /* The following call cannot fail. */ xntbase_alloc(name, XN_APERIODIC_TICK, 0, basep); xntbase_free(oldbase); } } else { if (xntbase_periodic_p(oldbase)) xntbase_update(oldbase, period); else { err = xntbase_alloc(name, period, 0, &newbase); if (!err) { int enabled = xntbase_enabled_p(oldbase); *basep = newbase; xntbase_free(oldbase); if (enabled) xntbase_start(newbase); } } } return err; }
void SKIN_EXIT(uitron) { xnprintf("stopping uITRON services.\n"); uimbx_cleanup(); uiflag_cleanup(); uisem_cleanup(); uitask_cleanup(); #ifdef CONFIG_XENO_OPT_PERVASIVE ui_syscall_cleanup(); #endif /* CONFIG_XENO_OPT_PERVASIVE */ xntbase_free(ui_tbase); xnpod_shutdown(XNPOD_NORMAL_EXIT); }
void SKIN_EXIT(psos) { xnprintf("stopping pSOS+ services.\n"); psostask_cleanup(); psostm_cleanup(); psosasr_cleanup(); psospt_cleanup(); psosqueue_cleanup(); psossem_cleanup(); psosrn_cleanup(); #ifdef CONFIG_XENO_OPT_PERVASIVE psos_syscall_cleanup(); #endif /* CONFIG_XENO_OPT_PERVASIVE */ xntbase_free(psos_tbase); xnpod_shutdown(XNPOD_NORMAL_EXIT); }
void SKIN_EXIT(native) { xnprintf("stopping native API services.\n"); __native_intr_pkg_cleanup(); __native_alarm_pkg_cleanup(); __native_heap_pkg_cleanup(); __native_queue_pkg_cleanup(); __native_pipe_pkg_cleanup(); __native_cond_pkg_cleanup(); __native_mutex_pkg_cleanup(); __native_event_pkg_cleanup(); __native_sem_pkg_cleanup(); __native_task_pkg_cleanup(); __native_misc_pkg_cleanup(); __native_syscall_cleanup(); xntbase_free(__native_tbase); xnpod_shutdown(XNPOD_NORMAL_EXIT); }
int SKIN_INIT(native) { int err; initq(&__native_global_rholder.alarmq); initq(&__native_global_rholder.condq); initq(&__native_global_rholder.eventq); initq(&__native_global_rholder.heapq); initq(&__native_global_rholder.intrq); initq(&__native_global_rholder.mutexq); initq(&__native_global_rholder.pipeq); initq(&__native_global_rholder.queueq); initq(&__native_global_rholder.semq); initq(&__native_global_rholder.ioregionq); initq(&__native_global_rholder.bufferq); err = xnpod_init(); if (err) goto fail; err = xntbase_alloc("native", tick_arg * 1000, 0, &__native_tbase); if (err) goto fail; xntbase_start(__native_tbase); err = __native_misc_pkg_init(); if (err) goto cleanup_pod; err = __native_task_pkg_init(); if (err) goto cleanup_misc; err = __native_sem_pkg_init(); if (err) goto cleanup_task; err = __native_event_pkg_init(); if (err) goto cleanup_sem; err = __native_mutex_pkg_init(); if (err) goto cleanup_event; err = __native_cond_pkg_init(); if (err) goto cleanup_mutex; err = __native_pipe_pkg_init(); if (err) goto cleanup_cond; err = __native_queue_pkg_init(); if (err) goto cleanup_pipe; err = __native_heap_pkg_init(); if (err) goto cleanup_queue; err = __native_alarm_pkg_init(); if (err) goto cleanup_heap; err = __native_intr_pkg_init(); if (err) goto cleanup_alarm; err = __native_syscall_init(); if (err) goto cleanup_intr; xnprintf("starting native API services.\n"); return 0; /* SUCCESS. */ cleanup_intr: __native_intr_pkg_cleanup(); cleanup_alarm: __native_alarm_pkg_cleanup(); cleanup_heap: __native_heap_pkg_cleanup(); cleanup_queue: __native_queue_pkg_cleanup(); cleanup_pipe: __native_pipe_pkg_cleanup(); cleanup_cond: __native_cond_pkg_cleanup(); cleanup_mutex: __native_mutex_pkg_cleanup(); cleanup_event: __native_event_pkg_cleanup(); cleanup_sem: __native_sem_pkg_cleanup(); cleanup_task: __native_task_pkg_cleanup(); cleanup_misc: __native_misc_pkg_cleanup(); cleanup_pod: xntbase_free(__native_tbase); xnpod_shutdown(err); fail: xnlogerr("native skin init failed, code %d.\n", err); return err; }
int SKIN_INIT(uitron) { int err; initq(&__ui_global_rholder.flgq); initq(&__ui_global_rholder.mbxq); initq(&__ui_global_rholder.semq); err = xnpod_init(); if (err) goto fail; err = xntbase_alloc("uitron", tick_arg * 1000, sync_time ? 0 : XNTBISO, &ui_tbase); if (err) goto cleanup_pod; xntbase_start(ui_tbase); err = uitask_init(); if (err) goto cleanup_tbase; err = uisem_init(); if (err) goto cleanup_task; err = uiflag_init(); if (err) goto cleanup_sem; err = uimbx_init(); if (err) goto cleanup_flag; #ifdef CONFIG_XENO_OPT_PERVASIVE ui_syscall_init(); #endif /* CONFIG_XENO_OPT_PERVASIVE */ xnprintf("starting uITRON services.\n"); return 0; cleanup_flag: uiflag_cleanup(); cleanup_sem: uisem_cleanup(); cleanup_task: uitask_cleanup(); cleanup_tbase: xntbase_free(ui_tbase); cleanup_pod: xnpod_shutdown(err); fail: xnlogerr("uITRON skin init failed, code %d.\n", err); return err; }