Supporting new CAMAC devices in MDSPlus

Adding new device support

Since an important part of supporting a new device is generating the automatic code , the first step is to determine the number and data types of inputs and outputs, and enter them into a new template file. (Presumably the format is YACC.) This is the .GEN file.

The .H include file and the code template are produced from this file using the foreign command GEN_DEVICE

In the following example, "test.gen" was a copy of mpb__decoder.gen with module names changed. There is only one routine (method) that will be dispatched by MDSplus during the shot cycle for this module, the initialization routine TEST$INIT .


BIRCH$ gen_device/single/suffix=_gen testmpb_decoder.gen
Parsing device description
Building TESTMPB_DECODER_GEN.C
Building TESTMPB_DECODER.H
Parsing interface description
BIRCH$
Syntax for the GEN_DEVICE command:

BIRCH$ verb gen_device
define verb GEN_DEVICE
   image MDS$ROOT:[SYSEXE]GEN_DEVICE.EXE
   parameter P1, label=DESCRIPTION, prompt="Description"
      value (required,type=$file)
   qualifier DIAGNOSTICS
      value (type=$file)
   qualifier LIBRARY
   qualifier SINGLE
   qualifier DEBUG, syntax=DEBUG_GEN_DEVICE
   qualifier SUFFIX
      value (required)
   qualifier ADD

define syntax DEBUG_GEN_DEVICE
   image MDS$ROOT:[SYSMAINT]GEN_DEVICE.EXE

The generated node-identifier constants from the .H include file need to be transferred to the "value" section of the Motif .UIL file for the device. Additionally, the line

DEVICE_NID : -1;

needs to be added in the "value" section.

After coding the device-specific code, in this case as TEMPMPB_DECODER.C, and compiling the C modules, link them into a sharable image. (When building the sharable image, only the entry points made visible as globals will be available to TRAVERSER.) Update the library MDS$ROOT:[SYSLIB]MDS$DEVICES.OLB:

BIRCH$ cc testmpb_decoder_gen
BIRCH$ cc testmpb_decoder
BIRCH$ @pppl$deviceslnk
BIRCH$ copy pppl$devices.exe mds$root:[syslib]
BIRCH$ librar/replace/share mds$root:[syslib]mds$devices pppl$devices