#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_BLM_CHANS (8) #define MPS_NODE_NUM_PIC_CHANS (8) #define MPS_NODE_NUM_RELS (2) #define MPS_CHAN_NUM_ATTRS (11) #define MPS_ATTR_LENGTH (100) #define MPS_BYK_WAVEFORM_LENGTH (1000) /* Actually 1024, but only looking at 1000 to make x-y graph have more axes numbering */ 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; /* 4/15/9 still working on this. what types. what fields */ typedef struct mpsPICChannel_s { double highthreshold; double lowthreshold; long loss_now; long loss_1; long loss_10; long loss_30; long loss_60; } mpsPICChannel_t; typedef struct mpsPIC_s { mpsPICChannel_t picchannels[MPS_NODE_NUM_PIC_CHANS]; } mpsPIC_t; typedef struct mpsBLMChannel_s { int basehighthreshold; int baselowthreshold; int testhighthreshold; int testlowthreshold; int beamhighthreshold; int beamlowthreshold; int hvlowthresholdcounts; int hvhighthresholdcounts; int hvlowthresholdvolts; int hvhighthresholdvolts; short beampedestal; } mpsBLMChannel_t; typedef struct mpsNode_s { int linknodeid; int linknodetype; int fpgaVersion; int qadcFpgaVersion; char dateId[11]; char subtypeId[5]; char systemId[5]; int rackelevation; char racknumber[MPS_ATTR_LENGTH]; int numChannels; mpsInputChannel_t inputchannels[MPS_NODE_NUM_CHANS]; mpsPIC_t pics[4]; mpsBLMChannel_t blmChannels[MPS_NODE_NUM_BLM_CHANS]; short beamped3d3; short beamped2d5; short beamped1d2; short beampedgnd; unsigned short blmFpgaVersion; double BYKThresholdHighVolts; double BYKThresholdHighVoltsArray[2]; /* just for plotting on xygraph */ unsigned short BYKThresholdHighCountsArray[2]; /* just for plotting on xygraph */ double BYKThresholdLowVolts; double BYKThresholdLowVoltsArray[2]; /* just for plotting on xygraph */ unsigned short BYKThresholdLowCountsArray[2]; /* just for plotting on xygraph */ int BYKADCNumSamples; int BYKADCNumPresamples; int BYKADCDelay; short BYKADCSamplesArray[2]; /* just for plotting on xygraph */ short BYKADCPresamplesArray[2]; /* just for plotting on xygraph */ char databaseVersion[MPS_LINE_LENGTH]; char rackLocation[MPS_LINE_LENGTH]; int rackLocked; unsigned short BYKWaveform[MPS_BYK_WAVEFORM_LENGTH]; } mpsNode_t; int mpsReadDatabaseVersion(char* current); char* mpsGetDatabaseVersion(void); /*char* mpsGetRackLocation(void); 3/13/9 dropped. redunc with iocManager */ int mpsSetRackLocked(int locked); int mpsGetRackLocked(void); int mpsGetFPGAVersion(void); int mpsReadFPGAVersion(void); int mpsReadFPGADateId(void); char* mpsGetFPGADateId(void); int mpsReadFPGASubtypeId(void); char* mpsGetFPGASubtypeId(void); int mpsReadFPGASystemId(void); char* mpsGetFPGASystemId(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 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 mpsClrBLMHVThresholdFaultStatus(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 mpsSetPICHighVoltage(int val); int mpsGetPICHighVoltageStatus(void); int mpsGetPIC29HighVoltageStatus(void); int mpsClrIPTimeout(void); int mpsSetCSR1Reset(int module); int mpsSetCSR1DiagnosticModeEnable(int module); int mpsSetCSR1Arm(int module); int mpsSetCSR1Enable(int module); int mpsSetCSR1DiagnosticModeSelect(int module, int val); int mpsSetCSR1TriggerSourceSelect(int module, int val); int mpsSetCSR1TriggerEdgeSelect(int module, int val); int mpsSetCSR1MissedTriggerStatus(int module, int val); int mpsGetCSR1MissedTriggerStatus(int module); int mpsSetCSR1SoftwareTrigger(int module, int val); int mpsSetCSR1DataReady(int module, int val); int mpsGetCSR1DataReady(int module); int mpsSetCSR1GateGeneratorSelect(int module, int val); int mpsGetCSR1GateGeneratorSelect(int module); int mpsSetCSR1GateTriggerSelect(int module, int val); /* ok no mpsGetCSR1GateTriggerSelect? */ int mpsSetCSR1GatePolarity(int module, int val); int mpsGetCSR1GatePolarity(int module); int mpsSetCSR1GateEnable(int module, int val); int mpsGetCSR1GateEnable(int module); int mpsGetCSR2D2LStatus(int module); int mpsGetCSR2D4LStatus(int module); int mpsSetCSR2TestPulseEnable(int module, int val); int mpsGetCSR2TestPulseEnable(int module); int mpsSetCSR2TestPulsePolarity(int module, int val); int mpsGetCSR2TestPulsePolarity(int module); int mpsSetCSR2TestPulseTriggerSelect(int module, int val); int mpsGetCSR2TestPulseTriggerSelect(int module); int mpsSetCSR2TestAcquisitionDelayControl(int module, int val); unsigned int mpsGetCSR2TestAcquisitionDelayControl(int module); int mpsSetCSR3SyncOutputEnable(int module, int val); int mpsGetCSR3SyncOutputEnable(int module); int mpsSetCSR3SyncPulsePolarity(int module, int val); int mpsGetCSR3SyncPulsePolarity(int module); int mpsSetCSR3SyncOutputMode(int module, int val); int mpsGetCSR3SyncOutputMode(int module); int mpsSetCSR3SyncOutputPulseSourceSelectionMUX(int module, int val); int mpsGetCSR3SyncOutputPulseSourceSelectionMUX(int module); int mpsSetCSR3ADCRangeControl(int module, int val); int mpsGetCSR3ADCRangeControl(int module); int mpsSetCSR3FBC(int module, int val); int mpsGetCSR3FBC(int module); int mpsGetCSR3PICMode(int module); int mpsSetCSR3(int val); int mpsGetCSR3(void); int mpsSetTriggerDelay(int module, int val); int mpsGetTriggerDelay(int module); int mpsClrTriggerErrorCounter(int module); int mpsGetTriggerErrorCounter(int module); int mpsSetTestPulseGeneratorDelay(int module, int val); int mpsGetTestPulseGeneratorDelay(int module); int mpsSetTestPulseGeneratorWidth(int module, int val); int mpsGetTestPulseGeneratorWidth(int module); int mpsSetGateGeneratorDelay(int module, int val); int mpsGetGateGeneratorDelay(int module); int mpsSetGateGeneratorWidth(int module, int val); int mpsGetGateGeneratorWidth(int module); int mpsSetSyncOutDelay(int module, int val); int mpsGetSyncOutDelay(int module); int mpsSetSyncOutWidth(int module, int val); int mpsGetSyncOutWidth(int module); int mpsSetGeneralPurposeIOControl(int module, int val); int mpsGetGeneralPurposeIOControl(int module); int mpsSetGateADCDelay(int module, int val); int mpsGetGateADCDelay(int module); int mpsSetBeamToTestAcqDelay(int module, int val); int mpsGetBeamToTestAcqDelay(int module); int mpsSetTestToBaseAcqDelay(int module, int val); int mpsGetTestToBaseAcqDelay(int module); int mpsSetExtendedGateGeneratorDelay(int module, int val); int mpsGetExtendedGateGeneratorDelay(int module); int mpsSetExtendedGateGeneratorWidthLow(int module, unsigned short val); unsigned short mpsGetExtendedGateGeneratorWidthLow(int module); int mpsSetExtendedGateGeneratorWidthHigh(int module, unsigned short val); unsigned short mpsGetExtendedGateGeneratorWidthHigh(int module); int mpsSetExtendedGateGeneratorWidth(int module, int width); int mpsGetExtendedGateGeneratorWidth(int module); unsigned int mpsConcatenateEgateWidth(unsigned short low, unsigned short high); int mpsSeparateEgateWidth(unsigned int width); int mpsSetExtendedGateADCDelay(int module, int val); int mpsGetExtendedGateADCDelay(int module); int mpsSetGatePEDADCDelay(int module, int val); int mpsGetGatePEDADCDelay(int module); int mpsGetAcquisitionCounter(int module); int mpsGetEventCounter(void); int mpsGetAbortCounter(void); int mpsGetStandbyCounter(void); int mpsGetEVGAbortCounter(void); int mpsGetBeamPedestal(int channel); int mpsGetBeamPed3d3(); int mpsGetBeamPed2d5(); int mpsGetBeamPed1d2(); int mpsGetBeamPedGnd(); int mpsGetQADCFault(int module, int channel, int type); int mpsRequestSyncRead(void* arg); /* 10/16/09 No longer passing in module */ int mpsGetSyncReadStatus(void); int mpsQADCReadout(int module); int mpsGetQADCReadoutStatus(void); int mpsSetQADCCSR(int module, int num, unsigned short val); int mpsGetQADCCSR(int module, int num); int mpsSetQADCBaseThreshold(int module, int channel, int type, long threshold); /* 4/13/9 add module, not because PIC uses this, but to keep consistent with mpsSetQADCBeamThreshold */ int mpsSetQADCTestThreshold(int module, int channel, int type, long threshold); /* 4/13/9 add module, not because PIC uses this, but to keep consistent with mpsSetQADCBeamThreshold */ int mpsSetQADCBeamThreshold(int module, int channel, int type, long threshold); /* 4/13/9 add module to accommodate PIC */ int mpsGetQADCBaseThresholdUpperRegister(int module, int channel, int type); int mpsGetQADCBaseThresholdLowerRegister(int module, int channel, int type); int mpsGetQADCTestThresholdUpperRegister(int module, int channel, int type); int mpsGetQADCTestThresholdLowerRegister(int module, int channel, int type); int mpsGetQADCBeamThresholdUpperRegister(int module, int channel, int type); int mpsGetQADCBeamThresholdLowerRegister(int module, int channel, int type); /* unsigned short mpsGetQADCBeamDose(int channel, int time, int bytes); helper internal to drvMpsLinkNode.c */ unsigned short mpsGetQADCTestDose(int channel, int time, int bytes); /* 4/13/9 add module to accommodate PIC */ long mpsAssembleBeamDose(int module, int channel, int time); long mpsGetBeamDoseFromMem(int module, int channel, int time); /* 4/15/8 PICs now read losses from mem */ long mpsAssembleTestDose(int channel, int time); short mpsGetADCDiagnostic(int module, int offset); /* 4/13/9 add module to accommodate PIC */ 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(); double* mpsGetWaveform(int rise, int run, int offset, int num_pts); int mpsSetBYKThreshold(int threshold_type, double threshold); /* 9/24/9: changed all decs from short to unsigned short in this routine */ unsigned short mpsGetBYKThreshold(int threshold_type); unsigned short* mpsGetBYKThresholdCountsArray(int threshold_type); int mpsSetBYKADCNumSamples(int number); short mpsGetBYKADCNumSamples(void); int mpsSetBYKADCNumPresamples(int number); short mpsGetBYKADCNumPresamples(void); int mpsSetBYKADCDelay(int delay); short mpsGetBYKADCDelay(void); int mpsGetBYKOverThresholdFault(void); int mpsGetBYKUnderThresholdFault(void); short* mpsGetBYKBeginSample(void); short* mpsGetBYKEndSample(void); int mpsGetBXKickLatch(void); int mpsGet30HzStdbyTriggerMissed(void); int mpsGet30HzAbortTriggerMissed(void); int mpsGet120HzStdbyTriggerMissed(void); int mpsGet120HzAbortTriggerMissed(void); int sqliteHandler(void); #endif