void __exit cleanup_module(void) {

	// On nettoie toutes les tâches
	invaders_task_cleanup_task();
	fb_task_cleanup_task();
	io_task_cleanup_task();
	hit_task_cleanup_task();
	ship_task_cleanup_task();

	// On nettoie tous les objets
	invaders_task_cleanup_objects();
	fb_task_cleanup_objects();
	io_task_cleanup_objects();
	hit_task_cleanup_objects();
	ship_task_cleanup_objects();

	// On désalloue le tas
	if(heap_allocated){
		heap_allocated = 0;
		rt_heap_free(&heap, &fb_mem_rt);
	}

	// On supprime le tas
	if(heap_created){
		heap_created = 0;
		rt_heap_delete(&heap);
	}

	rt_intr_delete(&isrDesc);

	xeno_ts_exit();
}
Example #2
0
int speed_exit(void) {
    if (!running) {
        goto err_not_running;
    }

    running = 0;

    rt_task_delete(&task_hard);
    rt_task_delete(&task_soft);
    rt_queue_delete(&queue);
    rt_mutex_delete(&mutex_average);
    rt_mutex_delete(&mutex_instant);
    rt_intr_disable(&intr);
    rt_intr_delete(&intr);

    fclose(ostream);

/* START DEBUG DEBUG DEBUG */
    {
        FILE * fp = fopen("average", "w");
        fprintf(fp, "%f\n", average);
        fclose(fp);
    }
/* STOP DEBUG DEBUG DEBUG */

    return 0;

err_not_running:
    return -1;
}
Example #3
0
void __exit cleanup_module(void) {


	/* To Be Completed */


	rt_intr_delete(&isrDesc);
	rt_task_delete(&menu_task);

//	pca9554_close(NULL, NULL);

	xeno_ts_exit();
}
Example #4
0
int rt_intr_create(RT_INTR *intr,
		   const char *name,
		   unsigned irq, rt_isr_t isr, rt_iack_t iack, int mode)
{
	int err;
	spl_t s;

	if (xnpod_asynch_p())
		return -EPERM;

	if (name)
		xnobject_copy_name(intr->name, name);
	else
		/* Kernel-side "anonymous" objects (name == NULL) get unique names.
		 * Nevertheless, they will not be exported via the registry. */
		xnobject_create_name(intr->name, sizeof(intr->name), isr);

	xnintr_init(&intr->intr_base, intr->name, irq, isr, iack, mode);
#ifdef CONFIG_XENO_OPT_PERVASIVE
	xnsynch_init(&intr->synch_base, XNSYNCH_PRIO, NULL);
	intr->pending = 0;
	intr->cpid = 0;
	intr->mode = 0;
#endif /* CONFIG_XENO_OPT_PERVASIVE */
	intr->magic = XENO_INTR_MAGIC;
	intr->handle = 0;	/* i.e. (still) unregistered interrupt. */
	inith(&intr->rlink);
	intr->rqueue = &xeno_get_rholder()->intrq;
	xnlock_get_irqsave(&nklock, s);
	appendq(intr->rqueue, &intr->rlink);
	xnlock_put_irqrestore(&nklock, s);

	err = xnintr_attach(&intr->intr_base, intr);

	/*
	 * <!> Since xnregister_enter() may reschedule, only register
	 * complete objects, so that the registry cannot return
	 * handles to half-baked objects...
	 */
	if (!err && name)
		err = xnregistry_enter(intr->name, intr, &intr->handle,
				       &__intr_pnode);
	if (err)
		rt_intr_delete(intr);

	return err;
}
void cleanup (void) {
	rt_intr_delete(&intr_desc);
	rt_task_delete(&server_desc);
}