#ifndef DRV_MPS_LINK_NODE_H #define DRV_MPS_LINK_NODE_H #include "mpsLinkNodeMacros.h" #define MPS_LINE_LENGTH (256) #define MPS_NODE_NUM_ATTRS (5) #define MPS_NODE_NUM_CHANS (96) #define MPS_NODE_NUM_RELS (2) #define MPS_CHAN_NUM_ATTRS (11) #define MPS_ATTR_LENGTH (100) typedef struct mpsInputChannel_s { int deadman; int debounceenum; int debouncetimemicroseconds; int inputcard; int inputcardchannel; int isautorecoverable; int latched; int state; char descript[MPS_ATTR_LENGTH]; char location[MPS_ATTR_LENGTH]; char inputname[MPS_ATTR_LENGTH]; char pv[MPS_ATTR_LENGTH]; char state0[MPS_ATTR_LENGTH]; char state1[MPS_ATTR_LENGTH]; } mpsInputChannel_t; typedef struct mpsPICChannel_s { int highthreshold; int lowthreshold; } mpsPICChannel_t; typedef struct mpsPIC_s { mpsPICChannel_t picchannels[8]; } mpsPIC_t; typedef struct mpsBLMChannel_s { int highthreshold; int lowthreshold; } mpsBLMChannel_t; typedef struct mpsNode_s { int linknodeid; int linknodetype; int fpgaVersion; int rackelevation; char racknumber[MPS_ATTR_LENGTH]; int numChannels; mpsInputChannel_t inputchannels[MPS_NODE_NUM_CHANS]; mpsPIC_t pics[4]; mpsBLMChannel_t blmChannels[8]; int BYKThresholdHigh; unsigned short BYKThresholdHighCountsArray[2]; int BYKThresholdLow; unsigned short BYKThresholdLowCountsArray[2]; int BYKADCNumSamples; int BYKADCNumPresamples; int BYKADCDelay; char databaseVersion[MPS_LINE_LENGTH]; char rackLocation[MPS_LINE_LENGTH]; int rackLocked; } mpsNode_t; int mpsReadDatabaseVersion(char* current); char* mpsGetDatabaseVersion(void); char* mpsGetRackLocation(void); int mpsSetRackLocked(int locked); int mpsGetRackLocked(void); int mpsGetFPGAVersion(void); int mpsReadFPGAVersion(void); mpsNode_t* mpsGetNode(void); int mpsReadLinkNodeIDRotary(void); /* int mpsParseDebounceConfig(char* filename); out 12/19/8 */ int mpsParseChannelsConfig(char* filename); int mpsParseNodeConfig(char* filename); int mpsGetLinkNodeID(void); int mpsSetLinkNodeID(int linknodeid); int mpsInitialise(void); int mpsReport(void); int mpsReportDebounceConfigi(void); int mpsGetAutoRecoverable(int channel); int mpsSetAutoRecoverable(int channel, int isautorecoverable); int mpsGetDebounceTime(int channel); int mpsSetDebounceEnum(int channel, int debounceEnum); int mpsGetDebounceEnum(int channel); int mpsSetDebounceTime(int channel, int debounceTime); /* 12/19/8 was FromEnum */ /* int mpsSetDebounceTimeFromUsecs(int channel, int debounceMicroseconds); */ int mpsSetDeadMan(int channel, int flag); int mpsGetDeadMan(int channel); int mpsSetPICThreshold(int pic, int channel, int thld_type, int threshold); int mpsGetPICThreshold(int pic, int channel, int thld_type); /* Invasive to FPGA. debug only */ int mpsSetLinkNodeType(int type); int mpsGetLinkNodeType(void); int mpsGetLatched(int channel); int mpsSetState(int channel); int mpsGetState(int channel); char* mpsGetFactory(void); char* mpsGetRevision(void); char* mpsGetSerial(void); char* mpsGetConsole(void); char* mpsGetKernel(void); char* mpsGetKernelArgs(void); char* mpsGetHWAddr0(void); char* mpsGetFirmware(void); char* mpsGetStartPoint(void); char* mpsGetRAMImage(void); char* mpsGetCache(void); int mpsGetAutobootTime(void); char* mpsGetBootpEnable(void); long mpsGetXilinxTempAnalog(void); long mpsGetBoardTempAnalog(void); long mpsGetP24V(void); long mpsGetP12V(void); long mpsGetP5V(void); long mpsGetP3d3V(void); int mpsSetBLMHV(int channel, unsigned short raw); unsigned short mpsGetBLMHV(int channel); int mpsClrBLMTimeout(void); int mpsClrBLMThresholdFaultStatus(void); int mpsGetBLMAcqStartStatus(void); int mpsGetBLMInitStatus(void); int mpsSetBLMHVThreshold(int channel, int thld_type, int threshold); int mpsGetBLMHVThreshold(int channel, int thld_type); long mpsGetPIC(int channel); int mpsClrIPTimeout(void); int mpsSetCSR1Reset(void); int mpsSetCSR1DiagnosticModeEnable(void); int mpsSetCSR1Arm(void); int mpsSetCSR1Enable(void); int mpsSetCSR1DiagnosticModeSelect(int val); int mpsSetCSR1TriggerSourceSelect(int val); int mpsSetCSR1TriggerEdgeSelect(int val); int mpsSetCSR1MissedTriggerStatus(int val); int mpsGetCSR1MissedTriggerStatus(void); int mpsSetCSR1SoftwareTrigger(int val); int mpsSetCSR1DataReady(int val); int mpsGetCSR1DataReady(void); int mpsSetCSR1GateGeneratorSelect(int val); int mpsGetCSR1GateGeneratorSelect(void); int mpsSetCSR1GateTriggerSelect(int val); /* ok no mpsGetCSR1GateTriggerSelect? */ int mpsSetCSR1GatePolarity(int val); int mpsGetCSR1GatePolarity(void); int mpsSetCSR1GateEnable(int val); int mpsGetCSR1GateEnable(void); int mpsGetCSR2D2LStatus(void); int mpsGetCSR2D4LStatus(void); int mpsSetCSR2TestPulseEnable(int val); int mpsGetCSR2TestPulseEnable(void); int mpsSetCSR2TestPulsePolarity(int val); int mpsGetCSR2TestPulsePolarity(void); int mpsSetCSR2TestPulseTriggerSelect(int val); int mpsGetCSR2TestPulseTriggerSelect(void); int mpsSetCSR2TestAcquisitionDelayControl(int val); unsigned int mpsGetCSR2TestAcquisitionDelayControl(void); int mpsSetCSR3SyncOutputEnable(int val); int mpsGetCSR3SyncOutputEnable(void); int mpsSetCSR3SyncPulsePolarity(int val); int mpsGetCSR3SyncPulsePolarity(void); int mpsSetCSR3SyncOutputMode(int val); int mpsGetCSR3SyncOutputMode(void); int mpsSetCSR3SyncOutputPulseSourceSelectionMUX(int val); int mpsGetCSR3SyncOutputPulseSourceSelectionMUX(void); int mpsSetCSR3ADCRangeControl(int val); int mpsGetCSR3ADCRangeControl(void); int mpsSetCSR3(int val); int mpsGetCSR3(void); int mpsGetCSR3PICMode(void); int mpsSetTriggerDelay(int val); int mpsGetTriggerDelay(void); int mpsClrTriggerErrorCounter(void); int mpsGetTriggerErrorCounter(void); int mpsSetTestPulseGeneratorDelay(int val); int mpsGetTestPulseGeneratorDelay(void); int mpsSetTestPulseGeneratorWidth(int val); int mpsGetTestPulseGeneratorWidth(void); int mpsSetGateGeneratorDelay(int val); int mpsGetGateGeneratorDelay(void); int mpsSetGateGeneratorWidth(int val); int mpsGetGateGeneratorWidth(void); int mpsSetSyncOutDelay(int val); int mpsGetSyncOutDelay(void); int mpsSetSyncOutWidth(int val); int mpsGetSyncOutWidth(void); int mpsSetGeneralPurposeIOControl(int val); int mpsGetGeneralPurposeIOControl(void); int mpsSetGateADCDelay(int val); int mpsGetGateADCDelay(void); int mpsSetBeamToTestAcqDelay(int val); int mpsGetBeamToTestAcqDelay(void); int mpsSetTestToBaseAcqDelay(int val); int mpsGetTestToBaseAcqDelay(void); int mpsSetExtendedGateGeneratorDelay(int val); int mpsGetExtendedGateGeneratorDelay(void); int mpsSetExtendedGateGeneratorWidthLow(unsigned short val); unsigned short mpsGetExtendedGateGeneratorWidthLow(void); int mpsSetExtendedGateGeneratorWidthHigh(unsigned short val); unsigned short mpsGetExtendedGateGeneratorWidthHigh(void); int mpsSetExtendedGateGeneratorWidth(unsigned int width); unsigned int mpsGetExtendedGateGeneratorWidth(void); unsigned int mpsConcatenateEgateWidth(unsigned short low, unsigned short high); int mpsSeparateEgateWidth(unsigned int width); int mpsGetQADCFault(int channel, int type); int mpsGetQADCReadoutStatus(void); int mpsSetQADCCSR(int num, unsigned short val); int mpsGetQADCCSR(int num); int mpsSetQADCBaseThreshold(int channel, int type, short threshold); int mpsSetQADCTestThreshold(int channel, int type, short threshold); int mpsSetQADCBeamThreshold(int channel, int type, short threshold); unsigned short mpsGetQADCBeamDose(int channel, int time, int bytes); /* was signed */ unsigned short mpsGetQADCTestDose(int channel, int time, int bytes); /* was signed */ long mpsAssembleBeamDose(int channel, int time); long mpsAssembleTestDose(int channel, int time); short mpsGetADCDiagnostic(int offset); int mpsSetFiducialDelay(unsigned long delay); int mpsGetFiducialDelay(void); int mpsSetFiducialWidth(unsigned long width); int mpsGetFiducialWidth(void); int mpsSetFiducialDCMPhase(unsigned long dcm_phase); int mpsGetFiducialDCMPhase(void); int mpsSetLinkNodeType(int mode); int mpsGetLinkNodeType(void); unsigned short* mpsGetRawWaveform(); short* mpsGetWaveform(int rise, int run, int offset, int num_pts); int mpsSetBYKThreshold(int threshold_type, int threshold); short mpsGetBYKThreshold(int threshold_type); /* Invasive to FPGA. debug only */ unsigned short* mpsGetBYKThresholdCountsArray(int threshold_type); int mpsSetBYKADCNumSamples(int number); short mpsGetBYKADCNumSamples(void); /* Invasive to FPGA. debug only */ int mpsSetBYKADCNumPresamples(int number); short mpsGetBYKADCNumPresamples(void); /* Invasive to FPGA. debug only */ int mpsSetBYKADCDelay(int delay); short mpsGetBYKADCDelay(void); /* Invasive to FPGA. debug only */ int mpsGetBYKOverThresholdFault(void); int mpsGetBYKUnderThresholdFault(void); int mpsGetBXKickLatch(void); int mpsGet30HzStdbyTriggerMissed(void); int mpsGet30HzAbortTriggerMissed(void); int mpsGet120HzStdbyTriggerMissed(void); int sqliteHandler(void); #endif