Table of Contents Previous Chapter Chapter 10: IOC Database Configuration

Chapter 10: IOC Database Configuration

1. Overview

This chapter describes the ASCII files that must be modified and/or created in order to provide new record support, device support, and/or device drivers. Before the ASCII files are described, an overview of database configuration and the concept of Self Defining Record (SDR) files is presented. Although it is not necessary for the application developer to understand these concepts, the discussion should clear up the mystery of what happens to the ASCII definition files.

The serious reader should obtain a listing of all the ASCII files in base/src/ascii.

2. Overview of IOC Database Configuration

NOTE: Everyone is STRONGLY encouraged to start using the GDCT ASCII database format and dbLoadRecords and dbLoadTemplates. See the GDCT document for details.

The IOC database is a memory resident database plus assorted data structures. Many of the data structures are configured via ASCII definition files. Let's briefly discuss the steps involved up to and including initialization of an IOC database.

  1. Create ASCII Files. Each configuration component has one or more associated ASCII definition files. The components and related ASCII files are:
  2. Create a DCT SDR File. Build utilities are provided to process the ASCII definition files. The build utilities convert each ASCII file to a self defining record (SDR) file. An SDR file contains a set of one or more self defining records. Two or more SDR files can be concatenated to create a file that is again an SDR file. A script file "makesdr" executes the appropriate build utilities and concatenates the output files so that an SDR file appropriate for input to DCT is generated.
  3. OLD STYLE:
    Create a database via DCT. DCT reads the SDR file generated by makesdr and accepts user input. The user creates and/or modifies an arbitrary number of records. When done DCT generates a file <name>.database. This file, which is also in SDR format, contains all the SDR records from the input SDR file as well as SDR records for the actual database records.
    NEW STYLE
    Create the database file via GDCT. It saves a file with the extension .db
  4. OLD STYLE:
    After an IOC is booted and iocCore is loaded, the commands:
        dbLoad("<database>")
    ...
    NEW STYLE:
        dbLoad("default.dctsdr")
    dbLoadRecords("<file>.db") ...
    OLD AND NEW
        ...
    iocInit("<resource file>"
    are executed. dbLoad reads the SDR file containing the database.
The Source/Release control manual describes the details of creating the SDR files. This manual merely describes the contents of the ASCII files.

3. Self Defining Records

Self defining records provide the following features:

  1. Many different types of information can be stored in the same file.
  2. Two or more files containing self defining records can be combined with the Unix cat command to form a new file that is also in self defining record format.
  3. Record structures can contain pointer fields. In files all pointers are kept as offsets. When sdrLoad reads a self defining record all offsets are automatically converted to addresses.
Each self defining record consists of a header (sdrHeader) followed by data. The header has the following format:

  struct sdrHeader {
    long  magic;  /* magic number */
    long  nbytes;  /*number of bytes of data which follow header*/
    short  type;  /* sdr record type*/
    short  pad;
    long  create_date;  /* creation date in standard unix format*/
  }
The allowable types are:

NOTE: SDR_DB_RECTYPE is needed to decipher many of the other SDRs. If needed it must always be the first SDR in a file.

Each type of self defining record is created by one of the build utilities or by DCT. Two subroutines are provided for use by any programs that want to use self defining records. The two routines are sdrLoad and sdrUnload.

4. Ascii Definition Files

dbRectype

This file, which defines the valid record types, has the format:

  "<record type>"
  ...

Choice

choiceGbl

The global choice table has the following format:

  <choice_set>  "<choice_string>"
  ...
The values for <choice_set> are defined in choiceGbl.h.

choiceRec

This file contains choices special to particular record types. For each record type the following definitions are accepted:

  "record type" <choice_set> "<choice_string>"
  ... 
The choice sets are defined in various record specific include files.

cvtTable

Raw data can be converted to engineering units via one of the following:

  1. No Conversion.
  2. Linear Conversion.
  3. Breakpoint table.
A conversion file consists of a set of definitions. The first two lines define no conversion and linear conversion. The remainder of the file defines breakpoint tables.

There are two methods of preparing breakpoint tables. The first method is to directly provide the breakpoint table. The second is to provide a table of raw values corresponding to equally spaced engineering values.

The format for directly defining a breakpoint table is as follows:

  "<name>"  BreakTable
  <raw value> <eng value>
  ...
  ENDTABLE 
The format for generating a breakpoint table from a data table of raw values corresponding to equally spaced engineering values is:

  <header line>
  <data table>
  ENDTABLE
The header line contains the following information:

An example definition is:

  "NO CONVERSION"
  "LINEAR"
  "TypeKdegF" 32 0 1832 4095 1.0 -454 2500 1
  <data table>
  ENDTABLE
  "Example Breakpoint" BreakTable
  0  0
  1000  .1
  2000  2.5
  3000  3.9
  4000  5.5
  4096  8.0
  ENDTABLE

devSup

This file defines the device support for each record type. For each record type the following definitions are accepted:

  "record type"  <link_type> "<dset_name>" "<choice_string>"
    ...
where

drvSup

This file contains the name of each driver entry table. It has the form:

  "<drvet_name>"
    ...

5. Record Description Files

An ASCII definition file must exist for each record type (for example ai.ascii). This file describes each field of the record except the fields defined by db_common.ascii.

Preceding the field definitions is a line of the form

  RECTYPE   "<type>"
Each field is defined by a number of definitions. The following definitions appear for all fields:

The remaining definitions depend of the field_type.

6. ASCII Build Utilities

The ASCII definition files are not used directly by IOC software or by the Database Configuration Tool (DCT). Instead they are translated by one of a set of "Build" utility programs. This section lists each build utility, the ASCII input files it accepts, and the SDR file it generates. It also lists the input and output for DCT.

bldCvtTable

This program reads file cvtTable.ascii and generates two files: cvtTable.sdr and choiceCvt.sdr.

INPUT:

  cvtTable.ascii
OUTPUT:

  SDR_CVTTABLE   cvtTable.sdr
  SDR_CHOICECVT   choiceCvt.sdr

bldGblChoice

This program reads file choiceGbl.ascii (after it is processed by cpp) and generates file choiceGbl.sdr.

INPUT:

  choiceGbl.ascii (after processing by cpp)
OUTPUT:

  SDR_CHOICEGBL   choiceGbl.sdr

bldRecChoice

INPUT:

  choiceRec.ascii (after processing by cpp)
  SDR_DB_RECTYPE dbRecType.sdr
OUTPUT:

  SDR_CHOICEREC  choiceRec.sdr

bldDevSup

INPUT:

  devSup.ascii
  SDR_DB_RECTYPE   dbRecType.sdr
OUTPUT:

  SDR_DEVSUP   devSup.sdr
  SDR_CHOICEDEV   choiceDev.sdr

bldRecDef

INPUTS:

  SDR_DB_RECTYPE   dbRecType.sdr
  dbCommon.ascii   All .ascii after cpp. dbCommon must be first
  <ai, etc>.ascii
OUTPUTS:

  SDR_DB_RECDES   dbRecDes.sdr
  SDR_DB_DCTRECDES   dbDctRecDes.sdr
  <aiRecord, etc>.h

bldDbRecType

INPUT:

  dbRectype.ascii
OUTPUT:

  SDR_DB_RECTYPE   dbRecType.s

bldDrvSup

INPUT:

  drvSup.ascii   From stdin
OUTPUT:

  SDR_DRVSUP   devSup.sdr

7. DCT - Database Configuration Tool

INCLUDES:

  choice.h
  dbDctRecDes.h
  dbDefs.f
  dbFldTypes.h
  dbRecords.h
  dbRecType.h
INPUTS: All inputs concatenated into file <appl>.dctsdr

  SDR_DB_RECTYPE
  SDR_DB_RECDES
  SDR_CHOICEGBL
  SDR_CHOICECVT
  SDR_CHOICEREC
  SDR_CHOICEDEV
  SDR_DEVSUP
IN/OUT: The records are all stored in SDR_DB_RECORDS format. The ".database" file contains the dctsdt records plus all database record.

 
Table of Contents Next Chapter