Project

General

Profile

BLM

A driver has been written to interface to the Control Department's MOOC framework allowing the board to be controlled via ACNET. The driver exports several functions. Some are to be used in VxWorks startup scripts and others can be invoked from the VxWorks shell. Although the source compiles for several targets, we've only done extensive testing on MVME-5500 boards running VxWorks 6.4.

Startup Example

Here's an example of using the driver. This example is pulled from PXIMPS's startup script:

ld (1, 1, "vxworks_boot/v6.4/module/mv5500/mooc-4.3.out");
MoocNew()

ld (1,1,"vxworks_boot/v6.4/module/mv5500/errlog-2.0.out");
errlogInit();
logOff();

ld (1,1,"vxworks_boot/v6.4/module/mv5500/ppcLib-1.2.out");
ld (1,1,"vxworks_boot/v6.4/module/mv5500/asta-blm-1.1.out");

ASTA_BLM_create_mooc_class(20);
ASTA_BLM_create_mooc_instance(23, 4, 1, 0x61, 0x00000000);

The "live waveform" statistics use routines from ppcLib, so it needs to be loaded first.

API


STATUS ASTA_BLM_create_mooc_class(uint8_t cls);

This function should be called once in a front-end's startup script. It attaches the device driver to MOOC and allows instances to be created (via ASTA_BLM_create_mooc_instance()). The parameter, cls, is a "class code" to use for the class. On a given front-end, all class codes need to be unique.


STATUS ASTA_BLM_create_mooc_instance(unsigned short oid, int dip, int intLevel, int vector, void* a32base);

Used in startup scripts, this function creates an instance of a MOOC class (i.e. driver). The startup script should have previously called ASTA_BLM_create_mooc_class().

oid represents the instance's "object ID", which needs to be unique on the front-end. All ACNET devices that refer to this instance will have the second word of their SSDN set to this value. The parameter, dip, should be set to the board's DIP switch setting (your kernel needs to have a working sysBusToLocalAdrs() for this to work properly.) intLevel specifies which VME interrupt level should be used. vector is the number of the interrupt vector the driver will use to handle interrupts. The board has a large buffer, located in A32 space, to hold waveforms. The last parameter, a32base, specifies where in A32 space the driver should locate the waveform buffer.

If the function detects and initializes the hardware correctly, this function returns OK. Any errors results in ERROR being returned.


STATUS blmInfo(int oid);

Used in the VxWorks shell. Prints information about the instance of the driver.


STATUS blmStatsGet(int oid);

Used in the VxWorks shell. Prints statistics gathered while generating "live waveforms". oid specifies which instance's statistics should be displayed.


STATUS blmWaveform(short oid, short chan, short offset, short length);

Controls the "live waveform" support in the driver. Normally the driver handles only data requests from MOOC; the hardware constantly collects waveforms in its buffer until a loss is detected. When a loss occurs, the driver copies all waveforms to local buffers to be read via ACNET. Until a loss occurs, attempting to read any buffer results in an ACNET_UPDATE error.

This function allows one channel to be collected after each cycle. oid specifies which instance of the driver to control. chan can be 1 through 8, indicating the channel to collect. offset and length define the starting sample and number of samples to collect, respectively. Care should be taken to make sure the offset and length parameters don't exceed the board settings. Setting the length too large may result in too long a collection time. Use blmStatsGet() to see how long the collection is taking.

Setting chan to zero disables live waveform mode.