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