#include <CCamacModule.h>
Inheritance diagram for CCamacModule:
Public Member Functions | |
CCamacModule (unsigned int branch, unsigned int crate, unsigned int slot) | |
Default constructor. | |
CCamacModule (const CCamacModule &rhs) | |
Copy constructor. | |
~CCamacModule () | |
Destructor. | |
CCamacModule & | operator= (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. |
Definition at line 296 of file CCamacModule.h.
CCamacModule::CCamacModule | ( | unsigned int | branch, | |
unsigned int | crate, | |||
unsigned int | slot | |||
) |
Default constructor.
Construct a module in a crate somewhere.
branch | - CAMAC Branch in which the module lives. | |
crate | - Crate within the branch. | |
slot | - Slot within the crate |
CRangeError | - if the branch, crate or slot are illegal. |
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.
rhs | - the source of the copy. |
Definition at line 366 of file CCamacModule.cpp.
CCamacModule::~CCamacModule | ( | ) | [inline] |
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.
aCCamacModule | - rhs of the assignment. |
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] |
unsigned int CCamacModule::getBranch | ( | ) | const [inline] |
unsigned short CCamacModule::getCrate | ( | ) | const [inline] |
int CCamacModule::getSlot | ( | ) | const [inline] |
unsigned long* CCamacModule::getBase | ( | ) | const [inline] |
unsigned long CCamacModule::Read | ( | unsigned int | f, | |
unsigned int | a | |||
) | const |
Reads 24 bits of data from the module:
f | - CAMAC function code must be in the set [0-7] | |
a | - Subaddress to assert must be in the set [0-15]. |
CRangeError | - if either the function code or the subaddress are out of range. |
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.
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. |
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.
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]. |
CRangeError | is thrown if f is not a control code or if a is an invalid subadress. |
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.
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.
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
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.
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] |
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:
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:
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.
f | - The function to check. |
Definition at line 649 of file CCamacModule.cpp.
References isRead(), and isWrite().
Referenced by Control().
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=().