00001 //#include "otsdaq-components/DAQHardware/VIPICFirmware.h" 00002 //#include "otsdaq-components/DAQHardware/VIPICFirmwareDefinitions.h" 00003 //#include "otsdaq-core/BitManipulator/BitManipulator.h" 00004 //#include "otsdaq-components/DetectorHardware/VIPICROCDefinitions.h" 00005 //#include "otsdaq-core/MessageFacility/MessageFacility.h" 00006 //#include "otsdaq-core/Macros/CoutMacros.h" 00007 //#include <sys/socket.h> 00008 //#include <netinet/in.h> 00009 //#include <arpa/inet.h> 00010 //#include <iostream> 00011 //#include <cstdlib> 00012 // 00013 //using namespace ots; 00014 // 00015 // 00017 // 00019 // 00038 // 00039 // 00041 // 00065 // 00066 // 00067 // 00069 //VIPICFirmware::VIPICFirmware(unsigned int version, std::string type) : 00070 // FrontEndFirmwareBase(version), 00071 // pixelCSRRegisterValue_(0) 00072 //{ 00073 // protocolInstance_ = FrontEndFirmwareBase::getInstance(type,version); 00074 // assert(protocolInstance_ != NULL); 00075 // //TODO if asserts are disabled/ignored still should check that protocol instance isn't null 00076 // //returns either new OtsUDPFirmware or new PurdueFirmwareCore, 00077 // //now we can call write/read etc with protocol->write, protocol->read, etc 00078 //} 00079 // 00081 //VIPICFirmware::~VIPICFirmware() 00082 //{ 00083 // delete protocolInstance_; 00084 // protocolInstance_= NULL; 00085 //} 00086 // 00088 //int VIPICFirmware::init() 00089 //{ 00090 // return 0; 00091 //} 00092 // 00094 //std::string VIPICFirmware::configureClocks(std::string source, double frequency) 00095 //{ 00096 // std::cout << __COUT_HDR_FL__ << "Writing Clock configuration!" << std::endl; 00097 // 00098 // std::string buffer; 00099 // 00100 // setTimeStampClockSource(source); 00101 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Reset CSR - reset trigger counter, external 27 MHz clock 00102 // 00103 // resetDCMCSR(true); 00104 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Set reset to DCM 00105 // 00106 // resetDCMCSR(false); 00107 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Clear reset to DCM 00108 // 00109 // setFrequencyFromClockState(buffer, frequency); 00110 // 00111 // protocolInstance_->waitSet(buffer, VIPIC_CSR, 1 << 30); // Wait for DCM to lock 00112 // 00113 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00114 // 00115 // return buffer; 00116 //} 00117 // 00119 //std::string VIPICFirmware::resetBCO(void) 00120 //{ 00121 // std::string buffer; 00122 // 00123 // resetDCMCSR(true); 00124 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Set reset to DCM 00125 // 00126 // resetDCMCSR(false); 00127 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Clear reset to DCM 00128 // 00129 // protocolInstance_->waitSet(buffer, VIPIC_CSR, 1 << 30); // Wait for DCM to lock 00130 // 00131 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00132 // 00133 // return buffer; 00134 //} 00136 //std::string VIPICFirmware::resetDetector(int reset) 00137 //{ 00138 // std::cout << __COUT_HDR_FL__ << "Resetting detector!" << std::endl; 00139 // std::string buffer; 00140 // //Documentation 5.2.1 00141 // //FIXME Sets DCM_RESET, TRIG_ENABLE 00142 // // write(buffer, Pixel_RESET, 0x80200000); 00143 // // waitSet(buffer, Pixel_RESET, 0x80000000); 00144 // // //From Jones' example it appears DMC_RESET does not clear by it self and must be manually cleared 00145 // // write(buffer, Pixel_RESET, 0x00200000); 00146 // // waitClear(buffer, Pixel_RESET, 0x80000000); 00147 // return buffer; 00148 //} 00149 // 00151 //std::string VIPICFirmware::enableTrigger(bool enable) 00152 //{ 00153 // std::string buffer; 00154 // std::cout << __COUT_HDR_FL__ << "Enabling Trigger!!!" << std::endl; 00155 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue in :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00156 // 00157 // enableTriggerDataStreamPixelCSR(enable); 00158 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); 00159 // 00160 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue out:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00161 // std::cout << __COUT_HDR_FL__ << "Done enabling Trigger!!!" << std::endl; 00162 // 00163 // return buffer; 00164 //} 00165 // 00167 //void VIPICFirmware::setTimeStampClockSource(std::string clockSource) 00168 //{ 00169 // if (clockSource == "External") 00170 // setTimeStampClockSourcePixelCSR(true); 00171 // else if (clockSource == "Internal") 00172 // setTimeStampClockSourcePixelCSR(false); 00173 // else 00174 // { 00175 // std::cout << __COUT_HDR_FL__ << "Configuration Error:\t" << std::endl; 00176 // std::cout << __COUT_HDR_FL__ << clockSource << " is not a valid clock source (Internal/External values allowed only)"<< std::endl; 00177 // assert(0); 00178 // } 00179 //} 00180 // 00182 //std::string VIPICFirmware::resetTimeStamp() 00183 //{ 00184 // std::cout << __COUT_HDR_FL__ << "Reset Time Stamp!!!" << std::endl; 00185 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue in :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00186 // std::string buffer; 00187 // 00188 // //// resetTriggerCounterPixelCSR(buffer); 00189 // // write(buffer, PIXEL_CSR, pixelCSRRegisterValue_); 00190 // // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00191 // // 00192 // // // enableTimeStampPixelCSR(true); 00193 // // write(buffer, PIXEL_CSR, pixelCSRRegisterValue_); 00194 // // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue out:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00195 // // std::cout << __COUT_HDR_FL__ << "Done reset Time Stamp!!!" << std::endl; 00196 // 00197 // return buffer; 00198 //} 00199 // 00201 //std::string VIPICFirmware::startStream() 00202 //{ 00203 // std::cout << __COUT_HDR_FL__ << "Start Stream!" << std::endl; 00204 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue in:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00205 // std::string buffer; 00206 // 00207 // enableStreamPixelCSR(true); 00208 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); 00209 // 00210 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue out:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00211 // std::cout << __COUT_HDR_FL__ << "Done start Stream!" << std::endl; 00212 // 00213 // return buffer; 00214 //} 00215 // 00217 //std::string VIPICFirmware::setUp() 00218 //{ 00219 // std::cout << __COUT_HDR_FL__ << "Start Stream!" << std::endl; 00220 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue in:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00221 // std::string buffer; 00222 // 00223 // setPacketSizePixelCSR(6); 00224 // prepareResetTimeStampCSR(); 00225 // clearTriggerCounterPixelCSR(); 00226 // enableStreamPixelCSR(true); 00227 // enableTriggerDataStreamPixelCSR(true); 00228 // 00229 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); 00230 // 00231 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue out:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl; 00232 // std::cout << __COUT_HDR_FL__ << "Done start Stream!" << std::endl; 00233 // 00234 // return buffer; 00235 //} 00236 // 00238 //std::string VIPICFirmware::stopStream() 00239 //{ 00240 // std::string buffer; 00241 // enableTriggerDataStreamPixelCSR(false); 00242 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); 00243 // return buffer; 00244 //} 00245 // 00246 // 00248 //void VIPICFirmware::makeMaskBuffer(std::string& buffer, unsigned int channel, const ROCStream& rocStream) 00249 //{ 00250 // std::cout << __COUT_HDR_FL__ << "\tMaking mask! " << std::endl; 00251 // std::string mask = rocStream.getROCMask(); 00252 // std::cout << __COUT_HDR_FL__ << "\tMask length: " << mask.length() << std::endl; 00253 // 00254 // //FIXME: missing configure data (12 bits) 00255 // 00256 // // 0 => set = 0 reset = 0 Normal Mode 00257 // // 1 => set = 0 reset = 1 Killed Mode 00258 // // 2 => set = 2 reset = 0 Deparsified Mode (the pixel should send data even when there is not hit 00259 // // 3 => set = 1 reset = 1 Both (it should be like the Deparsified Mode above) 00260 // const int length = mask.size(); 00261 // for (int i = 0; i < length; ++i) 00262 // { 00263 // switch(mask.at(i)) 00264 // { 00265 // case '0': 00266 // maskSetPixel(i, 0); 00267 // maskOffPixel(i, 0); 00268 // break; 00269 // case '1': 00270 // maskSetPixel(i, 0); 00271 // maskOffPixel(i, 1); 00272 // break; 00273 // case '2': 00274 // maskSetPixel(i, 1); 00275 // maskOffPixel(i, 0); 00276 // break; 00277 // case '3': 00278 // maskSetPixel(i, 1); 00279 // maskOffPixel(i, 1); 00280 // break; 00281 // default: 00282 // std::cout << __COUT_HDR_FL__ << "Configuration Error: " << "in pixel " << i 00283 // << "(x = " << pixelColumn(i) << " y = " << pixelRow(i) << ") " 00284 // << mask.at(i) << " is not a valid mask configuration value (only 0 1 2 3 are allowed)"; 00285 // assert(0); 00286 // break; 00287 // } 00288 // } 00289 // 00290 // for (int i = 0; i < PIXELS_SIDE * PIXELS_SIDE / 32; ++i) 00291 // { 00292 // protocolInstance_->write(buffer, VIPIC_SET_WRITE_BASE, setBuffer_[i]); 00293 // protocolInstance_->write(buffer, VIPIC_RESET_WRITE_BASE, resetBuffer_[i]); 00294 // } 00295 // 00296 // shiftBufferSetCLK(1); 00297 // shiftBufferResetCLK(1); 00298 // 00299 // for (int i = 0; i < PIXELS_SIDE * PIXELS_SIDE / 2; ++i) 00300 // { 00301 // protocolInstance_->write(buffer, VIPIC_DATA_WRITE_BASE, 0xFFF); 00302 // } 00303 // shiftBufferConfigurationCLK(1); 00304 // 00305 // 00306 // protocolInstance_->write(buffer, VIPIC_CLOCK, pixelClockRegisterValue_); 00307 // protocolInstance_->waitClear(buffer, VIPIC_CLOCK, (1 << 24) | (1 << 25) | (1 << 26)); 00308 //} 00309 // 00311 //void VIPICFirmware::setFrequencyFromClockState(std::string& buffer, double frequency) 00312 //{ 00313 // std::cout << __COUT_HDR_FL__ << "Setting up clock frequency!!!" << std::endl; 00314 // 00315 // int numerator; 00316 // int denominator; 00317 // double realClockFrequency; 00318 // 00319 // int const quotient = 4; 00320 // 00321 // if (isClockStateExternal()) //base freq: 54MHz 00322 // { 00323 // realClockFrequency = EXTERNAL_CLOCK_FREQUENCY / quotient; //this is the REAL frequency being used 00324 // } 00325 // else //base freq: 66.667MHz 00326 // { 00327 // realClockFrequency = INTERNAL_CLOCK_FREQUENCY / quotient; //this is the REAL frequency being used 00328 // } 00329 // 00330 // double factor = frequency / realClockFrequency; 00331 // 00332 // //The device needs the denominator and the denominator to be load into a 5 bit register 00333 // //It will take two initial numerator and denominator bigger than necessary (to do not loose precision) 00334 // //and divide them for their gcd. If they still do not fit in 5 bit, they are trunked (divided by 2) 00335 // //untill they are less than 32 00336 // numerator = factor * 100; //we will work with 2 digits precision after the decimal point 00337 // denominator = 100; 00338 // 00339 // do 00340 // { 00341 // //We will need the GCD at some point in order to simplify fractions //taken from other sources 00342 // int gcd = numerator; 00343 // int rest = denominator; 00344 // int tmp; 00345 // 00346 // while (rest != 0) 00347 // { 00348 // tmp = rest; 00349 // rest = gcd % tmp; 00350 // gcd = tmp; 00351 // } 00352 // //The GCD has been found 00353 // 00354 // if (gcd == 1) //if there's no GCD bigger than one, just divide by 2 to find the nearest approssimation with less bits 00355 // { 00356 // numerator /= 2; 00357 // denominator /= 2; 00358 // } 00359 // else 00360 // { 00361 // numerator /= gcd; 00362 // denominator /= gcd; 00363 // } 00364 // 00365 // } 00366 // while (denominator >= 32 || numerator >= 32); 00367 // 00368 // std::cout << __COUT_HDR_FL__ << "Numerator: " << numerator << std::endl; 00369 // std::cout << __COUT_HDR_FL__ << "Denominator: " << denominator << std::endl; 00370 // setFrequencyRatio(buffer, numerator, denominator); 00371 // std::cout << __COUT_HDR_FL__ << "Done with clock frequency setup!!!" << std::endl; 00372 //} 00373 // 00375 //bool VIPICFirmware::isClockStateExternal() 00376 //{ 00377 // return isClockStateExternalCSR(); 00378 //} 00379 // 00381 //bool VIPICFirmware::isClockLocked() 00382 //{ 00383 // return isClockLockedCSR(); 00384 //} 00385 // 00386 // 00388 //void VIPICFirmware::setFrequencyRatio(std::string& buffer, int numerator, int denominator) 00389 //{ 00390 // //The device need to load numerator minus one and denominator minus one, with an internal address of 0x50 and 0x52 respectively 00391 // protocolInstance_->write(buffer, VIPIC_DCM_DATA, 0x80500000 + (numerator - 1)); // Set Time StampCLK numerator 00392 // protocolInstance_->waitClear(buffer, VIPIC_DCM_DATA, 0xf0000000); // Wait DCM write to finish 00393 // 00394 // protocolInstance_->write(buffer, VIPIC_DCM_DATA, 0x80520000 + (denominator - 1)); // Set Time StampCLK denominator 00395 // protocolInstance_->waitClear(buffer, VIPIC_DCM_DATA, 0xf0000000); // Wait DCM write to finish - Time Stamp frequency should be 13.513 MHz 00396 //} 00397 // 00399 // * Local Registers Reset functions 00400 // */ 00401 // 00403 //void VIPICFirmware::resetPixelCSRRegisterValue() 00404 //{ 00405 // pixelCSRRegisterValue_ = 0; 00406 //} 00407 // 00409 //void VIPICFirmware::resetPixelDCMRegisterValue() 00410 //{ 00411 // pixelDCMRegisterValue_ = 0; 00412 //} 00413 // 00415 //void VIPICFirmware::resetPixelClockRegisterValue() 00416 //{ 00417 // pixelClockRegisterValue_ = 0; 00418 //} 00419 // 00421 //void VIPICFirmware::resetPixelTestInjectRegisterValue() 00422 //{ 00423 // pixelTestInjectRegisterValue_ = 0; 00424 //} 00425 // 00427 // * Register layer manipulation functions 00428 // */ 00429 // 00431 // 00433 //void VIPICFirmware::setPacketSizePixelCSR(uint32_t size) 00434 //{ 00435 // //Bit 7..3 . . . . Specifies packet size 00436 // if (size > 31) 00437 // { 00438 // std::cout << __COUT_HDR_FL__ << "ERROR: Maximum packet size is 31 while here you are trying to set " << std::endl; 00439 // std::cout << __COUT_HDR_FL__ << size << " packets!" << std::endl; 00440 // assert(0); 00441 // } 00442 // BitManipulator::insertBits(pixelCSRRegisterValue_, size, 3, 5); 00443 //} 00444 // 00446 //void VIPICFirmware::issueClearFIFOCSR(int delay) 00447 //{ 00448 // //FIXME: Waiting for specfication from Matthew 00449 // //Bit 9..8 . . . . Specifies delay before flushing partially filled packets 00450 // 00451 // 00452 // // BitManipulator::insertBits(pixelResetRegisterValue_, 00453 // // ((uint32_t) channel0) + ((uint32_t) channel1 << 1) 00454 // // + ((uint32_t) channel2 << 2) + ((uint32_t) channel3 << 3) 00455 // // + ((uint32_t) channel4 << 4) + ((uint32_t) channel5 << 5), 00456 // // 0, 6); 00457 // // BitManipulator::insertBits(pixelResetRegisterValue_, 1, 30, 1); 00458 //} 00459 // 00461 //bool VIPICFirmware::isClockStateExternalCSR() //returns true if the clock state is External 00462 //{ 00463 // //Bit 16 . . . . . Selects external reference clock 00464 // return BitManipulator::readBits(pixelCSRRegisterValue_, 16, 1); 00465 //} 00466 // 00468 //void VIPICFirmware::setTimeStampClockSourcePixelCSR(bool externalClockSource) 00469 //{ 00470 // //Bit 16 . . . . . Selects external reference clock 00471 // BitManipulator::insertBits(pixelCSRRegisterValue_, externalClockSource, 16, 1); 00472 //} 00473 // 00475 //void VIPICFirmware::prepareResetTimeStampCSR() 00476 //{ 00477 // //Prepares the logic to the global timestamp reset issued from the Master 00478 // //Bit 19 . . . . . Arm TS reset logic 00479 // BitManipulator::insertBits(pixelCSRRegisterValue_, 1, 19, 1); 00480 //} 00481 // 00483 //void VIPICFirmware::enableTimeStampCounterPixelCSR(bool enable) 00484 //{ 00485 // //Bit 20 . . . . . Enables sending of TS counter on network stream 00486 // BitManipulator::insertBits(pixelCSRRegisterValue_, (uint32_t) enable, 20, 1); 00487 //} 00488 // 00490 //void VIPICFirmware::clearTriggerCounterPixelCSR() 00491 //{ 00492 // //Bit 21 . . . . . Clears the trigger counter 00493 // BitManipulator::insertBits(pixelCSRRegisterValue_, 1, 21, 1); 00494 //} 00496 //void VIPICFirmware::immediateResetTimeStampCSR() 00497 //{ 00498 // //Resets the timestamp counter locally 00499 // //Bit 22 . . . . . TS counter reset 00500 // BitManipulator::insertBits(pixelCSRRegisterValue_, 1, 22, 1); 00501 //} 00502 // 00504 //void VIPICFirmware::enableStreamPixelCSR(bool enable) 00505 //{ 00506 // //Bit 23 . . . . . Enables the network stream interface 00507 // BitManipulator::insertBits(pixelCSRRegisterValue_, (uint32_t) enable, 23, 1); 00508 //} 00509 // 00511 //void VIPICFirmware::enableTriggerDataStreamPixelCSR(bool enable) 00512 //{ 00513 // //Bit 24 . . . . . Enables sending trigger data on network stream 00514 // BitManipulator::insertBits(pixelCSRRegisterValue_, (uint32_t) enable, 24, 1); 00515 //} 00516 // 00518 //void VIPICFirmware::resetNetworkPixelCSR(bool reset) 00519 //{ 00520 // //Bit 28 . . . . . Resets the network stream interface (not self clearing) 00521 // BitManipulator::insertBits(pixelCSRRegisterValue_, (uint32_t) reset, 28, 1); 00522 //} 00523 // 00525 //bool VIPICFirmware::isClockLockedCSR() //returns true if the clock is correctly locked 00526 //{ 00527 // //Bit 30 . . . . . DCM lock status (read only) 00528 // return BitManipulator::readBits(pixelCSRRegisterValue_, 30, 1); 00529 //} 00530 // 00532 //void VIPICFirmware::resetDCMCSR(bool reset) 00533 //{ 00534 // //It should be called with 1, then a write must issued and then it must be called with 0 00535 // //Bit 31 . . . . . Resets the DCM components (not self clearing) 00536 // BitManipulator::insertBits(pixelCSRRegisterValue_, reset, 31, 1); 00537 //} 00538 // 00540 // 00542 //void VIPICFirmware::waitTimeStampToReadCLK(uint8_t delay) 00543 //{ 00544 // //Bit 7..0 . . . readout period in TS_clk cycles (delay) 00545 // BitManipulator::insertBits(pixelClockRegisterValue_, delay, 0, 8); 00546 //} 00547 // 00549 //void VIPICFirmware::setReadsPerCycleCLK(uint8_t readsPerCycle) 00550 //{ 00551 // //Bit 15..8 . . . Number of reads in a readout cycle. 00552 // BitManipulator::insertBits(pixelClockRegisterValue_, readsPerCycle, 8, 8); 00553 //} 00554 // 00556 //void VIPICFirmware::setWaitingPerCycleCLK(uint8_t delay) 00557 //{ 00558 // //Bit 19..16 . . Number of Serial_clk cycles (minus one) between readout 00559 // //Suggested value is 3 00560 // BitManipulator::insertBits(pixelClockRegisterValue_, delay, 16, 4); 00561 //} 00562 // 00564 //void VIPICFirmware::assertCleanEndCLK(bool clean) 00565 //{ 00566 // //Bit 20 - assert clean at the end of the read cycle 00567 // BitManipulator::insertBits(pixelClockRegisterValue_, clean, 20, 1); 00568 //} 00569 // 00571 //void VIPICFirmware::assertTimeStampEndCLK(bool timestamp) 00572 //{ 00573 // //Bit 21 - send TS_clk signals 00574 // BitManipulator::insertBits(pixelClockRegisterValue_, timestamp, 21, 1); 00575 //} 00576 // 00578 //void VIPICFirmware::shiftBufferSetCLK(bool shift) 00579 //{ 00580 // //Bit 24 . . . . Write 1 to invoke the state machine that shifts the S 00581 // //It loads the S buffer to the chip 00582 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 24, 1); 00583 //} 00584 // 00585 // 00587 //void VIPICFirmware::shiftBufferResetCLK(bool shift) 00588 //{ 00589 // //Bit 25 . . . . Write 1 to invoke the state machine that shifts the R 00590 // //It loads the R buffer to the chip 00591 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 24, 1); 00592 //} 00593 // 00594 // 00596 //void VIPICFirmware::shiftBufferConfigurationCLK(bool shift) 00597 //{ 00598 // //Bit 26 . . . . Write 1 to invoke the state machine that shifts the D 00599 // //It loads the D buffer to the chip 00600 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 24, 1); 00601 //} 00602 // 00604 //void VIPICFirmware::assertLoadCLK(bool load) 00605 //{ 00606 // //Bit 27 . . . . Asserts the load signal for one serial_clk cycle. 00607 // BitManipulator::insertBits(pixelClockRegisterValue_, load, 27, 1); 00608 //} 00609 // 00611 //void VIPICFirmware::assertRestartCLK(bool restart) 00612 //{ 00613 // //Bit 29 . . . . Asserts the restart signal for one serial_clk cycle. 00614 // BitManipulator::insertBits(pixelClockRegisterValue_, restart, 29, 1); 00615 //} 00616 // 00617 // 00619 //void VIPICFirmware::stepTimeStampCLK(bool shift) 00620 //{ 00621 // //Bit 30 . . . . Send one ts_clk pulse 00622 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 30, 1); 00623 //} 00624 // 00626 //void VIPICFirmware::stepReadCycleCLK(bool shift) 00627 //{ 00628 // //Bit 31 . . . . Sends one ready cycle 00629 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 31, 1); 00630 //} 00631 // 00632 // 00634 // 00636 // * Pixels mask functions 00637 // */ 00638 // 00640 //int VIPICFirmware::pixelIndex(int column, int row) 00641 //{ 00642 // //Returns the index of the selected pixel 00643 // //FIXME: It is still to be decided if the sorting is forward or reverse 00644 // assert(column >= 0 && column < PIXELS_SIDE); 00645 // assert(row >= 0 && row < PIXELS_SIDE); 00646 // return PIXELS_SIDE*PIXELS_SIDE - (row | (column << 6)); 00647 //} 00648 // 00650 //int VIPICFirmware::pixelColumn(int index) 00651 //{ 00652 // //Returns the column coordinate of the selected pixel 00653 // //FIXME: It is still to be decided if the sorting is forward or reverse 00654 // assert(index >= 0 && index < PIXELS_SIDE * PIXELS_SIDE); 00655 // return 0x3f & ((PIXELS_SIDE*PIXELS_SIDE - index) >> 6); 00656 //} 00657 // 00659 //int VIPICFirmware::pixelRow(int index) 00660 //{ 00661 // //Returns the row coordinate of the selected pixel 00662 // //FIXME: It is still to be decided if the sorting is forward or reverse 00663 // assert(index >= 0 && index < PIXELS_SIDE * PIXELS_SIDE); 00664 // return 0x3f & (PIXELS_SIDE*PIXELS_SIDE - index); 00665 //} 00666 // 00668 //void VIPICFirmware::maskSetPixel(int index, bool force) 00669 //{ 00670 // //Forces a pixel to read without hit 00671 // BitManipulator::insertBits(setBuffer_[index / 32], force, index % 32, 1); 00672 //} 00673 // 00675 //void VIPICFirmware::maskOffPixel(int index, bool kill) 00676 //{ 00677 // //Masks a pixel 00678 // BitManipulator::insertBits(resetBuffer_[index / 32], kill, index % 32, 1); 00679 //} 00680 // 00682 //void VIPICFirmware::configurePixel(int index, uint16_t configure) 00683 //{ 00684 // //Configures a pixel 00685 // BitManipulator::insertBits(configureBuffer_[index / 2], configure, 16 * (index % 2), 12); 00686 //} 00687 // 00689 //void VIPICFirmware::maskSetPixel(int column, int row, bool force) 00690 //{ 00691 // //Forces a pixel to read without hit 00692 // maskSetPixel(pixelIndex(column, row), force); 00693 //} 00694 // 00696 //void VIPICFirmware::maskOffPixel(int column, int row, bool kill) 00697 //{ 00698 // //Masks a pixel 00699 // maskOffPixel(pixelIndex(column, row), kill); 00700 //} 00701 // 00703 //void VIPICFirmware::configurePixel(int column, int row, uint16_t configure) 00704 //{ 00705 // //Configures a pixel 00706 // configurePixel(pixelIndex(column, row), configure); 00707 //} 00708 // 00710 //bool VIPICFirmware::getSetMaskPixel(int column, int row) 00711 //{ 00712 // //Must be used after the load of the buffer from the device to seek for errors in the chain 00713 // int index = pixelIndex(column, row); 00714 // return BitManipulator::readBits(setBuffer_[index / 32], index % 32, 1); 00715 //} 00716 // 00718 //bool VIPICFirmware::getResetMaskPixel(int column, int row) 00719 //{ 00720 // //Must be used after the load of the buffer from the device to seek for errors in the chain 00721 // int index = pixelIndex(column, row); 00722 // return BitManipulator::readBits(resetBuffer_[index / 32], index % 32, 1); 00723 //} 00724 // 00726 //bool VIPICFirmware::getConfigurationPixel(int column, int row) 00727 //{ 00728 // //Must be used after the load of the buffer from the device to seek for errors in the chain 00729 // int index = pixelIndex(column, row); 00730 // return BitManipulator::readBits(resetBuffer_[index / 2], 16 * (index % 2), 12); 00731 //} 00732 //