Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

SctApi::SctApi Class Reference

SctApi class. More...

#include <SctApi.h>

Inheritance diagram for SctApi::SctApi:

Inheritance graph
[legend]
Collaboration diagram for SctApi::SctApi:

Collaboration graph
[legend]

Public Member Functions

 SctApi ()
 Default to local xmlConfig.

 SctApi (boost::shared_ptr< SctConfiguration::Configuration > newConf)
 Specify configuration.

void setMrsStream (MRSStream *stream)
 C++ only method to tell a MRS aware program where to write to.

void setIsDictionary (ISInfoDictionary *dict)
 C++ only method to tell a IS aware program where to write to.

void initialiseAll (int run)
 Initialise the crates and create the Rod/Vme objects.

void shutdownAll ()
 Leave everything in a suitable state and delete all the objects.

void setRunNumber (UINT32 newRun)
 IPC: Don't do during a scan.

void setScanNumber (UINT32 newScan)
 IPC: Don't do during a scan.

UINT32 getRunNumber ()
 IPC: Don't do during a scan.

UINT32 getScanNumber ()
 IPC: Don't do during a scan.

bool isRODPresent (unsigned int partition, unsigned int crate, unsigned int rod)
 Return true if ROD can accept commands (Doesn't go so far as to access ROD hardware).

void startupModules ()
 DDC: Check modules in configurable state.

std::list< std::string > getModuleList ()
 Return list of configured modules.

void loadConfiguration ()
 IPC: Don't do during a scan Conf: Definite interaction!

void loadConfiguration (std::string filename)
 IPC: Don't do during a scan Conf: Definite interaction!

int loadModuleConfigurations ()
 Return number of module loaded.

void storeModuleConfigurations ()
 IPC: Don't do during a scan Conf: Definite interaction!

void configureBOC (unsigned int partition, unsigned int crate, unsigned int rod)
 IPC: Don't do during a scan Conf: Definite interaction!

int awaitResponse (unsigned int partition, unsigned int crate, unsigned int rod, int timeout)
 IPC: Allow during a scan (only expert mode) Conf: no interaction!

int awaitResponseAll (unsigned int partition, unsigned int crate, int timeout)
 IPC: Allow during a scan (only expert mode) Conf: no interaction!

unsigned long * getResponse (unsigned int partition, unsigned int crate, unsigned int rod, unsigned long &length)
 (No interaction with VME) IPC: Allow during a scan (only expert mode) Conf: No interaction!

bool getRodMessage (unsigned int partition, unsigned int crate, unsigned int rod, char *buffer, unsigned long &length)
 Get a message in the text buffer.

void flashLED (unsigned int partition, unsigned int crate, unsigned int rod, long slaveNumber, long period=1000, long flashes=10)
 This creates its own primitive list and sends it to a slave DSP on the ROD.

void echo (unsigned int partition, unsigned int crate, unsigned int rod, unsigned int length, const unsigned long *data)
 IPC: Possible during a scan? Conf: No interaction.

void echoAll (unsigned int length, const unsigned long *data)
 IPC: Possible during a scan? Conf: No interaction.

void echoSlave (unsigned int partition, unsigned int crate, unsigned int rod, unsigned int slave, unsigned int length, const unsigned long *data)
 IPC: Possible during a scan? Conf: No interaction.

int dspBlockDump (unsigned int partition, unsigned int crate, unsigned int rod, long dspStart, long numWords, long dspNumber, bool usePrim=true)
 Dump contents of a block of DSP memory to cout.

int dspBlockDumpFile (unsigned int partition, unsigned int crate, unsigned int rod, long dspStart, long numWords, long dspNumber, std::string filename, bool usePrim=true)
 Dump contents of a block of DSP memory to a file.

void standardRegisterDump (RodLabel rl)
 Dump to ${tempDir}/Dump_%05d.

void standardRegisterDump (unsigned int partition, unsigned int crate, unsigned int rod)
 Dump to ${tempDir}/Dump_%05d.

void standardRegisterDumpAll ()
 Dump to ${tempDir}/Dump_%05d RODs sent to consecutive d.

unsigned long * dspBlockRead (unsigned int partition, unsigned int crate, unsigned int rod, long dspStart, long numWords, long dspNumber, unsigned long &length, bool usePrim=true)
 Use dspNumber -1 to refer to the master DSP.

int dspBlockWrite (unsigned int partition, unsigned int crate, unsigned int rod, unsigned long *buffer, unsigned long dspAddress, long numWords, long dspNumber, bool usePrim=true)
 Use dspNumber -1 to refer to the master DSP.

unsigned long * primReadSlaveDsp (unsigned int partition, unsigned int crate, unsigned int rod, int s, int add, int words)
 Don't use if important to preserve primitive state!

void primWriteSlaveDsp (unsigned int partition, unsigned int crate, unsigned int rod, int s, int add, int numWords, unsigned long *data)
 Don't use if important to preserve primitive state!

void writeSlaveFile (unsigned int partition, unsigned int crate, unsigned int rod, unsigned int slave, std::string fileName, unsigned long address, bool usePrim=true)
void startSlave (unsigned int partition, unsigned int crate, unsigned int rod, unsigned int slave)
 Send the start slave primitive to a DSP.

boost::shared_array< unsigned
long > 
loadFile (std::string filename, unsigned long &length)
 Get block of memory from file.

unsigned long readRodStatusReg (unsigned int partition, unsigned int crate, unsigned int rod, long regNumber)
 IPC: Immediate response Conf: No interaction.

unsigned long readRodCommandReg (unsigned int partition, unsigned int crate, unsigned int rod, long regNumber)
 IPC: Immediate response Conf: No interaction.

unsigned long dspSingleRead (unsigned int partition, unsigned int crate, unsigned int rod, const unsigned long dspAddr, long dspNumber)
 IPC: Immediate response Conf: No interaction.

void dspSingleWrite (unsigned int partition, unsigned int crate, unsigned int rod, unsigned long dspAddr, unsigned long value, long dspNumber)
 IPC: Immediate response (expert only) Conf: No interaction.

ABCDModule * retrieveModule (UINT32 mid)
 Module data as cached from Configuration.

void createDebugPrimList ()
 IPC: Immediate response (expert) Conf: No Interaction.

void addDebugPrimList (unsigned long length, long index, long id, long version, unsigned long *body)
 IPC: Immediate response (expert) Conf: No Interaction.

void sendDebugPrimList (unsigned int partition, unsigned int crate, unsigned int rod)
 IPC: Immediate response (expert) Conf: No Interaction.

void sendDebugPrimListAll ()
 IPC: Immediate response (expert) Conf: No Interaction.

void sendDebugSlavePrimList (unsigned int partition, unsigned int crate, unsigned int rod, unsigned int slave, bool await, bool response)
 Send the previously created prim list to a slave dsp.

void debugPrimListFromFile (std::string fileName)
 This doesn't check the primlist checksum (but slave lists will need the correct sum).

void dumpDebugPrimList ()
 Perform a binary dump of the debug prim list.

std::list< RodLabel > listRods ()
 Return a list of the RODs that have been configured.

UINT32 findModule (std::string sn)
std::string convertToString (UINT32 mid)
 IPC: Immediate response Conf: Lookup.

UINT32 findModule (INT32 mur, INT32 module)
 IPC: Immediate response Conf: Lookup.

std::pair< INT32, INT32 > convertToMUR (UINT32 mid)
 IPC: Immediate response Conf: Lookup.

UINT32 findBarrelModule (INT32 barrel, INT32 row, INT32 number)
 IPC: Immediate response Conf: Lookup.

void convertToBarrelModule (UINT32 mid, UINT32 &barrel, UINT32 &row, int &number)
 IPC: Immediate response Conf: Lookup.

UINT32 findEndcapModule (INT32 disk, INT32 quadrant, INT32 number)
 IPC: Immediate response Conf: Lookup.

void convertToEndcapModule (UINT32 mid, INT32 &disk, UINT32 &quadrant, UINT32 &number)
 IPC: Immediate response Conf: Lookup.

void getABCDModules (BankType bank)
 IPC: Immediate response Conf: Lookup.

virtual void getABCDModule (UINT32 mid, BankType bank)
 IPC: Immediate response Conf: Lookup.

virtual boost::shared_ptr<
ABCDModule > 
getABCDModuleRaw (unsigned int partition, unsigned int crate, unsigned int rod, UINT32 slot, BankType bank)
 IPC: Immediate response Conf: Lookup.

virtual void setABCDModules (BankType bank)
 IPC: Don't do during scan Conf: Possible cache.

virtual void setABCDModule (UINT32 mid, BankType bank)
 IPC: Don't do during scan Conf: Possible cache.

virtual void sendAllABCDModules (BankType bank, ConfigType type=SCTAPI_CONFIG_ALL)
virtual void sendABCDModule (UINT32 mid, BankType bank, ConfigType type=SCTAPI_CONFIG_ALL)
void modifyABCDMask (UINT32 mid, UINT32 *mask)
 Set the channel mask of all chips in a module.

void modifyABCDTrims (UINT32 mid, UINT8 *trims)
 Modify a module's trim configuration.

void modifyABCDVar (UINT32 typ, FLOAT32 var)
 IPC: Not during scan Conf: No communication.

void modifyABCDVar (UINT32 mid, UINT32 typ, FLOAT32 var)
 IPC: Not during scan Conf: No communication.

void modifyABCDVar (UINT32 mid, UINT32 chip, UINT32 typ, FLOAT32 var)
 IPC: Not during scan Conf: No communication.

void modifyABCDVarROD (UINT32 mid, UINT32 chip, UINT32 typ, FLOAT32 var, BankType bank)
 IPC: Not during scan Conf: No communication.

void modifyABCDVarROD (UINT32 mid, UINT32 typ, FLOAT32 var, BankType bank)
 IPC: Not during scan Conf: No communication.

void modifyABCDVarROD (UINT32 type, FLOAT32 value, BankType bank)
 IPC: Not during scan Conf: No communication.

void modifyABCDRC (UINT32 mid, UINT32 chip, UINT16 function, FLOAT32 p0, FLOAT32 p1, FLOAT32 p2)
 IPC: Not during scan Conf: No communication.

void modifyBOCParam (unsigned int partition, unsigned int crate, unsigned int rod, unsigned int channel, unsigned int type, unsigned int val)
 IPC: Not during scan Conf: No communication.

void modifyBOCParam (unsigned int type, unsigned int val)
 IPC: Not during scan Conf: No communication.

void printBOCSetup (unsigned int partition, unsigned int crate, unsigned int rod)
 IPC: Immediate response Conf: No communication.

std::vector< SctConfiguration::BOCChannelConfigcurrentBOCSetup (unsigned int partition, unsigned int crate, unsigned int rod)
 IPC: Immediate response (Needs results by IPC) Conf: No communication.

void printBOCRegisters (unsigned int partition, unsigned int crate, unsigned int rod)
 IPC: Immediate response Conf: No communication.

SctConfiguration::BOCGlobalConfig currentBOCRegisters (unsigned int partition, unsigned int crate, unsigned int rod)
 IPC: Immediate response (Needs results by IPC) Conf: No communication.

void saveBOCSetup (unsigned int partition, unsigned int crate, unsigned int rod)
 Save BOC setup.

void saveBOCRegisters (unsigned int partition, unsigned int crate, unsigned int rod)
 Save BOC registers.

void restoreBOCSetup (unsigned int partition, unsigned int crate, unsigned int rod)
 Response BOC setup.

void restoreBOCRegisters (unsigned int partition, unsigned int crate, unsigned int rod)
 Restore BOC registers.

void lasersOff ()
 IPC: Immediate response Conf: No communication.

void timSetFrequency (unsigned int partition, unsigned int crate, double trigFreq, double rstFreq)
 Freq is approximated by divider circuit Available frequencies are 600, 60, 6, 0.6 kHz Divided by: 1, 2, 3, 4, 5, 6, (10, 12).

void freeTriggers (unsigned int partition, unsigned int crate)
 IPC: Not during scan Conf: No communication.

void stopTriggers (unsigned int partition, unsigned int crate)
 IPC: Not during scan Conf: No communication.

void timL1A (unsigned int partition, unsigned int crate)
 IPC: Not during scan Conf: No communication.

void timCalL1A (unsigned int partition, unsigned int crate, int delay)
 IPC: Not during scan Conf: No communication.

void timSoftReset (unsigned int partition, unsigned int crate)
 IPC: Not during scan Conf: No communication.

void timBCReset (unsigned int partition, unsigned int crate)
 IPC: Not during scan Conf: No communication.

void sendTimBurst (unsigned int partition, unsigned int crate, unsigned int count)
 Send burst of triggers to TIM.

void timVerbose (unsigned int partition, unsigned int crate)
 Print all TIM registers to stdout.

void timWriteRegister (unsigned int partition, unsigned int crate, int reg, UINT16 val)
UINT16 timReadRegister (unsigned int partition, unsigned int crate, int reg)
void status ()
 IPC: Immediate response (sane in all eventualities!) Conf: No communication.

void defaultScan (int type)
 IPC: Not during any other scan Conf: No communication.

void doScan (boost::shared_ptr< Scan > scan)
 DDC: Check modules configured...

void awaitScan ()
 Await completion of a scan (alternative to checking IS running entry).

void abortScan ()
 Abort any long term activity.

void doRawScan (boost::shared_ptr< Scan > scan, int delay, int width, bool configureModules=false, bool clkBy2=false)
 IPC: Not during any other scan Conf: Lookup.

void sendTimTrigger (unsigned int partition, unsigned int crate, const Trigger *trig)
 IPC: Not during any other scan Conf: No communication.

void sendTrigger (unsigned int partition, unsigned int crate, unsigned int rod, const Trigger *trig)
 IPC: Not during any other scan Conf: No communication.

void printABCDModule (int mid)
 Uses the sctConf method.

void printABCDRodModule (int mid, BankType bank)
 First retrieve the configuration from the ROD Uses the sctConf method.

void decodeEvent (unsigned int partition, unsigned int crate, unsigned int rod, int sl, int index, bool extFlag=false, bool errorType=false)
 IPC: Needs feedback, immediate response Conf: No Communication.

void scanEvents (unsigned int partition, unsigned int crate, unsigned int rod, int sl, bool extFlag, bool errorType)
 IPC: Needs feedback, immediate response Conf: No Communication.

void reportEventErrors ()
 Suggest problems with modules based on events in event buffer.

void decodeConfig (unsigned int partition, unsigned int crate, unsigned int rod, bool skipTrim=false, bool bypass=false)
 Decode config bit stream (only valid after SEND_CONFIG.

void rawData (unsigned int partition, unsigned int crate, unsigned int rod, int delay, int units, bool setMask=true, const Trigger *trig=0)
 IPC: Needs feedback, immediate response Conf: No Communication.

void sendL1A (unsigned int partition, unsigned int crate, unsigned int rod, bool capture=false)
 The mask is unchanged in this function and it is set up to go to all modules.

std::vector< char > probe (unsigned int partition, unsigned int crate, unsigned int rod, signed int harness=-1)
 Do quick scan of channels Recognises all the same, clock by 2 and an event header Return a char for each link examined 0 All zero's 1 All one's 2 Clock by 2 4 Clock by 4 L L1A E Event Header S Soft Reset B BC Reset J Junk (ie anything else).

std::vector< char > probeWithTrigger (unsigned int partition, unsigned int crate, unsigned int rod, const Trigger *trigger, signed int harness=-1)
 Do quick scan of channels Recognises all the same, clock by 2 and an event header Return a char for each link examined 0 All zero's 1 All one's 2 Clock by 2 4 Clock by 4 L L1A E Event Header S Soft Reset B BC Reset J Junk (ie anything else).

std::vector< std::vector<
char > > 
SctApi::probeScan (unsigned int partition, unsigned int crate, unsigned int rod, boost::shared_ptr< Scan > scan, signed int harness=-1)
 Scan over a variable and perform a probe for each.

bool checkAllModulesProbe (std::string value)
 Probe all modules and check that value returned by probe is one of the characters specified.

void autoConfigure ()
 Suggest values for configuration.

void bocHistogram (unsigned int partition, unsigned int crate, unsigned int rod, unsigned int samples, unsigned int numLoops)
 Run the ROD "BOC histogram" primitive.

void requestHardResetAll ()
 Request hard reset on all modules.

void requestHardReset (UINT32 mid)
 Request hard reset of module mid.

void requestIVCurve (UINT32 mid, FLOAT32 start, FLOAT32 stop, FLOAT32 step, UINT16 delay, FLOAT32 currentLim)
 Request initialisation of an IV scan.

void requestIVCurveAll (FLOAT32 start, FLOAT32 stop, FLOAT32 step, UINT16 delay, FLOAT32 currentLim)
 Request initialisation of an IV scan on all modules.

void setSelectAllInCrate (int crate, bool value, int timeout=5)
 Set the select value for all known power supply channels in a crate.

void setSelect (UINT32 mid, bool value)
 Set the select value for module mid.

void changeRunState (int state)
 Change run state of all power modules.

void ddcChangeState (int crate, int channel, short state, int timeout=2)
 Change state on one channel.

void ddcChangeStateAll (int crate, short state, int timeout=2)
 Change state on all power supply channels.

void ddcLoadConfiguration (int crate, short state, int timeout=2)
 Load power supply crate configuration for particular state.

void ddcHardReset (int crate, int channel, int timeout=2)
 Send hard reset to power supply channel.

void ddcHardResetAll (int crate, int timeout=2)
 Send hard reset to all channels in power supply crate.

int ddcGetChannelParameterInt (int crate, int channel, std::string name, int timeout=2)
 Get a parameter that should be interpreted as an integer.

float ddcGetChannelParameterFloat (int crate, int channel, std::string name, int timeout=2)
 Get a parameter that should be interpreted as a float.

std::string ddcGetChannelParameterString (int crate, int channel, std::string name, int timeout=2)
 Get a parameter that should be interpreted as a string (most likely an error).

int ddcGetCardParameterInt (int crate, int card, std::string name, int timeout=2)
 Get a card parameter that should be interpreted as an integer.

float ddcGetCardParameterFloat (int crate, int card, std::string name, int timeout=2)
 Get a card parameter that should be interpreted as a float.

std::string ddcGetCardParameterString (int crate, int card, std::string name, int timeout=2)
 Get a card parameter that should be interpreted as a string (probably an error).

int ddcGetCrateParameterInt (int crate, std::string name, int timeout=2)
 Get a parameter of a power supply crate that should be interpreted as an integer.

float ddcGetCrateParameterFloat (int crate, std::string name, int timeout=2)
 Get a parameter of a power supply crate that should be interpreted as a float.

std::string ddcGetCrateParameterString (int crate, std::string name, int timeout=2)
 Get a parameter of a power supply crate that should be interpreted as a string.

void ddcGetCrateParameters (int crate, std::vector< std::string > names, std::map< std::string, float > &dpeValues, int timeout)
void ddcSetChannelParameter (int crate, int channel, std::string name, float value, int timeout=2)
 Set a parameter on a power supply channel.

void ddcSetCardParameter (int crate, int card, std::string name, float value, int timeout=2)
 Set a parameter on a power supply card.

void ddcSetCrateParameter (int crate, std::string name, float value, int timeout=2)
 Set a parameter on a power supply crate.

void tidyHistogramming ()
 Stop all tasks to do with histogramming.

long getRodSlot (unsigned int partition, unsigned int crate, unsigned int rod)
 Return slot this ROD is in.

int getRodRevision (unsigned int partition, unsigned int crate, unsigned int rod)
 Return slot this ROD is in.

int getRodRevision (const RodLabel &label)
 Return slot this ROD is in.

void testLinkOutSelect (unsigned int partition, unsigned int crate, unsigned int rod, unsigned int link)
 Select link to send to ROD front panel LEMO.

unsigned int testLinkOutRetrieve (unsigned int partition, unsigned int crate, unsigned int rod)
 Return selected link to send to ROD front panel LEMO.

void unsetDebugOption (std::string opt)
 Disable a debug option.

void setDebugOption (std::string opt)
 Enable a debug option.

std::list< std::string > listEnabledDebugOptions ()
 Get the currently enabled debug options.

std::vector< std::string > listDebugOptions ()
 List possible debug options.

void debugStepHistogram ()
 Perform a step in a histogram which is in a stalled state.

void debugContinueHistogram ()
 Continue a histogram which was previously stalled.

void debugAbortHistogram ()
 Try to abort the current histogram.

void eventTrapSetup (int slaveMask, int trapMatch, int trapMod, int trapRemain, bool tim, bool error, boost::shared_ptr< PrimListWrapper > primList)
 Setup event trapping.

void startEventTrap (int slave, boost::shared_ptr< PrimListWrapper > primList)
 Start event trap on a slave.

void stopEventTrap (int slave, boost::shared_ptr< PrimListWrapper > primList)
 Stop event trap on a slave.

void rodMode (unsigned int partition, unsigned int crate, unsigned int rod, int mode, int flag, int fifoSetup, int nBins, int delay, int message)
 Direct write of ROD mode!

void setupModuleMask (unsigned int partition, unsigned int crate, unsigned int rod, int port, int slvs)
 Set module masks.

void setupModuleMask (int port, int slvs, boost::shared_ptr< PrimListWrapper > list)
 Add set module masks command to primitive list.

std::pair< UINT32, UINT32 > sendData (unsigned int partition, unsigned int crate, unsigned int rod, int type, int dsp)
 Send a SEND_DATA primitive and retrieve the (pointer, length) result.

void resumePolling ()
 Resume the primitive polling thread.

void stopPolling ()
 Pause the primitive polling thread.

void print_calib (unsigned int partition, unsigned int crate, unsigned int rod)
 Print ROD calibration registers.

int synchSendPrimListAllCrates (boost::shared_ptr< PrimListWrapper > primList, int timeout=10)
 A helper function for other methods in this class, to be used only internally to this class as it exposes the RodPrimList class.

void stopHistogramming (const ScanEx &ex)
 Stop the histogramming and event trapping tasks.

void setSlaveBlock (unsigned int partition, unsigned int crate, unsigned int rod, int s, long sAdd, int words, long value=0, bool usePrim=true)
 Set block of slave memory to value (using RW_SLAVE_MEMORY).

void writeRODRegister (unsigned int partition, unsigned int crate, unsigned int rod, int reg, int off, int width, int value)
 Write to a ROD register.

unsigned int readRODRegister (unsigned int partition, unsigned int crate, unsigned int rod, int r)
 Read a register from the ROD.

int pollRegister (unsigned int partition, unsigned int crate, unsigned int rod, int r, int off, int width, int val, int timeout=1000000)
 Poll a register.

virtual unsigned long * readFifo (unsigned int partition, unsigned int crate, unsigned int rod, int id, int bank, int elems)
void startHistogramTask (const Scan &scan, const ScanEx &ex, const RodLabel, unsigned int startBin, unsigned int nBins, unsigned int nTrigs, boost::shared_ptr< PrimListWrapper > list)
 Create histogram task primitive.

void sendPrimList (unsigned int partition, unsigned int crate, unsigned int rod, boost::shared_ptr< PrimListWrapper > prim)
 A helper function for other methods in this class, to be used only internally to this class as it exposes the RodPrimList class.


Data Fields

MRSStream * mrs
ISInfoDictionary * m_isDict

Static Public Attributes

const unsigned int BAD_MODULE
 The constant returned as an unknown module.


Protected Member Functions

virtual int initialiseRod (unsigned int partition, unsigned int crate, unsigned int rod)
 Proxy for Crate.

virtual int initialiseModule (std::string module)
 Load module configuration from database Send module configuration to ROD.

ABCDModule * lookupConfig (UINT32 mid)
 Lookup module configuration in the cache.

virtual bool preScanHardwareCheck (Scan &scan, ScanEx &extra)
 Perform necessary hardware checks before a scan.

virtual void doHistogramSetup (const Scan &scan, const ScanEx &extra)
UINT32 * readEventBuffer (unsigned int partition, unsigned int crate, unsigned int rod, int sl, bool extFlag, bool errorType)
 IPC: Needs feedback, immediate response Conf: No Communication.

int getLastEventFrame (unsigned int partition, unsigned int crate, unsigned int rod, int slave)
 Return the frame in which the last event starts.

virtual int pollHistogramming (boost::shared_ptr< ScanControl > controller, int timeout=5)
 Wait for the number of bins to equal (bins - 1) on all master dsps involved in the scan.

void scanLoop ()
void scanPollingThread ()
void addRodToList (RodLabel newRod)
RodInfo & SctApi::getRodInfo (const RodLabel &l)

Protected Attributes

std::list< RodLabel > rodList
 List all the RODs.

std::map< RodLabel, RodInfo > rodInfoList
 List them again, but with additional info...

std::map< UINT32, ABCDModule > moduleMap
 Cache of module configurations.

boost::shared_ptr< ScanControl > scanController
boost::shared_ptr< ScanControl > lastScanController

Private Member Functions

 SctApi (const SctApi &)
SctApioperator= (const SctApi &)
void setup ()
 This sets the unexpected handler to interpret all sorts of exceptions.

void dumpPrimList (boost::shared_ptr< PrimListWrapper > prim)
 If requested, dump prim list to file and/or log to output.

void dumpRawEvent (unsigned int partition, unsigned int crate, unsigned int rod, int units, unsigned long *bufferA, unsigned long *bufferB)
 Save raw event to file.

void sendSlavePrimList (unsigned int partition, unsigned int crate, unsigned int rod, boost::shared_ptr< PrimListWrapper > prim, unsigned int slave, bool await, bool response)
 Send a RodPrimList to the Master DSP which contains the RodPrimList which is passed as an argument.

void sendPrimListAll (unsigned int partition, unsigned int crate, boost::shared_ptr< PrimListWrapper > prim)
 A helper function for other methods in this class, to be used only internally to this class as it exposes the RodPrimList class.

void setupEventTrapping (const Scan &scan, const ScanEx &ex, const RodLabel, boost::shared_ptr< PrimListWrapper > list)
 Setup event trapping according to scan and ex.

void startEventTrapping (const Scan &scan, const ScanEx &ex, const RodLabel, boost::shared_ptr< PrimListWrapper > primList)
 Start event trapping according to scan and ex.

void setupEventDump (const Scan &scan, const ScanEx &ex, const RodLabel, boost::shared_ptr< PrimListWrapper > list)
 Setup an event dump according to scan and ex.

void setupHistogramming (const Scan &scan, const ScanEx &ex, const RodLabel, bool tim, boost::shared_ptr< PrimListWrapper > list)
 Setup histogramming according to scan and ex.

void calib_init ()
 Setup ROD for calibration.

void readRawData (unsigned int partition, unsigned int crate, unsigned int rod, int delay, bool setMask)
 Read raw data from all links into one "histogram".

virtual int setupRawData (unsigned int partition, unsigned int crate, unsigned int rod, int delay, int units, bool setMask, const Trigger *trig=0)
 Put raw data into FIFOs ready to read out.

CrategetCrate (unsigned int partition, unsigned int crate) const
 Lookup the Crate object to send instructions to.

void cacheModuleConfig (UINT32 mid)
 Put module mid into the cache (if present in the configuration).

void getrpcrc (UINT32 mid, unsigned int &rpartition, unsigned int &rcrate, unsigned int &rrod, unsigned &rchannel)
 XXX What does it do on failure!!!

void initDDC ()
 I think I have to do this after ILU is running (otherwise SCTDCSCommand can't do the stuff it needs to initialise).

void setupScanMasks (ScanEx &extra, int distSlave, bool dual)
 Setup module, dsp masks etc.

bool checkModuleListsForScan ()
 Return whether check passed.

void preScanModuleSetup (Scan &scan)
 Needs to know whether to set formatters into expanded mode.

bool checkDebugOption (std::string opt)
bool checkDebugOption (int opt)

Private Attributes

boost::shared_ptr< SctConfiguration::Configurationconfig
 The configuration database.

IPCPartition * ddcPartition
std::string * ddcCtrls [2]
SCTDCSCommand * ddcCmd
boost::shared_ptr< DCSAccessdcsAccess
boost::shared_ptr< PrimListWrapper > debugPrimList
 The current debug primitive list.

std::map< std::pair< unsigned
int, unsigned int >, Crate * > 
crateMap
 Map to retrieve crate objects.

Log log
 Log everything that is called.

boost::shared_ptr< const ScanlastDebugScan
 For debug only, save the scan information.

boost::shared_ptr< const ScanEx > lastDebugScanEx
UINT32 scanNumber
 Current scan number.

UINT32 runNumber
 Current run number.

boost::condition scanQueue_notEmpty
boost::mutex scanQueue_mutex
std::auto_ptr< boost::thread > scanPollThread
bool m_stopPolling
bool m_inScanLoop
boost::mutex logMutex

Detailed Description

SctApi class.

This is the API used by the rest of the world to interact with SCT Modules using RODs.

Functionality that should be included in this class includes.

Modules are referred to by an "mid" which is a 32bit number packed in hex as PPCCRRCH where: PP is the partition CC is the crate RR is the ROD CH is the ROD channel

DAQ run level transitions: Boot Load and run the crate controller (Done automatically in DAQ-1 from configuration) Load Load config? Config Send config to Modules Start Mode for execution of scans

Configuration: loading from file loading to modules fine grained control on modules recovering module configuration from the ROD Save configuration

Reconfiguring from new configuration file

Scanning: perform scans over configuration variable(s)

DCS: minimal DCS communication

ROD diagnostics: Flash LEDs Text buffer retrieval Memory dumps Send arbitrary primitives to a single ROD

Indexing: There are several ways of addressing a ROD or module the canonical method is partition, crate, rod, module

Other methods include: Geographical: barrel/disc MUR, number MUR: Partition, MUR, number

Definition at line 236 of file SctApi.h.


Constructor & Destructor Documentation

SctApi::SctApi::SctApi  ) 
 

Default to local xmlConfig.

SctApi::SctApi::SctApi boost::shared_ptr< SctConfiguration::Configuration newConf  ) 
 

Specify configuration.


Member Function Documentation

void SctApi::SctApi::abortScan  ) 
 

