#ifndef _RTTASKS_H #define _RTTASKS_H #include "mitos.h" #include "fujitsu.h" #include "utilities.h" #define MAXTSKLENNAME 16 #define MAXSEMLENNAME MAXTSKLENNAME + 6 //incremento dei cicli effettuati dall'avvio del realtime extern RT_INTR int_desc; /* costanti di definizione dei task */ #define NUMTASKS 61 // TOTALI #define tsk_APGS 0 #define tsk_SYSGEN 1 #define tsk_IOMANAG 2 #define tsk_POLKEY 3 #define tsk_INOUT 4 #define tsk_ALARM 5 #define tsk_EXEMSG 6 #define tsk_EXEC 7 #define tsk_EXECC 8 #define tsk_ARBIX 9 #define tsk_BARRI 10 #define tsk_AXECAN 11 #define tsk_INICAN 12 #define tsk_CANBUS 13 #define tsk_EXEC00 14 #define tsk_EXEC01 15 #define tsk_EXEC02 16 #define tsk_EXEC03 17 #define tsk_EXEC04 18 #define tsk_EXEC05 19 #define tsk_EXEC06 20 #define tsk_EXEC07 21 #define tsk_EXEC08 22 #define tsk_EXEC09 23 #define tsk_EXEC10 24 #define tsk_EXEC11 25 #define tsk_EXEC12 26 #define tsk_EXEC13 27 #define tsk_EXEC14 28 #define tsk_EXEC15 29 #define tsk_EXEC16 30 #define tsk_EXEC17 31 #define tsk_EXEC18 32 #define tsk_EXEC19 33 #define tsk_EXECY 34 #define tsk_EXECZ 35 #define tsk_EXECV 36 #define tsk_EXECW 37 #define tsk_FUN 38 #define tsk_FUNY 39 #define tsk_FUNZ 40 #define tsk_FUNV 41 #define tsk_FUNW 42 #define tsk_FORY 43 #define tsk_FORZ 44 #define tsk_FORV 45 #define tsk_FORW 46 #define tsk_CUTY 47 #define tsk_CUTZ 48 #define tsk_CUTV 49 #define tsk_CUTW 50 #define tsk_CUTP 51 #define tsk_TESTA 52 #define tsk_TESTA2 53 #define tsk_HOSTC 54 #define tsk_REFPARC 55 #define ID_RTTASK_PLD 56 #define tsk_FUNINO 57 #define tsk_GESTDP 58 #define tsk_BCKPLC 59 #define tsk_OROLOGIO 60 #define NUMSYSSEM 28 // TOTALI #define ID_SEM_EXE 0 #define ID_SEM_AXECAN 1 #define ID_SEM_INICAN 2 #define ID_SEM_ALA 3 #define ID_SEM_EXY 4 #define ID_SEM_EXZ 5 #define ID_SEM_EXV 6 #define ID_SEM_EXW 7 #define ID_SEM_REX 8 #define ID_SEM_FUN 9 #define ID_SEM_FUNY 10 #define ID_SEM_FUNZ 11 #define ID_SEM_FUNV 12 #define ID_SEM_FUNW 13 #define ID_SEM_FORY 14 #define ID_SEM_FORZ 15 #define ID_SEM_FORV 16 #define ID_SEM_FORW 17 #define ID_SEM_CUTY 18 #define ID_SEM_CUTZ 19 #define ID_SEM_CUTV 20 #define ID_SEM_CUTW 21 #define ID_SEM_CUTP 22 #define ID_SEM_INOUT 23 #define ID_SEM_PKEY 24 #define ID_SEM_MSG 25 #define ID_SEM_RESMSG 26 #define ID_SEM_SDO 27 #define NUMSYSREG 2 // TOTALI #define ID_REG_MEM 0 #define ID_REG_SDO 1 #define NUMSYSMBX 29 // TOTALI #define ID_MBX_CUTY 0 #define ID_MBX_RCUTY 1 #define ID_MBX_CUTZ 2 #define ID_MBX_RCUTZ 3 #define ID_MBX_CUTV 4 #define ID_MBX_RCUTV 5 #define ID_MBX_CUTW 6 #define ID_MBX_RCUTW 7 #define ID_MBX_CUTP 8 // Mailbox per invio a CUTP #define ID_MBX_RCUTP 9 // Mailbox per risposta da CUTP #define ID_MBX_BAR 10 #define ID_MBX_RBAR_C 11 #define ID_MBX_RBAR_B 12 #define ID_MBX_ARB 13 #define ID_MBX_RARB_A 14 #define ID_MBX_RARB_B 15 #define ID_MBX_RARB_C 16 #define ID_MBX_RARB_D 17 #define ID_MBX_RARB_E 18 #define ID_MBX_RARB_F 19 #define ID_MBX_TSA 20 #define ID_MBX_RTSA 21 #define ID_MBX_TSA2 22 #define ID_MBX_RTSA2 23 #define ID_MBX_EXEC 24 // Comando Task EXEC CANONICO #define ID_MBX_REXE 25 // Risposta dei Task EXEC CANONICO e SECONDO #define ID_MBX_MSG 26 // Mailbox per task EXEMSG #define ID_MBX_RESMSG 27 // Mailbox richiesta reset coda per EXEMSG #define ID_MBX_CANBUS 28 // Mailbox richiesta task CanBus /////////////////////////////////////////////////////////////////////////////// typedef struct { int priority; // range between 99 and 0, 99 is the most priority char name[MAXTSKLENNAME]; // nome da assegnare al task RT_TASK * rtDesc; // descrittore che viene valorizzato durante la create int stkSize; // dimensione dello stack da istanziare, con valore 0 viene scelto dal sistem int mode; // vedi documentazione Xenomai, funzione rt_task_create RT_SEM * enabSem; // semaforo di abilitazione del task word32 fnAddr; // puntatore alla funzione da eseguire void * tskArgs; // puntatore agli argomenti da passare alla funzione eseguita dal task } RTTASKS; extern RTTASKS tabRtTask[]; extern RT_SEM envSem[NUMSYSSEM]; extern RT_MUTEX envReg[NUMSYSREG]; extern RT_QUEUE envMbx[NUMSYSMBX]; //attivazione tasks realtime extern boolean InitRTEnv( void ); extern boolean CleanRtEnv( void ); //prototipi handler dei task // extern void tskHnd_IrqFuj ( void *cookie ); // extern void tskHnd_Inout ( void *cookie ); // extern void tskHnd_PlcFast ( void *cookie ); // extern void tskHnd_PlcSlow ( void *cookie ); // extern void tskHnd_CanSrv ( void *cookie ); // extern void tskHnd_Bck ( void *cookie ); extern void tskHnd_PlcQuery ( void *cookie ); //prototipi task esterni extern void AxeCan( void ); extern void IniCan( void ); extern void exemsg (void); extern void arbix (void); extern void cuty (void); extern void cutv (void); extern void cutw (void); extern void CutPz (void); extern void cutz (void); extern void CutPz (void); #endif