00001 /************************************************************************************ 00002 * primFuncts.h 00003 * 00004 * synopsis: Declares the PrimData structure tag used to exchange information with 00005 * the primitive routines in msgBuff.c and the primitive execution routines 00006 * which are in primFuncts.c 00007 * 00008 * related files: 00009 * listManager.c: Routines which manage the execution of a primitive list and 00010 * writing the reply data. The primitive execution functions in 00011 * primFuncts.c are called from listManager.c. 00012 * primFuncts.c: Primitive execution functions and function which initializes the 00013 * primParameters array of structures. 00014 * primParams.h: Defines primitive ids which are used to index the array of pointers 00015 * to primitive functions, structure tags for primitive data and reply 00016 * data, and prototypes of primitive functions. 00017 * 00018 * Damon Fasching, UW Madison (510)486-5230 fasching@wisconsin.cern.ch 00019 ************************************************************************************/ 00020 00021 /* 00022 * For comments and a description of how to add a primitive, complete with an 00023 * example, see primParams.h. 00024 */ 00025 00026 #ifndef PRIM_FUNCTS 00027 #define PRIM_FUNCTS 00028 00029 #include "processor.h" 00030 00031 #define UNINITIALIZED_PRIM (0xFFFFFFFF) 00032 00033 /* 00034 * The PrimData structure includes items: 00035 * set by execPrim(), the routine which calls the primitive routines 00036 * priBodyPtr - pointer to the body of the primitive being executed 00037 * priBodyLength - length of the primitive body 00038 * repBodyPtr - pointer to location where reply data should be written 00039 * repBuffEnd - last address of the reply buffer 00040 * set by the primitive routine 00041 * repBodyLength - length of the reply message body 00042 */ 00043 00044 typedef struct { 00045 UINT32 *priBodyPtr; 00046 UINT32 priBodyLength; 00047 UINT32 *repBodyPtr; 00048 UINT32 repBodyLength; 00049 UINT32 *repBuffEnd; 00050 } PrimData; 00051 00052 /* 00053 * The two members of the PrimParameters structure are a pointer to a primitive 00054 * function of type INT32 which takes a pointer a PRIM_DATA structure as a 00055 * parameter, and the revision number of the primitive. 00056 */ 00057 00058 struct PRIM_PARAMETERS { 00059 UINT32 primRevision; 00060 INT32 (*fxnValidate)(UINT32 revision, PrimData *primData); 00061 INT32 (*primFunction)(PrimData *); 00062 }; 00063 typedef struct { 00064 UINT32 primID; 00065 UINT32 primRevision; 00066 INT32 (*fxnValidate)(UINT32 revision, PrimData *primData); 00067 INT32 (*primFunction)(PrimData *primData); 00068 } PrimParameters; 00069 00070 #endif