Abort any long term activity.

Unimplemented

DDC: No action IPC: Immediate response Conf: No communication

void SctApi::SctApi::addDebugPrimList unsigned long  length,
long  index,
long  id,
long  version,
unsigned long *  body
 

IPC: Immediate response (expert) Conf: No Interaction.

void SctApi::SctApi::autoConfigure  ) 
 

Suggest values for configuration.

1) Perform probe scan of tx channels and interpret giving connections of modules to tx channels

int SctApi::SctApi::awaitResponse unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  timeout
 

IPC: Allow during a scan (only expert mode) Conf: no interaction!

int SctApi::SctApi::awaitResponseAll unsigned int  partition,
unsigned int  crate,
int  timeout
 

IPC: Allow during a scan (only expert mode) Conf: no interaction!

void SctApi::SctApi::awaitScan  ) 
 

Await completion of a scan (alternative to checking IS running entry).

void SctApi::SctApi::bocHistogram unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned int  samples,
unsigned int  numLoops
 

Run the ROD "BOC histogram" primitive.

void SctApi::SctApi::cacheModuleConfig UINT32  mid  )  [private]
 

Put module mid into the cache (if present in the configuration).

void SctApi::SctApi::calib_init  )  [private]
 

Setup ROD for calibration.

void SctApi::SctApi::changeRunState int  state  ) 
 

