CCamacModule Class Reference

#include <CCamacModule.h>

Inheritance diagram for CCamacModule:

CBD8210 CCamacNimout List of all members.

Public Member Functions

 CCamacModule (unsigned int branch, unsigned int crate, unsigned int slot)
 Default constructor.
 CCamacModule (const CCamacModule &rhs)
 Copy constructor.
 ~CCamacModule ()
 Destructor.
CCamacModuleoperator= (const CCamacModule &rhs)
 Assignment.
int operator== (const CCamacModule &rhs) const
 Comparison for equality.
int operator!= (const CCamacModule &rhs) const
unsigned int getBranch () const
unsigned short getCrate () const
int getSlot () const
unsigned long * getBase () const
unsigned long Read (unsigned int f, unsigned int a) const
void Write (unsigned int f, unsigned int a, unsigned long d) const
unsigned short Control (unsigned int f, unsigned int a) const
unsigned long * MakePointer (unsigned int f, unsigned int a, bool isshort=false) const
unsigned long * MakePointer (unsigned int c, unsigned int n, unsigned int a, unsigned int f, bool isshort=false) const

Static Public Member Functions

static bool ValidBranch (unsigned int branch)
static bool ValidCrate (unsigned int crate)
static bool ValidSlot (unsigned int slot)
static bool ValidSubaddress (unsigned int a)
static bool ValidFunction (unsigned int f)
static bool isRead (unsigned int f)
static bool isWrite (unsigned int f)
static bool isControl (unsigned int f)

Private Attributes

unsigned int m_nBranch
 Branch module lives in (0-7).
unsigned short m_nCrate
 Crate module lives in (1-7).
int m_nSlot
 Slot module lives in. 24-31 are controller.
unsigned long * m_pBase
 Base address of module.

Detailed Description

Encapsulates a generic camac module. CAMAC modules are assumed to live inside of the VME space through the CES/CBD 8210. A Camac module is geographicall defined in terms of its Branch Crate and Slot. More specialized modules can be generated and can cache pointers to time critical functions using the MakePointer member function.

Definition at line 296 of file CCamacModule.h.


Constructor & Destructor Documentation

CCamacModule::CCamacModule ( unsigned int  branch,
unsigned int  crate,
unsigned int  slot 
)

Default constructor.

Construct a module in a crate somewhere.

Parameters:
branch - CAMAC Branch in which the module lives.
crate - Crate within the branch.
slot - Slot within the crate
Exceptions:
CRangeError - if the branch, crate or slot are illegal.
Note:
- Crate controllers can be constructed with full slot addressing up to n=31.

Definition at line 322 of file CCamacModule.cpp.

References BRANCH_RANGE, CCamac::BranchInit(), CRATE_RANGE, m_pBase, MakePointer(), SLOT_RANGE, ValidBranch(), ValidCrate(), and ValidSlot().

CCamacModule::CCamacModule ( const CCamacModule rhs  ) 

Copy constructor.

Copy construction. This is invoked when e.g. an object is passed by value to a function. The copy constructor makes a clone of the rhs object.

Parameters:
rhs - the source of the copy.

Definition at line 366 of file CCamacModule.cpp.

CCamacModule::~CCamacModule (  )  [inline]

Destructor.

Definition at line 311 of file CCamacModule.h.


Member Function Documentation

CCamacModule & CCamacModule::operator= ( const CCamacModule aCCamacModule  ) 

Assignment.

Assignment operation. This member function supports assignment of an object of this class to an object of the same class.

Parameters:
aCCamacModule - rhs of the assignment.
Returns:
Reference to the lhs of the assignment. This allows = to be chained.

Definition at line 384 of file CCamacModule.cpp.

References m_nBranch, m_nCrate, m_nSlot, and m_pBase.

Referenced by CCamacNimout::operator=(), and CBD8210::operator=().

int CCamacModule::operator== ( const CCamacModule rhs  )  const

