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