CCrateController

Name

CCrateController -- Encapsulation of a BiRa 1302 CAMAC controller via CES CBS8210.

Synopsis


#include <CCrateController.h>
            
 class CCrateController {

  CCrateController(unsigned int b, unsigned int c);

  void Z();
  void C();
  long Lams();
  void UnInhibit();
  void DisableDemand();
  void Inhibit();
  void nableDemand();
  bool isInhibited();
  bool isDemanding();
  bool isDemandEnabled();
  void BroadcastControl(unsigned int f, unsigned int a);
  void BroadcastWrite(unsigned int f, unsigned int a, unsigned long d);
  void MulticastControl(unsigned int f, unsigned int a, unsigned long nMask);
  void MulticastWrite(unsigned int f, unsigned int a, unsigned long nMask, unsigned long nData);
  void InitializeCrate();
}

Description

Instances of the CCrateController class allow you to manipulate a BiRA Model 1302 Type A1/A2 crate controller on the end of a parallel branch highway. The CAMAC Branch highway standard provides some common specifications for the behavior of Type A1 crate controller. In addition, there are some model specific features of the controller. It is certain that this class will work correctly with respect to the standard features of all A1/A2 crate controllers. Extension may or may not work depending on the way they've been implemented.

Public member functions

CCrateController(unsigned int b, unsigned int c);

Constructs a CCrateController object. b is the branch number, which also implies a VME crate number. c is the crate numbers set in the thumbwheels on the front of the CAMAC crate controller module.

void Z(void);

Performs a Z cycle on the CAMAC crate. The dataway Z line is pulse in accordance with the requirements of the CAMAC crate standard for Z cycles.

void C(void);

Peforms a C cyle on the crate. The C line is pulsed in accordance with the requirments of the CAMAC crate standard for C cycles.

long Lams(void);

Returns the 24 bit graded LAM mask from the controller. This is only meaningful if a lam grader is installed in the device to map the dataway LAM pattern to graded LAM values. At the NSCL we generally use a passive jumper block for a lam grader that maps the LAM of each slot into the corresponding bit of the LAM grader. The LAM grader plugs into a connector on the back of the controller module.

void UnInhibit(void);

Deasserts the data way I line. The I line provides an Inhibit signal to the modules. while modules are free, under the standard, to interpret the presence or absence of the I signal in any way desired by the designer, in general the I line is used to disable some functions of the module. For, example, in many digitization modules, the I line prevents gates from having any effect on the module.

void DisableDemand(void);

Disables the crate controllers ability to assert the branch demand (BD) line. The branch demand line is generally asserted by a crate controller if it has LAMs.

void Inhibit(void);

Asserts the I (inhibit) line on the crate dataway. See the UnInhibit function description for more information about this line and its purpose/funcion.

void EnableDemand(void);

Enable the module to assert the branch demand (BD) line if LAMs are present.

bool isInhibited(void);

Returns true if the data way is inhibited. Note that this function cannot be atomic, a test function must be performed, and the state of the branch Q read. Therefore to ensure reliable results, the VME bus should be software locked when doing this function.

bool isDemanding(void);

Returns true if the controller is asserting a branch demand.

bool isDemandEnabled(void);

Returns true if the branch demand is enabled.

void BroadcastControl(unsigned int f, unsigned int a);

Performs a control (non data transfer) broadcast operation to the crate. A broadcast operation sends the function code f and subaddress a to all modules by asserting all N lines (slot selects) during the cycle. f must be in one of the inclusive ranges 8-15 or 24-31.

void BroadcastWrite(unsigned int f, unsigned int a, unsigned long d);

Performs a broadcast write. Broadcast writes are like broadcast control operations (See BroadcastControl above) but data are assserted on the data way lines and the function code, f, must be in the inclusive range 16-23. This causes common write data to be transferred to all modules on the data way.

Note that as the data way read lines are bussed, it makes no sense to provide a broadcast read operation...although the open collector nature of the CAMAC dataway would not cause electrical damage.

void MulticastControl(unsigned int f, unsigned int a, unsigned long nMask);

Performs a multicast control operation by writing the mask of affected slots, nMask, to the station number register (a misnomer), and performing a multicast operation using function code f and a as the subaddress.

The function value f must be in the range of valid non data transfer CAMAC function codes.

void MulticastWrite(unsigned int f, unsigned int a, unsigned long nMask, unsigned long nData);

Performs a multicast write. See MulticastControl for much of the description, however, the function code f must be a valid write operation and the data nData is written on the data way.

void InitializeCrate(void);

Initializes a CAMAC crate by performing a C cycle, a Z cycle, Disabling the demand and uninhibiting the dataway.