#include <CADC2530.h>
Public Member Functions | |
CADC2530 (int crateNum=0, long nBase=0) | |
'normal' constructor. | |
CADC2530 (const CADC2530 &card) | |
Copy Constructor. | |
~CADC2530 () | |
Destructor. | |
CADC2530 & | operator= (const CADC2530 &) |
Assignment operator. | |
const std::string & | toString () |
Stringify. | |
int | readListEvents (void *, int &) |
Read multiple events into buffer. | |
int | readHistogramChannel (void *, int) |
Read a histogram channel. | |
unsigned short | cardType () |
Return module device type. | |
unsigned short | manufacturerId () |
Return module Id of card. | |
void | clearHistogramMemory () |
Zero only histogram memory. | |
void | clearMemory () |
Zero all histo/list memory. | |
void | resetCard () |
Reset card to initial settings. | |
void | clearListAddress () |
Clear list memory address counter. | |
unsigned int | getListAddress () |
Get list memory address counter. | |
void | arm () |
Arm the module. | |
void | disarm () |
Disarm the module. | |
bool | isArmed () |
Check if module is armed. | |
void | modeHistogram (bool) |
Set to histogram mode. | |
void | modeGate () |
Set to list mode. | |
void | resetCSR () |
Reset the CSR to zero. | |
void | fastClear () |
Force fast clear all channels. | |
bool | isBusy () |
Check if modules is busy. | |
bool | dataReady () |
Check if data ready. | |
bool | hasInterrupt () |
Check CSR interrupt status. | |
void | enableInterrupt () |
Enable interrupt. | |
void | disableInterrupt () |
Disable interrupt. | |
void | enableGate () |
Enable gate mode. | |
void | disableGate () |
Disable gate mode. | |
void | enableZeroCnv () |
Enable zero conversion. | |
void | disableZeroCnv () |
Disable zero conversion. | |
void | enableCalibration () |
Enable calibration. | |
void | disableCalibration () |
Disable calibration. | |
void | enableSlidingScale () |
Enable sliding scale. | |
void | disableSlidingScale () |
Disable sliding scale. | |
void | setIPL (unsigned short) |
Set the interrupt priority level. | |
unsigned short | getIPL () |
Get the interrupt priority level. | |
unsigned short | getCSR () |
Get the CSR value. | |
void | dataReadyOnEvent () |
Data ready when at least 1 event. | |
void | dataReadyOnFullness () |
Data ready on fullness flags. | |
void | setLLD (unsigned short) |
Set the LLD value. | |
unsigned short | getLLD () |
Get the LLD value. | |
void | setULD (unsigned short) |
Set the ULD value. | |
unsigned short | getULD () |
Get the ULD value. | |
void | setInterruptVector (unsigned short) |
Set the interrupt vector. | |
unsigned short | getInterruptVector () |
Get the interrupt vector. | |
void | setInterruptMask (unsigned short) |
Set the interrupt mask. | |
unsigned short | getInterruptMask () |
Get the interrupt mask. | |
void | clearFullnessFlags () |
Clear the fullness flags to 0. | |
unsigned short | getFullnessFlags () |
Get the fullness flags. | |
bool | isChannelFull (unsigned short) |
Check if histo. chan. is full. | |
bool | channelHasData (unsigned short) |
Check if histo. channel has data. | |
bool | isListFull () |
Check if list full. | |
bool | isListHalfFull () |
Check if list is half full. | |
unsigned int | getEventCounter () |
Get the event counter. | |
void | clearEventCounter () |
Clear the event counter. | |
unsigned short | getCTR () |
Get the CTR value. | |
void | resetCTR () |
Reset the CTR to zero. | |
void | setCTRchannel (unsigned short) |
Set the CTR channel. | |
unsigned short | getCTRchannel () |
Get the CTR channel. | |
void | enableAutoFastClear () |
Enable CTR auto fast clear. | |
void | disableAutoFastClear () |
Disable CTR auto fast clear. | |
void | enableMUXswitch () |
Enable CTR MUX switch. | |
void | disableMUXswitch () |
Disable CTR MUX switch. | |
void | enableCompensation () |
Enable CTR compensation. | |
void | disableCompensation () |
Disable CTR compensation. | |
void | setSSTR (unsigned short) |
Set the sliding scale test reg. | |
unsigned short | getSSTR () |
Get the sliding scale test reg. | |
Static Public Member Functions | |
static bool | checkCard (int, long, unsigned short &, unsigned short &) |
Static method to check if a card is a Hyted 2530 ADC. | |
static unsigned short | volt2lld (double) |
Static method to convert a voltage to an LLD setting. | |
static unsigned short | volt2uld (double) |
Static method to convert a voltage to an ULD setting. | |
Protected Member Functions | |
void | mapModule () |
Map register memory. | |
void | mapMemory () |
Map list/histogram memory. | |
void | destroyModule () |
Destroy register memory map. | |
void | destroyMemory () |
Destroy list/histogram memory map. | |
void | destroyCard () |
Destroy a card memory maps. | |
void | mapCard () |
Map the card's memory. | |
void | slotInit () |
Initialize a slot. | |
int | readListEvent (void *, int) |
Read event into a user buffer. | |
unsigned long | calcMemoryOffset (unsigned long) |
Compute memory offset. | |
unsigned long | setMemoryOffset (unsigned long) |
Set the memory offset. | |
void | setCSR (unsigned short) |
Set the CSR to a value. | |
void | setCSRbits (unsigned short, unsigned short) |
Set bits in the CSR. | |
void | resetCSRbits (unsigned short) |
Reset bits in the CSR. | |
void | setCTR (unsigned short) |
Set the CTR to a value. | |
void | setCTRbits (unsigned short, unsigned short) |
Set bits in the CTR. | |
void | resetCTRbits (unsigned short) |
Reset bits in the CTR. | |
Protected Attributes | |
int | my_nCrate |
VME crate number housing the module. | |
unsigned long | my_nBase |
Base physical VME address in crate. | |
unsigned long | my_nMemOffset |
Register vale for list/histogram offset. | |
unsigned short | my_nCardId |
Card Id (filled in at MapCard). | |
unsigned short | my_nCardType |
Type of card (filled in at MapCard). | |
void * | my_nModFd |
File desc. for registers open on VME. | |
void * | my_nMemFd |
File desc. for memory open on VME. | |
bool | my_eventmode |
True when in event mode. | |
unsigned int | my_cureventpos |
The current event long position. | |
CVmeModule * | my_pModule |
CVmeModule * | my_pMemory |
This is a support class for the Hytec 2530 ADC.
Note that for now, copy construction will involve the creation of a new memory map and is therefore discouraged.
Definition at line 53 of file CADC2530.h.
CADC2530::CADC2530 | ( | int | crateNum = 0 , |
|
long | nBase = 0 | |||
) |
'normal' constructor.
Definition at line 182 of file CADC2530.cpp.
References CADC2530_REGSIZE, and slotInit().
CADC2530::CADC2530 | ( | const CADC2530 & | card | ) |
Copy Constructor.
Copy constructor: Constructs a new card from an existing card object. A new map is established to the card for this object. The card is not re-initialized, but remains in the state defined by the existing card.
card | The card to copy. |
Definition at line 211 of file CADC2530.cpp.
References mapCard().
CADC2530::~CADC2530 | ( | ) |
Destructor.
Unmap and destruct this card object.
None |
Definition at line 265 of file CADC2530.cpp.
References destroyCard().
bool CADC2530::checkCard | ( | int | nCrate, | |
long | nBase, | |||
unsigned short & | rType, | |||
unsigned short & | rManId | |||
) | [static] |
Static method to check if a card is a Hyted 2530 ADC.
Static method to check if a card is a Hytec 2530 ADC. Simply maps the register set and retrieves the manufacturer id and device type from the locations where they are stored for the ADC2530. These values are returned in rManId and rType.
Note, this is a static method that does not require the instantiation of this class to be called. Also, it should be called as: CADC2530::checkCard().
nCrate | The crate number to check. | |
nBase | The crate number to check. | |
rType | The device type (output). | |
rManId | The manufactuer id (output). |
Definition at line 288 of file CADC2530.cpp.
References CVmeModule::a24d32, CADC2530_REGSIZE, CVmeModule::peekw(), and ShortOffset.
unsigned short CADC2530::volt2lld | ( | double | volt | ) | [static] |
Static method to convert a voltage to an LLD setting.
Static method to convert a voltage in the range [0-0.8191] volts to a lower level discriminator (LLD) value. All specified values greater than 0.8191 will return 0x3FFC (maximum setting), and all values less than zero will return 0x0 (minimu setting).
Note, this is a static method that does not require the instantiation of this class to be called. Also, it should be called as: CADC2530::volt2lld().
volt | The voltage to convert. |
Definition at line 339 of file CADC2530.cpp.
unsigned short CADC2530::volt2uld | ( | double | volt | ) | [static] |
Static method to convert a voltage to an ULD setting.
Static method to convert a voltage in the range [0-8.191] volts. to a upper level discriminator (ULD) value. All values greater than 8.191 will be set to 8.191 and all values less than zero will be set to 0.
Note, this is a static method that does not require the instantiation of this class to be called. Also, it should be called as: CADC2530::volt2uld().
A | string exeception on error. |
volt | The voltage to convert. |
Definition at line 370 of file CADC2530.cpp.
Assignment operator.
Definition at line 239 of file CADC2530.cpp.
References destroyCard(), mapCard(), my_cureventpos, my_eventmode, my_nBase, my_nCrate, my_nMemFd, my_nMemOffset, my_nModFd, my_pMemory, and my_pModule.
const std::string & CADC2530::toString | ( | ) |
Stringify.
Stringify this card as a std::string that describes this module.
A | string execption if there were any problems. |
None |
Definition at line 396 of file CADC2530.cpp.
References my_nBase, my_nCrate, and my_nMemOffset.
int CADC2530::readListEvents | ( | void * | buf, | |
int & | nEvents | |||
) |
Read multiple events into buffer.
Reads multiple list memory events into a user buffer (pointer to local memory). The buf parameter is a pointer to local memory that has already been alocated. The size of buf should be at least 40*nEvents in size to guarantee sufficient space for reading the request number of events.
buf | A pointer to local memory that has already been allocated. | |
nEvents | (IN) The number of events to read, (OUT) the number of events actually read. |
>0 | indicates the number of BYTES of data placed in buf. | |
0 | indicates that no data was placed in the buffer. |
Definition at line 504 of file CADC2530.cpp.
References CADC2530_MEMSIZE, dataReady(), getListAddress(), my_cureventpos, and readListEvent().
int CADC2530::readHistogramChannel | ( | void * | buf, | |
int | channum | |||
) |
Read a histogram channel.
Reads a single histogram channel into a user buffer (pointer to local memory). The buf parameter is a pointer to local memory that has already been alocated. This user allocated buffer must be sized to contain at least 8192 (0x2000) 32-bit long words (32768 bytes).
String | exception on error. |
buf | A pointer to local memory that has already been allocated. | |
channum | The channel number to read in the range [1-8]. |
>0 | indicates the number of BYTES of data placed in buf. | |
0 | indicates that no data was placed in the buffer. |
Definition at line 546 of file CADC2530.cpp.
References CADC2530_HISTOCHANSIZE, and my_pMemory.
unsigned short CADC2530::cardType | ( | ) |
Return module device type.
Return the device type of this card. It should 2530(dec) for the Hytec 2530 ADC as read from location base+0x02.
None |
Definition at line 596 of file CADC2530.cpp.
References my_nCardType, my_pModule, CVmeModule::peekw(), and ShortOffset.
Referenced by mapModule().
unsigned short CADC2530::manufacturerId | ( | ) |
Return module Id of card.
Return the manufacturer id for this card. It should 0x8063 for the Hytec 2530 ADC as read from location base+0x0.
None |
Definition at line 617 of file CADC2530.cpp.
References my_nCardId, my_pModule, CVmeModule::peekw(), and ShortOffset.
Referenced by mapModule().
void CADC2530::clearHistogramMemory | ( | ) |
Zero only histogram memory.
Write zeroes to all locations in only the histogram memory. Since the memory used for histogramming is significantly smaller that that used in list mode, clearing only histogram memory is faster than clearing all of the card's memory.
string | describing why the method failed. |
None |
Definition at line 853 of file CADC2530.cpp.
References CADC2530_HISTOMEMSIZE, my_nBase, my_nCrate, my_pMemory, and CVmeModule::pokel().
Referenced by slotInit().
void CADC2530::clearMemory | ( | ) |
Zero all histo/list memory.
Write zeroes to all locations in the histogram/list memory.
string | describing why the method failed. |
None |
Definition at line 823 of file CADC2530.cpp.
References CADC2530_MEMSIZE, my_nBase, my_nCrate, my_pMemory, and CVmeModule::pokel().
void CADC2530::resetCard | ( | ) |
Reset card to initial settings.
Reset this card to a set of initial settings. This includes issuing a CSR clear and FFCLR and setting the CSR to an all zero state. This does not clear the list/histogram memory (call clearMemory() or clearHistogramMemory() to zero all list/histogram memory or just histogram memory respectively).
string | describing why the method failed. |
None |
Definition at line 884 of file CADC2530.cpp.
References clearEventCounter(), clearFullnessFlags(), clearListAddress(), disarm(), fastClear(), modeHistogram(), my_nBase, my_nCrate, my_pModule, resetCSR(), resetCTR(), setInterruptMask(), setInterruptVector(), setLLD(), and setULD().
Referenced by destroyModule(), and slotInit().
void CADC2530::clearListAddress | ( | ) |
Clear list memory address counter.
Set the list address counter to zero.
None |
Definition at line 1356 of file CADC2530.cpp.
References my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by resetCard().
unsigned int CADC2530::getListAddress | ( | ) |
Get list memory address counter.
Return the list address counter. Can be used to determine the amount of data has in list memory when in gate mode.
None |
Definition at line 1333 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
Referenced by readListEvents().
void CADC2530::arm | ( | ) |
Arm the module.
Start acquistion according to the current mode (list or histogram) setting.
None |
Definition at line 976 of file CADC2530.cpp.
References ADCcsr_union::bit_struct::ARM, ADCcsr_union::bits, ADCcsr_union::csrval, and setCSRbits().
void CADC2530::disarm | ( | ) |
Disarm the module.
Stop either histogram or list mode acquistion depending on setting.
None |
Definition at line 993 of file CADC2530.cpp.
References ADCcsr_union::bit_struct::ARM, ADCcsr_union::bits, ADCcsr_union::csrval, and resetCSRbits().
Referenced by resetCard().
bool CADC2530::isArmed | ( | ) |
Check if module is armed.
Check whether acquisition has been started.
None |
Definition at line 1220 of file CADC2530.cpp.
References ADCcsr_union::bit_struct::ARM, ADCcsr_union::bits, ADCcsr_union::csrval, and getCSR().
void CADC2530::modeHistogram | ( | bool | indgates | ) |
Set to histogram mode.
Set acquisition to histogram mode. If indgates is false, then use self gating. If indgates is true, use individual gates on front panel.
indgates | True if individual front panel gates are to be used. |
Definition at line 1237 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, dataReadyOnFullness(), ADCcsr_union::bit_struct::GE, ADCcsr_union::bit_struct::HE, resetCSRbits(), and setCSRbits().
Referenced by resetCard().
void CADC2530::modeGate | ( | ) |
Set to list mode.
Set acquisition to gate mode. Gate mode using front panel master gate with data stored in list mode.
None |
Definition at line 1267 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, dataReadyOnEvent(), ADCcsr_union::bit_struct::GE, ADCcsr_union::bit_struct::HE, resetCSRbits(), and setCSRbits().
void CADC2530::resetCSR | ( | ) |
Reset the CSR to zero.
Reset the status register (CSR) to zero.
None |
Definition at line 1604 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, getCSR(), my_eventmode, ADCcsr_union::bit_struct::RSTBSY, and setCSR().
Referenced by resetCard().
void CADC2530::fastClear | ( | ) |
Force fast clear all channels.
Force a fast clear on all channels.
None |
Definition at line 1635 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::FFCLR, getCSR(), and setCSR().
Referenced by resetCard().
bool CADC2530::isBusy | ( | ) |
Check if modules is busy.
Check is the module has accepted input pulses and that they are being converted.
None |
Definition at line 1376 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, getCSR(), and ADCcsr_union::bit_struct::RSTBSY.
bool CADC2530::dataReady | ( | ) |
Check if data ready.
Check is any of the channel flags are set (data ready) for this module.
None |
Definition at line 1589 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::DR, and getCSR().
Referenced by readListEvents().
bool CADC2530::hasInterrupt | ( | ) |
Check CSR interrupt status.
Check the control and status register interrupt status. A return of true indicates that a mask enabled fullness flag has been set.
None |
Definition at line 1573 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, getCSR(), and ADCcsr_union::bit_struct::IS.
void CADC2530::enableInterrupt | ( | ) |
Enable interrupt.
Enable interrupt. An IRQ is generated if the CSR interrupt status bit is set and interrupts are enabled. The IRQ number is determined by the CSR interrupt priority level. This bit is cleared during the interrupt cycle ROAK.
None |
Definition at line 1185 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::IE, and setCSRbits().
void CADC2530::disableInterrupt | ( | ) |
Disable interrupt.
Disable interrupt. An IRQ is generated if the CSR interrupt status bit is set and interrupts are enabled. The IRQ number is determined by the CSR interrupt priority level. This bit is cleared during the interrupt cycle ROAK.
None |
Definition at line 1204 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::IE, and resetCSRbits().
void CADC2530::enableGate | ( | ) |
Enable gate mode.
Enable mode that uses front panel master gate.
None |
Definition at line 1050 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::GE, and setCSRbits().
void CADC2530::disableGate | ( | ) |
Disable gate mode.
Disable mode that uses front panel master gate.
None |
Definition at line 1066 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::GE, and resetCSRbits().
void CADC2530::enableZeroCnv | ( | ) |
Enable zero conversion.
Enable zero conversion.
None |
Definition at line 1082 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, setCSRbits(), and ADCcsr_union::bit_struct::ZE.
void CADC2530::disableZeroCnv | ( | ) |
Disable zero conversion.
Disable zero conversion.
None |
Definition at line 1098 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, resetCSRbits(), and ADCcsr_union::bit_struct::ZE.
void CADC2530::enableCalibration | ( | ) |
Enable calibration.
Enable calibration. When enabled the calibration and test register (CTR) functions are enabled.
None |
Definition at line 1115 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::SC, and setCSRbits().
void CADC2530::disableCalibration | ( | ) |
Disable calibration.
Disable calibrarion. When disabled the calibration and test register (CTR) functions are disabled.
None |
Definition at line 1132 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, resetCSRbits(), and ADCcsr_union::bit_struct::SC.
void CADC2530::enableSlidingScale | ( | ) |
Enable sliding scale.
Enable sliding scale. Note, when this CSR bit is 0, sliding scale is enabled.
None |
Definition at line 1149 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, resetCSRbits(), and ADCcsr_union::bit_struct::SS.
void CADC2530::disableSlidingScale | ( | ) |
Disable sliding scale.
Disable sliding scale. Note, when this CSR bit is 1, sliding scale is disabled.
None |
Definition at line 1166 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, setCSRbits(), and ADCcsr_union::bit_struct::SS.
void CADC2530::setIPL | ( | unsigned short | iplval | ) |
Set the interrupt priority level.
Set the interrupt priority level. The value specified should be in the range [0-7]. Only the 3 lower bits of the specified value are retained.
iplval | The new interrupt priority level. |
Definition at line 1653 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::IPL, and setCSRbits().
unsigned short CADC2530::getIPL | ( | ) |
Get the interrupt priority level.
Get the interrupt priority level.
None |
Definition at line 1675 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, getCSR(), and ADCcsr_union::bit_struct::IPL.
unsigned short CADC2530::getCSR | ( | ) |
Get the CSR value.
Return the current control and status register (CSR) setting.
None |
Definition at line 2017 of file CADC2530.cpp.
References CSR, my_pModule, CVmeModule::peekw(), and ShortOffset.
Referenced by dataReady(), fastClear(), getIPL(), hasInterrupt(), isArmed(), isBusy(), resetCSR(), resetCSRbits(), and setCSRbits().
void CADC2530::dataReadyOnEvent | ( | ) |
Data ready when at least 1 event.
The data ready flag will be set when there's at least one event. This is the default for gate mode (list memory) operation.
None |
Definition at line 1012 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::DR, ADCcsr_union::bit_struct::FHE, my_eventmode, and setCSRbits().
Referenced by modeGate().
void CADC2530::dataReadyOnFullness | ( | ) |
Data ready on fullness flags.
The data ready flag will be set based on fullness flag register bits. This is the default for histogram mode.
None |
Definition at line 1032 of file CADC2530.cpp.
References ADCcsr_union::bits, ADCcsr_union::csrval, ADCcsr_union::bit_struct::DR, ADCcsr_union::bit_struct::FHE, my_eventmode, and resetCSRbits().
Referenced by modeHistogram().
void CADC2530::setLLD | ( | unsigned short | lldval | ) |
Set the LLD value.
Set the lower level discriminator (LLD) DAC value. The value specified is NOT a voltage but the computed DAC value as described the ADC manual. This value can be computed from the desired voltage (per the manual) as:
LDD DAC value = (((Vreq/3.2764)/(0.25/4095))<<2)&0x3FFC
lldval | The new LLD value. |
Definition at line 1696 of file CADC2530.cpp.
References my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by resetCard().
unsigned short CADC2530::getLLD | ( | ) |
Get the LLD value.
Get the lower level discriminator (LLD) DAC value. The value returned is NOT a voltage but the computed DAC value as described the ADC manual. This value can be computed from the desired voltage (per the manual) as:
LLD DAC value = (((Vreq/3.2764)/(0.25/4095))<<2)&0x3FFC
The value return by this method is the computed "LLD DAC value."
None |
Definition at line 1721 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
void CADC2530::setULD | ( | unsigned short | uldval | ) |
Set the ULD value.
Set the upper level discriminator (ULD) DAC value. The value specified is NOT a voltage but the computed DAC value as described the ADC manual. This value can be computed from the desired voltage (per the manual) as:
ULD DAC value = ((((Vreq/3.2764)-2)/(0.25/4095))<<2)&0x3FFC
uldval | The new ULD value. |
Definition at line 1745 of file CADC2530.cpp.
References my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by resetCard().
unsigned short CADC2530::getULD | ( | ) |
Get the ULD value.
Get the upper level discriminator (ULD) DAC value. The value returned is NOT a voltage but the computed DAC value as described the ADC manual. This value can be computed from the desired voltage (per the manual) as:
ULD DAC value = ((((Vreq/3.2764)-2)/(0.25/4095))<<2)&0x3FFC
The value return by this method is the computed "ULD DAC value."
None |
Definition at line 1770 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
void CADC2530::setInterruptVector | ( | unsigned short | ivect | ) |
Set the interrupt vector.
Set the interrupt vector to the specified value.
ivect | The new interrupt vector setting. |
Definition at line 1789 of file CADC2530.cpp.
References my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by resetCard().
unsigned short CADC2530::getInterruptVector | ( | ) |
Get the interrupt vector.
Get the current interrupt vector setting.
None |
Definition at line 1806 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
void CADC2530::setInterruptMask | ( | unsigned short | imask | ) |
Set the interrupt mask.
Set the interrupt mask to the specified value.
imask | The new interrupt mask setting. |
Definition at line 1825 of file CADC2530.cpp.
References my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by resetCard().
unsigned short CADC2530::getInterruptMask | ( | ) |
Get the interrupt mask.
Get the current interrupt mask setting.
None |
Definition at line 1842 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
void CADC2530::clearFullnessFlags | ( | ) |
Clear the fullness flags to 0.
Clear the fullness flags to zero.
None |
Definition at line 1391 of file CADC2530.cpp.
References my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by resetCard().
unsigned short CADC2530::getFullnessFlags | ( | ) |
Get the fullness flags.
Get the fullness flags. Note, the meaning of the individual bits is dependent on whether the module is in list or histogram mode.
None |
Definition at line 1410 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
Referenced by channelHasData(), isChannelFull(), isListFull(), and isListHalfFull().
bool CADC2530::isChannelFull | ( | unsigned short | aChan | ) |
Check if histo. chan. is full.
Check if the specified histogram channel is full (overflow). Note, no determination is made as whether the module is actually operating in histogram mode. Also, histogram mode flags are shared with list mode flags.
String | exception on error. |
aChan | The channel to check in the range [1-8]. |
Definition at line 1433 of file CADC2530.cpp.
References ADCfullnessflag_union::bytes, ADCfullnessflag_union::flags, ADCfullnessflag_union::byte_struct::FULL, and getFullnessFlags().
bool CADC2530::channelHasData | ( | unsigned short | aChan | ) |
Check if histo. channel has data.
Check if the specified histogram channel has data. Note, no determination is made as whether the module is actually operating in histogram mode. Also, histogram mode flags are shared with list mode flags.
String | exception on error. |
aChan | The channel to check in the range [1-8]. |
Definition at line 1460 of file CADC2530.cpp.
References ADCfullnessflag_union::bytes, ADCfullnessflag_union::flags, getFullnessFlags(), and ADCfullnessflag_union::byte_struct::HALFFULL.
bool CADC2530::isListFull | ( | ) |
Check if list full.
Check if list mode memory is full. Note, no determination is made as whether the module is actually operating in list mode. Also, List mode flags are shared with histogram mode flags.
None. |
Definition at line 1486 of file CADC2530.cpp.
References ADCfullnessflag_union::bytes, ADCfullnessflag_union::flags, ADCfullnessflag_union::byte_struct::FULL, and getFullnessFlags().
bool CADC2530::isListHalfFull | ( | ) |
Check if list is half full.
Check if list mode memory is half full. Note, no determination is made as whether the module is actually operating in list mode. Also, List mode flags are shared with histogram mode flags.
None. |
Definition at line 1505 of file CADC2530.cpp.
References ADCfullnessflag_union::bytes, ADCfullnessflag_union::flags, getFullnessFlags(), and ADCfullnessflag_union::byte_struct::HALFFULL.
unsigned int CADC2530::getEventCounter | ( | ) |
Get the event counter.
Return the number of events currently recorded by the ADC event counter.
None |
Definition at line 1288 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
void CADC2530::clearEventCounter | ( | ) |
Clear the event counter.
Set the ADC event counter to zero.
None |
Definition at line 1310 of file CADC2530.cpp.
References my_cureventpos, my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by resetCard().
unsigned short CADC2530::getCTR | ( | ) |
Get the CTR value.
Return the current calibration and test register (CTR) setting.
None |
Definition at line 2115 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
Referenced by getCTRchannel(), resetCTRbits(), and setCTRbits().
void CADC2530::resetCTR | ( | ) |
Reset the CTR to zero.
Reset the calibration and test register (CTR) to zero.
None |
Definition at line 1622 of file CADC2530.cpp.
References setCTR().
Referenced by resetCard().
void CADC2530::setCTRchannel | ( | unsigned short | chanval | ) |
Set the CTR channel.
Set the test channel in the calibration and test register. The value specified should be in the range [1-8]. Only the 3 lower bits of the specified value -1 are retained.
throw | String exception on error. | |
chanval | The new calibration channel. |
Definition at line 1864 of file CADC2530.cpp.
References ADCctr_union::bits, ADCctr_union::ctrval, ADCctr_union::bit_struct::M012, and setCTRbits().
unsigned short CADC2530::getCTRchannel | ( | ) |
Get the CTR channel.
Get the test channel from the calibration and test register (CTR). The value returned is the CTR setting +1 to give a channel value in the range [1-8].
None |
Definition at line 1894 of file CADC2530.cpp.
References ADCctr_union::bits, ADCctr_union::ctrval, getCTR(), and ADCctr_union::bit_struct::M012.
void CADC2530::enableAutoFastClear | ( | ) |
Enable CTR auto fast clear.
Enable auto fast clear (DEAC flag in the CTR). Intended for calibration and testing.
None |
Definition at line 1911 of file CADC2530.cpp.
References ADCctr_union::bits, ADCctr_union::ctrval, ADCctr_union::bit_struct::DEAC, and resetCTRbits().
void CADC2530::disableAutoFastClear | ( | ) |
Disable CTR auto fast clear.
Disable auto fast clear (DEAC flag in the CTR). Intended for calibration and testing.
None |
Definition at line 1928 of file CADC2530.cpp.
References ADCctr_union::bits, ADCctr_union::ctrval, ADCctr_union::bit_struct::DEAC, and setCTRbits().
void CADC2530::enableMUXswitch | ( | ) |
Enable CTR MUX switch.
Enable CTR MUX switch (MEN flag in the CTR). This opens the channel gate and sets the MUX switch on PCB to allow voltage at the channel input to be measured. Call after setting the CTR channel (setCTRchannel()); Intended for calibration and testing.
None |
Definition at line 1982 of file CADC2530.cpp.
References ADCctr_union::bits, ADCctr_union::ctrval, ADCctr_union::bit_struct::MEN, and setCTRbits().
void CADC2530::disableMUXswitch | ( | ) |
Disable CTR MUX switch.
Disable CTR MUX switch (MEN flag in the CTR). This closes the channel gate and sets the MUX switch on PCB, preventing voltage at the channel input from being measured. Intended for calibration and testing.
None |
Definition at line 2001 of file CADC2530.cpp.
References ADCctr_union::bits, ADCctr_union::ctrval, ADCctr_union::bit_struct::MEN, and resetCTRbits().
void CADC2530::enableCompensation | ( | ) |
Enable CTR compensation.
Enable compensation (DISC flag in the CTR). Intended for calibration and testing.
None |
Definition at line 1945 of file CADC2530.cpp.
References ADCctr_union::bits, ADCctr_union::ctrval, ADCctr_union::bit_struct::DISC, and resetCTRbits().
void CADC2530::disableCompensation | ( | ) |
Disable CTR compensation.
Disable compensation (DISC flag in the CTR). Intended for calibration and testing.
None |
Definition at line 1962 of file CADC2530.cpp.
References ADCctr_union::bits, ADCctr_union::ctrval, ADCctr_union::bit_struct::DISC, and setCTRbits().
void CADC2530::setSSTR | ( | unsigned short | sstrval | ) |
Set the sliding scale test reg.
Set the sliding scale test register. The first and last two bits are control bits and must be set to zero. This method will a mask of 0x3FFC to the specified value to ensure the first and last two bits are set to zero before writing to the register.
Note that a bit setting of 0 (default value) indicates that the sliding scale counters for that channel will increment, while a setting of 1 set the sliding scale counters to zero.
sstrval | The new SSTR setting. |
Definition at line 1529 of file CADC2530.cpp.
References my_pModule, CVmeModule::pokew(), and ShortOffset.
unsigned short CADC2530::getSSTR | ( | ) |
Get the sliding scale test reg.
Get the sliding scale test register. The first and last two bits are control bits.
Note that a bit setting of 0 (default value) indicates that the sliding scale counters for that channel will increment, while a setting of 1 set the sliding scale counters to zero.
None |
Definition at line 1552 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), and ShortOffset.
void CADC2530::mapModule | ( | ) | [protected] |
Map register memory.
Given the values in
string | describing why the method failed. |
None |
Definition at line 684 of file CADC2530.cpp.
References CVmeModule::a24d32, CADC2530_REGSIZE, cardType(), manufacturerId(), my_nBase, my_nCardId, my_nCardType, my_nCrate, my_nModFd, and my_pModule.
Referenced by mapCard().
void CADC2530::mapMemory | ( | ) | [protected] |
Map list/histogram memory.
Given the values in
string | describing why the method failed. |
None |
Definition at line 743 of file CADC2530.cpp.
References CVmeModule::a32d32, CADC2530_MEMSIZE, calcMemoryOffset(), my_nBase, my_nCrate, my_nMemFd, my_nMemOffset, my_pMemory, my_pModule, and setMemoryOffset().
Referenced by mapCard().
void CADC2530::destroyModule | ( | ) | [protected] |
Destroy register memory map.
Destroy the register memory map for this card. The card is also reset (resetCard()).
None |
Definition at line 916 of file CADC2530.cpp.
References CADC2530_REGSIZE, my_nModFd, my_pModule, and resetCard().
Referenced by destroyCard().
void CADC2530::destroyMemory | ( | ) | [protected] |
Destroy list/histogram memory map.
Destroy the list/histogram memory map for this card.
None |
Definition at line 799 of file CADC2530.cpp.
References CADC2530_MEMSIZE, my_nMemFd, and my_pMemory.
Referenced by destroyCard().
void CADC2530::destroyCard | ( | ) | [protected] |
Destroy a card memory maps.
Destroy the memory maps for this card.
None |
Definition at line 961 of file CADC2530.cpp.
References destroyMemory(), and destroyModule().
Referenced by operator=(), and ~CADC2530().
void CADC2530::mapCard | ( | ) | [protected] |
Map the card's memory.
Given the values in
string | describing why the method failed. |
None |
Definition at line 947 of file CADC2530.cpp.
References mapMemory(), and mapModule().
Referenced by CADC2530(), operator=(), and slotInit().
void CADC2530::slotInit | ( | ) | [protected] |
Initialize a slot.
Maps the card and initializes it to a well defined state. The card location is assumed to already have been set up as defined by the member variables (except for my_pModule and my_pMemory which are filled in by mapCard()).
A | string execption if there were any problems. |
None |
Definition at line 580 of file CADC2530.cpp.
References clearHistogramMemory(), mapCard(), and resetCard().
Referenced by CADC2530().
int CADC2530::readListEvent | ( | void * | buf, | |
int | lngsLeft | |||
) | [protected] |
Read event into a user buffer.
Reads a single list memory event into a user buffer (pointer to local memory). The buf parameter is a pointer to local memory that has already been alocated.
This method is meant for internal use and assumes that list memory boundary checking has already been completed before this method was called.
buf | A pointer to local memory that has already been allocated. | |
lngsLeft | Number of longs left in list memory. |
>0 | indicates the number of BYTES of data placed in buf. | |
0 | indicates that no data was placed in the buffer. |
Definition at line 450 of file CADC2530.cpp.
References GET_LIST_CHANCOUNT, my_cureventpos, and my_pMemory.
Referenced by readListEvents().
unsigned long CADC2530::calcMemoryOffset | ( | unsigned | long | ) | [protected] |
unsigned long CADC2530::setMemoryOffset | ( | unsigned | long | ) | [protected] |
Set the memory offset.
Definition at line 640 of file CADC2530.cpp.
References my_pModule, CVmeModule::peekw(), CVmeModule::pokew(), and ShortOffset.
Referenced by mapMemory().
void CADC2530::setCSR | ( | unsigned | short | ) | [protected] |
Set the CSR to a value.
Definition at line 2038 of file CADC2530.cpp.
References ADCcsr_union::bits, CSR, ADCcsr_union::csrval, ADCcsr_union::bit_struct::DR, my_eventmode, my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by fastClear(), and resetCSR().
void CADC2530::setCSRbits | ( | unsigned short | nBits, | |
unsigned short | nMask | |||
) | [protected] |
Set bits in the CSR.
Set specified bits in the control status register (CSR). The arguments passed to this method are a set of bits that should be set in the CSR and a mask (of 1's) indicating which bits are affected.
nBits | The CSR bits to set. | |
nMask | Mask of the bit set affected (1-> bit affected). |
Definition at line 2064 of file CADC2530.cpp.
References ADCcsr_union::bits, CADC2530_CSRMASK, CSR, ADCcsr_union::csrval, ADCcsr_union::bit_struct::DR, getCSR(), my_eventmode, my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by arm(), dataReadyOnEvent(), disableSlidingScale(), enableCalibration(), enableGate(), enableInterrupt(), enableZeroCnv(), modeGate(), modeHistogram(), and setIPL().
void CADC2530::resetCSRbits | ( | unsigned | short | ) | [protected] |
Reset bits in the CSR.
Definition at line 2092 of file CADC2530.cpp.
References ADCcsr_union::bits, CADC2530_CSRMASK, CSR, ADCcsr_union::csrval, ADCcsr_union::bit_struct::DR, getCSR(), my_eventmode, my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by dataReadyOnFullness(), disableCalibration(), disableGate(), disableInterrupt(), disableZeroCnv(), disarm(), enableSlidingScale(), modeGate(), and modeHistogram().
void CADC2530::setCTR | ( | unsigned | short | ) | [protected] |
Set the CTR to a value.
Definition at line 2134 of file CADC2530.cpp.
References my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by resetCTR().
void CADC2530::setCTRbits | ( | unsigned short | nBits, | |
unsigned short | nMask | |||
) | [protected] |
Set bits in the CTR.
Set specified bits in the calibration and test register (CTR). The arguments passed to this method are a set of bits that should be set in the CTR and a mask (of 1's) indicating which bits are affected.
nBits | The CST bits to set. | |
nMask | Mask of the bit set affected (1-> bit affected). |
Definition at line 2155 of file CADC2530.cpp.
References CADC2530_CTRMASK, getCTR(), my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by disableAutoFastClear(), disableCompensation(), enableMUXswitch(), and setCTRchannel().
void CADC2530::resetCTRbits | ( | unsigned | short | ) | [protected] |
Reset bits in the CTR.
Definition at line 2179 of file CADC2530.cpp.
References CADC2530_CTRMASK, getCTR(), my_pModule, CVmeModule::pokew(), and ShortOffset.
Referenced by disableMUXswitch(), enableAutoFastClear(), and enableCompensation().
int CADC2530::my_nCrate [protected] |
VME crate number housing the module.
Definition at line 156 of file CADC2530.h.
Referenced by clearHistogramMemory(), clearMemory(), mapMemory(), mapModule(), operator=(), resetCard(), and toString().
unsigned long CADC2530::my_nBase [protected] |
Base physical VME address in crate.
Definition at line 157 of file CADC2530.h.
Referenced by clearHistogramMemory(), clearMemory(), mapMemory(), mapModule(), operator=(), resetCard(), and toString().
unsigned long CADC2530::my_nMemOffset [protected] |
Register vale for list/histogram offset.
Definition at line 158 of file CADC2530.h.
Referenced by mapMemory(), operator=(), and toString().
unsigned short CADC2530::my_nCardId [protected] |
Card Id (filled in at MapCard).
Definition at line 159 of file CADC2530.h.
Referenced by manufacturerId(), and mapModule().
unsigned short CADC2530::my_nCardType [protected] |
Type of card (filled in at MapCard).
Definition at line 160 of file CADC2530.h.
Referenced by cardType(), and mapModule().
void* CADC2530::my_nModFd [protected] |
File desc. for registers open on VME.
Definition at line 161 of file CADC2530.h.
Referenced by destroyModule(), mapModule(), and operator=().
void* CADC2530::my_nMemFd [protected] |
File desc. for memory open on VME.
Definition at line 162 of file CADC2530.h.
Referenced by destroyMemory(), mapMemory(), and operator=().
bool CADC2530::my_eventmode [protected] |
True when in event mode.
Definition at line 163 of file CADC2530.h.
Referenced by dataReadyOnEvent(), dataReadyOnFullness(), operator=(), resetCSR(), resetCSRbits(), setCSR(), and setCSRbits().
unsigned int CADC2530::my_cureventpos [protected] |
The current event long position.
Definition at line 164 of file CADC2530.h.
Referenced by clearEventCounter(), operator=(), readListEvent(), and readListEvents().
CVmeModule* CADC2530::my_pModule [protected] |
Definition at line 167 of file CADC2530.h.
Referenced by cardType(), clearEventCounter(), clearFullnessFlags(), clearListAddress(), destroyModule(), getCSR(), getCTR(), getEventCounter(), getFullnessFlags(), getInterruptMask(), getInterruptVector(), getListAddress(), getLLD(), getSSTR(), getULD(), manufacturerId(), mapMemory(), mapModule(), operator=(), resetCard(), resetCSRbits(), resetCTRbits(), setCSR(), setCSRbits(), setCTR(), setCTRbits(), setInterruptMask(), setInterruptVector(), setLLD(), setMemoryOffset(), setSSTR(), and setULD().
CVmeModule* CADC2530::my_pMemory [protected] |
Definition at line 168 of file CADC2530.h.
Referenced by clearHistogramMemory(), clearMemory(), destroyMemory(), mapMemory(), operator=(), readHistogramChannel(), and readListEvent().