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

TxCurrentTest.h

00001 #ifndef SCTCALIBRATIONCONTROLLER_TXCURRENTTEST_H
00002 #define SCTCALIBRATIONCONTROLLER_TXCURRENTTEST_H
00003 
00004 #include "../ipc/TestRequest.h"
00005 #include "../ipc/CalibrationController.h"
00006 #include "../ipc/ScanLibrary.h"
00007 #include "../ipc/Sct_CalibrationController.hh"
00008 
00009 #include "../SctApiAccessException.h"
00010 #include "../SctApiCall.h"
00011 #include "../CalibrationControllerImpl.h"
00012 #include "Sct/LogicErrors.h"
00013 #include "SctApi/extraScans.h"
00014 
00015 #include <CommonWithDsp/ABCD/ABCDscans.h>
00016 #include <iostream>
00017 #include <vector>
00018 
00019 using namespace Sct;
00020 using namespace std;
00021 using namespace SctCalibrationController::Ipc;
00022 using namespace SctCalibrationController;
00023 
00024 namespace SctCalibrationController {
00025 namespace Scripts {
00026     
00027 class TxCurrentTest : public TestRequestImpl {
00028 public:
00029    static TxCurrentTest& instance() {
00030     static TxCurrentTest rt;
00031     return rt;
00032     }
00033    
00034    virtual void startTest(Sct_SctApi_T_SctApi& the_api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {    
00035      this->api = &the_api;
00036      // No masked channels
00037      name = "TxCurrentTest";
00038      testVariable = ST_ELAPSED;
00039      nScans = 1;
00040      testPoints.push_back(nTriggers);
00041    }
00042    
00043    virtual ScanRequest* getNextScan(unsigned long index) {
00044      ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();
00045      const bool issueSoftReset = true;
00046      ScanRequest& request = sl.rawScan(nTriggers, issueSoftReset);
00047   
00048      // Number of bytes to read from the conf register: There should be about 210 ish bytes.  We will read a few more just so we have some elbow room.  Rather arbitrarily, then we chose to read 256 bits:
00049      const int bitsToRead = 256;
00050      request.setWidth(bitsToRead);
00051      Sct_SctApi_T_Scan* scan = request.getScan();
00052 
00053      // This next two executable lines (which disables data
00054      // mode, and thus enables SendConfRegister mode) 
00055      // is the second line which (beyond the test names!) 
00056      // should be the source of difference between THIS
00057      // test and the usual TxCurrentTest:
00058      APICALL(scan, setOption(&st, Sct_SctApi_T_Scan_ScanOptions_enableDataMode, 0), "Failed to disable dataMode (failed to enable SendConfRegIDMode)")
00059        
00060      APICALL(scan, configure(&st, ST_TX_CURRENT, 0, 255, 5), "Failed to set Scan information")
00061      return &request;
00062    }
00063     
00064     virtual bool canFeedback() {
00065     return true;
00066     }
00067     
00068     virtual void endTest() {
00069       api = 0;
00070     }
00071 
00072 private:
00073     TxCurrentTest() {}
00074     Sct_SctApi_T_SctApi* api;    
00075     static const int nTriggers = 10;
00076 };
00077 }
00078 }
00079 #endif //SCTCALIBRATIONCONTROLLER_TXCURRENTTEST_H

Generated on Fri Jan 14 12:47:12 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5