GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> IPBS / V0-0-2 > pbs / i845e


Interface   Data Structures   File List   Data Fields   Globals  

PARITY.h File Reference

Priority calculation, callable interface. More...


Defines

#define PARITY_K_EVEN   0x6996
 A vector of bits whose bit number (counting from least significant bit = 0) gives the even parity of a nibble of that bit number.
#define PARITY_4(_nibble)   ((PARITY_K_EVEN >> ((_nibble) & 0xf)) & 1)
 Returns 0 if the parity of _nibble is even, 1 if the parity is odd.
#define PARITY_8(_byte)   PARITY_4 ( ((_byte ) >> 4) ^ (_byte ))
 Returns 0 if the parity of _byte is even, 1 if the parity is odd.
#define PARITY_16(_hword)   PARITY_8 ( ((_hword) >> 8) ^ (_hword))
 Returns 0 if the parity of _hword is even, 1 if the parity is odd.
#define PARITY_32(_word)   PARITY_16( ((_word ) >> 16) ^ (_word ))
 Returns 0 if the parity of _word is even, 1 if the parity is odd.
#define PARITY_64(_ll)   PARITY_32( ((_ll ) >> 32) ^ (_ll ))
 Returns 0 if the parity of _ll is even, 1 if the parity is odd.
#define PARITY_K_ODD   0x9669
 A vector of bits whose bit number (counting from least significant bit = 0) gives the odd parity of a nibble of that bit number.
#define PARITY_ODD4(_nibble)   ((PARITY_K_ODD >> ((_nibble) & 0xf)) & 1)
 Returns 0 if the parity of _nibble is odd, 1 if the parity is even.
#define PARITY_ODD8(_byte)   PARITY_ODD4 ( ((_byte ) >> 4) ^ (_byte ))
 Returns 0 if the parity of _byte is odd, 1 if the parity is even.
#define PARITY_ODD16(_hword)   PARITY_ODD8 ( ((_hword) >> 8) ^ (_hword))
 Returns 0 if the parity of _hword is odd, 1 if the parity is even.
#define PARITY_ODD32(_word)   PARITY_ODD16( ((_word ) >> 16) ^ (_word ))
 Returns 0 if the parity of _word is odd, 1 if the parity is even.
#define PARITY_ODD64(_ll)   PARITY_ODD32( ((_ll ) >> 32) ^ (_ll ))
 Returns 0 if the parity of _ll is odd, 1 if the parity is even.

Functions

int PARITY_calc8 (unsigned char byte)
 Calculates the parity over the 8 bits in the specified byte.
int PARITY_calc16 (unsigned short int hword)
 Calculates the parity over the 16 bits in the specified half word.
int PARITY_calc32 (unsigned int word)
 Calculates the parity over the 32 bits in the specified word.
int PARITY_calc64 (unsigned long long int ll)
 Calculates the parity over the 64 bits in the specified long long.
int PARITY_calc8N (const unsigned char *bytes, int nbytes)
 Calculates the parity over all the bits in the specified array of bytes.
int PARITY_calc16N (const unsigned short int *hwords, int nhwords)
 Calculates the parity over all the bits in the specified array of half words (16-bit integers).
int PARITY_calc32N (const unsigned int *words, int nwords)
 Calculates the parity over all the bits in the specified array of words (32-bit integers).
int PARITY_calc64N (const unsigned long long int *lls, int nlls)
 Calculates the parity over all the bits in the specified array of long longs (64-bit integers).
int PARITY_calcOdd8 (unsigned char byte)
 Calculates the odd parity over the 8 bits in the specified byte.
int PARITY_calcOdd16 (unsigned short int hword)
 Calculates the odd parity over the 16 bits in the specified half word.
int PARITY_calcOdd32 (unsigned int word)
 Calculates the odd parity over the 32 bits in the specified word.
int PARITY_calcOdd64 (unsigned long long int ll)
 Calculates the odd parity over the 64 bits in the specified long long.
int PARITY_calcOdd8N (const unsigned char *bytes, int nbytes)
 Calculates the odd parity over all the bits in the specified array of bytes.
int PARITY_calcOdd16N (const unsigned short int *hwords, int nhwords)
 Calculates the odd parity over all the bits in the specified array of half words (16-bit integers).
