/************************************************************************************ * The task manager list structures: The TaskMgrCtrl structure contains information * meant to be monitored. The TaskData structure * contains information that will be passed on to the task routines. The TaskList * structure contains control information used by the task manager routines. * * In the Status Register: * nTasks: The main DSP status register (SR 0) contains a copy of the * TaskList nTasks field (the taskList itself is allowed to float * in the main program IDRAM data section). * * TaskMgrCtrl Fields: * * runningTaskReg: This register contains nibbles (half-byte) indicating the * status of the various tasks. The values are (in hex) * 0: initialized, ready. * 1-C: running, in states which are task-specific. * D: completed (Done). * E: halted with an Error. * F: stopped; ie. stopTask was sent to halt the task. (Forced) * * taskIterations: The number of iterations for which at least one task * function has been active. * * TaskData Fields: * * taskType: The task to be run. Task types are defined in primParams.h * taskRevision: The task revision number. Like primRevison, guards against * the task input structures declared in the DAQ being out of * date with respect to the DSP version. * priority: The priority for this task. * completionFlag: Will the task manager send an information message out when * the task completes? (the running-task register will monitor * task completion regardless; this is just a convenience). * * taskStruct: Contains any input data needed by the task. * taskFunction: Pointer to the task function. * * TaskList Fields: * * nTasks: The number of currently running tasks. * taskData[]: A TaskData structure for each currently defined task, up to * the possible number of tasks on a DSP (+1). Master & slave * DSPs have different numbers and types of tasks. The last space in the list * is reserved. * * Douglas Ferguson ************************************************************************************/ #include "primParams.h" #ifndef TASK_STRUCT #define TASK_STRUCT /* dpsf rTR => commreg. add in address of all relevant task structures in/out in the ctrl structure */ typedef struct { UINT32 taskIterations, unused[3]; } TaskMgrCtrl; /* Flags for task operations. The init, reset & query masks are used within tasks to set their internal & output variables. The others determine the state of the taskData structure. */ #define TASK_INIT_MASK 0x10000000 #define TASK_HALT_MASK 0x01000000 #define TASK_QUERY_MASK 0x00100000 /* nibble values / states-- unlisted states are defined by the task */ #define TASK_INIT 1 #define TASK_PAUSED 0xb #define TASK_DONE 0xd #define TASK_ERROR 0xe #define TASK_FORCED 0xf /* Note that the state & prevState below are only for storing the state while the a task is paused for quick retrieval in the task manager-- the current task states are always found in the task-state register. */ typedef struct { UINT8 taskType, taskRevision, priority, completionFlag, state, prevState, trapFxn, unused; /*[2];*/ TaskInput taskStruct; INT32 (*taskFunction)(TaskInput *, TaskOutput *, UINT32); } TaskData; typedef struct { UINT32 nTasks; TaskData taskData[MAX_NUM_TASKS +1]; } TaskList; #endif