/****************************************************************************** * * Title : hostDefinitions.c * Version 0.0 * * Description: Host[n] specific variables (host[n] is part of the program, which is responsible and communicate only with Rod[n]). * Related files: all files in rcc.prj * * Author: Lukas Tomasek, tomasekl@fzu.cz * ******************************************************************************/ #ifndef HOST_DEFINITIONS_H /* multiple-inclusion protection */ #define HOST_DEFINITIONS_H /****************************************************************************** * Header files * ******************************************************************************/ #include #include "processor.h" //dpsf: #include "memoryPartitions.h" #include "comRegDfns.h" #include "txtBuffer.h" #include "errorCodesRcc.h" //dpsf: #include "smSendTxtBuff.h" #include "vmeAddressMap.h" #include "commandListDefinitions.h" #include "primListTableDefinitions.h" /****************************************************************************** * Definitions * ******************************************************************************/ #define RAW_EXTERNAL_LIST 666 /* * Buffer sizes. * For MasterMemoryTest (MEMORY_TEST primitive) define MASTER_MEMORY_TEST in * compiler defines - this version will work with master DSP MemoryTest executable. */ #ifndef MASTER_MEMORY_TEST #define PRIM_BUFF_SIZE MDSP_PRM_BFR_SZ #define REP_BUFF_SIZE MDSP_REP_BFR_SZ #define TXT_BUFF_SIZE TXT_BFR_SZ #define PRIM_BUFF_BASE MDSP_PRM_BFR_BASE #define REP_BUFF_BASE MDSP_REP_BFR_BASE #define ERR_BUFF_BASE ERR_BFR_BASE #define DIAG_BUFF_BASE DIAG_BFR_BASE #define INFO_BUFF_BASE INFO_BFR_BASE #define XFER_BUFF_BASE XFER_BFR_BASE #else #define PRIM_BUFF_SIZE PRM_BFR_SZ_MEM #define REP_BUFF_SIZE REP_BFR_SZ_MEM #define TXT_BUFF_SIZE TXT_BFR_SZ_MEM #define PRIM_BUFF_BASE PRM_BFR_BASE_MEM #define REP_BUFF_BASE REP_BFR_BASE_MEM #define ERR_BUFF_BASE ERR_BFR_BASE_MEM #define DIAG_BUFF_BASE DIAG_BFR_BASE_MEM #define INFO_BUFF_BASE INFO_BFR_BASE_MEM #define XFER_BUFF_BASE XFER_BFR_BASE_MEM #endif /****************************************************************************** * Type definitions * ******************************************************************************/ /*------------------------ CONTROL_THREAD_OPTIONS ----------------------------*/ typedef enum { CMDLISTEXEC_IDLE=0, CMDLISTEXEC_BUSY=1, CMDLISTEXEC_ABORT=2, }CMDLIST_EXEC_STATE; /*-------------------------- LIST_HANDLER_STATE ------------------------------*/ typedef enum{ LIST_HANDL_IDLE=0, LIST_HANDL_REPEAT_BUILD=1, POLL_DspAck_CLEAR=2, POLL_DspAck_SET=3, }LIST_HANDLER_STATE; /*------------------------ TEXTBUFF_HANDLER_STATE ----------------------------*/ typedef enum { TEXT_BUFF_IDLE=0, READ_RQ_SET=1 } TEXTBUFF_HANDLER_STATE; /*-------------------------- struct PANEL_HANDLES ----------------------------*/ /* *labWindows UIR panel handles */ struct PANEL_HANDLES { int parent; /* main window */ int commandListStatus; /* commandList window */ int txtBuff[N_TXT_BUFFS]; /* txtBuffer windows */ int dspMonitor; /* dsp monitoring windows */ }; /*-------------------------- struct ----------------------------*/ /* *labWindows UIR control id's */ struct CONTROL_IDS { int primRing; /* host prim ring control ID in ROD_STCO panel */ int commandRing; /* host command ring control ID in CLISTP panel */ }; /*--------------------------- struct THREAD_INFO -----------------------------*/ /* thread info struct */ struct THREAD_INFO { HANDLE handle; /* thread handle */ DWORD id; /* thread id */ int priority; /* thread priority */ }; /*------------------- struct HOST_PROGRAM_OPTIONS ----------------------------*/ /* * HostStatusControl program options (some used only for debugging) */ struct HOST_PROGRAM_OPTIONS{ volatile int rodEnabled; /* access to VME on/off */ volatile int hostExit; /* exit host menu variable */ volatile int repeatExecNotBuild; /* if !=0 repeat only execution of the primList, ie. build and send primList only for the 1st time - after then (if primListRepetitions>0) set only inListReady bit in commandReg */ volatile unsigned int primListRepetitions; /* repeat primList x times - 0 means execute once */ volatile unsigned int commandListRepetitions; /* repeat commandList x times - 0 means execute once */ volatile unsigned int commandRepetitions; /* repeat command in commandList x times - 0 means execute once */ /* text buffs read requests allowed yes/no */ volatile int textBuffReadRq[N_TXT_BUFFS]; }; /*--------------------------- struct LIST_FIFO -------------------------------*/ /*=============================== struct HOST ===============================*/ /* * Struct which store all info specific for Host/Rod[n] */ struct HOST{ unsigned char slotNumber; /* = arrayIndex+FIRST_ROD_SLOT, where global->host[arrayIndex] */ volatile int rodInitialized; /* init flag */ /* primBuff and repBuff starting hpi address - * defined in memoryPartitions.h and init. in loadExitHost.c */ /* text buffers info */ UINT32 txtBuffStructHpiAddr[N_TXT_BUFFS]; /* masterStruct hpiAddress - init in rodInit.c */ struct COMMAND_LIST commandList; /* commandList to be executed in hostControl thread */ struct LIST_TABLE listTable; /* listTable buffer */ UINT32 listIndex; struct HOST_PROGRAM_OPTIONS option; /* program ControlWindow options*/ /* * Host copies of CommunicationRegisters */ #define NUMBER_OF_ROD_STAT_REGS 3 #define NUMBER_OF_VME_COMMAND_REGS 2 UINT32 rodStatusReg[NUMBER_OF_ROD_STAT_REGS]; UINT32 vmeCommandReg[NUMBER_OF_VME_COMMAND_REGS]; LIST_HANDLER_STATE listHandlerState; TEXTBUFF_HANDLER_STATE textBuffHandlerState[N_TXT_BUFFS]; char txtBuffFileName[N_TXT_BUFFS][PATHNAME_LENGTH]; char *commandStatusFile; /* pointer to command status file name stored in hostControl thread */ char cListFile[PATHNAME_LENGTH]; /* used in command status printout, used only as a message */ char primListFile[PATHNAME_LENGTH]; char primTableFile[PATHNAME_LENGTH]; /* * Shared handshake variables - used for synchronization between threads */ volatile int primListReady; /* between primListBuilding and ListHandler */ volatile int commandReady; /* */ volatile ERROR_ID commandStatus; struct COMMAND *command; volatile CMDLIST_EXEC_STATE cmdListExecState; /* state */ volatile unsigned int primListRepCounter; /* primList repetition counter */ #ifdef PIXEL_ROD //Defines the input bandwidth of this ROD: volatile int bandwidth; #endif /* * Threads info */ struct THREAD_INFO cmdListExecThread; /* * Interthread synchronization events */ HANDLE commandDone_event; /* */ struct PANEL_HANDLES panel; /* LabWindowsGUI host panels info */ char *dataDir; /* pointer to host data directory name */ struct CONTROL_IDS controlId; }; /******************************************************************************/ #endif /* HOST_DEFINITIONS_H */