GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LATC / dev > latc_cmn / rhel4-32


Interface   Data Structures   File List   Data Fields   Globals  

map.c File Reference

Provoides functionality concerned with creating and manipulating a LATC_map. More...

#include <LATC/LATC_msgs.h>
#include <map_p.h>
#include <addr.h>
#include <number.ic>
#include <AG_latcType_s.h>
#include <PBS/MBA.h>
#include <LEM/msg_macros.h>
#include <string.h>

Functions

LATC_mapLATC_newMap (void)
 Allocate and initialise a new LATC_map.
void LATC_deleteMap (LATC_map *map)
 Free the memory allocated for the LATC_map structure.
unsigned LATC_setBit (LATC_map *map, LATC_type type, const LATC_addr *addr)
 Set a bit in the map.
unsigned LATC_clearBit (LATC_map *map, LATC_type type, const LATC_addr *addr)
 Clear a bit in the map.
int LATC_countBits (const LATC_map *map, LATC_type type)
 Clear a bit in the map.
int LATC_checkBit (const LATC_map *map, LATC_type type, const LATC_addr *addr)
 Check a bit in the map.
void LATC_setACD (LATC_map *map)
 Set all the bits in the ARC and AFE submaps.
void LATC_clearACD (LATC_map *map)
 Clear all the bits in the ARC and AFE submaps.
unsigned LATC_setTWR (LATC_map *map, unsigned twr)
 Set all the bits in TEM, TIC, CCC, CRC, CFE, TCC TRC and TFE submaps corresponding to a particular tower.
unsigned LATC_clearTWR (LATC_map *map, unsigned twr)
 Clear all the bits in TEM, TIC, CCC, CRC, CFE, TCC TRC and TFE submaps corresponding to a particular tower.
unsigned LATC_setByTWR (LATC_map *map, LATC_type type, unsigned twr)
unsigned LATC_clearByTWR (LATC_map *map, LATC_type type, unsigned twr)
void LATC_setMap (LATC_map *map)
 Set the map.
void LATC_clearMap (LATC_map *map)
 Clear the map.
void LATC_dumpMap (LATC_map *map, FILE *fp)
 Print out the map.
unsigned mapIndex (const LATC_map *map, LATC_type type, const LATC_addr *addr, unsigned *index)
 Convert the address into an index appropriate for this type of map as well as performing various checks on the input parameters.
unsigned mapRange (const LATC_map *map, LATC_type type, unsigned twr, unsigned *start, unsigned *end)
 Find start and end indicies to use in a loop over all the bits in one tower (ie the first bit of the tower and the bit one past the last bit of the same tower).


Detailed Description

Provoides functionality concerned with creating and manipulating a LATC_map.

Author:
James Swain -- jswain@slac.stanford.edu

Function Documentation

int LATC_checkBit ( const LATC_map map,
LATC_type  type,
const LATC_addr addr 
)

Check a bit in the map.

Parameters:
map Structure being manipulated
type Identifies map to manipulate
addr bit to check
Return values:
0 if the bit is clear
1 if the bit is set

References checkBit(), mapIndex(), and LATC_map_::ptr.

void LATC_clearACD ( LATC_map map  ) 

Clear all the bits in the ARC and AFE submaps.

Parameters:
map Pointer to a LATC_map structure

References clearMap(), and LATC_map_::ptr.

unsigned LATC_clearBit ( LATC_map map,
LATC_type  type,
const LATC_addr addr 
)

Clear a bit in the map.

Parameters:
map Structure being manipulated
type Identifies map to manipulate
addr bit to clear
Returns:
One of LATC_msgs, LATC_SUCCESS on success

References clearBit(), mapIndex(), and LATC_map_::ptr.

unsigned LATC_clearByTWR ( LATC_map map,
LATC_type  type,
unsigned  twr 
)

Parameters:
map Pointer to a LATC_map structure
type Identifies the sub-map to manipulate
twr Index of a tower
Return values:
LATC_BADTYPE if the type does not exist
LATC_MAPLESS if there is no sub-map corresponding to this type
LATC_BADADDR if the twr ID is out of range
LATC_SUCCESS if everything goes well

References clearBit(), mapRange(), and LATC_map_::ptr.

Referenced by LATC_clearTWR().

void LATC_clearMap ( LATC_map map  ) 

Clear the map.

Parameters:
map Structure being manipulated

References clearMap(), and LATC_map_::ptr.

Referenced by LATC_clearIMM().

unsigned LATC_clearTWR ( LATC_map map,
unsigned  twr 
)

Clear all the bits in TEM, TIC, CCC, CRC, CFE, TCC TRC and TFE submaps corresponding to a particular tower.