Change run state of all power modules.

One of Off, Standby, On

DDC: Primary purpose IPC: Not during scan Conf: No communication

bool SctApi::SctApi::checkAllModulesProbe std::string  value  ) 
 

Probe all modules and check that value returned by probe is one of the characters specified.

Parameters:
value Set of chars allowed as response to probe

bool SctApi::SctApi::checkModuleListsForScan  )  [private]
 

Return whether check passed.

void SctApi::SctApi::configureBOC unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

IPC: Don't do during a scan Conf: Definite interaction!

void SctApi::SctApi::convertToBarrelModule UINT32  mid,
UINT32 &  barrel,
UINT32 &  row,
int &  number
 

IPC: Immediate response Conf: Lookup.

void SctApi::SctApi::convertToEndcapModule UINT32  mid,
INT32 &  disk,
UINT32 &  quadrant,
UINT32 &  number
 

IPC: Immediate response Conf: Lookup.

std::pair<INT32, INT32> SctApi::SctApi::convertToMUR UINT32  mid  ) 
 

IPC: Immediate response Conf: Lookup.

std::string SctApi::SctApi::convertToString UINT32  mid  ) 
 

IPC: Immediate response Conf: Lookup.

void SctApi::SctApi::createDebugPrimList  ) 
 

IPC: Immediate response (expert) Conf: No Interaction.

