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

BocCard.h

00001 // File: BocCard.h
00002 
00003 #ifndef SCTPIXELROD_BOCCARD_H
00004 #define SCTPIXELROD_BOCCARD_H
00005 
00006 #include <iostream>
00007 #include <cmath>
00008 
00009 #include "BocAddresses.h"
00010 #include "RodModule.h"
00011 
00012 
00013 namespace SctPixelRod {
00014 
00021     const unsigned int PRE_PRODUCTION_BOC  = 0x0;
00022     const unsigned int PRODUCTION_REVA_BOC = 0x1;
00023         const unsigned int PRODUCTION_REVB_BOC = 0x2;
00024         const unsigned int PRODUCTION_REVC_BOC = 0x3;
00025 
00032 
00033     const unsigned int MONITOR_CURRENT  = 1;
00034     const unsigned int MONITOR_VOLTAGE  = 2;
00035     const unsigned int MONITOR_TEMP     = 3;
00036     const unsigned int MONITOR_CHANNEL_TYPE[BOC_MONITOR_CHANNELS] = {
00037         MONITOR_CURRENT,
00038         MONITOR_CURRENT,
00039         MONITOR_CURRENT,
00040         MONITOR_CURRENT,
00041         MONITOR_CURRENT,
00042         MONITOR_CURRENT,
00043         MONITOR_CURRENT,
00044         MONITOR_CURRENT,
00045         MONITOR_VOLTAGE,
00046         MONITOR_VOLTAGE,
00047         MONITOR_TEMP,
00048         MONITOR_TEMP};
00049 
00053         const double iArevA = -0.04051;
00054         const double iBrevA = 41.52;
00056         const double vArevA = 0.011106;
00057         const double vBrevA = 0.0;
00059         const double tArevA = 10000.0;
00060         const double tBrevA = 1023.0;
00061         const double tC0revA = 7.4717e-4;
00062         const double tC1revA = 2.7726e-4;
00063         const double tC2revA = 6.8388e-8;
00064 
00067         const double iArevB = 0.02383;
00068         const double iBrevB = 0.0;
00070         const double vArevB = 0.014492;
00071         const double vBrevB = 0.0;
00073         const double tArevB = 10000.0;
00074         const double tBrevB = 1023.0;
00075         const double tC0revB = 7.4717e-4;
00076         const double tC1revB = 2.7726e-4;
00077         const double tC2revB = 6.8388e-8;
00078 
00081         const double iArevC = 0.02383;
00082         const double iBrevC = 0.0;
00084         const double vArevC = 0.014492;
00085         const double vBrevC = 0.0;
00087         const double tArevC = 10000.0;
00088         const double tBrevC = 1023.0;
00089         const double tC0revC = 7.4717e-4;
00090         const double tC1revC = 2.7726e-4;
00091         const double tC2revC = 6.8388e-8;
00092 
00093 
00094 //------------------------------------------------------------------------
00095 
00097 
00110 class BocException : public BaseException {
00111 
00112 public:
00113 
00114   BocException( std::string descriptor);
00115   BocException( std::string descriptor, INT32 value1, INT32 value2);
00116   INT32 getNumData() {return m_numValue; };
00117   INT32 getData1() {return m_value1; };
00118   INT32 getData2() {return m_value2; };
00119   virtual void what(std::ostream&);
00120 
00121 private:
00122 
00123 // Number of data items
00124   INT32 m_numValue;
00125 // 1st data value returned by exception
00126   INT32 m_value1;
00127 
00128 // 2nd data value returned by exception
00129   INT32 m_value2;
00130 
00131 // End of BocException declarations
00132 
00133 };
00134 
00135 
00136 //------------------------------------------------------------------------
00137 
00139 
00151 class BocCard
00152 {
00153 public:
00154 
00155 // Constructor and destructor
00156     BocCard(RodModule & rod );                     // Constructor
00157     ~BocCard();                                    // Destructor
00158 
00159 
00160 // Accessor methods
00161 
00162     UINT32 getSerialNumber() {return m_serialNumber;};
00163     UINT32 getManufacturer() {return m_manufacturer;};
00164     UINT32 getModuleType() {return m_moduleType;};
00165     UINT32 getHardwareRevision() {return m_hardwareRevision;};
00166     UINT32 getFirmwareRevision() {return m_firmwareRevision;};
00167     RodModule* getRod() {return m_myrod;};
00168 
00184         void initialize();
00185 
00186 
00189         void reset();
00190 
00191 
00192 /* status() reports the status of the BOC.
00193  * This initial version just prints the information to standard output.
00194  */
00195         void status();
00196 
00197 
00203         void getLaserCurrent(const UINT32 channel, UINT32 buffer[],
00204                 const UINT32 numChannels) throw (BocException&);
00205     UINT32 getLaserCurrent(const UINT32 channel) throw (BocException&);
00206 
00207 
00212         void setLaserCurrent(const UINT32 channel, const UINT32 buffer[],
00213                 const UINT32 numChannels) throw (BocException&);
00214     void setLaserCurrent(const UINT32 channel, const UINT32 value)
00215                 throw (BocException&);
00216 
00217 
00223     void getRxThreshold(const UINT32 channel, UINT32 buffer[], 
00224                 const UINT32 numChannels) throw (BocException&);
00225     UINT32 getRxThreshold(const UINT32 channel) throw (BocException&);
00226 
00227 
00232     void setRxThreshold(const UINT32 channel, const UINT32 buffer[], 
00233                 const UINT32 numChannels) throw (BocException&);
00234         void setRxThreshold(const UINT32 channel, const UINT32 value)
00235                 throw (BocException&);
00236 
00237 
00243         void getRxDataDelay(const UINT32 channel, UINT32 buffer[],
00244                 const UINT32 numChannels) throw (BocException&);
00245     UINT32 getRxDataDelay(const UINT32 channel) throw (BocException&);
00246 
00247 
00252         void setRxDataDelay(const UINT32 channel, const UINT32 buffer[],
00253                 const UINT32 numChannels) throw (BocException&);
00254         void setRxDataDelay(const UINT32 channel, const UINT32 value)
00255                 throw (BocException&);
00256 
00257 
00266         void getStrobeDelay(const UINT32 channel, UINT32 buffer[],
00267                 const UINT32 numChannels) throw (BocException&);
00268     UINT32 getStrobeDelay(const UINT32 channel) throw (BocException&);
00269 
00270 
00278         void setStrobeDelay(const UINT32 channel, const UINT32 buffer[],
00279                 const UINT32 numChannels) throw (BocException&);
00280         void setStrobeDelay(const UINT32 channel, const UINT32 value)
00281                 throw (BocException&);
00282 
00283 
00290         void getBpmStreamInhibit(const UINT32 channel, UINT32 buffer[],
00291                 const UINT32 numChannels) throw (BocException&);
00292     UINT32 getBpmStreamInhibit(const UINT32 channel) throw (BocException&);
00293 
00294 
00301         void setBpmStreamInhibit(const UINT32 channel, const UINT32 buffer[],
00302                 const UINT32 numChannels) throw (BocException&); 
00303         void setBpmStreamInhibit(const UINT32 channel, const UINT32 value)
00304                 throw (BocException&);
00305 
00306 
00313         void getBpmMarkSpace(const UINT32 channel, UINT32 buffer[],
00314                 const UINT32 numChannels) throw (BocException&);
00315     UINT32 getBpmMarkSpace(const UINT32 channel) throw (BocException&);
00316 
00317 
00324         void setBpmMarkSpace(const UINT32 channel, const UINT32 buffer[],
00325                 const UINT32 numChannels) throw (BocException&);
00326         void setBpmMarkSpace(const UINT32 channel, const UINT32 value)
00327                 throw (BocException&);
00328 
00329 
00336         void getBpmCoarseDelay(const UINT32 channel, UINT32 buffer[],
00337                 const UINT32 numChannels) throw (BocException&);
00338     UINT32 getBpmCoarseDelay(const UINT32 channel) throw (BocException&);
00339 
00340 
00347         void setBpmCoarseDelay(const UINT32 channel, const UINT32 buffer[],
00348                 const UINT32 numChannels) throw (BocException&);
00349         void setBpmCoarseDelay(const UINT32 channel, const UINT32 value)
00350                 throw (BocException&);
00351 
00352 
00359         void getBpmFineDelay(const UINT32 channel, UINT32 buffer[],
00360                 const UINT32 numChannels) throw (BocException&);
00361     UINT32 getBpmFineDelay(const UINT32 channel) throw (BocException&);
00362 
00363 
00370         void setBpmFineDelay(const UINT32 channel, const UINT32 buffer[],
00371                 const UINT32 numChannels) throw (BocException&);
00372         void setBpmFineDelay(const UINT32 channel, const UINT32 value) 
00373                 throw (BocException&);
00374 
00375 
00378         UINT32 getClockControl();
00379 
00380 
00383         void setClockControl(const UINT32 value) throw (BocException&);
00384 
00385 
00388         UINT32 getRxDataMode();
00389 
00390 
00393         void setRxDataMode(const UINT32 value) throw (BocException&);
00394 
00395 
00398         UINT32 getRxDacClear();
00399 
00400 
00405         void clearRxDac();
00406 
00407 
00410         UINT32 getTxDacClear();
00411 
00412 
00417         void clearTxDac();
00418 
00419 
00423     UINT32 getVernierFinePhase();
00424 
00425 
00429     void setVernierFinePhase(const UINT32 value) throw (BocException&);
00430 
00431 
00436         UINT32 getVernierClockPhase0();
00437 
00438 
00443         void setVernierClockPhase0(const UINT32 value) throw (BocException&);
00444 
00445 
00450         UINT32 getVernierClockPhase1();
00451 
00452 
00457         void setVernierClockPhase1(const UINT32 value) throw (BocException&);
00458 
00459 
00462     UINT32 getBpmClockPhase();
00463 
00464 
00467     void setBpmClockPhase(const UINT32 value) throw (BocException&);
00468 
00469 
00472         UINT32 getBregClockPhase();
00473 
00474 
00477         void setBregClockPhase(const UINT32 value) throw (BocException&);
00478 
00479 
00482     UINT32 getBocReset();
00483 
00484 
00489     void resetBoc();
00490 
00491 
00494         UINT32 getBpmReset();
00495 
00496 
00501         void resetBpm();
00502 
00503 
00506         UINT32 getVpinReset();
00507 
00508 
00513         void resetVpin();
00514 
00515 
00518         UINT32 getBocOkReset();
00519 
00520 
00525         void resetBocOk();
00526 
00527 
00532     UINT32 getBocStatusRegister();      //Read-only register
00533 
00534 
00542     double getMonitorAdc(const UINT32 channel, std::string &units, 
00543                              std::string &type) throw (BocException&);
00544     double getMonitorAdc(const UINT32 channel) throw (BocException&);
00545 
00546 
00551     std::string getMonitorAdcUnits(const UINT32 channel) 
00552                                        throw (BocException&);
00553 
00554 
00559         std::string getMonitorAdcType(const UINT32 channel) 
00560                                       throw (BocException&);
00561 
00562 
00567     void resetMonitorAdc();
00568 
00577     UINT32 getInterlockStatus(UINT32 *localEnable, UINT32 *remoteEnable);
00578     UINT32 getInterlockStatus();
00579 
00580 private: 
00581 
00582 
00584         UINT32 singleRead(const UINT32 bocAddress) throw (BocException&);
00585         void singleWrite(const UINT32 bocAddress, const UINT32 value) throw (BocException&);
00586 
00587 
00589         void blockRead(const UINT32 bocAddress,  UINT32 buffer[],
00590                 const INT32 length);
00591         void blockWrite(const UINT32 bocAddress,  const UINT32 buffer[],
00592                 const INT32 length);
00593 
00594 
00596     UINT32 bpmRead(const UINT32 bpm, const UINT32 stream, 
00597                 const UINT32 offset);
00598     void bpmWrite(const UINT32 bpm, const UINT32 stream, 
00599                 const UINT32 offset, const UINT32 value);
00600 
00601 
00603     RodModule* m_myrod;
00604 
00605 
00607     UINT32 m_serialNumber;
00608 
00609 
00611     UINT32 m_manufacturer;
00612 
00613 
00615     UINT32 m_moduleType;
00616 
00617 
00620     UINT32 m_hardwareRevision;
00621 
00622 
00624     UINT32 m_firmwareRevision;
00625 
00629     UINT32 m_bocType;
00630 
00633     UINT32 m_bocMask;
00634 
00635   }; // End of class BocCard declaration
00636 
00637 
00638 }; // End namespace SctPixelRod
00639 
00640 #endif  // SCTPIXELROD_BOCCARD_H

Generated on Thu Jul 15 09:50:43 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5