CSIS3820 Class Reference

#include <CSIS3820.h>

Inheritance diagram for CSIS3820:

CModule32 List of all members.

Public Types

enum  OperatingMode {
  LatchingScaler = 0x00000000, ReservedScaler1 = 0x10000000, MultiChannelScaler = 0x20000000, HistogrammingScaler = 0x30000000,
  ReservedScaler2 = 0x40000000, ReservedScaler3 = 0x50000000, ReservedScaler4 = 0x60000000, RamTestScaler = 0x70000000
}
enum  InputMode {
  NoInputs = 0x0000000, InputLatchInhibitLatch = 0x0010000, InputLatchInhibitAllAndLatch = 0x0020000, InputLatchInhibitAll = 0x0030000,
  InhibitGroups = 0x0040000, InputLNEHiscal = 0x0050000, InputLNEInhAllExtClear = 0x0060000, InputReserved7 = 0x0070000
}
enum  LNESource {
  LatchVMEOnly = 0x00000000, LatchFP = 0x00000010, Latch10Mhz = 0x00000020, LatchChannelN = 0x00000030,
  LatchPresetN = 0x00000040, LatchReserved5 = 0x00000050, LatchReserved6 = 0x00000060, LatchReserved7 = 0x00000070
}

Public Member Functions

 CSIS3820 (unsigned long base, int crate=0) throw (STD(string))
virtual ~CSIS3820 ()
double getRevision () const
 Get firmware revision.
void LightOn () const
 Turn on the user led.
void LightOff () const
 Turn off the user led.
unsigned int getCsr () const
 Return value of CSR.
unsigned long getAcqMode () const
void Reset () const
 Reset the module.
void setOperatingMode (OperatingMode mode) const throw (STD(string))
OperatingMode getOperatingMode () const
void setInputMode (InputMode mode) const throw (STD(string))
InputMode getInputMode () const
void setLatchSource (LNESource mode) const throw (STD(string))
LNESource getLatchSource () const
void Arm () const
 Arm the module.
bool isArmed () const
 true if module is armed..
void Enable () const
 Enable the module...
void Disable () const
 Disable the mdoule...
bool isEnabled () const
 true if module is enabled.
void EnableReferencePulser () const
 Enable the ref pulser.
void DisableReferencePulser () const
 Turn off ref pulser.
bool isReferencePulserEnabled () const
 Test state of ref. pulser.
void EnableTestCounter () const
 Turn on 25mhz test pulser.
void DisableTestCounter () const
 Turn off 25mhz test pulser.
bool isTestCounterOn () const
 is test pulser on??
void ClearChannels () const
 Clear all scaler chans.
void DisableClearOnLatch () const
 Turn off clear on latch.
void EnableClearOnLatch () const
 Turn on clear on latch.
unsigned long ReadChannel (unsigned int num) const
 read live channel.
void ReadAllChannels (unsigned long *buffer) const
void Latch () const
 Latch scalers.
unsigned long ReadLatchedChannel (unsigned int num) const
void ReadAllLatchedChannels (unsigned long *buffer) const
void LatchAndRead (unsigned long *buffer) const

Protected Member Functions

int getModuleInfo () const
void setAcqMode (unsigned long data) const
 Set acq mode reg.
void setCSR (unsigned int long data) const

Static Protected Member Functions

static void ValidChannel (unsigned int chan, const char *pWhere) throw (STD(string))
static unsigned long ChannelOffset (unsigned long base, unsigned int chan)

Private Member Functions

 CSIS3820 (const CSIS3820 &)
CSIS3820operator= (const CSIS3820 &)
int operator== (const CSIS3820 &)
int operator!= (const CSIS3820 &)

Detailed Description

Controls an SIS3820 module. The SIS3820 is a 32 channel latching VME scaler module.

Definition at line 301 of file CSIS3820.h.


Member Enumeration Documentation

enum CSIS3820::OperatingMode

Enumerator:
LatchingScaler  Scaler operating mode. Latching scaler.
ReservedScaler1 
MultiChannelScaler  Multichannel scaler.
HistogrammingScaler  Histogramming scaler.
ReservedScaler2 
ReservedScaler3 
ReservedScaler4 
RamTestScaler  Test FIFO and ram.

Definition at line 307 of file CSIS3820.h.

