/************************************************************************* $Archive: /PACS/OnBoard/Seq.h $ $Revision: 1.11 $ $Date: 2009/04/23 13:51:12 $ $Author: amazy $ $Log: Seq.h,v $ Revision 1.11 2009/04/23 13:51:12 amazy 6.029 * * 31 3/14/06 4:32p Pacs Egse * Version 6.001 * Cleaned and commented *************************************************************************/ #define SEQ_H #ifndef CSL_TYPE_H #include "csl_type.h" #endif #ifndef COMMANDS_H #include "commands.h" #endif #ifndef CONSTANT_H #include "constant.h" #endif #ifndef T_STATUS_H #include "t_status.h" #endif #ifndef U_RES_H #include "u_res.h" #endif /**************************************************************** TYPE DEFINITIONS ****************************************************************/ // define a type for pointer on function called by the sequencer to execute a command. typedef BOOL (*SequencerCommandFunction)(CommandParameter param); //**************************************************************** // MACRO //**************************************************************** #define SetSequencerError(newError) \ {\ SetGlobalError(newError);\ LOCK_WRITE_RES_PARAMS;\ SET_BITS(gpSequencer->TaskStatus, K_BMASK_TASK_STATUS_ERROR_STATUS | K_BMASK_TASK_STATUS_ERROR_CODE, K_BMASK_TASK_STATUS_TASK_IN_ERROR | newError); \ SET_BITS(gpSequencer->TaskStatus, K_BMASK_TASK_STATUS_SEQ_EXECUTION_STATUS, K_BMASK_TASK_STATUS_SEQ_IDLE);\ UNLOCK_WRITE_RES_PARAMS;\ }\ /**************************************************************** FUNCTIONS DECLARATION ****************************************************************/ extern void SequencerSendNack(int param, uint errorCode); extern void SequencerSendAck(uint commandId); extern void InterpreteAndExecute(Command command, int mode, int SID); /**************************************************************** ENUMERATIONS ****************************************************************/ // defines the status of the Sequencer #define K_BMASK_TASK_STATUS_SEQ_IDLE 0x00100000 #define K_BMASK_TASK_STATUS_SEQ_RUNNING 0x00200000 #define K_BMASK_TASK_STATUS_SEQ_SUSPENDED 0x00400000 #define K_BMASK_TASK_STATUS_SEQ_EXECUTION_STATUS 0x00700000 // defines the availability of a command in Sequence mode or in direct commanding mode enum { TRIG = K_BMASK_TASK_STATUS_SEQ_IDLE, IN_SEQ = K_BMASK_TASK_STATUS_SEQ_RUNNING, ALL = TRIG | IN_SEQ, INTERNAL = TRIG, IN_TEST = TRIG }; // defines the type of parameters for trigger commands enum { PAR_NONE, PAR_UINT32, PAR_INT32, PAR_UINT8, PAR_UINT16, PAR_INT16 }; /* STRUCT: SequencerParams *********************** AUTHOR: Amazy USE: This structure contains all variables related to the Sequencer task */ typedef struct { int TaskStatus; int Options; int OBSID; int BBID; int Time[2]; int TemporaryTime[2]; int Label; uint Pointer; Command SequenceBuffer[MAX_SEQUENCE_SIZE]; int CurrentLoopLevel; uint aCurrentLoopIndex[MAX_NESTED_LOOPS]; uint WaitForRampsIndex; } SequencerParams;