Parameters:
map Pointer to a LATC_map structure
twr Index of a tower
Return values:
LATC_BADADDR if the twr ID is out of range
LATC_SUCCESS if everything goes well

References LATC_clearByTWR().

unsigned LATC_countBits ( const LATC_map map,
LATC_type  type 
)

Clear a bit in the map.

Parameters:
map Structure being manipulated
type Identifies map to count
Returns:
Number of bits set in the map, or -1 for an illegal type

References countMap(), and LATC_map_::ptr.

void LATC_deleteMap ( LATC_map map  ) 

Free the memory allocated for the LATC_map structure.

Parameters:
map Pointer to a map created by LATC_newMap

Referenced by LATC_deleteIMM().

void LATC_dumpMap ( LATC_map map,
FILE *  fp 
)

Print out the map.

Parameters:
map Pointer to an initialised map structure
fp Pointer to file where the map should be written

References LATC_map_::ptr, and sizeofMap().

LATC_map * LATC_newMap ( void   ) 

Allocate and initialise a new LATC_map.

Returns:
Pointer to an initialised LATC_map allocated with MBA_alloc, or NULL if the memory allocation failed.

References LATC_map_::ptr, and sizeofMap().

Referenced by LATC_newIMM().

void LATC_setACD ( LATC_map map  ) 

Set all the bits in the ARC and AFE submaps.

Parameters:
map Pointer to a LATC_map structure

References LATC_map_::ptr, and setMap().

unsigned LATC_setBit ( LATC_map map,
LATC_type  type,
const LATC_addr addr 
)

Set a bit in the map.

Parameters:
map Structure being manipulated
type Identifies map to manipulate
addr bit to set
Returns:
One of LATC_msgs, LATC_SUCCESS on success

References mapIndex(), LATC_map_::ptr, and setBit().

unsigned LATC_setByTWR ( LATC_map map,
LATC_type  type,
unsigned  twr 
)

Parameters:
map Pointer to a LATC_map structure
type Identifies the sub-map to manipulate
twr Index of a tower
Return values:
LATC_BADTYPE if the type does not exist
LATC_MAPLESS if there is no sub-map corresponding to this type
LATC_BADADDR if the twr ID is out of range
LATC_SUCCESS if everything goes well

References mapRange(), LATC_map_::ptr, and setBit().

Referenced by LATC_setTWR().

void LATC_setMap ( LATC_map map  ) 

Set the map.

Parameters:
map Pointer to a LATC_map structure

References LATC_map_::ptr, and setMap().

unsigned LATC_setTWR ( LATC_map map,
unsigned  twr 
)

Set all the bits in TEM, TIC, CCC, CRC, CFE, TCC TRC and TFE submaps corresponding to a particular tower.

Parameters:
map Pointer to a LATC_map structure
twr Index of a tower
Return values:
LATC_BADADDR if the twr ID is out of range
LATC_SUCCESS if everything goes well

References LATC_setByTWR().

unsigned mapIndex ( const LATC_map map,
LATC_type  type,
const LATC_addr addr,
unsigned *  index 
)

Convert the address into an index appropriate for this type of map as well as performing various checks on the input parameters.

Parameters:
map Pointer to a map structure
type Type of the map
addr Pointer to an address structure identifying the required bit
index Pointer to location to store the calculated index
Return values:
LATC_BADTYPE if the type does not exist
LATC_MAPLESS if there is no sub-map corresponding to this type
LATC_BADBCAST if the address contains a mixture of broadcast and singlecast addresses
LATC_BADADDR if any component of the address is out of range
LATC_BADINDEX if the final index exceeds the total number of bits in the map
LATC_SUCCESS if everything goes well

References LATC_getIndex().

Referenced by LATC_checkBit(), LATC_clearBit(), LATC_setBit(), and mapRange().

unsigned mapRange ( const LATC_map map,
LATC_type  type,
unsigned  twr,
unsigned *  start,
unsigned *  end 
)

Find start and end indicies to use in a loop over all the bits in one tower (ie the first bit of the tower and the bit one past the last bit of the same tower).

Parameters:
map Pointer to a map structure
type Type of the map
twr Tower ID
start Pointer to location to store the index of the start bit
end Pointer to location to store the index of the end bit
Return values:
LATC_BADTYPE if the type does not exist
LATC_MAPLESS if there is no sub-map corresponding to this type
LATC_BADBCAST if the address contains a mixture of broadcast and singlecast addresses
LATC_BADADDR if any component of the address is out of range
LATC_BADINDEX if the final index exceeds the total number of bits in the map
LATC_SUCCESS if everything goes well

References LATC_addr::cpt, LATC_getIndex(), and mapIndex().

Referenced by LATC_clearByTWR(), and LATC_setByTWR().


Generated on Thu Apr 7 17:31:28 2011 by  doxygen 1.5.8