SctConfiguration::BOCGlobalConfig SctApi::SctApi::currentBOCRegisters unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

IPC: Immediate response (Needs results by IPC) Conf: No communication.

std::vector<SctConfiguration::BOCChannelConfig> SctApi::SctApi::currentBOCSetup unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

IPC: Immediate response (Needs results by IPC) Conf: No communication.

void SctApi::SctApi::ddcChangeState int  crate,
int  channel,
short  state,
int  timeout = 2
 

Change state on one channel.

void SctApi::SctApi::ddcChangeStateAll int  crate,
short  state,
int  timeout = 2
 

Change state on all power supply channels.

float SctApi::SctApi::ddcGetCardParameterFloat int  crate,
int  card,
std::string  name,
int  timeout = 2
 

Get a card parameter that should be interpreted as a float.

int SctApi::SctApi::ddcGetCardParameterInt int  crate,
int  card,
std::string  name,
int  timeout = 2
 

Get a card parameter that should be interpreted as an integer.

std::string SctApi::SctApi::ddcGetCardParameterString int  crate,
int  card,
std::string  name,
int  timeout = 2
 

Get a card parameter that should be interpreted as a string (probably an error).

float SctApi::SctApi::ddcGetChannelParameterFloat int  crate,
int  channel,
std::string  name,
int  timeout = 2
 

