MOPOS Maps

Table Storage in NV RAM

The data that is stored on this board is largely system dependent. The ROCS/Mugef system stores both tables and Functions on the board whilst the ROCS/MOPOS stores only configuration tables.

The common data is a header structure and a command recorder.

The Shared Memory Maps

As an example, there now follows a description of the calls for the ROCS/MOPOS maps. There are four maps in this implementation which contain:

Per Channel data

Per Event data

Calibration Data

Per Crate/System data

These are obtained from the relevant tables in rocsfe.c. and are all contained in the single shared memory segment. All the routines described can be found in the file nvmap.c with the data structures in maps.h and tlpos.h.

There is a single routine to attach the shared memory segment the first time it is used which is:

void AttachMaps(void)

Though most of the routines call it themselves if the segment is not attached. Each of the maps has functions for:

Loading the map from a table in NVRAM

Getting a map entry

Printing the map data

These will now be described for each map.

Channel Maps

This contains the per-channel information which is contained in the structure:

	typedef struct 
		{
		SFLOAT fAperture;
		SFLOAT fHorizontal;
		SFLOAT fVertical;
		SFLOAT fDelayCW;
		SFLOAT fDelayCCW;
		short sInclination;
		short sSpare;
		short sCrate;
		short sPickup;
		short sNvTab;
		short sConnected;
		char pcName[11];
		} TlMemberData;
              

The map is initialised with the routine:

int InitNVMap(TlMemberData *dp, int nrec)

from the member data routine which contains nrec records starting at dp.

To extract a record from the map use:

TlMemberData *GetNVMap(int nv)

giving the routine an N-Value. This returns NULL on an invalid N-Value. To convert between an (external) N-Value and an (internal) channel number, use:

int GetChanFromNV(int nv)

To print the whole map use:

void PrintNVMap(void)

 

Event Maps

This contains the per-event information which is contained in the structure:

	typedef struct 
		{
		SFLOAT fWidth; 
		SFLOAT fDelayField; 
		SFLOAT fMainDelay; 
		long lEvcode;
		int iGain; 
		int iDirection; 
		int iModeField; 
		int iPack; 
		int iAcqMode; 
		int iCalMode; 
		int iTest; 
		int iDiagChannel;
		short sSetting;
		} TlEventData;
             

 

The map is initialised with the routine:

int InitEVMap(TlEventData *ep, int nrec)

from the event data table which contains nrec records starting at dp.

To extract a record from the map use:

TlEventData *GetEVMap(long ec)

giving the routine an Event Code. This returns NULL on an invalid Event.

To print the whole map use:

void PrintEVMap(void)

 

Calibration Maps

Unlike the otyher maps, the calibration maps are a set of maps which consist of 40 structures for each of 8 settings. The 40 structures are in order of channel number and the setting is given in the Event map as the member sSetting. The structure has the format:

typedef struct {
		SFLOAT fIntensityFactor;
		SFLOAT fCalPosFactor;
		int iSigma3;
		int iDelta3;
		int iSigma2;
		int iDelta2;
		short sCrate;
		short sPickup;
		short sSetting; /* 0-TL_CALTAB_NUM_MAX */
		short sPlane;
		char pcName[11];
		} TlCalibData;
		 
           

The map is initialised with the routine:

int InitCalMap(TlCalibData *cp, int len)

from the event data table of length len bytes.

To extract a calibration set from the map use:

TlCalibData *GetCalMap(long ec)

giving the routine the Event code. This returns a pointer to an array of 40 structures or NULL on an error.

A new calibration map can be stored with the extra routine:

int NewCalTab(long ec, TlCalibData *cp);

To print a calibration map (for a single setting) use:

void PrintCalMap(int s)

 

Crate Information

This is a single structure which contains all the information specific to this crate. There is no index for this map, which has the format:

typedef struct {
		int iReferenceCycle;
		int piLimit[11];
		int iMemberMax;
		int iPlaneMax;
		short sCrate;
		char pcName[11];
		char pcFamilyMember[21];
		char pcBusHost[21];
		} TlCrateData;
            

 

The map is initialised with the routine:

int InitCrateMap(TlCrateData *dp)

from the crate information table at dp.

To extract the map use:

TlCrateData *GetCrateMap(void)

To print the map use:

void PrintCrateMap(void)