Comparison for equality.

Compare for equality. If equal, all members are equal. The pointer is derived from b,c,n so it is not compared:

Definition at line 403 of file CCamacModule.cpp.

References m_nBranch, m_nCrate, and m_nSlot.

Referenced by operator!=().

int CCamacModule::operator!= ( const CCamacModule rhs  )  const [inline]

Definition at line 315 of file CCamacModule.h.

References operator==().

unsigned int CCamacModule::getBranch (  )  const [inline]

Definition at line 322 of file CCamacModule.h.

References m_nBranch.

unsigned short CCamacModule::getCrate (  )  const [inline]

Definition at line 326 of file CCamacModule.h.

References m_nCrate.

int CCamacModule::getSlot (  )  const [inline]

Definition at line 330 of file CCamacModule.h.

References m_nSlot.

unsigned long* CCamacModule::getBase (  )  const [inline]

Definition at line 334 of file CCamacModule.h.

References m_pBase.

unsigned long CCamacModule::Read ( unsigned int  f,
unsigned int  a 
) const

Reads 24 bits of data from the module:

Parameters:
f - CAMAC function code must be in the set [0-7]
a - Subaddress to assert must be in the set [0-15].
Exceptions:
CRangeError - if either the function code or the subaddress are out of range.
Parameters:
unsigned int f, unsigned int a

Definition at line 425 of file CCamacModule.cpp.

References isRead(), MakePointer(), READ_RANGE, SUB_RANGE, and ValidSubaddress().

Referenced by CCrateController::Lams().

void CCamacModule::Write ( unsigned int  f,
unsigned int  a,
unsigned long  d 
) const

Transfers a 24 bit data item to the module.

Parameters:
f - Function code to use for the transfer. Must be in the set [16-23].
a - Subaddress to use for transfer. Must be in the set [0-15]
d - Data to write to the module.
Exceptions:
CRangeError - Thrown if either f or a are invalid for a write.

Definition at line 458 of file CCamacModule.cpp.

References isWrite(), MakePointer(), SUB_RANGE, ValidSubaddress(), and WRITE_RANGE.

Referenced by CCrateController::BroadcastWrite(), CCAMACScalerLRS4434::Clear(), CCAMACScalerLRS4434::Initialize(), CCrateController::MulticastWrite(), and CCrateController::WriteSnr().

unsigned short CCamacModule::Control ( unsigned int  f,
unsigned int  a 
) const

Performs a CAMAC control (non data transfer) operation on the module.

Parameters:
f - Function code to execute. This must be in the set: [8-15,24-31].
a - Subaddress at which the function is directed. This must be in the range of [0-15].
Exceptions:
CRangeError is thrown if f is not a control code or if a is an invalid subadress.
Note:
A minor kludge: There are two valid ranges for f. These will be encoded in the message and the lowest set will be supplied as the 'valid lower/upper' ranges for the CRangeError throw.

Definition at line 499 of file CCamacModule.cpp.

References CTL_RANGES, isControl(), MakePointer(), SUB_RANGE, and ValidSubaddress().

Referenced by CCrateController::BroadcastControl(), CCrateController::C(), CCAMACScalerLRS2551::Clear(), CCrateController::DisableDemand(), CCrateController::EnableDemand(), CCrateController::Inhibit(), CCrateController::isDemandEnabled(), CCrateController::isDemanding(), CCrateController::isInhibited(), CCrateController::MulticastControl(), CCrateController::UnInhibit(), and CCrateController::Z().

unsigned long * CCamacModule::MakePointer ( unsigned int  f,
unsigned int  a,
bool  isshort = false 
) const

Returns a pointer which when dereferenced appropriately will perform the selected CAMAC function.

Parameters:
f - Function to perform.
a - Subaddress to which the function will be directed.
isshort - true if the pointer is for a 16 bit camac operation false if for 24 bits.
unsigned int f, unsigned int n, bool isshort=false