Get a parameter that should be interpreted as a float.

int SctApi::SctApi::ddcGetChannelParameterInt int  crate,
int  channel,
std::string  name,
int  timeout = 2
 

Get a parameter that should be interpreted as an integer.

std::string SctApi::SctApi::ddcGetChannelParameterString int  crate,
int  channel,
std::string  name,
int  timeout = 2
 

Get a parameter that should be interpreted as a string (most likely an error).

float SctApi::SctApi::ddcGetCrateParameterFloat int  crate,
std::string  name,
int  timeout = 2
 

Get a parameter of a power supply crate that should be interpreted as a float.

int SctApi::SctApi::ddcGetCrateParameterInt int  crate,
std::string  name,
int  timeout = 2
 

Get a parameter of a power supply crate that should be interpreted as an integer.

void SctApi::SctApi::ddcGetCrateParameters int  crate,
std::vector< std::string >  names,
std::map< std::string, float > &  dpeValues,
int  timeout
 

Parameters:
crate The crate id
names A list of strings representing parameters
dpeValues The return value, map parameter name strings to values

std::string SctApi::SctApi::ddcGetCrateParameterString int  crate,
std::string  name,
int  timeout = 2
 

Get a parameter of a power supply crate that should be interpreted as a string.

void SctApi::SctApi::ddcHardReset int  crate,
int  channel,
int  timeout = 2
 

Send hard reset to power supply channel.

void SctApi::SctApi::ddcHardResetAll int  crate,
int  timeout = 2
 

Send hard reset to all channels in power supply crate.

void SctApi::SctApi::ddcLoadConfiguration int  crate,
short  state,
int  timeout = 2
 

Load power supply crate configuration for particular state.

void SctApi::SctApi::ddcSetCardParameter int  crate,
int  card,
std::string  name,
float  value,
int  timeout = 2
 

Set a parameter on a power supply card.

void SctApi::SctApi::ddcSetChannelParameter int  crate,
int  channel,
std::string  name,
float  value,
int  timeout = 2
 

Set a parameter on a power supply channel.

void SctApi::SctApi::ddcSetCrateParameter int  crate,
std::string  name,
float  value,
int  timeout = 2
 

Set a parameter on a power supply crate.

void SctApi::SctApi::debugAbortHistogram  ) 
 

Try to abort the current histogram.

This may not work. The DSP can be in a state where the abort signal is delayed in its interpretation

void SctApi::SctApi::debugContinueHistogram  ) 
 

Continue a histogram which was previously stalled.

This only works if the histogram is at the end of a bin

void SctApi::SctApi::debugPrimListFromFile std::string  fileName  ) 
 

This doesn't check the primlist checksum (but slave lists will need the correct sum).

void SctApi::SctApi::debugStepHistogram  ) 
 

Perform a step in a histogram which is in a stalled state.

void SctApi::SctApi::decodeConfig unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
bool  skipTrim = false,
bool  bypass = false
 

Decode config bit stream (only valid after SEND_CONFIG.

void SctApi::SctApi::decodeEvent unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  sl,
int  index,
bool  extFlag = false,
bool  errorType = false
 

IPC: Needs feedback, immediate response Conf: No Communication.

void SctApi::SctApi::defaultScan int  type  ) 
 

IPC: Not during any other scan Conf: No communication.

void SctApi::SctApi::doRawScan boost::shared_ptr< Scan scan,
int  delay,
int  width,
bool  configureModules = false,
bool  clkBy2 = false
 

IPC: Not during any other scan Conf: Lookup.

void SctApi::SctApi::doScan boost::shared_ptr< Scan scan  ) 
 

DDC: Check modules configured...

Check select IPC: Not during any other scan Conf: Lookup

int SctApi::SctApi::dspBlockDump unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
long  dspStart,
long  numWords,
long  dspNumber,
bool  usePrim = true
 

Dump contents of a block of DSP memory to cout.

Parameters:
dspNumber Slave number, -1 for the Master DSP.
usePrim Use a primitive instead of direct VME access
IPC: Possible during a scan Conf: No interaction

int SctApi::SctApi::dspBlockDumpFile unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
long  dspStart,
long  numWords,
long  dspNumber,
std::string  filename,
bool  usePrim = true
 

Dump contents of a block of DSP memory to a file.

Use dspNumber -1 to refer to the master DSP.

Parameters:
dspNumber Slave number, -1 for the Master DSP.
usePrim Use a primitive instead of direct VME access
IPC: Possible during a scan Conf: No interaction

unsigned long* SctApi::SctApi::dspBlockRead unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
long  dspStart,
long  numWords,
long  dspNumber,
unsigned long &  length,
bool  usePrim = true
 

Use dspNumber -1 to refer to the master DSP.

IPC: Possible during a scan Conf: No interaction

int SctApi::SctApi::dspBlockWrite unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned long *  buffer,
unsigned long  dspAddress,
long  numWords,
long  dspNumber,
bool  usePrim = true
 

Use dspNumber -1 to refer to the master DSP.

IPC: Possible during a scan Conf: No interaction

unsigned long SctApi::SctApi::dspSingleRead unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
const unsigned long  dspAddr,
long  dspNumber
 

IPC: Immediate response Conf: No interaction.

void SctApi::SctApi::dspSingleWrite unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned long  dspAddr,
unsigned long  value,
long  dspNumber
 

IPC: Immediate response (expert only) Conf: No interaction.

void SctApi::SctApi::dumpDebugPrimList  ) 
 

Perform a binary dump of the debug prim list.

void SctApi::SctApi::dumpPrimList boost::shared_ptr< PrimListWrapper >  prim  )  [private]
 

If requested, dump prim list to file and/or log to output.

void SctApi::SctApi::dumpRawEvent unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  units,
unsigned long *  bufferA,
unsigned long *  bufferB
[private]
 

Save raw event to file.

void SctApi::SctApi::echo unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned int  length,
const unsigned long *  data
 

IPC: Possible during a scan? Conf: No interaction.

void SctApi::SctApi::echoAll unsigned int  length,
const unsigned long *  data
 

IPC: Possible during a scan? Conf: No interaction.

void SctApi::SctApi::echoSlave unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned int  slave,
unsigned int  length,
const unsigned long *  data
 

IPC: Possible during a scan? Conf: No interaction.

void SctApi::SctApi::eventTrapSetup int  slaveMask,
int  trapMatch,
int  trapMod,
int  trapRemain,
bool  tim,
bool  error,
boost::shared_ptr< PrimListWrapper >  primList
 

Setup event trapping.

A reduced set of parameters compared to the primitive is used.

UINT32 SctApi::SctApi::findBarrelModule INT32  barrel,
INT32  row,
INT32  number
 

IPC: Immediate response Conf: Lookup.

