#include <v890.h>
Public Types | |
enum | _EdgeDetectSelection { EdgePairs = 0, TrailingEdge = 1, LeadingEdge = 2, EitherEdge = 3 } |
enum | _ResolutionSelection { ps800 = 0, ps200 = 1, ps100 = 2 } |
enum | _MaxHitSelection { HitMax0, HitMax1, HitMax2, HitMax4, HitMax8, HitMax16, HitMax32, HitMax64, HitMax128, HitMaxNoLimit } |
typedef enum CAENV890::_EdgeDetectSelection | EdgeDetectSelection |
Values for edge detection. | |
typedef enum CAENV890::_ResolutionSelection | ResolutionSelection |
Values for resolution. | |
typedef enum CAENV890::_MaxHitSelection | MaxHitSelection |
Public Member Functions | |
CAENV890 (int nSlot, int nCrate=0, bool fGeo=true, unsigned long lBase=0) | |
~CAENV890 () | |
int | getSlot () const |
int | getCrate () const |
bool | getGeo () const |
unsigned long | getBase () const |
void * | getRegisters () |
void * | getVmeDevice () |
unsigned | getModuleType () const |
unsigned | getSlotRegister () const |
Get hardware slot. | |
void | EmptyEvent (bool state) |
allow/disallow empty events. | |
bool | EmptyEventOn () |
Empty events allowed? | |
void | Reset () |
Soft reset the module. | |
void | Clear () |
Soft clear the module. | |
void | TestMode (bool enable, unsigned long nPattern=0) |
void | LoadDefaultConfig () |
bool | isTriggerMatching () |
void | ReadTriggerConfig (TriggerInfo *pTriggerInfo) |
void | SetTriggerMatchingMode () |
Trigger mode management:. | |
void | SetContinuousStorageMode () |
bool | isTriggerMatchingMode () |
void | EnableChannel (int nChan) |
Channel enables:. | |
void | DisableChannel (int nChan) |
void | EnableAllChannels () |
void | DisableAllChannels () |
void | SetChannelMask (unsigned short *pMask) |
void | ReadChannelEnables (unsigned short *pEnables) |
void | SetWindowWidth (int ns) |
int | GetWindowWidth () |
void | SetWindowOffset (int ns) |
int | GetWindowOffset () |
void | EnableTriggerSubtraction () |
void | DisableTriggerSubtraction () |
bool | TriggerSubtractionEnabled () |
void | SetEdgeDetection (EdgeDetectSelection edge) |
EdgeDetectSelection | GetEdgeDetection () |
void | SetResolution (ResolutionSelection res) |
ResolutionSelection | GetResolution () |
void | EnableDelimeters () |
void | DisableDelimeters () |
bool | DelimetersEnabled () |
void | SetMaxHits (MaxHitSelection hits) |
MaxHitSelection | GetMaxHits () |
bool | DataReady () |
unsigned int | Read (unsigned int nBufferSize, void *pBuffer) |
Static Public Attributes | |
static const int | m_nTdcClock |
static const int | m_nTdcMaxVal |
Protected Member Functions | |
void | MapModule () |
void * | MapRegions (void *pfd, unsigned long base) |
void | WriteMicro (unsigned short opcode) |
unsigned short | ReadMicro () |
void | ReadMicroArray (unsigned short opcode, unsigned short nWords, void *pBuffer) |
void | WriteMicroArray (unsigned short opcode, unsigned short nWords, void *pBuffer) |
Static Protected Member Functions | |
static int | ReadModuleType (void *prom) |
static int | TicksToNs (int ticks) |
static int | NsToTicks (int ns) |
Private Attributes | |
int | m_nSlot |
int | m_nCrate |
bool | m_fGeographical |
unsigned long | m_lBase |
void * | m_pModule |
void * | m_pVmeDevice |
unsigned | m_nModuleType |
Classes | |
struct | TriggerInfo |
In most cases to use the board it is not necessary to know the details of this communication as that's hidden from you.
Definition at line 16 of file v890.h.
Values for edge detection.
Values for resolution.
typedef enum CAENV890::_MaxHitSelection CAENV890::MaxHitSelection |
CAENV890::CAENV890 | ( | int | nSlot, | |
int | nCrate = 0 , |
|||
bool | fGeo = true , |
|||
unsigned long | lBase = 0 | |||
) |
Constructor; Create a V890 module. The parameters are stored for use by the member functions that actually create the module. The parameters interact depending on the state of the geo parameter:
nSlot | (int [in]): The slot number for the device. If the geo parameter is true, this is used to
| |
nCrate | (int [in] = 0): The VME crate number for the device. | |
fGeo | (bool [in] = true): If true the module is initially accessed in geographical mode and then reprogrammed into A32 space according to its slot. If false, the module is accessed soley through the address in the base parameter. | |
lBase | (unsigned long [in]): The base address to use to access the module if geo is false. This parameter is ignored if geo is true. |
Definition at line 145 of file v890.cpp.
References MapModule().
CAENV890::~CAENV890 | ( | ) |
Destructor: destroys the memory map that was held on the device.
Definition at line 164 of file v890.cpp.
References CAENRegisterSize(), m_pModule, and m_pVmeDevice.
int CAENV890::getCrate | ( | ) | const [inline] |
bool CAENV890::getGeo | ( | ) | const [inline] |
unsigned long CAENV890::getBase | ( | ) | const [inline] |
void* CAENV890::getRegisters | ( | ) | [inline] |
void* CAENV890::getVmeDevice | ( | ) | [inline] |
unsigned CAENV890::getModuleType | ( | ) | const [inline] |
unsigned CAENV890::getSlotRegister | ( | ) | const |
void CAENV890::EmptyEvent | ( | bool | state | ) |
allow/disallow empty events.
Set the empty event enable on or off.
state | (bool [in]):
|
Definition at line 320 of file v890.cpp.
References CTL_ENABLE_EMPTY(), and m_pModule.
bool CAENV890::EmptyEventOn | ( | ) |
Empty events allowed?
Determine if empty event headers have been enabled.
Definition at line 332 of file v890.cpp.
References CTL_ENABLE_EMPTY(), and m_pModule.
void CAENV890::Reset | ( | ) |
Soft reset the module.
Do a soft reset of the module. Note that this operation will require about 1 second.
Definition at line 342 of file v890.cpp.
References m_pModule.
Referenced by MapModule().
void CAENV890::Clear | ( | ) |
void CAENV890::TestMode | ( | bool | enable, | |
unsigned long | nPattern = 0 | |||
) |
void CAENV890::LoadDefaultConfig | ( | ) |
Load the default configuration into the TDC through the micro controller. This implies that:
Definition at line 429 of file v890.cpp.
References WriteMicro().
bool CAENV890::isTriggerMatching | ( | ) |
Return true if trigger matching is enabled. This involves a command write of 0x0200 and a read of data from the micro register.
Definition at line 442 of file v890.cpp.
References ReadMicro(), and WriteMicro().
void CAENV890::ReadTriggerConfig | ( | TriggerInfo * | pTriggerInfo | ) |
Read the trigger configuration from the tdc.
pTriggerInfo | (short* [out]): An array of 5 words to hold the trigger information:
|
Definition at line 464 of file v890.cpp.
References ReadMicroArray().
Referenced by GetWindowOffset(), GetWindowWidth(), and TriggerSubtractionEnabled().
void CAENV890::SetTriggerMatchingMode | ( | ) |
Trigger mode management:.
Enables the module to run in trigger match mode. See section 2.2 of the manual for more information. This mode is mutually exclusive from Continuous storage mode (see SetContinousStorageMode()).
Definition at line 475 of file v890.cpp.
References WriteMicro().
void CAENV890::SetContinuousStorageMode | ( | ) |
Enables the module to run in continuous storage mode (see ection 2.2 of the manual for more infomration). This mode is mutually exclusive from trigger match mode (see SetTriggerMatchingMode()).
Definition at line 485 of file v890.cpp.
References WriteMicro().
bool CAENV890::isTriggerMatchingMode | ( | ) |
Determines if the module is in trigger matching mode.
Definition at line 496 of file v890.cpp.
References ReadMicroArray().
void CAENV890::EnableChannel | ( | int | nChan | ) |
Channel enables:.
Enable an individual channel
nChan | (int [in]): The channel to enable. |
Definition at line 512 of file v890.cpp.
References WriteMicro().
void CAENV890::DisableChannel | ( | int | nChan | ) |
Disable an individual channel:
nChan | (int [in]): Selects the channel to disable. |
Definition at line 529 of file v890.cpp.
References WriteMicro().
void CAENV890::EnableAllChannels | ( | ) |
void CAENV890::DisableAllChannels | ( | ) |
void CAENV890::SetChannelMask | ( | unsigned short * | pMask | ) |
void CAENV890::ReadChannelEnables | ( | unsigned short * | pEnables | ) |
void CAENV890::SetWindowWidth | ( | int | ns | ) |
Set the trigger window width.
ns | (int [in]): ns to set the trigger window to. Note that the resolution of the trigger window is 25ns, so this is rounded to the nearest 25ns. |
string | if the ns parameter is not in the range 0-102400 ns. |
Definition at line 590 of file v890.cpp.
References m_nTdcMaxVal, NsToTicks(), TicksToNs(), and WriteMicroArray().
int CAENV890::GetWindowWidth | ( | ) |
Get the trigger window width currently set in the module.
Definition at line 615 of file v890.cpp.
References ReadTriggerConfig(), TicksToNs(), and CAENV890::TriggerInfo::Window.
void CAENV890::SetWindowOffset | ( | int | ns | ) |
Set the window offset of the tdc:
ns | - (int [in]): Window offset in ns. This is converted to nearest 25ns clock tick prior to programming. |
string | Exceptions if the resulting clock tick count is out of the valid range of -2048 to 40. |
Definition at line 632 of file v890.cpp.
References msg, NsToTicks(), and WriteMicroArray().
int CAENV890::GetWindowOffset | ( | ) |
Get the current value of the tdc window offset.
Definition at line 650 of file v890.cpp.
References CAENV890::TriggerInfo::Offset, ReadTriggerConfig(), and TicksToNs().
void CAENV890::EnableTriggerSubtraction | ( | ) |
void CAENV890::DisableTriggerSubtraction | ( | ) |
bool CAENV890::TriggerSubtractionEnabled | ( | ) |
Return the state of the trigger subtraction mode.
Definition at line 679 of file v890.cpp.
References ReadTriggerConfig(), and CAENV890::TriggerInfo::SubtractionEnabled.
void CAENV890::SetEdgeDetection | ( | CAENV890::EdgeDetectSelection | edge | ) |
Set edge detection mode.
edge | (CAENV80::EdgeDetectSelection [in]): Desired edge detection mode. |
string | If the detection mode is invalid (ints look too much like enums). |
Definition at line 693 of file v890.cpp.
References EdgePairs, EitherEdge, and WriteMicroArray().
CAENV890::EdgeDetectSelection CAENV890::GetEdgeDetection | ( | ) |
Retrieve the edge detection mode.
Definition at line 706 of file v890.cpp.
References ReadMicroArray().
void CAENV890::SetResolution | ( | CAENV890::ResolutionSelection | res | ) |
Set the module resolution.
res | (CAENV890::ResolutionSelection [in]): Resolution to select. |
string | Throws an error message if the resolution is illegal. |
Definition at line 721 of file v890.cpp.
References ps100, ps800, and WriteMicroArray().
CAENV890::ResolutionSelection CAENV890::GetResolution | ( | ) |
Get the module resolution.
Definition at line 734 of file v890.cpp.
References ReadMicroArray().
void CAENV890::EnableDelimeters | ( | ) |
Enable the ADC to produce a header and EOB (collectively called delimieters).
Definition at line 745 of file v890.cpp.
References WriteMicro().
void CAENV890::DisableDelimeters | ( | ) |
Disable the ADC production of header and EOB (collectively called delimeters).
Definition at line 754 of file v890.cpp.
References WriteMicro().
bool CAENV890::DelimetersEnabled | ( | ) |
Determine if delimeters are on or off (see EnableDelimeters and DisableDelimeters).
Definition at line 766 of file v890.cpp.
References ReadMicroArray().
void CAENV890::SetMaxHits | ( | CAENV890::MaxHitSelection | hits | ) |
Set the maximum number of hits that will be returned for an event. This value is a per TDC value if I read the manual correctly, that is If you set a value of 1, you could get 4 hits. See 5.5.5 and read carefully!!!
hits | (CAENV890::MaxHitSelection [in]): Selects the maximum number of hits to accept. string error messgae if hits is invalid. |
Definition at line 783 of file v890.cpp.
References HitMaxNoLimit, and WriteMicroArray().
CAENV890::MaxHitSelection CAENV890::GetMaxHits | ( | ) |
Returns the maximum number of hits that will be returned for an event. See SetMaxHits for more information about the trickiness of this function.
Definition at line 796 of file v890.cpp.
References ReadMicroArray().
bool CAENV890::DataReady | ( | ) |
Test for data in the output buffer.
Definition at line 925 of file v890.cpp.
References m_pModule, pModule(), and STAT_DATAREADY().
unsigned int CAENV890::Read | ( | unsigned int | nBufferSize, | |
void * | pBuffer | |||
) |
void CAENV890::MapModule | ( | ) | [protected] |
Create a mapping to the module. See the constructor for information about how the member variables will be set up. The base address of the module will be put in m_pModule.
string |
|
Definition at line 206 of file v890.cpp.
References CAENPROMSize(), CAENRegisterSize(), CAENRegisters::m_Ader24, CAENRegisters::m_Ader32, CAENRegisters::m_EnableAder, m_fGeographical, CAENRegisters::m_Geo, m_lBase, m_nCrate, m_nModuleType, m_nSlot, m_pModule, m_pVmeDevice, MapRegions(), ReadModuleType(), and Reset().
Referenced by CAENV890().
void * CAENV890::MapRegions | ( | void * | pfd, | |
unsigned long | base | |||
) | [protected] |
Create mappings to both the module registers and prom given a device an the base address. The register mappings will be returned in m_pModule and the prom map will be returned in the function return value. This function is a protected utility.
pfd | (void* [in]): pointer to handle from CVMEInterface::Open (could be a geo or an A32 mapping). | |
base | (unsigned long[in]): Base address of the module (registers). |
Definition at line 186 of file v890.cpp.
References CAENPROMOffset(), CAENPROMSize(), CAENRegisterSize(), and m_pModule.
Referenced by MapModule().
void CAENV890::WriteMicro | ( | unsigned short | opcode | ) | [protected] |
u_short CAENV890::ReadMicro | ( | ) | [protected] |
Read a word from the micro controller.
Definition at line 832 of file v890.cpp.
References assinine_delay(), m_pModule, pModule(), and UH_READ_OK().
Referenced by isTriggerMatching().
void CAENV890::ReadMicroArray | ( | unsigned short | opcode, | |
unsigned short | nWords, | |||
void * | pBuffer | |||
) | [protected] |
Referenced by DelimetersEnabled(), GetEdgeDetection(), GetMaxHits(), GetResolution(), isTriggerMatchingMode(), and ReadTriggerConfig().
void CAENV890::WriteMicroArray | ( | unsigned short | opcode, | |
unsigned short | nWords, | |||
void * | pBuffer | |||
) | [protected] |
Referenced by SetEdgeDetection(), SetMaxHits(), SetResolution(), SetWindowOffset(), and SetWindowWidth().
int CAENV890::ReadModuleType | ( | void * | prom | ) | [static, protected] |
Utility function to read the module type given a pointer to the PROM.
Definition at line 882 of file v890.cpp.
References CAENProm::m_BoardType, CAENProm::m_BoardTypeLSB, and CAENProm::m_BoardTypeMSB.
Referenced by MapModule().
int CAENV890::TicksToNs | ( | int | ticks | ) | [static, protected] |
Utility to convert ticks to ns.
ticks | (int [in]): Number of m_nTdcClock ns clocks to convert. |
Definition at line 899 of file v890.cpp.
References m_nTdcClock.
Referenced by GetWindowOffset(), GetWindowWidth(), and SetWindowWidth().
int CAENV890::NsToTicks | ( | int | ns | ) | [static, protected] |
Utility to convert ns to ticks.
ns | (int [in]): Number of ns to convert. |
Definition at line 911 of file v890.cpp.
References m_nTdcClock.
Referenced by SetWindowOffset(), and SetWindowWidth().
int CAENV890::m_nSlot [private] |
int CAENV890::m_nCrate [private] |
bool CAENV890::m_fGeographical [private] |
unsigned long CAENV890::m_lBase [private] |
void* CAENV890::m_pModule [private] |
Definition at line 21 of file v890.h.
Referenced by Clear(), DataReady(), EmptyEvent(), EmptyEventOn(), getRegisters(), getSlotRegister(), MapModule(), MapRegions(), ReadMicro(), Reset(), and ~CAENV890().
void* CAENV890::m_pVmeDevice [private] |
unsigned CAENV890::m_nModuleType [private] |
const int CAENV890::m_nTdcClock [static] |
const int CAENV890::m_nTdcMaxVal [static] |