int PARITY_calcOdd32N (const unsigned int *words, int nwords)
 Calculates the odd parity over all the bits in the specified array of words (32-bit integers).
int PARITY_calcOdd64N (const unsigned long long int *lls, int nlls)
 Calculates the odd parity over all the bits in the specified array of long longs (64-bit integers).


Detailed Description

Priority calculation, callable interface.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: PARITY.h,v 1.1.1.1 2006/02/10 21:45:35 saxton Exp $

For full documentation and explanation of the algorithms, see the inline versions, documented in PARITY.ih. For the parity calculations

Define Documentation

#define PARITY_K_EVEN   0x6996

A vector of bits whose bit number (counting from least significant bit = 0) gives the even parity of a nibble of that bit number.

This is a bit vector whose bit number gives the even parity of that bit number. The array is indexed by left shifting by the bit number. This array is used to return a 0 if the parity is EVEN and a 1 if the parity is ODD.
The following table maps a number idx into an even parity. The bottom line is the hex number representing the parity bit array.

       Idx  Parity    Index  Parity   Index Parity    Index Parity
         C       0        8       1       4      1        0      0
         D       1        9       0       5      0        1      1
         E       1        A       0       6      0        2      1
         F       0        B       1       7      1        3      0
      0x         6                9              9               6
  

Referenced by PARITY_calc16(), PARITY_calc16N(), PARITY_calc32(), PARITY_calc32N(), PARITY_calc64(), PARITY_calc64N(), PARITY_calc8(), and PARITY_calc8N().

#define PARITY_K_ODD   0x9669

A vector of bits whose bit number (counting from least significant bit = 0) gives the odd parity of a nibble of that bit number.

This is a bit vector whose bit number gives the odd parity of that bit number, The array is indexed by left shifting by the bit number. This array is used to return a 0 if the parity is ODD and a 1 if the parity is EVEN.
The following table maps a number idx into an even parity. The bottom line is the hex number representing the parity bit array.

       Idx  Parity    Index  Parity   Index Parity    Index Parity
         C       1        8       0       4      0        0      1
         D       0        9       1       5      1        1      0
         E       0        A       1       6      1        2      0
         F       1        B       0       7      0        3      1
      0x         9                6              6               9
  

Referenced by PARITY_calcOdd16(), PARITY_calcOdd16N(), PARITY_calcOdd32(), PARITY_calcOdd32N(), PARITY_calcOdd64(), PARITY_calcOdd64N(), PARITY_calcOdd8(), and PARITY_calcOdd8N().


Function Documentation

int PARITY_calc16 ( unsigned short int  hword  ) 

Calculates the parity over the 16 bits in the specified half word.

Returns:
The parity, either 0 or 1, over the 16 bits the specified half word.
Parameters:
hword The half word (short int) to calculate the parity of.

References PARITY_K_EVEN.

int PARITY_calc16N ( const unsigned short int *  hwords,
int  nhwords 
)

Calculates the parity over all the bits in the specified array of half words (16-bit integers).

Returns:
The parity, either 0 or 1, over all the bits in the specified array of half words (16-bit integers). If a length of 0 is specified, 0 is returned.
Parameters:
hwords The array of half words (16-bit integers) to calculate the parity over.
nhwords The number of half words (16-bit integers) in the array.

References PARITY_K_EVEN.

int PARITY_calc32 ( unsigned int  word  ) 

Calculates the parity over the 32 bits in the specified word.

Returns:
The parity, either 0 or 1, over the 32 bits the specified word.
Parameters:
word The word to calculate the parity over.

References PARITY_K_EVEN.

int PARITY_calc32N ( const unsigned int *  words,
int  nwords 
)

Calculates the parity over all the bits in the specified array of words (32-bit integers).

Returns:
The parity, either 0 or 1, of the specified array of words. If a length of 0 is specified, 0 is returned.
Parameters:
words The array of words (ints) to calculate the parity over.
nwords The number of words (ints) in the array.

References PARITY_K_EVEN.

int PARITY_calc64 ( unsigned long long int  ll  ) 

Calculates the parity over the 64 bits in the specified long long.

Returns:
The parity, either 0 or 1, over the 64 bits the specified long long.
Parameters:
ll The long long word to calculate the parity over.

