00001 #ifndef SCTCALIBRATIONCONTROLLER_CHIPCOUNTERTEST_H
00002 #define SCTCALIBRATIONCONTROLLER_CHIPCOUNTERTEST_H
00003
00004 #include "../ipc/TestRequest.h"
00005 #include "../ipc/CalibrationController.h"
00006 #include "../ipc/ScanLibrary.h"
00007 #include "../ipc/CalibrationController.hh"
00008
00009 #include "../SctApiAccessException.h"
00010 #include "../SctApiCall.h"
00011 #include "../CalibrationControllerImpl.h"
00012 #include "Sct/LogicErrors.h"
00013 #include "CommonWithDsp/ABCD/ABCDscans.h"
00014
00015 #include <iostream>
00016 #include <vector>
00017
00018 using namespace Sct;
00019 using namespace std;
00020 using namespace SctCalibrationController::Ipc;
00021 using namespace SctCalibrationController;
00022
00023 namespace SctCalibrationController {
00024 namespace Scripts {
00025
00026 class ChipCounterTest : public TestRequestImpl {
00027 private:
00028 static const bool registeredInTestLibrary;
00029
00030 public:
00031 static Sct_CalibrationController::TestRequest_ptr instance() {
00032 static ChipCounterTest rt;
00033 return rt._this();
00034 }
00035
00036 virtual void startTestRealImpl(Sct_SctApi::SctApiIPC_ptr the_api, string& name, unsigned short& testVariable, unsigned long& nScans, vector<double>& testPoints) {
00037 this->api = Sct_SctApi::SctApiIPC::_duplicate(the_api);
00038
00039 name = "ChipCounterTest";
00040 testVariable = ST_ELAPSED;
00041 nScans = 1;
00042 testPoints.push_back(nTriggers);
00043 }
00044
00045 virtual Sct_CalibrationController::ScanRequest_ptr getNextScanRealImpl(unsigned long index) {
00046 Sct_CalibrationController::ScanLibrary_var sl = CalibrationControllerImpl::instance()->getScanLibrary();
00047 const bool issueSoftReset = false;
00048 Sct_CalibrationController::ScanRequest_ptr request = sl->rawScan(nTriggers, issueSoftReset);
00049 Sct_SctApi::Scan_var scan = request->getScanCorba();
00050
00051 const int bitsToRead = 64;
00052 request->setWidthCorba(bitsToRead);
00053
00054
00055
00056
00057
00058
00059 APICALL(scan, setOption(Sct_SctApi::Scan::enableDataMode, 1), "Failed to disable dataMode (failed to enable SendConfRegIDMode)")
00060
00061 APICALL(scan, configure(ST_ELAPSED, 0, 31, 1), "Failed to set Scan information")
00062 return request;
00063 }
00064
00065 virtual bool canFeedbackRealImpl() {
00066 return false;
00067 }
00068
00069 virtual void endTestRealImpl() {
00070 api = Sct_SctApi::SctApiIPC::_nil();
00071 }
00072
00073 private:
00074 ChipCounterTest() {}
00075 Sct_SctApi::SctApiIPC_var api;
00076 static const int nTriggers = 1;
00077 };
00078 }
00079 }
00080 #endif //SCTCALIBRATIONCONTROLLER_CHIPCOUNTERTEST_H