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

RxThresholdBasedOnConfigRegisterTest.h

00001 #ifndef SCTCALIBRATIONCONTROLLER_RXTHRESHOLDBASEDONCONFIGREGISTERTEST_H
00002 #define SCTCALIBRATIONCONTROLLER_RXTHRESHOLDBASEDONCONFIGREGISTERTEST_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 RxThresholdBasedOnConfigRegisterTest : public TestRequestImpl {
00028 public: 
00029     static RxThresholdBasedOnConfigRegisterTest& instance() {
00030     static RxThresholdBasedOnConfigRegisterTest rc;
00031     return rc;
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 = "RxThresholdBasedOnConfigRegisterTest";
00038     testVariable = ST_ELAPSED;
00039     nScans = 1;
00040     // put in clock / 2 mode.
00041         
00042         // This next commented executable line (which used to put
00043         // the module into clock by two mode)
00044         // mode, and thus enables SendConfRegister mode) 
00045         // is the first line which (beyond the test names!) 
00046         // should be the source of difference between THIS
00047         // test and the usual RxThresholdTest:
00048     // APICALL(api, modifyABCDVar(&st, ST_FEEDTHROUGH, 0), "RxThresholdBasedOnConfigRegisterTest::startTest");
00049     testPoints.push_back(nTriggers);
00050     }
00051     
00052     virtual ScanRequest* getNextScan(unsigned long index) {
00053     ScanLibrary& sl = CalibrationControllerImpl::instance().getScanLibrary();
00054        const bool issueSoftReset=true;
00055     ScanRequest& request = sl.rawScan(nTriggers, issueSoftReset);
00056 
00057        // 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:
00058        const int bitsToRead = 256;
00059        request.setWidth(bitsToRead);
00060     Sct_SctApi_T_Scan* scan = request.getScan();
00061     
00062        // This next two executable lines (which disables data
00063        // mode, and thus enables SendConfRegister mode) 
00064        // is the second line which (beyond the test names!) 
00065        // should be the source of difference between THIS
00066        // test and the usual RxThresholdTest:
00067        APICALL(scan, setOption(&st, Sct_SctApi_T_Scan_ScanOptions_enableDataMode, 0), "Failed to disable dataMode (failed to enable SendConfRegIDMode)")
00068           
00069 
00070     APICALL(scan, configure(&st, ST_RX_THRESHOLD, 0, 255, 5), "Failed to set Scan information")
00071        return &request;
00072     }
00073     
00074     virtual bool canFeedback() {
00075     return true;
00076     }
00077     
00078     virtual void endTest() {
00079       // put width back to whatever it was originally
00080       // APICALL(api, modifyABCDVar(&st, ST_FEEDTHROUGH, 1), "RxThresholdBasedOnConfigRegisterTest::endTest");
00081     api = 0;
00082     }
00083 
00084 private:
00085     RxThresholdBasedOnConfigRegisterTest() {}
00086     Sct_SctApi_T_SctApi* api;    
00087     static const int nTriggers = 10;
00088 };
00089 }
00090 }
00091 #endif //SCTCALIBRATIONCONTROLLER_RXTHRESHOLDBASEDONCONFIGREGISTERTEST_H

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