enum CSIS3820::InputMode

Module input modes. See setInputMode for a full description of these bits.

Enumerator:
NoInputs 
InputLatchInhibitLatch 
InputLatchInhibitAllAndLatch 
InputLatchInhibitAll 
InhibitGroups 
InputLNEHiscal 
InputLNEInhAllExtClear 
InputReserved7 

Definition at line 321 of file CSIS3820.h.

enum CSIS3820::LNESource

Defines the legal latch sources for the scaler. Note that not all of them have software support. see the description of setLatchSource for more information.

Enumerator:
LatchVMEOnly 
LatchFP 
Latch10Mhz 
LatchChannelN 
LatchPresetN 
LatchReserved5 
LatchReserved6 
LatchReserved7 

Definition at line 339 of file CSIS3820.h.


Constructor & Destructor Documentation

CSIS3820::CSIS3820 ( unsigned long  base,
int  crate = 0 
) throw (STD(string))

Construct a module object. The module object is the software entity through which the device will be controlled.

The default mode of the device is a latching scaler with inputs in InputLatchInhibitAllAndLatch (inputs configured to support external latch as well as inhibits on the external latch and all counters.

We also arrange the LNE source to be front panel (VME Key is always a valid option).

Parameters:
base (unsigned long [in]) base address of the module.
crate (int [in] = 0): Crate in which the module lives.
Exceptions:
string If the module cannot be mapped a string describing the problem is thrown

Definition at line 379 of file CSIS3820.cpp.

References IDMask(), and IDShift().

virtual CSIS3820::~CSIS3820 (  )  [inline, virtual]

Definition at line 356 of file CSIS3820.h.

CSIS3820::CSIS3820 ( const CSIS3820  )  [private]


Member Function Documentation

CSIS3820& CSIS3820::operator= ( const CSIS3820  )  [private]

int CSIS3820::operator== ( const CSIS3820  )  [private]

int CSIS3820::operator!= ( const CSIS3820  )  [private]

double CSIS3820::getRevision (  )  const

Get firmware revision.

Returns the revision level of the module as a floating point value of the form major.minor.

Definition at line 404 of file CSIS3820.cpp.

References getModuleInfo(), MAJORShift(), and REVMask().

Referenced by sis3820tests::TestFirmware().

void CSIS3820::LightOn (  )  const

Turn on the user led.

Turn on the user led. This is done by turning on the bottom bit in the CSR.

Definition at line 428 of file CSIS3820.cpp.

References LEDOn(), and setCSR().

Referenced by sis3820tests::TestCSRRead(), and sis3820tests::TestReset().

void CSIS3820::LightOff (  )  const

Turn off the user led.

Turn off the user led. This is done by turning on the 16'th bit of the CSR (numbered from 0).

Definition at line 437 of file CSIS3820.cpp.

References LEDOff(), and setCSR().

Referenced by sis3820tests::TestCSRRead().

unsigned int CSIS3820::getCsr (  )  const

Return value of CSR.

Return the current contents of the CSR. This is required if nothing else to make my test suite's run but may be of interest to users as well. It's harmless since I'm only giving read access.

Definition at line 449 of file CSIS3820.cpp.

References CSR, and CModule32::peek().

Referenced by isArmed(), isEnabled(), isReferencePulserEnabled(), isTestCounterOn(), sis3820tests::TestCSRRead(), and sis3820tests::TestReset().

unsigned long CSIS3820::getAcqMode (  )  const

Return value of the ACQ mode register.

Definition at line 458 of file CSIS3820.cpp.

References ACQMode(), and CModule32::peek().

Referenced by DisableClearOnLatch(), EnableClearOnLatch(), getInputMode(), getLatchSource(), and getOperatingMode().

void CSIS3820::Reset (  )  const

Reset the module.

Reset the module. Module goes back to its power up state but does not take the time to do self tests (this is instantaneous).

Definition at line 468 of file CSIS3820.cpp.

References CModule32::Key(), and RESET.

Referenced by sis3820tests::TestReset().

void CSIS3820::setOperatingMode ( CSIS3820::OperatingMode  mode  )  const throw (STD(string))

Set the operating mode to whatever the user requests. At present the following mode are supported:

Parameters:
mode (CSIS3820::OperatingMode [in]): The desired operating mode. See the text above for restrictions.
Exceptions:
string If the operating mode is illegal.

Definition at line 492 of file CSIS3820.cpp.

Referenced by sis3820tests::ArmInLatchMode(), iniscl(), sis3820tests::InvalidMode(), and sis3820tests::LatchMode().

CSIS3820::OperatingMode CSIS3820::getOperatingMode (  )  const

Return the current operating mode.

Definition at line 524 of file CSIS3820.cpp.

References getAcqMode(), and OperatingModeMask().

Referenced by sis3820tests::LatchMode().

void CSIS3820::setInputMode ( CSIS3820::InputMode  mode  )  const throw (STD(string))

Set the input mode of the module. The input mode defines which inputs do what on the module. Since the module is run by an FPGA, these are highly programmable. The following modes are supported (undescribed inputs do nothing):

Parameters:
mode (CSIS3820::InputMode [in]) desired new input mode.
Exceptions:
string If an invalid input mode is specified.

Definition at line 583 of file CSIS3820.cpp.

Referenced by iniscl(), and sis3820tests::TestInputModes().

CSIS3820::InputMode CSIS3820::getInputMode (  )  const

Return the current input mode. We are helped by the fact that the input mode enum is set up so that the values are the values stored in the bitfield, already appropriately positioned:

Returns:
CSIS3820::InputMode The current input mode.

Definition at line 631 of file CSIS3820.cpp.

References getAcqMode(), and InputModeMask().

Referenced by sis3820tests::TestInputModes().

void CSIS3820::setLatchSource ( LNESource  mode  )  const throw (STD(string))

Set the source of the latch request. The latch request will copy all scalers to the shadow registers within 5ns, where they will be stable and can be read. The modes defined by the module are:

Parameters:
mode (CSIS3820::CLNESource [in]): The latch mode to be selected.
Exceptions:
string if the latch mode is unsupported.

Definition at line 663 of file CSIS3820.cpp.

Referenced by sis3820tests::TestLNESource().

CSIS3820::LNESource CSIS3820::getLatchSource (  )  const

Return the current value of the latching mode.

Definition at line 704 of file CSIS3820.cpp.

References getAcqMode(), and LatchModeMask().

Referenced by sis3820tests::TestLNESource().

void CSIS3820::Arm (  )  const

Arm the module.

Arm the module. To count, the module must be armed and enabled.

Definition at line 716 of file CSIS3820.cpp.

References ARM(), and CModule32::Key().

Referenced by sis3820tests::Arm(), sis3820tests::ArmInLatchMode(), and iniscl().

bool CSIS3820::isArmed (  )  const

true if module is armed..

Determine if the module is armed.

Definition at line 725 of file CSIS3820.cpp.

References getCsr(), and ISARMED().

Referenced by sis3820tests::Arm().

void CSIS3820::Enable (  )  const

Enable the module...

Enable the scaler.

Definition at line 735 of file CSIS3820.cpp.

References ENABLE(), and CModule32::Key().

Referenced by sis3820tests::Count2sec(), sis3820tests::Enable(), and iniscl().

void CSIS3820::Disable (  )  const

Disable the mdoule...

Disable the scaler.

Definition at line 744 of file CSIS3820.cpp.

References DISABLE(), and CModule32::Key().

Referenced by sis3820tests::ClearChannels(), sis3820tests::ClearOnLatch(), and sis3820tests::Enable().

bool CSIS3820::isEnabled (  )  const

true if module is enabled.

Return true if the module is enabled. note that in order to deal with future developments supporting MCS mode, Enabled is defined as either of the SCALERENABLED and MCSENABLED bits set in the csr.

Definition at line 755 of file CSIS3820.cpp.

References getCsr(), MCSENABLED(), and SCALERENABLED().

Referenced by sis3820tests::Enable().

void CSIS3820::EnableReferencePulser (  )  const

Enable the ref pulser.

Select the input of channel 1 to be the reference pulser. The reference pulser is a 50Mhz crystal oscillator. Note that 25Mhz test mode has priority over this setting.

Definition at line 767 of file CSIS3820.cpp.

References ENABLEREFPULSER(), and setCSR().

Referenced by sis3820tests::ReferencePulser(), and sis3820tests::SetupReferencePulser().

void CSIS3820::DisableReferencePulser (  )  const

Turn off ref pulser.

Turn off the reference pulser going into channel 1. After this, channel 1 is a normal scaler that counts whenever it sees an input pulse on the front panel.

Definition at line 777 of file CSIS3820.cpp.

References DISABLEREFPULSER(), and setCSR().

Referenced by sis3820tests::ReferencePulser().

bool CSIS3820::isReferencePulserEnabled (  )  const

Test state of ref. pulser.

Return true if the reference pulser is currently enabled into channel 1 of the module

Returns:
bool
  • true if the reference pulser is on.
  • false if not.

Definition at line 789 of file CSIS3820.cpp.

References getCsr(), and REFPULSERON().

Referenced by sis3820tests::ReferencePulser().

void CSIS3820::EnableTestCounter (  )  const

Turn on 25mhz test pulser.

Enable the 25Mhz test pulser to clock all scaler channels. This setting overrides the reference pulser setting if both are set.

Definition at line 802 of file CSIS3820.cpp.

References ENABLETESTPULSER(), and setCSR().

Referenced by sis3820tests::CounterTestMode(), and sis3820tests::Setup25MhzCounter().

void CSIS3820::DisableTestCounter (  )  const

Turn off 25mhz test pulser.

Disable the 25Mhz test pulser.

Definition at line 810 of file CSIS3820.cpp.

References DISABLETESTPULSER(), and setCSR().

Referenced by sis3820tests::ClearChannels(), and sis3820tests::CounterTestMode().

bool CSIS3820::isTestCounterOn (  )  const

is test pulser on??

True if the 25Mhz test pulser is enabled into all the channels.

Returns:
bool
  • true the 25Mhz test pulser is on.
  • false the 25Mhz test pulser is off.

Definition at line 821 of file CSIS3820.cpp.

References getCsr(), and TESTPULSERON().

Referenced by sis3820tests::CounterTestMode().

void CSIS3820::ClearChannels (  )  const

Clear all scaler chans.

Clear all the channels via write to the clear key register.

Definition at line 831 of file CSIS3820.cpp.

References CLEAR(), and CModule32::Key().

Referenced by sis3820tests::ClearChannels(), and sis3820tests::ClearOnLatch().

void CSIS3820::DisableClearOnLatch (  )  const

Turn off clear on latch.

Disable the auto clear on the latch function. After this is called, the scaler counters will not clear when latched but will continue to count.

Definition at line 842 of file CSIS3820.cpp.

References getAcqMode(), NONCLEARINGMODE(), and setAcqMode().

Referenced by sis3820tests::ClearOnLatch(), and iniscl().

void CSIS3820::EnableClearOnLatch (  )  const

Turn on clear on latch.

Enable the autoclear on latch function. After this is called scaler counters will be cleare when latched...and then continue to count.

Definition at line 854 of file CSIS3820.cpp.

References getAcqMode(), NONCLEARINGMODE(), and setAcqMode().

Referenced by sis3820tests::ClearOnLatch().

unsigned long CSIS3820::ReadChannel ( unsigned int  num  )  const

read live channel.

Read a channel of the scaler. Note that this reads the live scaler channels, not the latched scalers. To read latched scaler values, use ReadLatchedChannel

Parameters:
num (unsigned int [in]): The channel number in the range [0,ChannelCount).
Returns:
unsigned long The instantaneous channel value.
Note:
Reading a channel also causes a latch of the counters into the shadow registers. In other words it's synchronous (within 5ns) to read one channel and then read the rest with ReadLatchedChannel e.g.

Definition at line 880 of file CSIS3820.cpp.

References ChannelOffset(), COUNTERS(), CModule32::peek(), and ValidChannel().

Referenced by sis3820tests::Read1Channel(), and ReadAllChannels().

void CSIS3820::ReadAllChannels ( unsigned long *  buffer  )  const

Reads all scaler counters. See ReadChannel for more information about what this means and when it might be inappropriate.

Parameters:
buffer (unsigned long* [out]): Pointer to a 32 long buffer to hold the scaler values.

Definition at line 895 of file CSIS3820.cpp.

References ChannelCount(), and ReadChannel().

Referenced by sis3820tests::AllChannelsCount(), and sis3820tests::ReadAllChannels().

void CSIS3820::Latch (  )  const

Latch scalers.

Latch the current counters into the shadow registers. Once this has been done, the channels can be read via ReadLatchedChannel and ReadAllLatchedChannesl

Definition at line 908 of file CSIS3820.cpp.

References CModule32::Key(), and LATCH().

Referenced by LatchAndRead().

unsigned long CSIS3820::ReadLatchedChannel ( unsigned int  num  )  const

Read a specific channel from the latched channel (shadow) registers. In latch mode, the LNE or Latch operation (either front panel or Latch function) transfers the scaler counter values to shadow registers where they remain stable until the next latch function.

The transfer takes 5ns. This function reads a channel of these registers.

Parameters:
num (unsigned int [in]): The number of the channel to read, must be in the range [0, 32).
Returns:
unsigned long The value of the latched register for that channel.
Exceptions:
string If the channel value is out of range.

Definition at line 933 of file CSIS3820.cpp.

References ChannelOffset(), CModule32::peek(), SHADOWCOUNTERS(), and ValidChannel().

Referenced by ReadAllLatchedChannels().

void CSIS3820::ReadAllLatchedChannels ( unsigned long *  buffer  )  const

Read all latched channels. See ReadLatchedChannel and Latch for more information, however this function reads the values of all shadow registers into a user buffer.

Parameters:
buffer (unsigned long* [out]): user buffer of ChannelCount longs to hold the channel values.

Definition at line 948 of file CSIS3820.cpp.

References ChannelCount(), and ReadLatchedChannel().

Referenced by LatchAndRead(), and sis3820tests::LatchTest().

void CSIS3820::LatchAndRead ( unsigned long *  buffer  )  const

This convenience function does a Latch and then a call to ReadAllLatchedChannels.

Parameters:
buffer (unsigned long * [out]): Pointer to user buffer to hold the scalers.

Definition at line 962 of file CSIS3820.cpp.

References Latch(), and ReadAllLatchedChannels().

Referenced by sis3820tests::ClearChannels(), sis3820tests::ClearOnLatch(), and sis3820tests::LatchTest().

int CSIS3820::getModuleInfo (  )  const [protected]

Return the module information (id and firmware) register:

Definition at line 419 of file CSIS3820.cpp.

References IdAndFirmware(), and CModule32::peek().

Referenced by getRevision().

void CSIS3820::setAcqMode ( unsigned long  value  )  const [protected]

Set acq mode reg.

Utility function to set a new value for the acquisition mode register:

Definition at line 974 of file CSIS3820.cpp.

References ACQMode(), and CModule32::poke().

Referenced by DisableClearOnLatch(), and EnableClearOnLatch().

void CSIS3820::setCSR ( unsigned int long  data  )  const [protected]

Write a value to the CSR:

Definition at line 983 of file CSIS3820.cpp.

References CSR, and CModule32::poke().

Referenced by DisableReferencePulser(), DisableTestCounter(), EnableReferencePulser(), EnableTestCounter(), LightOff(), and LightOn().

void CSIS3820::ValidChannel ( unsigned int  chan,
const char *  pWhere 
) throw (STD(string)) [static, protected]

Throws a string exception if the channel number passed in is not a valid channel.

Parameters:
chan (unsigned int [in]): The number of the channel to check.
pWhere (const char* pWhere): The where context for the string.
Exceptions:
string If the channel is out of range.

Definition at line 998 of file CSIS3820.cpp.

References ChannelCount(), and msg.

Referenced by ReadChannel(), and ReadLatchedChannel().

unsigned long CSIS3820::ChannelOffset ( unsigned long  base,
unsigned int  chan 
) [static, protected]

Returns the offset into the module associated with a channel.

Parameters:
base (unsigned long): Base of the register page, usually either COUNTERS or SHADOWCOUNTERS (in future may be in the fifo/ram).
chan (unsigned int): Channel number to compute the offset for.
Returns:
unsigned long The offset at which the channel can be read.

Definition at line 1019 of file CSIS3820.cpp.

Referenced by ReadChannel(), and ReadLatchedChannel().


The documentation for this class was generated from the following files:
Generated on Wed Sep 17 08:38:11 2008 for NSCL Device support. by  doxygen 1.5.1