Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

taskManager.h

00001 /************************************************************************************
00002  *  The task manager list structures: The TaskMgrCtrl structure contains information
00003  *                                    meant to be monitored. The TaskData structure
00004  *    contains information that will be passed on to the task routines. The TaskList
00005  *    structure contains control information used by the task manager routines.
00006  *
00007  *     In the Status Register:  
00008  *     nTasks:  The main DSP status register (SR 0) contains a copy of the
00009  *              TaskList nTasks field (the taskList itself is allowed to float
00010  *              in the main program IDRAM data section).
00011  *
00012  *    TaskMgrCtrl Fields:
00013  *
00014  *     runningTaskReg: This register contains nibbles (half-byte) indicating the
00015  *                     status of the various tasks. The values are (in hex)
00016  *          0:    initialized, ready.
00017  *          1-C:  running, in states which are task-specific.
00018  *          D:    completed (Done).
00019  *          E:    halted with an Error.
00020  *          F:    stopped; ie. stopTask was sent to halt the task. (Forced)
00021  * 
00022  *     taskIterations:  The number of iterations for which at least one task
00023  *                      function has been active.
00024  *     
00025  *    TaskData Fields:
00026  *
00027  *     taskType:       The task to be run. Task types are defined in primParams.h 
00028  *     taskRevision:   The task revision number. Like primRevison, guards against
00029  *                     the task input structures declared in the DAQ being out of
00030  *                     date with respect to the DSP version.  
00031  *     priority:       The priority for this task.
00032  *     completionFlag: Will the task manager send an information message out when
00033  *                     the task completes?  (the running-task register will monitor
00034  *       task completion regardless; this is just a convenience).
00035  *
00036  *     taskStruct:     Contains any input data needed by the task.
00037  *     taskFunction:   Pointer to the task function.
00038  * 
00039  *    TaskList Fields:
00040  *
00041  *     nTasks:         The number of currently running tasks.
00042  *     taskData[]:     A TaskData structure for each currently defined task, up to
00043  *                     the possible number of tasks on a DSP (+1). Master & slave
00044  *       DSPs have different numbers and types of tasks. The last space in the list
00045  *       is reserved.
00046  *
00047  *  Douglas Ferguson
00048  ************************************************************************************/
00049 #include "primParams.h"
00050 #ifndef TASK_STRUCT
00051 #define TASK_STRUCT
00052 
00053 
00054 /* dpsf rTR => commreg.  add in address of all relevant task structures in/out
00055    in the ctrl structure */
00056 typedef struct {
00057     UINT32 taskIterations, unused[3];
00058 } TaskMgrCtrl;
00059 
00060 /* Flags for task operations. The init, reset & query masks are used within tasks 
00061    to set their internal & output variables. The others determine the state of the
00062    taskData structure. */
00063 #define TASK_INIT_MASK    0x10000000
00064 #define TASK_HALT_MASK    0x01000000
00065 #define TASK_QUERY_MASK   0x00100000
00066 
00067 /* nibble values / states-- unlisted states are defined by the task */
00068 #define TASK_INIT       1
00069 
00070 #define TASK_PAUSED     0xb
00071 
00072 #define TASK_DONE       0xd
00073 #define TASK_ERROR      0xe
00074 #define TASK_FORCED     0xf
00075 
00076 
00077 /* Note that the state & prevState below are only for storing the state while
00078    the a task is paused for quick retrieval in the task manager-- the current task
00079    states are always found in the task-state register. */
00080 typedef struct {
00081     UINT8  taskType, taskRevision, priority, completionFlag,
00082            state, prevState, trapFxn, unused; /*[2];*/
00083     TaskInput taskStruct;
00084     INT32 (*taskFunction)(TaskInput *, TaskOutput *, UINT32);
00085 } TaskData;
00086 
00087 typedef struct {
00088     UINT32 nTasks;
00089     TaskData taskData[MAX_NUM_TASKS +1];
00090 } TaskList;
00091 
00092 #endif

Generated on Thu Dec 15 21:14:41 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5