TACHE tacheInit(void) { puts("------> EXEC tache Init"); active(cree(Conso)); active(cree(Conso2)); active(cree(Prod)); puts("------> FIN tache Init"); fin_tache(); }
TACHE tacheInit(void) { puts("------> EXEC tache A"); tacheP = cree(Prod); tacheC = cree(Conso); active(tacheC); active(tacheP); puts("------> FIN tache A"); fin_tache(); }
/*--------------------------------------------------------------------------* * --- Lancer le systeme --- * * Entree : Adresse de la premiere tache a lancer * * Sortie : Neant * * Descrip: Active la tache et lance le systeme * * * * * * Err. fatale: Neant * * * *--------------------------------------------------------------------------*/ void start(TACHE_ADR adr_tache) { short j; register unsigned int sp asm("sp"); for (j=0; j<MAX_TACHES; j++) { /* initialisation de l'etat des taches */ _contexte[j].status = NCREE; } /* Initialisation de la variable Haut de la pile des tâches */ _tos = sp; /* initialisation de la file */ file_init(); /* initialisation de la tache courante */ _tache_c = cree(adr_tache); /* ajout de la tache a la file */ ajoute(_tache_c); /* Passer en mode IRQ */ _set_arm_mode_(ARMMODE_IRQ); /* sp_irq initial */ sp = _contexte[_tache_c].sp_irq; /* Repasser en mode SYS */ _set_arm_mode_(ARMMODE_SYS); /* on interdit les interruptions */ _irq_disable_(); /* Initialisation du timer à 100 Hz */ timerInit(TIMER1, IRQ_FREQ); /* Initialisation de l'AITC */ timerEnableInterrupt(TIMER1); interruptEnableSource(INTERRUPT_TIMER1); /* creation et activation premiere tache */ active(_tache_c); schedule(); }
/*--------------------------------------------------------------------------* * --- Lancer le systeme --- * * Entree : Adresse de la premiere tache a lancer * * Sortie : Neant * * Descrip: Active la tache et lance le systeme * * * * * * Err. fatale: Neant * * * *--------------------------------------------------------------------------*/ void start( TACHE_ADR adr_tache ) { short j; register unsigned int sp asm("sp"); struct imx_timer* tim1 = (struct imx_timer *) TIMER1_BASE; struct imx_aitc* aitc = (struct imx_aitc *) AITC_BASE; for (j=0; j<MAX_TACHES; j++) { /* initialisation de l'etat des taches */ _contexte[j].status = NCREE; } /* Initialisation de la variable Haut de la pile des tâches */ _tos = sp; /* initialisation de la file */ file_init(); /* initialisation de la tache courante */ _tache_c = cree(adr_tache); /* ajout de la tache a la file */ ajoute(_tache_c); /* Passer en mode IRQ */ /* sp_irq initial */ /* Repasser en mode SYS */ /* on interdit les interruptions */ /* Initialisation du timer à 100 Hz */ /* Initialisation de l'AITC */ /* creation et activation premiere tache */ }