Latch Database

The data unpacking routine unpacks the latch information into GROUP_LATCHES.

To uniquely identify each latched bit, one has to know what word in GROUP_LATCHES to take and which bit inside this word to look at.

The "Latch Database" package described in this document was written to make the use of GROUP_LATCH easier. For example, it provides functions to access the latch bits using symbolic names, such as "lev1a1", "tpxmult1", "tpx2bit3", etc...

Header files, Libraries, Sources and Map files

The C header file latchDatabase.h defines the data structures and functions used by the latch database.

Programs using the latch database should link with the libdata.a library.

The source code is located in the libdata subsystem.

The database data file is located in the map manager file db-files.Map, subsystem db-files, item latches.

Format of the Map file

The database data file has the following format, one entry per bit:

latches.nbits:	256

latches.1.name: triggerbit1
latches.1.word: 0
latches.1.bit: 0
latches.1.used: 1

latches.2.name: triggerbit2
latches.2.word: 0
latches.2.bit: 1
latches.2.used: 1

...
The various fields have the following format:

Format of the latchDatabase_t array


typedef struct
{
  int flags;		/* the flags are defined in the header file */
  const char *name;     /* name of the bit */
  int offset;           /* offset into the GROUP_LATCHES group, counting from zero */
  int bit;              /* bit number inside the word, range is from 0 to 31 */

} latchDatabaseEntry_t;

typedef struct
{
  int nbits;

  latchDatabaseEntry_t bit[1];

} latchDatabase_t;

Subroutines used to access the latch database


latch_getDatabase(int runNo)


Purpose:

Arguments:

Return Value:


int latch_lookupDatabase(database,bitName)


Purpose:

Arguments:

Return Value:


int latch_getBitValue(latches,database,bitName)


Purpose:

Arguments:

Return Value:


Author: K.Olchanski, 1996-Apr-13