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
00037 name = "RxThresholdBasedOnConfigRegisterTest";
00038 testVariable = ST_ELAPSED;
00039 nScans = 1;
00040
00041
00042
00043
00044
00045
00046
00047
00048
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
00058 const int bitsToRead = 256;
00059 request.setWidth(bitsToRead);
00060 Sct_SctApi_T_Scan* scan = request.getScan();
00061
00062
00063
00064
00065
00066
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
00080
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