UINT32 SctApi::SctApi::findEndcapModule INT32  disk,
INT32  quadrant,
INT32  number
 

IPC: Immediate response Conf: Lookup.

UINT32 SctApi::SctApi::findModule INT32  mur,
INT32  module
 

IPC: Immediate response Conf: Lookup.

UINT32 SctApi::SctApi::findModule std::string  sn  ) 
 

Parameters:
sn Module serial number
Returns:
The unique identifier, BAD_MODULE if not found
IPC: Immediate response Conf: Lookup

void SctApi::SctApi::flashLED unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
long  slaveNumber,
long  period = 1000,
long  flashes = 10
 

This creates its own primitive list and sends it to a slave DSP on the ROD.

Parameters:
period Flash period given in ms
slaveNumber Slave number or -1 for Master
IPC: Possible during a scan? Conf: No interaction

void SctApi::SctApi::freeTriggers unsigned int  partition,
unsigned int  crate
 

IPC: Not during scan Conf: No communication.

virtual void SctApi::SctApi::getABCDModule UINT32  mid,
BankType  bank
[virtual]
 

IPC: Immediate response Conf: Lookup.

virtual boost::shared_ptr<ABCDModule> SctApi::SctApi::getABCDModuleRaw unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
UINT32  slot,
BankType  bank
[virtual]
 

IPC: Immediate response Conf: Lookup.

void SctApi::SctApi::getABCDModules BankType  bank  ) 
 

IPC: Immediate response Conf: Lookup.

Crate* SctApi::SctApi::getCrate unsigned int  partition,
unsigned int  crate
const [private]
 

Lookup the Crate object to send instructions to.

Return 0 if not found.

int SctApi::SctApi::getLastEventFrame unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  slave
[protected]
 

Return the frame in which the last event starts.

std::list<std::string> SctApi::SctApi::getModuleList  ) 
 

Return list of configured modules.

unsigned long* SctApi::SctApi::getResponse unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned long &  length
 

(No interaction with VME) IPC: Allow during a scan (only expert mode) Conf: No interaction!

bool SctApi::SctApi::getRodMessage unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
char *  buffer,
unsigned long &  length
 

Get a message in the text buffer.

Get a message from a ROD text buffer Returns whether the action was completed

int SctApi::SctApi::getRodRevision const RodLabel &  label  ) 
 

Return slot this ROD is in.

int SctApi::SctApi::getRodRevision unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Return slot this ROD is in.

long SctApi::SctApi::getRodSlot unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Return slot this ROD is in.

void SctApi::SctApi::getrpcrc UINT32  mid,
unsigned int &  rpartition,
unsigned int &  rcrate,
unsigned int &  rrod,
unsigned &  rchannel
[private]
 

XXX What does it do on failure!!!

UINT32 SctApi::SctApi::getRunNumber  ) 
 

IPC: Don't do during a scan.

UINT32 SctApi::SctApi::getScanNumber  ) 
 

IPC: Don't do during a scan.

void SctApi::SctApi::initDDC  )  [private]
 

I think I have to do this after ILU is running (otherwise SCTDCSCommand can't do the stuff it needs to initialise).

void SctApi::SctApi::initialiseAll int  run  ) 
 

Initialise the crates and create the Rod/Vme objects.

Load the system configuration from the database. Create crates and RODs as necessary. Calls initialiseRod and initialiseModule as necessary.

Store the module configuration in the RODs (UNIMPLEMENTED)

Return: 0 for success Possibly error code for failure

IPC: Block everything else!

virtual int SctApi::SctApi::initialiseModule std::string  module  )  [protected, virtual]
 

Load module configuration from database Send module configuration to ROD.

Return 0 for success

virtual int SctApi::SctApi::initialiseRod unsigned int  partition,
unsigned int  crate,
unsigned int  rod
[protected, virtual]
 

Proxy for Crate.

Return 0 for success

bool SctApi::SctApi::isRODPresent unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Return true if ROD can accept commands (Doesn't go so far as to access ROD hardware).

void SctApi::SctApi::lasersOff  ) 
 

IPC: Immediate response Conf: No communication.

std::vector<std::string> SctApi::SctApi::listDebugOptions  ) 
 

List possible debug options.

DDC: No action IPC: Class action, immediate response Conf: No communication

std::list<std::string> SctApi::SctApi::listEnabledDebugOptions  ) 
 

Get the currently enabled debug options.

DDC: No action IPC: Class action, immediate response Conf: No communication

std::list<RodLabel> SctApi::SctApi::listRods  ) 
 

Return a list of the RODs that have been configured.

void SctApi::SctApi::loadConfiguration std::string  filename  ) 
 

IPC: Don't do during a scan Conf: Definite interaction!

void SctApi::SctApi::loadConfiguration  ) 
 

IPC: Don't do during a scan Conf: Definite interaction!

boost::shared_array<unsigned long> SctApi::SctApi::loadFile std::string  filename,
unsigned long &  length
 

Get block of memory from file.

int SctApi::SctApi::loadModuleConfigurations  ) 
 

Return number of module loaded.

ABCDModule* SctApi::SctApi::lookupConfig UINT32  mid  )  [protected]
 

Lookup module configuration in the cache.

void SctApi::SctApi::modifyABCDMask UINT32  mid,
UINT32 *  mask
 

Set the channel mask of all chips in a module.

IPC: Not during scan Conf: No communication

void SctApi::SctApi::modifyABCDRC UINT32  mid,
UINT32  chip,
UINT16  function,
FLOAT32  p0,
FLOAT32  p1,
FLOAT32  p2
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::modifyABCDTrims UINT32  mid,
UINT8 *  trims
 

Modify a module's trim configuration.

IPC: Not during scan Conf: No communication

void SctApi::SctApi::modifyABCDVar UINT32  mid,
UINT32  chip,
UINT32  typ,
FLOAT32  var
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::modifyABCDVar UINT32  mid,
UINT32  typ,
FLOAT32  var
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::modifyABCDVar UINT32  typ,
FLOAT32  var
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::modifyABCDVarROD UINT32  type,
FLOAT32  value,
BankType  bank
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::modifyABCDVarROD UINT32  mid,
UINT32  typ,
FLOAT32  var,
BankType  bank
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::modifyABCDVarROD UINT32  mid,
UINT32  chip,
UINT32  typ,
FLOAT32  var,
BankType  bank
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::modifyBOCParam unsigned int  type,
unsigned int  val
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::modifyBOCParam unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned int  channel,
unsigned int  type,
unsigned int  val
 

IPC: Not during scan Conf: No communication.

virtual int SctApi::SctApi::pollHistogramming boost::shared_ptr< ScanControl >  controller,
int  timeout = 5
[protected, virtual]
 

Wait for the number of bins to equal (bins - 1) on all master dsps involved in the scan.

Then wait for the number of events on the slave to equal to events

Timeout if the bin count doesn't change, and if the number of events doesn't change

int SctApi::SctApi::pollRegister unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  r,
int  off,
int  width,
int  val,
int  timeout = 1000000
 

Poll a register.

virtual bool SctApi::SctApi::preScanHardwareCheck Scan scan,
ScanEx &  extra
[protected, virtual]
 

Perform necessary hardware checks before a scan.

Returns:
true if successful, false otherwise

void SctApi::SctApi::preScanModuleSetup Scan scan  )  [private]
 

Needs to know whether to set formatters into expanded mode.

unsigned long* SctApi::SctApi::primReadSlaveDsp unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  s,
int  add,
int  words
 

Don't use if important to preserve primitive state!

Returns new[]ed block of memory

IPC: Possible during a scan Conf: No interaction

void SctApi::SctApi::primWriteSlaveDsp unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  s,
int  add,
int  numWords,
unsigned long *  data
 

Don't use if important to preserve primitive state!

IPC: Possible during a scan Conf: No interaction

void SctApi::SctApi::print_calib unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Print ROD calibration registers.

void SctApi::SctApi::printABCDModule int  mid  ) 
 

Uses the sctConf method.

IPC: Not very useful without feedback Conf: Possible lookup

void SctApi::SctApi::printABCDRodModule int  mid,
BankType  bank
 

First retrieve the configuration from the ROD Uses the sctConf method.

IPC: Not very useful without feedback Conf: Possible lookup

void SctApi::SctApi::printBOCRegisters unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