References PARITY_K_EVEN.

int PARITY_calc64N ( const unsigned long long int *  lls,
int  nlls 
)

Calculates the parity over all the bits in the specified array of long longs (64-bit integers).

Returns:
The parity, either 0 or 1, of the specified array of words. If a length of 0 is specified, 0 is returned.
Parameters:
lls The array of long longs to calculate the parity over.
nlls The number of long longs in the array.

References PARITY_K_EVEN.

int PARITY_calc8 ( unsigned char  byte  ) 

Calculates the parity over the 8 bits in the specified byte.

Returns:
The parity, either 0 or 1, over the 8 bits in the specified byte.
Parameters:
byte The byte to calculate the parity over.

References PARITY_K_EVEN.

int PARITY_calc8N ( const unsigned char *  bytes,
int  nbytes 
)

Calculates the parity over all the bits in the specified array of bytes.

Returns:
The parity, either 0 or 1, over the specified array of bytes. If a length of 0 is specified, 0 is returned.
Parameters:
bytes The array of bytes to calculate the parity over.
nbytes The number of bytes in array.

References PARITY_K_EVEN.

int PARITY_calcOdd16 ( unsigned short int  hword  ) 

Calculates the odd parity over the 16 bits in the specified half word.

Returns:
The odd parity, either 0 or 1, over the 16 bits the specified half word.
Parameters:
hword The half word (short int) to calculate the odd parity of.

References PARITY_K_ODD.

int PARITY_calcOdd16N ( const unsigned short int *  hwords,
int  nhwords 
)

Calculates the odd parity over all the bits in the specified array of half words (16-bit integers).

Returns:
The odd parity, either 0 or 1, over all the bits in the specified array of half words (16-bit integers). If a length of 0 is specified, 1 is returned.
Parameters:
hwords The array of half words (16-bit integers) to calculate the odd parity over.
nhwords The number of half words (16-bit integers) in the array.

References PARITY_K_ODD.

int PARITY_calcOdd32 ( unsigned int  word  ) 

Calculates the odd parity over the 32 bits in the specified word.

Returns:
The odd parity, either 0 or 1, over the 32 bits the specified word.
Parameters:
word The word to calculate the odd parity over.

References PARITY_K_ODD.

int PARITY_calcOdd32N ( const unsigned int *  words,
int  nwords 
)

Calculates the odd parity over all the bits in the specified array of words (32-bit integers).

Returns:
The odd parity, either 0 or 1, of the specified array of words. If a length of 0 is specified, 1 is returned.
Parameters:
words The array of words (ints) to calculate the odd parity over.
nwords The number of words (ints) in the array.

References PARITY_K_ODD.

int PARITY_calcOdd64 ( unsigned long long int  ll  ) 

Calculates the odd parity over the 64 bits in the specified long long.

Returns:
The odd parity, either 0 or 1, over the 64 bits the specified long long.
Parameters:
ll The long long word to calculate the parity odd over.

References PARITY_K_ODD.

int PARITY_calcOdd64N ( const unsigned long long int *  lls,
int  nlls 
)

Calculates the odd parity over all the bits in the specified array of long longs (64-bit integers).

Returns:
The parity, either 0 or 1, of the specified array of words. If a length of 0 is specified, 1 is returned.
Parameters:
lls The array of long longs to calculate the parity over.
nlls The number of long longs in the array.

References PARITY_K_ODD.

int PARITY_calcOdd8 ( unsigned char  byte  ) 

Calculates the odd parity over the 8 bits in the specified byte.

Returns:
The odd parity, either 0 or 1, over the 8 bits in the specified byte.
Parameters:
byte The byte to calculate the odd parity over.

References PARITY_K_ODD.

int PARITY_calcOdd8N ( const unsigned char *  bytes,
int  nbytes 
)

Calculates the odd parity over all the bits in the specified array of bytes.

Returns:
The odd parity, either 0 or 1, over the specified array of bytes. If a length of 0 is specified, 1 is returned.
Parameters:
bytes The array of bytes to calculate the odd parity over.
nbytes The number of bytes in array.

References PARITY_K_ODD.


Generated on Wed Nov 21 21:23:53 2012 by  doxygen 1.5.8