00001 #include <boost/shared_ptr.hpp>
00002 
00003 #include "primListWrapper.h"
00004 
00005 
00006 #include <Sct/AbcdModule.h>
00007 
00008 
00009 #include "serialStreams.h"
00010 
00011 namespace SctApi {
00012 namespace Utility {
00013   class MemoryBlock;
00014 }
00015 
00016 class PrimBuilder {
00017  private:
00018   
00019   PrimBuilder(const PrimBuilder&);
00020   PrimBuilder& operator=(const PrimBuilder&);
00021 
00022  protected:
00023   
00024   PrimBuilder();
00025 
00026  public:
00028 
00032   void slavePrimList(boost::shared_ptr<PrimListWrapper> primList, boost::shared_ptr<PrimListWrapper> prim, 
00033                           unsigned int slaveNumber, bool await, bool response);
00034 
00035   void startSlaveList(boost::shared_ptr<PrimListWrapper> primList, unsigned int slaveNumber, bool await, bool response);
00036 
00037   void echo(boost::shared_ptr<PrimListWrapper> prim, Utility::MemoryBlock block);
00038 
00039   void flashLed(boost::shared_ptr<PrimListWrapper> prim, int period, int flashes);
00040 
00041   void startSlave(boost::shared_ptr<PrimListWrapper> prim, int s);
00042 
00043   void readFifo(boost::shared_ptr<PrimListWrapper> prim, int id, int bank, int elems);
00044 
00045   void pollRegister(boost::shared_ptr<PrimListWrapper> prim, int r, int off, int width, int val, int timeout);
00046 
00047   void taskOp(boost::shared_ptr<PrimListWrapper> prim, int typ, int op, int data);
00048 
00049   void readRegister(boost::shared_ptr<PrimListWrapper> prim, int r);
00050 
00051   void writeRegister(boost::shared_ptr<PrimListWrapper> prim, int r, int off, int wid, int value);
00052 
00053   void buildStream(boost::shared_ptr<PrimListWrapper> primList, int port);
00054 
00055   void sendStream(boost::shared_ptr<PrimListWrapper> primList, int cmdBuff, bool capture = 0);
00056 
00057   void startEvTrap(boost::shared_ptr<PrimListWrapper> primList);
00058 
00059   void stopEvTrap(boost::shared_ptr<PrimListWrapper> primList);
00060 
00061   void setMemory(boost::shared_ptr<PrimListWrapper> primList, unsigned long address, unsigned long words, long value);
00062 
00063   void readSlaveMemory(boost::shared_ptr<PrimListWrapper> primList, unsigned long slave, unsigned long address, unsigned long words);
00064 
00065   void writeSlaveMemory(boost::shared_ptr<PrimListWrapper> primList, unsigned long slave, unsigned long address, unsigned long words, unsigned long *data);
00066 
00067   void readModuleData(boost::shared_ptr<PrimListWrapper> primList, int bank, int channel);
00068 
00069   void writeModuleData(boost::shared_ptr<PrimListWrapper> primList, const ABCDModule* module, int cfgset_bits, int channel, UINT32 moduleParts);
00070 
00071   void copyModuleData(boost::shared_ptr<PrimListWrapper> primList, int from_bank, UINT32 to_banks_bitset, int channel);
00072 
00073   void sendConfig(boost::shared_ptr<PrimListWrapper>, 
00074                   int port, int capture, int module0, int module1, int chip, int setLinks, int restore, 
00075                   int bank, int group, int data, int active, int enableData);
00076 
00077   void writeModuleVariable(boost::shared_ptr<PrimListWrapper>, UINT32 dsp_bank_set, int group, int module, int chip, int type, float val);
00078 
00079   void rodMode(boost::shared_ptr<PrimListWrapper> rodModeList, 
00080                int mode, int flag, int fifoSetup, int nBits, int delay, int message);
00081 
00083   void moduleMask(boost::shared_ptr<PrimListWrapper> maskList, 
00084                   int module, int port, int useStructSet, int passOn, int slvs,
00085                   int cmdLine, int dataLine0, int dataLine1, 
00086                   int cfg, int modMask0, int modMask1, int maskType, int storage, int maskSet);
00087 
00092   void masksFromConfig(boost::shared_ptr<PrimListWrapper> maskList, int port);
00093 
00098   void masksToSlaves(boost::shared_ptr<PrimListWrapper> maskList, int slvBits);
00099 
00105   void masksConfig(boost::shared_ptr<PrimListWrapper> maskList, int moduleMask[2], int port, int maskType, int command, int maskSet);
00106 
00111   void masksUpdate(boost::shared_ptr<PrimListWrapper> maskList, int moduleMask[2], int port, int maskType, int maskSet);
00112 
00117   void masksConfigModule(boost::shared_ptr<PrimListWrapper> maskList, int module, int cmd, int rx0, int rx1);
00118 
00119   void bocHistogram(boost::shared_ptr<PrimListWrapper> primList, int delay, int width, int numEvents, 
00120             struct ::CmdList trigger, int port);
00121 
00122   void setTrigger(boost::shared_ptr<PrimListWrapper> primList, int currentBin, int histogramSet);
00123 
00124   static PrimBuilder& instance();
00125   static PrimBuilder *singleton;
00126 };
00127 }