IPC: Immediate response Conf: No communication.

void SctApi::SctApi::printBOCSetup unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

IPC: Immediate response Conf: No communication.

std::vector<char> SctApi::SctApi::probe unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
signed int  harness = -1
 

Do quick scan of channels Recognises all the same, clock by 2 and an event header Return a char for each link examined 0 All zero's 1 All one's 2 Clock by 2 4 Clock by 4 L L1A E Event Header S Soft Reset B BC Reset J Junk (ie anything else).

IPC: Needs feedback, some delay to response Conf: Some lookup?!

std::vector<char> SctApi::SctApi::probeWithTrigger unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
const Trigger trigger,
signed int  harness = -1
 

Do quick scan of channels Recognises all the same, clock by 2 and an event header Return a char for each link examined 0 All zero's 1 All one's 2 Clock by 2 4 Clock by 4 L L1A E Event Header S Soft Reset B BC Reset J Junk (ie anything else).

IPC: Needs feedback, some delay to response Conf: Some lookup?!

void SctApi::SctApi::rawData unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  delay,
int  units,
bool  setMask = true,
const Trigger trig = 0
 

IPC: Needs feedback, immediate response Conf: No Communication.

UINT32* SctApi::SctApi::readEventBuffer unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  sl,
bool  extFlag,
bool  errorType
[protected]
 

IPC: Needs feedback, immediate response Conf: No Communication.

void SctApi::SctApi::readRawData unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  delay,
bool  setMask
[private]
 

Read raw data from all links into one "histogram".

unsigned long SctApi::SctApi::readRodCommandReg unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
long  regNumber
 

IPC: Immediate response Conf: No interaction.

unsigned int SctApi::SctApi::readRODRegister unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  r
 

Read a register from the ROD.

unsigned long SctApi::SctApi::readRodStatusReg unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
long  regNumber
 

IPC: Immediate response Conf: No interaction.

void SctApi::SctApi::reportEventErrors  ) 
 

Suggest problems with modules based on events in event buffer.

void SctApi::SctApi::requestHardReset UINT32  mid  ) 
 

Request hard reset of module mid.

DDC: Primary purpose IPC: Not during scan Conf: Some lookup?!

void SctApi::SctApi::requestHardResetAll  ) 
 

Request hard reset on all modules.

DDC: Primary purpose IPC: Not during scan Conf: Some lookup?!

void SctApi::SctApi::requestIVCurve UINT32  mid,
FLOAT32  start,
FLOAT32  stop,
FLOAT32  step,
UINT16  delay,
FLOAT32  currentLim
 

Request initialisation of an IV scan.

DDC: Primary purpose IPC: Not during scan, result will be asynchronous Conf: Some lookup?!

void SctApi::SctApi::requestIVCurveAll FLOAT32  start,
FLOAT32  stop,
FLOAT32  step,
UINT16  delay,
FLOAT32  currentLim
 

Request initialisation of an IV scan on all modules.

DDC: Primary purpose IPC: Not during scan, result will be asynchronous Conf: Some lookup?!

void SctApi::SctApi::restoreBOCRegisters unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Restore BOC registers.

void SctApi::SctApi::restoreBOCSetup unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Response BOC setup.

void SctApi::SctApi::resumePolling  ) 
 

Resume the primitive polling thread.

ABCDModule* SctApi::SctApi::retrieveModule UINT32  mid  ) 
 

Module data as cached from Configuration.

IPC: Immediate response Conf: Interaction

void SctApi::SctApi::rodMode unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  mode,
int  flag,
int  fifoSetup,
int  nBins,
int  delay,
int  message
 

Direct write of ROD mode!

void SctApi::SctApi::saveBOCRegisters unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Save BOC registers.

void SctApi::SctApi::saveBOCSetup unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Save BOC setup.

void SctApi::SctApi::scanEvents unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  sl,
bool  extFlag,
bool  errorType
 

IPC: Needs feedback, immediate response Conf: No Communication.

std::vector<std::vector<char> > SctApi::SctApi::SctApi::probeScan unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
boost::shared_ptr< Scan scan,
signed int  harness = -1
 

Scan over a variable and perform a probe for each.

virtual void SctApi::SctApi::sendABCDModule UINT32  mid,
BankType  bank,
ConfigType  type = SCTAPI_CONFIG_ALL
[virtual]
 

Parameters:
mid Unique identifier of the module to send
bank Configuration bank in the ROD
type How much configuration to transmit
DDC: Check module state Set select line IPC: Not during scan Conf: No Lookup

virtual void SctApi::SctApi::sendAllABCDModules BankType  bank,
ConfigType  type = SCTAPI_CONFIG_ALL
[virtual]
 

Parameters:
bank Configuration bank in the ROD
type How much configuration to transmit
DDC: Check module state Set select line IPC: Not during scan Conf: No Lookup

std::pair<UINT32, UINT32> SctApi::SctApi::sendData unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  type,
int  dsp
 

Send a SEND_DATA primitive and retrieve the (pointer, length) result.

void SctApi::SctApi::sendDebugPrimList unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

IPC: Immediate response (expert) Conf: No Interaction.

void SctApi::SctApi::sendDebugPrimListAll  ) 
 

IPC: Immediate response (expert) Conf: No Interaction.

void SctApi::SctApi::sendDebugSlavePrimList unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned int  slave,
bool  await,
bool  response
 

Send the previously created prim list to a slave dsp.

Parameters:
await Master prim list waits for slave list to complete
response Expect a reply
IPC: Immediate response (expert) Conf: No Interaction

void SctApi::SctApi::sendL1A unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
bool  capture = false
 

The mask is unchanged in this function and it is set up to go to all modules.

IPC: Not during scan Conf: No Communication

void SctApi::SctApi::sendPrimList unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
boost::shared_ptr< PrimListWrapper >  prim
 

A helper function for other methods in this class, to be used only internally to this class as it exposes the RodPrimList class.

void SctApi::SctApi::sendPrimListAll unsigned int  partition,
unsigned int  crate,
boost::shared_ptr< PrimListWrapper >  prim
[private]
 

A helper function for other methods in this class, to be used only internally to this class as it exposes the RodPrimList class.

void SctApi::SctApi::sendSlavePrimList unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
boost::shared_ptr< PrimListWrapper >  prim,
unsigned int  slave,
bool  await,
bool  response
[private]
 

Send a RodPrimList to the Master DSP which contains the RodPrimList which is passed as an argument.

Parameters:
await If true master waits for completion of slave primlist
response If true master expects reponse from slave

void SctApi::SctApi::sendTimBurst unsigned int  partition,
unsigned int  crate,
unsigned int  count
 

Send burst of triggers to TIM.

void SctApi::SctApi::sendTimTrigger unsigned int  partition,
unsigned int  crate,
const Trigger trig
 

IPC: Not during any other scan Conf: No communication.

void SctApi::SctApi::sendTrigger unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
const Trigger trig
 

IPC: Not during any other scan Conf: No communication.

virtual void SctApi::SctApi::setABCDModule UINT32  mid,
BankType  bank
[virtual]
 

IPC: Don't do during scan Conf: Possible cache.

virtual void SctApi::SctApi::setABCDModules BankType  bank  )  [virtual]
 

IPC: Don't do during scan Conf: Possible cache.

void SctApi::SctApi::setDebugOption std::string  opt  ) 
 

Enable a debug option.

DDC: No action IPC: Class action Conf: No communication

void SctApi::SctApi::setIsDictionary ISInfoDictionary *  dict  ) 
 

C++ only method to tell a IS aware program where to write to.

void SctApi::SctApi::setMrsStream MRSStream *  stream  ) 
 

C++ only method to tell a MRS aware program where to write to.

void SctApi::SctApi::setRunNumber UINT32  newRun  ) 
 

IPC: Don't do during a scan.

void SctApi::SctApi::setScanNumber UINT32  newScan  ) 
 

IPC: Don't do during a scan.

void SctApi::SctApi::setSelect UINT32  mid,
bool  value
 

Set the select value for module mid.

This is a debug method for DCS. Primary route to this functionality is via modifyABCDVar and sendModule!

DDC: Primary purpose IPC: Not during scan Conf: Some lookup?!

void SctApi::SctApi::setSelectAllInCrate int  crate,
bool  value,
int  timeout = 5
 

