inp.camac
Class CamacDriver

java.lang.Object
  |
  +--inp.camac.CamacDriver
Direct Known Subclasses:
DriverCC232

public abstract class CamacDriver
extends java.lang.Object

CamacDriver is a basic abstract class to extend by real implementations of CAMAC hardware. Implemntations must have default constructor without parameters. This implementation of CamacDriver initialize instantiated by name class calling it's init() method. Application software must use the following code to load driver by class name

    CamacDriver driver = CamacDriver.loadDriver("inp.camac.cc232.DriverCC232");
    Crate crate        = driver.getCrate(0);    
    Module module      = new Module();
    crate.addModule(module,2);       
    crate.Z();
    crate.C();
    crate.I(true);
    module.addLAMlistener(new myLAMlistener());
   
 


Constructor Summary
CamacDriver()
           
 
Method Summary
abstract  void C(int crateN)
          Execute C cycle in specified crate
abstract  void close(int crateN)
          Close crate connectection and release all allocated resources for this crate
abstract  void executeNAF(int crateN, int N, int A, int F, int[] data, int bits, Module module)
          Execute NAF in Crate
 Crate getCrate(int crateN)
           
abstract  void I(int crateN, boolean inhibit)
          set I (inhibit) bus state
abstract  void init()
          Implement here whatever needed to initialize camac driver called by loadDriver when new driver loaded.
abstract  void initCrate(int crateN)
          Implement here whatever needed to initialize connection with crate controller.
static CamacDriver loadDriver(java.lang.String className)
          Get driver by class name
 void onLAM(int crateN, int N)
          Callback.
abstract  void setLAMMask(int crateN, int mask)
          set LAM bit mask to filter out LAM events only from given positions.
abstract  void Z(int crateN)
          Execute Z cycle in specified crate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamacDriver

public CamacDriver()
Method Detail

loadDriver

public static CamacDriver loadDriver(java.lang.String className)
                              throws java.lang.Exception
Get driver by class name
Parameters:
className - driver class name to load and/or instantiate,
Returns:
existing instance of driver by class name or load and initialize new driver if no instance exists. Default implementation call CamacDriver.init() after creating new instance.

executeNAF

public abstract void executeNAF(int crateN,
                                int N,
                                int A,
                                int F,
                                int[] data,
                                int bits,
                                Module module)
                         throws java.io.IOException
Execute NAF in Crate
Parameters:
crateN - Crate number from 0 to MAXCRATES
N - Camac module position (1..24)
A - Camac subaddress
F - Camac function
data - Array of data, NAF will be executed as many times as data.length is. If data is null than NAF will be executed once without data transfer. In case of write operation, data from this array must be written in target module. In case of read operation data read from module must be placed in this array.
bits - Number of significant bits in data transfer. For some sort of hardware this parameter might be usefull to reduce data transfer time. Implementation might return either all 24 bits either only required number of bits
Module - module reference, Usefull in particular implementations to check module.mustHaveX() and module.mustHaveQ() for correct exceptions handling.

C

public abstract void C(int crateN)
                throws java.io.IOException
Execute C cycle in specified crate
Parameters:
crateN - crate Number

Z

public abstract void Z(int crateN)
                throws java.io.IOException
Execute Z cycle in specified crate
Parameters:
crateN - crate Number

I

public abstract void I(int crateN,
                       boolean inhibit)
                throws java.io.IOException
set I (inhibit) bus state
Parameters:
crateN - crate Number
inhibit -  

initCrate

public abstract void initCrate(int crateN)
                        throws java.io.IOException
Implement here whatever needed to initialize connection with crate controller. Called by default implementation of CamacDriver.getCrate on first attempt to get crate.

init

public abstract void init()
                   throws java.io.IOException
Implement here whatever needed to initialize camac driver called by loadDriver when new driver loaded.

setLAMMask

public abstract void setLAMMask(int crateN,
                                int mask)
                         throws java.io.IOException
set LAM bit mask to filter out LAM events only from given positions.
Parameters:
crateN - crate number
mask - LAM mask. 1 enables LAM, 0 disables LAM. LSB bit 0 of mask corresponds to position 1

close

public abstract void close(int crateN)
Close crate connectection and release all allocated resources for this crate
Parameters:
crateN - crate number to release.

getCrate

public Crate getCrate(int crateN)
               throws java.io.IOException
Returns:
Crate object. In case object already was created once it return existing instance, if this is first attempt to get crate with this number it create new Crate and initialize it with calling CamacDriver.initCrate(in crateN)

onLAM

public void onLAM(int crateN,
                  int N)
Callback. Must be called by implementation when LAM occures in module
Parameters:
crateN - crate number
N - module position must be from 1 to 24.