otsdaq_components  v2_02_00
VIPICFirmware.cc
1 //#include "otsdaq-components/DAQHardware/VIPICFirmware.h"
2 //#include "otsdaq-components/DAQHardware/VIPICFirmwareDefinitions.h"
3 //#include "otsdaq-core/BitManipulator/BitManipulator.h"
4 //#include "otsdaq-components/DetectorHardware/VIPICROCDefinitions.h"
5 //#include "otsdaq-core/MessageFacility/MessageFacility.h"
6 //#include "otsdaq-core/Macros/CoutMacros.h"
7 //#include <sys/socket.h>
8 //#include <netinet/in.h>
9 //#include <arpa/inet.h>
10 //#include <iostream>
11 //#include <cstdlib>
12 //
13 //using namespace ots;
14 //
15 //
17 //
19 //
38 //
39 //
41 //
65 //
66 //
67 //
69 //VIPICFirmware::VIPICFirmware(unsigned int version, std::string type) :
70 // FrontEndFirmwareBase(version),
71 // pixelCSRRegisterValue_(0)
72 //{
73 // protocolInstance_ = FrontEndFirmwareBase::getInstance(type,version);
74 // assert(protocolInstance_ != NULL);
75 // //TODO if asserts are disabled/ignored still should check that protocol instance isn't null
76 // //returns either new OtsUDPFirmware or new PurdueFirmwareCore,
77 // //now we can call write/read etc with protocol->write, protocol->read, etc
78 //}
79 //
81 //VIPICFirmware::~VIPICFirmware()
82 //{
83 // delete protocolInstance_;
84 // protocolInstance_= NULL;
85 //}
86 //
88 //int VIPICFirmware::init()
89 //{
90 // return 0;
91 //}
92 //
94 //std::string VIPICFirmware::configureClocks(std::string source, double frequency)
95 //{
96 // std::cout << __COUT_HDR_FL__ << "Writing Clock configuration!" << std::endl;
97 //
98 // std::string buffer;
99 //
100 // setTimeStampClockSource(source);
101 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Reset CSR - reset trigger counter, external 27 MHz clock
102 //
103 // resetDCMCSR(true);
104 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Set reset to DCM
105 //
106 // resetDCMCSR(false);
107 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Clear reset to DCM
108 //
109 // setFrequencyFromClockState(buffer, frequency);
110 //
111 // protocolInstance_->waitSet(buffer, VIPIC_CSR, 1 << 30); // Wait for DCM to lock
112 //
113 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
114 //
115 // return buffer;
116 //}
117 //
119 //std::string VIPICFirmware::resetBCO(void)
120 //{
121 // std::string buffer;
122 //
123 // resetDCMCSR(true);
124 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Set reset to DCM
125 //
126 // resetDCMCSR(false);
127 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_); // Clear reset to DCM
128 //
129 // protocolInstance_->waitSet(buffer, VIPIC_CSR, 1 << 30); // Wait for DCM to lock
130 //
131 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
132 //
133 // return buffer;
134 //}
136 //std::string VIPICFirmware::resetDetector(int reset)
137 //{
138 // std::cout << __COUT_HDR_FL__ << "Resetting detector!" << std::endl;
139 // std::string buffer;
140 // //Documentation 5.2.1
141 // //FIXME Sets DCM_RESET, TRIG_ENABLE
142 // // write(buffer, Pixel_RESET, 0x80200000);
143 // // waitSet(buffer, Pixel_RESET, 0x80000000);
144 // // //From Jones' example it appears DMC_RESET does not clear by it self and must be manually cleared
145 // // write(buffer, Pixel_RESET, 0x00200000);
146 // // waitClear(buffer, Pixel_RESET, 0x80000000);
147 // return buffer;
148 //}
149 //
151 //std::string VIPICFirmware::enableTrigger(bool enable)
152 //{
153 // std::string buffer;
154 // std::cout << __COUT_HDR_FL__ << "Enabling Trigger!!!" << std::endl;
155 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue in :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
156 //
157 // enableTriggerDataStreamPixelCSR(enable);
158 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_);
159 //
160 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue out:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
161 // std::cout << __COUT_HDR_FL__ << "Done enabling Trigger!!!" << std::endl;
162 //
163 // return buffer;
164 //}
165 //
167 //void VIPICFirmware::setTimeStampClockSource(std::string clockSource)
168 //{
169 // if (clockSource == "External")
170 // setTimeStampClockSourcePixelCSR(true);
171 // else if (clockSource == "Internal")
172 // setTimeStampClockSourcePixelCSR(false);
173 // else
174 // {
175 // std::cout << __COUT_HDR_FL__ << "Configuration Error:\t" << std::endl;
176 // std::cout << __COUT_HDR_FL__ << clockSource << " is not a valid clock source (Internal/External values allowed only)"<< std::endl;
177 // assert(0);
178 // }
179 //}
180 //
182 //std::string VIPICFirmware::resetTimeStamp()
183 //{
184 // std::cout << __COUT_HDR_FL__ << "Reset Time Stamp!!!" << std::endl;
185 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue in :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
186 // std::string buffer;
187 //
188 // //// resetTriggerCounterPixelCSR(buffer);
189 // // write(buffer, PIXEL_CSR, pixelCSRRegisterValue_);
190 // // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue :" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
191 // //
192 // // // enableTimeStampPixelCSR(true);
193 // // write(buffer, PIXEL_CSR, pixelCSRRegisterValue_);
194 // // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue out:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
195 // // std::cout << __COUT_HDR_FL__ << "Done reset Time Stamp!!!" << std::endl;
196 //
197 // return buffer;
198 //}
199 //
201 //std::string VIPICFirmware::startStream()
202 //{
203 // std::cout << __COUT_HDR_FL__ << "Start Stream!" << std::endl;
204 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue in:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
205 // std::string buffer;
206 //
207 // enableStreamPixelCSR(true);
208 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_);
209 //
210 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue out:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
211 // std::cout << __COUT_HDR_FL__ << "Done start Stream!" << std::endl;
212 //
213 // return buffer;
214 //}
215 //
217 //std::string VIPICFirmware::setUp()
218 //{
219 // std::cout << __COUT_HDR_FL__ << "Start Stream!" << std::endl;
220 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue in:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
221 // std::string buffer;
222 //
223 // setPacketSizePixelCSR(6);
224 // prepareResetTimeStampCSR();
225 // clearTriggerCounterPixelCSR();
226 // enableStreamPixelCSR(true);
227 // enableTriggerDataStreamPixelCSR(true);
228 //
229 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_);
230 //
231 // std::cout << __COUT_HDR_FL__ << "pixelCSRRegisterValue out:" << std::hex << pixelCSRRegisterValue_ << std::dec << std::endl;
232 // std::cout << __COUT_HDR_FL__ << "Done start Stream!" << std::endl;
233 //
234 // return buffer;
235 //}
236 //
238 //std::string VIPICFirmware::stopStream()
239 //{
240 // std::string buffer;
241 // enableTriggerDataStreamPixelCSR(false);
242 // protocolInstance_->write(buffer, VIPIC_CSR, pixelCSRRegisterValue_);
243 // return buffer;
244 //}
245 //
246 //
248 //void VIPICFirmware::makeMaskBuffer(std::string& buffer, unsigned int channel, const ROCStream& rocStream)
249 //{
250 // std::cout << __COUT_HDR_FL__ << "\tMaking mask! " << std::endl;
251 // std::string mask = rocStream.getROCMask();
252 // std::cout << __COUT_HDR_FL__ << "\tMask length: " << mask.length() << std::endl;
253 //
254 // //FIXME: missing configure data (12 bits)
255 //
256 // // 0 => set = 0 reset = 0 Normal Mode
257 // // 1 => set = 0 reset = 1 Killed Mode
258 // // 2 => set = 2 reset = 0 Deparsified Mode (the pixel should send data even when there is not hit
259 // // 3 => set = 1 reset = 1 Both (it should be like the Deparsified Mode above)
260 // const int length = mask.size();
261 // for (int i = 0; i < length; ++i)
262 // {
263 // switch(mask.at(i))
264 // {
265 // case '0':
266 // maskSetPixel(i, 0);
267 // maskOffPixel(i, 0);
268 // break;
269 // case '1':
270 // maskSetPixel(i, 0);
271 // maskOffPixel(i, 1);
272 // break;
273 // case '2':
274 // maskSetPixel(i, 1);
275 // maskOffPixel(i, 0);
276 // break;
277 // case '3':
278 // maskSetPixel(i, 1);
279 // maskOffPixel(i, 1);
280 // break;
281 // default:
282 // std::cout << __COUT_HDR_FL__ << "Configuration Error: " << "in pixel " << i
283 // << "(x = " << pixelColumn(i) << " y = " << pixelRow(i) << ") "
284 // << mask.at(i) << " is not a valid mask configuration value (only 0 1 2 3 are allowed)";
285 // assert(0);
286 // break;
287 // }
288 // }
289 //
290 // for (int i = 0; i < PIXELS_SIDE * PIXELS_SIDE / 32; ++i)
291 // {
292 // protocolInstance_->write(buffer, VIPIC_SET_WRITE_BASE, setBuffer_[i]);
293 // protocolInstance_->write(buffer, VIPIC_RESET_WRITE_BASE, resetBuffer_[i]);
294 // }
295 //
296 // shiftBufferSetCLK(1);
297 // shiftBufferResetCLK(1);
298 //
299 // for (int i = 0; i < PIXELS_SIDE * PIXELS_SIDE / 2; ++i)
300 // {
301 // protocolInstance_->write(buffer, VIPIC_DATA_WRITE_BASE, 0xFFF);
302 // }
303 // shiftBufferConfigurationCLK(1);
304 //
305 //
306 // protocolInstance_->write(buffer, VIPIC_CLOCK, pixelClockRegisterValue_);
307 // protocolInstance_->waitClear(buffer, VIPIC_CLOCK, (1 << 24) | (1 << 25) | (1 << 26));
308 //}
309 //
311 //void VIPICFirmware::setFrequencyFromClockState(std::string& buffer, double frequency)
312 //{
313 // std::cout << __COUT_HDR_FL__ << "Setting up clock frequency!!!" << std::endl;
314 //
315 // int numerator;
316 // int denominator;
317 // double realClockFrequency;
318 //
319 // int const quotient = 4;
320 //
321 // if (isClockStateExternal()) //base freq: 54MHz
322 // {
323 // realClockFrequency = EXTERNAL_CLOCK_FREQUENCY / quotient; //this is the REAL frequency being used
324 // }
325 // else //base freq: 66.667MHz
326 // {
327 // realClockFrequency = INTERNAL_CLOCK_FREQUENCY / quotient; //this is the REAL frequency being used
328 // }
329 //
330 // double factor = frequency / realClockFrequency;
331 //
332 // //The device needs the denominator and the denominator to be load into a 5 bit register
333 // //It will take two initial numerator and denominator bigger than necessary (to do not loose precision)
334 // //and divide them for their gcd. If they still do not fit in 5 bit, they are trunked (divided by 2)
335 // //untill they are less than 32
336 // numerator = factor * 100; //we will work with 2 digits precision after the decimal point
337 // denominator = 100;
338 //
339 // do
340 // {
341 // //We will need the GCD at some point in order to simplify fractions //taken from other sources
342 // int gcd = numerator;
343 // int rest = denominator;
344 // int tmp;
345 //
346 // while (rest != 0)
347 // {
348 // tmp = rest;
349 // rest = gcd % tmp;
350 // gcd = tmp;
351 // }
352 // //The GCD has been found
353 //
354 // if (gcd == 1) //if there's no GCD bigger than one, just divide by 2 to find the nearest approssimation with less bits
355 // {
356 // numerator /= 2;
357 // denominator /= 2;
358 // }
359 // else
360 // {
361 // numerator /= gcd;
362 // denominator /= gcd;
363 // }
364 //
365 // }
366 // while (denominator >= 32 || numerator >= 32);
367 //
368 // std::cout << __COUT_HDR_FL__ << "Numerator: " << numerator << std::endl;
369 // std::cout << __COUT_HDR_FL__ << "Denominator: " << denominator << std::endl;
370 // setFrequencyRatio(buffer, numerator, denominator);
371 // std::cout << __COUT_HDR_FL__ << "Done with clock frequency setup!!!" << std::endl;
372 //}
373 //
375 //bool VIPICFirmware::isClockStateExternal()
376 //{
377 // return isClockStateExternalCSR();
378 //}
379 //
381 //bool VIPICFirmware::isClockLocked()
382 //{
383 // return isClockLockedCSR();
384 //}
385 //
386 //
388 //void VIPICFirmware::setFrequencyRatio(std::string& buffer, int numerator, int denominator)
389 //{
390 // //The device need to load numerator minus one and denominator minus one, with an internal address of 0x50 and 0x52 respectively
391 // protocolInstance_->write(buffer, VIPIC_DCM_DATA, 0x80500000 + (numerator - 1)); // Set Time StampCLK numerator
392 // protocolInstance_->waitClear(buffer, VIPIC_DCM_DATA, 0xf0000000); // Wait DCM write to finish
393 //
394 // protocolInstance_->write(buffer, VIPIC_DCM_DATA, 0x80520000 + (denominator - 1)); // Set Time StampCLK denominator
395 // protocolInstance_->waitClear(buffer, VIPIC_DCM_DATA, 0xf0000000); // Wait DCM write to finish - Time Stamp frequency should be 13.513 MHz
396 //}
397 //
399 // * Local Registers Reset functions
400 // */
401 //
403 //void VIPICFirmware::resetPixelCSRRegisterValue()
404 //{
405 // pixelCSRRegisterValue_ = 0;
406 //}
407 //
409 //void VIPICFirmware::resetPixelDCMRegisterValue()
410 //{
411 // pixelDCMRegisterValue_ = 0;
412 //}
413 //
415 //void VIPICFirmware::resetPixelClockRegisterValue()
416 //{
417 // pixelClockRegisterValue_ = 0;
418 //}
419 //
421 //void VIPICFirmware::resetPixelTestInjectRegisterValue()
422 //{
423 // pixelTestInjectRegisterValue_ = 0;
424 //}
425 //
427 // * Register layer manipulation functions
428 // */
429 //
431 //
433 //void VIPICFirmware::setPacketSizePixelCSR(uint32_t size)
434 //{
435 // //Bit 7..3 . . . . Specifies packet size
436 // if (size > 31)
437 // {
438 // std::cout << __COUT_HDR_FL__ << "ERROR: Maximum packet size is 31 while here you are trying to set " << std::endl;
439 // std::cout << __COUT_HDR_FL__ << size << " packets!" << std::endl;
440 // assert(0);
441 // }
442 // BitManipulator::insertBits(pixelCSRRegisterValue_, size, 3, 5);
443 //}
444 //
446 //void VIPICFirmware::issueClearFIFOCSR(int delay)
447 //{
448 // //FIXME: Waiting for specfication from Matthew
449 // //Bit 9..8 . . . . Specifies delay before flushing partially filled packets
450 //
451 //
452 // // BitManipulator::insertBits(pixelResetRegisterValue_,
453 // // ((uint32_t) channel0) + ((uint32_t) channel1 << 1)
454 // // + ((uint32_t) channel2 << 2) + ((uint32_t) channel3 << 3)
455 // // + ((uint32_t) channel4 << 4) + ((uint32_t) channel5 << 5),
456 // // 0, 6);
457 // // BitManipulator::insertBits(pixelResetRegisterValue_, 1, 30, 1);
458 //}
459 //
461 //bool VIPICFirmware::isClockStateExternalCSR() //returns true if the clock state is External
462 //{
463 // //Bit 16 . . . . . Selects external reference clock
464 // return BitManipulator::readBits(pixelCSRRegisterValue_, 16, 1);
465 //}
466 //
468 //void VIPICFirmware::setTimeStampClockSourcePixelCSR(bool externalClockSource)
469 //{
470 // //Bit 16 . . . . . Selects external reference clock
471 // BitManipulator::insertBits(pixelCSRRegisterValue_, externalClockSource, 16, 1);
472 //}
473 //
475 //void VIPICFirmware::prepareResetTimeStampCSR()
476 //{
477 // //Prepares the logic to the global timestamp reset issued from the Master
478 // //Bit 19 . . . . . Arm TS reset logic
479 // BitManipulator::insertBits(pixelCSRRegisterValue_, 1, 19, 1);
480 //}
481 //
483 //void VIPICFirmware::enableTimeStampCounterPixelCSR(bool enable)
484 //{
485 // //Bit 20 . . . . . Enables sending of TS counter on network stream
486 // BitManipulator::insertBits(pixelCSRRegisterValue_, (uint32_t) enable, 20, 1);
487 //}
488 //
490 //void VIPICFirmware::clearTriggerCounterPixelCSR()
491 //{
492 // //Bit 21 . . . . . Clears the trigger counter
493 // BitManipulator::insertBits(pixelCSRRegisterValue_, 1, 21, 1);
494 //}
496 //void VIPICFirmware::immediateResetTimeStampCSR()
497 //{
498 // //Resets the timestamp counter locally
499 // //Bit 22 . . . . . TS counter reset
500 // BitManipulator::insertBits(pixelCSRRegisterValue_, 1, 22, 1);
501 //}
502 //
504 //void VIPICFirmware::enableStreamPixelCSR(bool enable)
505 //{
506 // //Bit 23 . . . . . Enables the network stream interface
507 // BitManipulator::insertBits(pixelCSRRegisterValue_, (uint32_t) enable, 23, 1);
508 //}
509 //
511 //void VIPICFirmware::enableTriggerDataStreamPixelCSR(bool enable)
512 //{
513 // //Bit 24 . . . . . Enables sending trigger data on network stream
514 // BitManipulator::insertBits(pixelCSRRegisterValue_, (uint32_t) enable, 24, 1);
515 //}
516 //
518 //void VIPICFirmware::resetNetworkPixelCSR(bool reset)
519 //{
520 // //Bit 28 . . . . . Resets the network stream interface (not self clearing)
521 // BitManipulator::insertBits(pixelCSRRegisterValue_, (uint32_t) reset, 28, 1);
522 //}
523 //
525 //bool VIPICFirmware::isClockLockedCSR() //returns true if the clock is correctly locked
526 //{
527 // //Bit 30 . . . . . DCM lock status (read only)
528 // return BitManipulator::readBits(pixelCSRRegisterValue_, 30, 1);
529 //}
530 //
532 //void VIPICFirmware::resetDCMCSR(bool reset)
533 //{
534 // //It should be called with 1, then a write must issued and then it must be called with 0
535 // //Bit 31 . . . . . Resets the DCM components (not self clearing)
536 // BitManipulator::insertBits(pixelCSRRegisterValue_, reset, 31, 1);
537 //}
538 //
540 //
542 //void VIPICFirmware::waitTimeStampToReadCLK(uint8_t delay)
543 //{
544 // //Bit 7..0 . . . readout period in TS_clk cycles (delay)
545 // BitManipulator::insertBits(pixelClockRegisterValue_, delay, 0, 8);
546 //}
547 //
549 //void VIPICFirmware::setReadsPerCycleCLK(uint8_t readsPerCycle)
550 //{
551 // //Bit 15..8 . . . Number of reads in a readout cycle.
552 // BitManipulator::insertBits(pixelClockRegisterValue_, readsPerCycle, 8, 8);
553 //}
554 //
556 //void VIPICFirmware::setWaitingPerCycleCLK(uint8_t delay)
557 //{
558 // //Bit 19..16 . . Number of Serial_clk cycles (minus one) between readout
559 // //Suggested value is 3
560 // BitManipulator::insertBits(pixelClockRegisterValue_, delay, 16, 4);
561 //}
562 //
564 //void VIPICFirmware::assertCleanEndCLK(bool clean)
565 //{
566 // //Bit 20 - assert clean at the end of the read cycle
567 // BitManipulator::insertBits(pixelClockRegisterValue_, clean, 20, 1);
568 //}
569 //
571 //void VIPICFirmware::assertTimeStampEndCLK(bool timestamp)
572 //{
573 // //Bit 21 - send TS_clk signals
574 // BitManipulator::insertBits(pixelClockRegisterValue_, timestamp, 21, 1);
575 //}
576 //
578 //void VIPICFirmware::shiftBufferSetCLK(bool shift)
579 //{
580 // //Bit 24 . . . . Write 1 to invoke the state machine that shifts the S
581 // //It loads the S buffer to the chip
582 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 24, 1);
583 //}
584 //
585 //
587 //void VIPICFirmware::shiftBufferResetCLK(bool shift)
588 //{
589 // //Bit 25 . . . . Write 1 to invoke the state machine that shifts the R
590 // //It loads the R buffer to the chip
591 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 24, 1);
592 //}
593 //
594 //
596 //void VIPICFirmware::shiftBufferConfigurationCLK(bool shift)
597 //{
598 // //Bit 26 . . . . Write 1 to invoke the state machine that shifts the D
599 // //It loads the D buffer to the chip
600 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 24, 1);
601 //}
602 //
604 //void VIPICFirmware::assertLoadCLK(bool load)
605 //{
606 // //Bit 27 . . . . Asserts the load signal for one serial_clk cycle.
607 // BitManipulator::insertBits(pixelClockRegisterValue_, load, 27, 1);
608 //}
609 //
611 //void VIPICFirmware::assertRestartCLK(bool restart)
612 //{
613 // //Bit 29 . . . . Asserts the restart signal for one serial_clk cycle.
614 // BitManipulator::insertBits(pixelClockRegisterValue_, restart, 29, 1);
615 //}
616 //
617 //
619 //void VIPICFirmware::stepTimeStampCLK(bool shift)
620 //{
621 // //Bit 30 . . . . Send one ts_clk pulse
622 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 30, 1);
623 //}
624 //
626 //void VIPICFirmware::stepReadCycleCLK(bool shift)
627 //{
628 // //Bit 31 . . . . Sends one ready cycle
629 // BitManipulator::insertBits(pixelClockRegisterValue_, shift, 31, 1);
630 //}
631 //
632 //
634 //
636 // * Pixels mask functions
637 // */
638 //
640 //int VIPICFirmware::pixelIndex(int column, int row)
641 //{
642 // //Returns the index of the selected pixel
643 // //FIXME: It is still to be decided if the sorting is forward or reverse
644 // assert(column >= 0 && column < PIXELS_SIDE);
645 // assert(row >= 0 && row < PIXELS_SIDE);
646 // return PIXELS_SIDE*PIXELS_SIDE - (row | (column << 6));
647 //}
648 //
650 //int VIPICFirmware::pixelColumn(int index)
651 //{
652 // //Returns the column coordinate of the selected pixel
653 // //FIXME: It is still to be decided if the sorting is forward or reverse
654 // assert(index >= 0 && index < PIXELS_SIDE * PIXELS_SIDE);
655 // return 0x3f & ((PIXELS_SIDE*PIXELS_SIDE - index) >> 6);
656 //}
657 //
659 //int VIPICFirmware::pixelRow(int index)
660 //{
661 // //Returns the row coordinate of the selected pixel
662 // //FIXME: It is still to be decided if the sorting is forward or reverse
663 // assert(index >= 0 && index < PIXELS_SIDE * PIXELS_SIDE);
664 // return 0x3f & (PIXELS_SIDE*PIXELS_SIDE - index);
665 //}
666 //
668 //void VIPICFirmware::maskSetPixel(int index, bool force)
669 //{
670 // //Forces a pixel to read without hit
671 // BitManipulator::insertBits(setBuffer_[index / 32], force, index % 32, 1);
672 //}
673 //
675 //void VIPICFirmware::maskOffPixel(int index, bool kill)
676 //{
677 // //Masks a pixel
678 // BitManipulator::insertBits(resetBuffer_[index / 32], kill, index % 32, 1);
679 //}
680 //
682 //void VIPICFirmware::configurePixel(int index, uint16_t configure)
683 //{
684 // //Configures a pixel
685 // BitManipulator::insertBits(configureBuffer_[index / 2], configure, 16 * (index % 2), 12);
686 //}
687 //
689 //void VIPICFirmware::maskSetPixel(int column, int row, bool force)
690 //{
691 // //Forces a pixel to read without hit
692 // maskSetPixel(pixelIndex(column, row), force);
693 //}
694 //
696 //void VIPICFirmware::maskOffPixel(int column, int row, bool kill)
697 //{
698 // //Masks a pixel
699 // maskOffPixel(pixelIndex(column, row), kill);
700 //}
701 //
703 //void VIPICFirmware::configurePixel(int column, int row, uint16_t configure)
704 //{
705 // //Configures a pixel
706 // configurePixel(pixelIndex(column, row), configure);
707 //}
708 //
710 //bool VIPICFirmware::getSetMaskPixel(int column, int row)
711 //{
712 // //Must be used after the load of the buffer from the device to seek for errors in the chain
713 // int index = pixelIndex(column, row);
714 // return BitManipulator::readBits(setBuffer_[index / 32], index % 32, 1);
715 //}
716 //
718 //bool VIPICFirmware::getResetMaskPixel(int column, int row)
719 //{
720 // //Must be used after the load of the buffer from the device to seek for errors in the chain
721 // int index = pixelIndex(column, row);
722 // return BitManipulator::readBits(resetBuffer_[index / 32], index % 32, 1);
723 //}
724 //
726 //bool VIPICFirmware::getConfigurationPixel(int column, int row)
727 //{
728 // //Must be used after the load of the buffer from the device to seek for errors in the chain
729 // int index = pixelIndex(column, row);
730 // return BitManipulator::readBits(resetBuffer_[index / 2], 16 * (index % 2), 12);
731 //}
732 //