00001 #include <boost/shared_ptr.hpp>
00002 
00003 #include "primListWrapper.h"
00004 
00005 
00006 #include <CommonWithDsp/sctStructure.h>
00007 
00008 namespace SctApi {
00009 namespace Utility {
00010   class MemoryBlock;
00011 }
00012 
00013 class PrimBuilder {
00014  private:
00015   
00016   PrimBuilder(const PrimBuilder&);
00017   PrimBuilder& operator=(const PrimBuilder&);
00018 
00019  protected:
00020   
00021   PrimBuilder();
00022 
00023  public:
00025 
00029   void slavePrimList(boost::shared_ptr<PrimListWrapper> primList, boost::shared_ptr<PrimListWrapper> prim, 
00030                           unsigned int slaveNumber, bool await, bool response);
00031 
00032   void startSlaveList(boost::shared_ptr<PrimListWrapper> primList, unsigned int slaveNumber, bool await, bool response);
00033 
00034   void echo(boost::shared_ptr<PrimListWrapper> prim, Utility::MemoryBlock block);
00035 
00036   void flashLed(boost::shared_ptr<PrimListWrapper> prim, int period, int flashes);
00037 
00038   void startSlave(boost::shared_ptr<PrimListWrapper> prim, int s);
00039 
00040   void readFifo(boost::shared_ptr<PrimListWrapper> prim, int id, int bank, int elems);
00041 
00042   void pollRegister(boost::shared_ptr<PrimListWrapper> prim, int r, int off, int width, int val, int timeout);
00043 
00044   void taskOp(boost::shared_ptr<PrimListWrapper> prim, int typ, int op, int data);
00045 
00046   void readRegister(boost::shared_ptr<PrimListWrapper> prim, int r);
00047 
00048   void writeRegister(boost::shared_ptr<PrimListWrapper> prim, int r, int off, int wid, int value);
00049 
00050   void buildStream(boost::shared_ptr<PrimListWrapper> primList, int port);
00051 
00052   void sendStream(boost::shared_ptr<PrimListWrapper> primList, int cmdBuff, bool capture = 0);
00053 
00054   void startEvTrap(boost::shared_ptr<PrimListWrapper> primList);
00055 
00056   void stopEvTrap(boost::shared_ptr<PrimListWrapper> primList);
00057 
00058   void setMemory(boost::shared_ptr<PrimListWrapper> primList, unsigned long address, unsigned long words, long value);
00059 
00060   void readSlaveMemory(boost::shared_ptr<PrimListWrapper> primList, unsigned long slave, unsigned long address, unsigned long words);
00061 
00062   void writeSlaveMemory(boost::shared_ptr<PrimListWrapper> primList, unsigned long slave, unsigned long address, unsigned long words, unsigned long *data);
00063 
00064   void readModuleData(boost::shared_ptr<PrimListWrapper> primList, int bank, int channel);
00065 
00066   void writeModuleData(boost::shared_ptr<PrimListWrapper> primList, const ABCDModule* module, int bank, int channel);
00067 
00068   void sendConfig(boost::shared_ptr<PrimListWrapper>, 
00069                   int port, int capture, int module0, int module1, int chip, int setLinks, int restore, 
00070                   int bank, int group, int data, int active, int enableData);
00071 
00072   void writeModuleVariable(boost::shared_ptr<PrimListWrapper>, int bank, int group, int module, int chip, int type, float val);
00073 
00074   void rodMode(boost::shared_ptr<PrimListWrapper> rodModeList, 
00075                int mode, int flag, int fifoSetup, int nBits, int delay, int message);
00076 
00077   void moduleMask(boost::shared_ptr<PrimListWrapper> maskList, 
00078                   int module, int port, int useStructSet, int passOn, int slvs,
00079                   int cmdLine, int dataLine0, int dataLine1, 
00080                   int cfg, int modMask0, int modMask1, int maskType, int storage, int maskSet);
00081 
00082   void masksFromConfig(boost::shared_ptr<PrimListWrapper> maskList, int port);
00083 
00084   void masksToSlaves(boost::shared_ptr<PrimListWrapper> maskList, int slvBits);
00085 
00086   void bocHistogram(boost::shared_ptr<PrimListWrapper> primList, int samples, int numLoops);
00087 
00088   void setTrigger(boost::shared_ptr<PrimListWrapper> primList, int currentBin, int histogramSet);
00089 
00090   static PrimBuilder& instance();
00091   static PrimBuilder *singleton;
00092 };
00093 }