Set the select value for all known power supply channels in a crate.

This is a debug method for DCS. Primary route to this functionality is via modifyABCDVar and sendModule???

DDC: Primary purpose IPC: Not during scan Conf: Some lookup?!

void SctApi::SctApi::setSlaveBlock unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  s,
long  sAdd,
int  words,
long  value = 0,
bool  usePrim = true
 

Set block of slave memory to value (using RW_SLAVE_MEMORY).

void SctApi::SctApi::setup  )  [private]
 

This sets the unexpected handler to interpret all sorts of exceptions.

Called by constructor

void SctApi::SctApi::setupEventDump const Scan scan,
const ScanEx &  ex,
const  RodLabel,
boost::shared_ptr< PrimListWrapper >  list
[private]
 

Setup an event dump according to scan and ex.

void SctApi::SctApi::setupEventTrapping const Scan scan,
const ScanEx &  ex,
const  RodLabel,
boost::shared_ptr< PrimListWrapper >  list
[private]
 

Setup event trapping according to scan and ex.

void SctApi::SctApi::setupHistogramming const Scan scan,
const ScanEx &  ex,
const  RodLabel,
bool  tim,
boost::shared_ptr< PrimListWrapper >  list
[private]
 

Setup histogramming according to scan and ex.

void SctApi::SctApi::setupModuleMask int  port,
int  slvs,
boost::shared_ptr< PrimListWrapper >  list
 

Add set module masks command to primitive list.

void SctApi::SctApi::setupModuleMask unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  port,
int  slvs
 

Set module masks.

virtual int SctApi::SctApi::setupRawData unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  delay,
int  units,
bool  setMask,
const Trigger trig = 0
[private, virtual]
 

Put raw data into FIFOs ready to read out.

void SctApi::SctApi::setupScanMasks ScanEx &  extra,
int  distSlave,
bool  dual
[private]
 

Setup module, dsp masks etc.

void SctApi::SctApi::shutdownAll  ) 
 

Leave everything in a suitable state and delete all the objects.

Shutdown anything that needs shutting down This is where we should send DCS to standby message??

IPC: Block everything else!

void SctApi::SctApi::standardRegisterDump unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Dump to ${tempDir}/Dump_%05d.

void SctApi::SctApi::standardRegisterDump RodLabel  rl  ) 
 

Dump to ${tempDir}/Dump_%05d.

Parameters:
rl Refers to the ROD to dump

void SctApi::SctApi::standardRegisterDumpAll  ) 
 

Dump to ${tempDir}/Dump_%05d RODs sent to consecutive d.

void SctApi::SctApi::startEventTrap int  slave,
boost::shared_ptr< PrimListWrapper >  primList
 

Start event trap on a slave.

void SctApi::SctApi::startEventTrapping const Scan scan,
const ScanEx &  ex,
const  RodLabel,
boost::shared_ptr< PrimListWrapper >  primList
[private]
 

Start event trapping according to scan and ex.

void SctApi::SctApi::startHistogramTask const Scan scan,
const ScanEx &  ex,
const  RodLabel,
unsigned int  startBin,
unsigned int  nBins,
unsigned int  nTrigs,
boost::shared_ptr< PrimListWrapper >  list
 

Create histogram task primitive.

void SctApi::SctApi::startSlave unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned int  slave
 

Send the start slave primitive to a DSP.

void SctApi::SctApi::startupModules  ) 
 

DDC: Check modules in configurable state.

Correct run state and no warnings

IPC: Don't do during a scan Conf: Maybe interaction

void SctApi::SctApi::status  ) 
 

IPC: Immediate response (sane in all eventualities!) Conf: No communication.

void SctApi::SctApi::stopEventTrap int  slave,
boost::shared_ptr< PrimListWrapper >  primList
 

Stop event trap on a slave.

void SctApi::SctApi::stopHistogramming const ScanEx &  ex  ) 
 

Stop the histogramming and event trapping tasks.

void SctApi::SctApi::stopPolling  ) 
 

Pause the primitive polling thread.

void SctApi::SctApi::stopTriggers unsigned int  partition,
unsigned int  crate
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::storeModuleConfigurations  ) 
 

IPC: Don't do during a scan Conf: Definite interaction!

int SctApi::SctApi::synchSendPrimListAllCrates boost::shared_ptr< PrimListWrapper >  primList,
int  timeout = 10
 

A helper function for other methods in this class, to be used only internally to this class as it exposes the RodPrimList class.

unsigned int SctApi::SctApi::testLinkOutRetrieve unsigned int  partition,
unsigned int  crate,
unsigned int  rod
 

Return selected link to send to ROD front panel LEMO.

void SctApi::SctApi::testLinkOutSelect unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
unsigned int  link
 

Select link to send to ROD front panel LEMO.

void SctApi::SctApi::tidyHistogramming  ) 
 

Stop all tasks to do with histogramming.

This is a lower level function than abort, which returns to a know state

DDC: If changed? IPC: Any time Conf: No communication

void SctApi::SctApi::timBCReset unsigned int  partition,
unsigned int  crate
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::timCalL1A unsigned int  partition,
unsigned int  crate,
int  delay
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::timL1A unsigned int  partition,
unsigned int  crate
 

IPC: Not during scan Conf: No communication.

UINT16 SctApi::SctApi::timReadRegister unsigned int  partition,
unsigned int  crate,
int  reg
 

Parameters:
reg VME address of the register

void SctApi::SctApi::timSetFrequency unsigned int  partition,
unsigned int  crate,
double  trigFreq,
double  rstFreq
 

Freq is approximated by divider circuit Available frequencies are 600, 60, 6, 0.6 kHz Divided by: 1, 2, 3, 4, 5, 6, (10, 12).

void SctApi::SctApi::timSoftReset unsigned int  partition,
unsigned int  crate
 

IPC: Not during scan Conf: No communication.

void SctApi::SctApi::timVerbose unsigned int  partition,
unsigned int  crate
 

Print all TIM registers to stdout.

void SctApi::SctApi::timWriteRegister unsigned int  partition,
unsigned int  crate,
int  reg,
UINT16  val
 

Parameters:
reg VME address of the register

void SctApi::SctApi::unsetDebugOption std::string  opt  ) 
 

Disable a debug option.

DDC: No action IPC: Class action Conf: No communication

void SctApi::SctApi::writeRODRegister unsigned int  partition,
unsigned int  crate,
unsigned int  rod,
int  reg,
int  off,
int  width,
int  value
 

Write to a ROD register.


Field Documentation

const unsigned int SctApi::SctApi::BAD_MODULE [static]
 

The constant returned as an unknown module.

Definition at line 242 of file SctApi.h.

boost::shared_ptr<SctConfiguration::Configuration> SctApi::SctApi::config [private]
 

The configuration database.

Definition at line 1664 of file SctApi.h.

std::map<std::pair<unsigned int, unsigned int>, Crate* > SctApi::SctApi::crateMap [private]
 

Map to retrieve crate objects.

Definition at line 1676 of file SctApi.h.

boost::shared_ptr<PrimListWrapper> SctApi::SctApi::debugPrimList [private]
 

The current debug primitive list.

Definition at line 1673 of file SctApi.h.

boost::shared_ptr<const Scan> SctApi::SctApi::lastDebugScan [private]
 

For debug only, save the scan information.

Definition at line 1682 of file SctApi.h.

Log SctApi::SctApi::log [private]
 

Log everything that is called.

Definition at line 1679 of file SctApi.h.

std::map<UINT32, ABCDModule> SctApi::SctApi::moduleMap [protected]
 

Cache of module configurations.

Definition at line 1568 of file SctApi.h.

std::map<RodLabel, RodInfo> SctApi::SctApi::rodInfoList [protected]
 

List them again, but with additional info...

Definition at line 1565 of file SctApi.h.

std::list<RodLabel> SctApi::SctApi::rodList [protected]
 

List all the RODs.

Definition at line 1562 of file SctApi.h.

UINT32 SctApi::SctApi::runNumber [private]
 

Current run number.

Definition at line 1689 of file SctApi.h.

UINT32 SctApi::SctApi::scanNumber [private]
 

Current scan number.

Definition at line 1686 of file SctApi.h.


The documentation for this class was generated from the following file:
Generated on Thu Jul 15 09:52:01 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5