Definition at line 534 of file CCamacModule.cpp.

References AShift, FShift, m_pBase, and ShortBit.

Referenced by CBD8210::CBD8210(), CCamacModule(), CCamacNimout::CCamacNimout(), Control(), Read(), and Write().

unsigned long * CCamacModule::MakePointer ( unsigned int  c,
unsigned int  n,
unsigned int  f,
unsigned int  a,
bool  isshort = false 
) const

Returns a pointer which when derererenced will perform the appropriate CAMAC function on the branch the module lives in. This overload differs from the prior MakePointer by allowing any crate or slot in the branch to be referenced.

Parameters:
c - Crate to reference.
n - Slot to reference.
f - Function code.
a - Subaddress.
isshort - When true, the pointer is generated for a short access, when not, for a long.
 

Definition at line 563 of file CCamacModule.cpp.

References AShift, CCamac::Base(), CCamac::BranchInit(), CShift, FShift, m_nBranch, NShift, and ShortBit.

bool CCamacModule::ValidBranch ( unsigned int  branch  )  [static]

Determines if a branch number is valid. This is a static member functionl

Parameters:
branch - The branch number to check.

Definition at line 589 of file CCamacModule.cpp.

References BRANCH_RANGE.

Referenced by CCamacModule().

bool CCamacModule::ValidCrate ( unsigned int  crate  )  [static]

Definition at line 594 of file CCamacModule.cpp.

References CRATE_RANGE.

Referenced by CCamacModule().

bool CCamacModule::ValidSlot ( unsigned int  slot  )  [static]

Determines if slot is a valid slot number.

Parameters:
slot - Slot number to check.

Definition at line 604 of file CCamacModule.cpp.

References SLOT_RANGE.

Referenced by CCamacModule().

bool CCamacModule::ValidSubaddress ( unsigned int  a  )  [static]

Determines if a is valid subaddress.

Parameters:
a - Subaddress to check.

Definition at line 613 of file CCamacModule.cpp.

References SUB_RANGE.

Referenced by Control(), Read(), and Write().

bool CCamacModule::ValidFunction ( unsigned int  f  )  [static]

Determines if the selected function code is valid. f - the function code to check.

Definition at line 622 of file CCamacModule.cpp.

References F_RANGE.

bool CCamacModule::isRead ( unsigned int  f  )  [static]

Determines if the specified function code is a Read function:

Parameters:
f - Function to check.

Definition at line 631 of file CCamacModule.cpp.

References READ_RANGE.

Referenced by isControl(), and Read().

bool CCamacModule::isWrite ( unsigned int  f  )  [static]

Determines if the function is a write function code:

Parameters:
f - Function code to check.

Definition at line 640 of file CCamacModule.cpp.

References WRITE_RANGE.

Referenced by isControl(), and Write().

bool CCamacModule::isControl ( unsigned int  f  )  [static]

Determines if a function code is a control function.

Parameters:
f - The function to check.

Definition at line 649 of file CCamacModule.cpp.

References isRead(), and isWrite().

Referenced by Control().


Member Data Documentation

unsigned int CCamacModule::m_nBranch [private]

Branch module lives in (0-7).

Definition at line 299 of file CCamacModule.h.

Referenced by getBranch(), MakePointer(), operator=(), and operator==().

unsigned short CCamacModule::m_nCrate [private]

Crate module lives in (1-7).

Definition at line 300 of file CCamacModule.h.

Referenced by getCrate(), operator=(), and operator==().

int CCamacModule::m_nSlot [private]

Slot module lives in. 24-31 are controller.

Definition at line 301 of file CCamacModule.h.

Referenced by getSlot(), operator=(), and operator==().

unsigned long* CCamacModule::m_pBase [private]

Base address of module.

Definition at line 302 of file CCamacModule.h.

Referenced by CCamacModule(), getBase(), MakePointer(), and operator=().


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