dmap library - dmap


This module implements all the fuctions necessary for the conversion. Initialization and query functions are also present.

Index


Initialization functions

The implementation of the detector map is based on a global variable, hidden in the library. Proper initialization is needed before any access to it.

Two functions are present:

dmap_load()
This function initializes the detector map and are fills it with the data read from the file.
Should be called before any other function in the library!

Syntax:
int dmap_load(char *filename);
Parameters:
IN: filename
file name from which read the data
(relative to the current directory, *.map file names recomended)
Returns:
DMAP_ERROR_OK in case of success

dmap_dispose()
This function frees the memory allocated by the library.
Should be called when you do not need the library any more.

Syntax:
int dmap_dispose(void);
Returns:
DMAP_ERROR_OK in case of success


Conversion functions

The implementation is made to prefer the conversion from FEE to physical format. The other type of conversion is possible, but it is much more slow.

The two functions are:

dmap_get()
Converts from FEE to phycical format.

Syntax:
int dmap_get(unsigned char chain, unsigned char crate, unsigned char slot, unsigned char chan, DMAP_CHAN_EL *data);
Parameters:
IN: chain,crate,slot,chan
the FEE address
OUT: data
the pysical address
Returns:
DMAP_ERROR_OK in case of success
DMAP_ERROR_EMPTY in the FEE address have no physical address associated (data value undefined)

dmap_find()
Converts from physical to FEE format.
It is much more slow than dmap_get!

Syntax:
int dmap_find(DMAP_CHAN_EL data, unsigned char *chain, unsigned char *crate, unsigned char *slot, unsigned char *chan);
Parameters:
IN: data
the pysical address
OUT: chain,crate,slot,chan
the FEE address
Returns:
DMAP_ERROR_OK in case of success
DMAP_ERROR_EMPTY in the physical address have no FEE address associated (data value undefined)

Conversion functions specific type:


Query functions

This functions should be used to find out the valid range of FEE addresses and the type of boards in the slots.

dmap_query_nr_chains()
dmap_query_nr_crates()
dmap_query_nr_slots()
Syntax:
int dmap_query_nr_chains(void);
int dmap_query_nr_crates(unsigned char chain);
int dmap_query_nr_slots(unsigned char chain, unsigned char crate);
Parameters:
IN: chain,crate
the FEE address
Returns:
the number of chains, crates, slots in case of success
DMAP_ERROR_UNKNOWN in case of an error

dmap_query_nr_chans()
Syntax:
int dmap_query_nr_chans(unsigned char chain, unsigned char crate, unsigned char slot);
Parameters:
IN: chain,crate,slot
the FEE address
Returns:
in case of success, the number of channels is returned: DMAP_ERROR_EMPTY if the slot is empty
DMAP_ERROR_UNKNOWN in case of an error

dmap_query_btype()
Syntax:
int dmap_query_btype(unsigned char chain, unsigned char crate, unsigned char slot);
Parameters:
IN: chain,crate,slot
the FEE address
Returns:
the board type in case of success
DMAP_ERROR_EMPTY if the slot is empty
DMAP_ERROR_UNKNOWN in case of an error


Examples

The better examples are the
conversion and extraction programs present in this package.

Here are the links to the source code:


Top of the page. dmap library
Send comments to: Igor Sfiligoi

Created:10.4.1997
Last modified:18.8.1997