00001
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
00017 const unsigned int PRE_PRODUCTION_BOC = 0x10;
00018 const unsigned int PRODUCTION_REVA_BOC = 0x21;
00019 const unsigned int PRODUCTION_REVB_BOC = 0x22;
00020
00026 const unsigned int MONITOR_CHANNELS = 12;
00027
00028 const unsigned int MONITOR_CURRENT = 1;
00029 const unsigned int MONITOR_VOLTAGE = 2;
00030 const unsigned int MONITOR_TEMP = 3;
00031 const unsigned int MONITOR_CHANNEL_TYPE[MONITOR_CHANNELS] = {
00032 MONITOR_CURRENT,
00033 MONITOR_CURRENT,
00034 MONITOR_CURRENT,
00035 MONITOR_CURRENT,
00036 MONITOR_CURRENT,
00037 MONITOR_CURRENT,
00038 MONITOR_CURRENT,
00039 MONITOR_CURRENT,
00040 MONITOR_VOLTAGE,
00041 MONITOR_VOLTAGE,
00042 MONITOR_TEMP,
00043 MONITOR_TEMP};
00044
00048 const double iArevA = -0.04051;
00049 const double iBrevA = 41.52;
00051 const double vArevA = 0.011106;
00052 const double vBrevA = 0.0;
00054 const double tArevA = 10000.0;
00055 const double tBrevA = 1023.0;
00056 const double tC0revA = 7.4717e-4;
00057 const double tC1revA = 2.7726e-4;
00058 const double tC2revA = 6.8388e-8;
00059
00062 const double iArevB = 0.02383;
00063 const double iBrevB = 0.0;
00065 const double vArevB = 0.014492;
00066 const double vBrevB = 0.0;
00068 const double tArevB = 10000.0;
00069 const double tBrevB = 1023.0;
00070 const double tC0revB = 7.4717e-4;
00071 const double tC1revB = 2.7726e-4;
00072 const double tC2revB = 6.8388e-8;
00073
00074
00075 namespace SctPixelRod {
00076
00077
00078
00080
00092 class BocCard
00093 {
00094 public:
00095
00096
00097 BocCard(RodModule & rod );
00098 ~BocCard();
00099
00100
00101
00102
00103 UINT32 getSerialNumber() {return m_serialNumber;};
00104 UINT32 getManufacturer() {return m_manufacturer;};
00105 UINT32 getModuleType() {return m_moduleType;};
00106 UINT32 getHardwareRevision() {return m_hardwareRevision;};
00107 UINT32 getFirmwareRevision() {return m_firmwareRevision;};
00108 RodModule* getRod() {return m_myrod;};
00109
00125 void initialize();
00126
00127
00130 void reset();
00131
00132
00133
00134
00135
00136 void status();
00137
00138
00144 void getLaserCurrent(const UINT32 channel, UINT32 buffer[],
00145 const UINT32 numChannels);
00146 UINT32 getLaserCurrent(const UINT32 channel);
00147
00148
00153 void setLaserCurrent(const UINT32 channel, const UINT32 buffer[],
00154 const UINT32 numChannels);
00155 void setLaserCurrent(const UINT32 channel, const UINT32 value);
00156
00157
00163 void getRxThreshold(const UINT32 channel, UINT32 buffer[],
00164 const UINT32 numChannels);
00165 UINT32 getRxThreshold(const UINT32 channel);
00166
00167
00172 void setRxThreshold(const UINT32 channel, const UINT32 buffer[],
00173 const UINT32 numChannels);
00174 void setRxThreshold(const UINT32 channel, const UINT32 value);
00175
00176
00182 void getRxDataDelay(const UINT32 channel, UINT32 buffer[],
00183 const UINT32 numChannels);
00184 UINT32 getRxDataDelay(const UINT32 channel);
00185
00186
00191 void setRxDataDelay(const UINT32 channel, const UINT32 buffer[],
00192 const UINT32 numChannels);
00193 void setRxDataDelay(const UINT32 channel, const UINT32 value);
00194
00195
00201 void getStrobeDelay(const UINT32 channel, UINT32 buffer[],
00202 const UINT32 numChannels);
00203 UINT32 getStrobeDelay(const UINT32 channel);
00204
00205
00210 void setStrobeDelay(const UINT32 channel, const UINT32 buffer[],
00211 const UINT32 numChannels);
00212 void setStrobeDelay(const UINT32 channel, const UINT32 value);
00213
00214
00221 void getBpmStreamInhibit(const UINT32 channel, UINT32 buffer[],
00222 const UINT32 numChannels);
00223 UINT32 getBpmStreamInhibit(const UINT32 channel);
00224
00225
00232 void setBpmStreamInhibit(const UINT32 channel, const UINT32 buffer[],
00233 const UINT32 numChannels);
00234 void setBpmStreamInhibit(const UINT32 channel, const UINT32 value);
00235
00236
00243 void getBpmMarkSpace(const UINT32 channel, UINT32 buffer[],
00244 const UINT32 numChannels);
00245 UINT32 getBpmMarkSpace(const UINT32 channel);
00246
00247
00254 void setBpmMarkSpace(const UINT32 channel, const UINT32 buffer[],
00255 const UINT32 numChannels);
00256 void setBpmMarkSpace(const UINT32 channel, const UINT32 value);
00257
00258
00265 void getBpmCoarseDelay(const UINT32 channel, UINT32 buffer[],
00266 const UINT32 numChannels);
00267 UINT32 getBpmCoarseDelay(const UINT32 channel);
00268
00269
00276 void setBpmCoarseDelay(const UINT32 channel, const UINT32 buffer[],
00277 const UINT32 numChannels);
00278 void setBpmCoarseDelay(const UINT32 channel, const UINT32 value);
00279
00280
00287 void getBpmFineDelay(const UINT32 channel, UINT32 buffer[],
00288 const UINT32 numChannels);
00289 UINT32 getBpmFineDelay(const UINT32 channel);
00290
00291
00298 void setBpmFineDelay(const UINT32 channel, const UINT32 buffer[],
00299 const UINT32 numChannels);
00300 void setBpmFineDelay(const UINT32 channel, const UINT32 value);
00301
00302
00305 UINT32 getClockControl();
00306
00307
00310 void setClockControl(const UINT32 value);
00311
00312
00315 UINT32 getRxDataMode();
00316
00317
00320 void setRxDataMode(const UINT32 value);
00321
00322
00325 UINT32 getRxDacClear();
00326
00327
00332 void clearRxDac();
00333
00334
00337 UINT32 getTxDacClear();
00338
00339
00344 void clearTxDac();
00345
00346
00350 UINT32 getVernierFinePhase();
00351
00352
00356 void setVernierFinePhase(const UINT32 value);
00357
00358
00363 UINT32 getVernierClockPhase0();
00364
00365
00370 void setVernierClockPhase0(const UINT32 value);
00371
00372
00377 UINT32 getVernierClockPhase1();
00378
00379
00384 void setVernierClockPhase1(const UINT32 value);
00385
00386
00389 UINT32 getBpmClockPhase();
00390
00391
00394 void setBpmClockPhase(const UINT32 value);
00395
00396
00399 UINT32 getBregClockPhase();
00400
00401
00404 void setBregClockPhase(const UINT32 value);
00405
00406
00409 UINT32 getBocReset();
00410
00411
00416 void resetBoc();
00417
00418
00421 UINT32 getBpmReset();
00422
00423
00428 void resetBpm();
00429
00430
00433 UINT32 getVpinReset();
00434
00435
00440 void resetVpin();
00441
00442
00447 UINT32 getBocStatusRegister();
00448
00454 double getMonitorAdc(const UINT32 channel);
00455
00460 void resetMonitorAdc();
00461
00470 UINT32 getInterlockStatus(UINT32 *localEnable, UINT32 *remoteEnable);
00471 UINT32 getInterlockStatus();
00472
00473 private:
00474
00475
00477 UINT32 singleRead(const UINT32 bocAddress);
00478 void singleWrite(const UINT32 bocAddress, const UINT32 value);
00479
00480
00482 void blockRead(const UINT32 bocAddress, UINT32 buffer[],
00483 const INT32 length);
00484 void blockWrite(const UINT32 bocAddress, const UINT32 buffer[],
00485 const INT32 length);
00486
00487
00489 UINT32 bpmRead(const UINT32 bpm, const UINT32 stream,
00490 const UINT32 offset);
00491 void bpmWrite(const UINT32 bpm, const UINT32 stream,
00492 const UINT32 offset, const UINT32 value);
00493
00494
00496 RodModule* m_myrod;
00497
00498
00500 UINT32 m_serialNumber;
00501
00502
00504 UINT32 m_manufacturer;
00505
00506
00508 UINT32 m_moduleType;
00509
00510
00512 UINT32 m_hardwareRevision;
00513
00514
00516 UINT32 m_firmwareRevision;
00517
00520 UINT32 m_bocType;
00521
00522 };
00523
00524
00525 };
00526
00527 #endif // SCTPIXELROD_BOCCARD_H