GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> GRB / dev > grb_doc / sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

GRB_pktdef.h File Reference

Defines the message passing that goes on between the server (EPU) and client (SIU). More...

#include <PBI/Endianness.h>
#include <PBI/BSWP.ih>
#include <GRB/GRB_msgdef.h>

Classes

struct  _GRB_pktHdr
 The packet header. More...

Typedefs

typedef enum _GRB_PKT_OPEN_REASON GRB_PKT_OPEN_REASON
 Typedef for enum _GRB_PKT_OPEN_REASON.
typedef enum _GRB_PKT_OPEN_REASON GRB_pktOpenReason
 Typedef for enum _GRB_PKT_OPEN_REASON.
typedef enum _GRB_PKT_CLOSE_REASON GRB_PKT_CLOSE_REASON
 Typedef for enum _GRB_PKT_CLOSE_REASON.
typedef enum _GRB_PKT_CLOSE_REASON GRB_pktCloseReason
 Typedef for enum _GRB_PKT_CLOSE_REASON.
typedef struct _GRB_pktHdr GRB_pktHdr
 Typedef for struct _GRB_pktHdr.

Enumerations

enum  _GRB_PKT_OPEN_REASON {
  GRB_PKT_OPEN_REASON_START = 0x0,
  GRB_PKT_OPEN_REASON_TIME = 0x1,
  GRB_PKT_OPEN_REASON_COUNT = 0x2,
  GRB_PKT_OPEN_REASON_FULL = 0x3
}
 These are the open reasons for a GRB_pkt. More...
enum  _GRB_PKT_CLOSE_REASON {
  GRB_PKT_CLOSE_REASON_STOP = 0x0,
  GRB_PKT_CLOSE_REASON_TIME = 0x1,
  GRB_PKT_CLOSE_REASON_COUNT = 0x2,
  GRB_PKT_CLOSE_REASON_FULL = 0x3
}
 These are the close reasons for a GRB_pkt. More...

Functions

static __inline void GRB__pktConstruct (GRB_pktHdr *hdr, unsigned char src, GRB_pktOpenReason reason, unsigned int seq)
 Constructs a packet header.
static __inline void GRB__pktConstructNext (GRB_pktHdr *hdr, GRB_pktOpenReason reason)
 Constructs the next packet header. This is just a short-hand routine that can be used when constructing subsequent packets. It presumes that GRBP__pktConstruct has already been called, thus establishing the source and sequence values. This routine retains the source field and increments the sequence field.
static __inline int GRB__pktMsgDeclare (GRB_pktHdr *hdr, unsigned int len32)
 Declares that a new message of length len32 has been added to packet.
static __inline void GRB__pktClose (GRB_pktHdr *hdr, GRB_pktCloseReason reason)
 Declares that a packet is closed.
static __inline void GRB__pktHdrSwap (GRB_pktHdr *dst, const GRB_pktHdr *hdr)
 Ensures the packet header is in big-endian style.
static __inline unsigned int GRB__pktLength (const GRB_pktHdr *hdr)
 Accessor function to return the length in 32-bit words.
static __inline unsigned int GRB__pktSequence (const GRB_pktHdr *hdr)
 Accessor function to return the packet's sequence number. This is primarily used as an integrity check, ensuring that all packets from a given source ID have been seen.
static __inline unsigned short int GRB__pktMsgCount (const GRB_pktHdr *hdr)
 Accessor function to return the number of messages in the packet.
static __inline unsigned char GRB__pktSource (const GRB_pktHdr *hdr)
 Accessor function to return the source CPU identifier.
static __inline GRB_pktOpenReason GRB__pktOpenReason (const GRB_pktHdr *hdr)
 Accessor function to return the packet's open reason.
static __inline GRB_pktCloseReason GRB__pktCloseReason (const GRB_pktHdr *hdr)
 Accessor function to return the packet's close reason.
static __inline GRB_msgHdrGRB__pktFirstMsg (const GRB_pktHdr *hdr)
 Accessor function to return the packet's first message.
static __inline GRB_pktHdrGRB__pktNext (const GRB_pktHdr *hdr)
 Returns a pointer to the next packet.
static __inline GRB_pktHdrGRB__pktAdvance (const GRB_pktHdr *hdr, unsigned int len32)
 Advances the packet header pointer by the specified number of 32-bit words. This is function can be used instead of GRB__pktNext when the length of the packet has already been extracted or when advancing by more than 1 packet. It is assumed the len32 came from adding one or more packet lengths. If not, there is no guarantee that what is returned has anything to do with a packet header.


Detailed Description

Defines the message passing that goes on between the server (EPU) and client (SIU).

Author:
S.Maldonado smaldona@slac.stanford.edu

   CVS $Id: GRB_pktdef.h,v 1.6 2011/03/25 23:20:51 apw Exp $

Typedef Documentation

Typedef for struct _GRB_pktHdr.

Note:
This structure should not be accessed directly, use the accessor functions. This will provide compile time protection in case the format changes.


Enumeration Type Documentation

These are the close reasons for a GRB_pkt.

Enumerator:
GRB_PKT_CLOSE_REASON_STOP  Packet closed on stop
GRB_PKT_CLOSE_REASON_TIME  Packet is being closed because the time limit has been reached
GRB_PKT_CLOSE_REASON_COUNT  Packet is being closed because the count limit has been reached
GRB_PKT_CLOSE_REASON_FULL  Packet is being closed because there is no more room

These are the open reasons for a GRB_pkt.

Enumerator:
GRB_PKT_OPEN_REASON_START  Packet opened on a start
GRB_PKT_OPEN_REASON_TIME  Packet time limit reached Continuing after previous packet reached time limit
GRB_PKT_OPEN_REASON_COUNT  Packet count limit reached Continuing afer Previous packet reached count limit
GRB_PKT_OPEN_REASON_FULL  Continuing after previous packet filled, no more room


Function Documentation

static __inline GRB_pktHdr * GRB__pktAdvance ( const GRB_pktHdr hdr,
unsigned int  len32 
) [static]

Advances the packet header pointer by the specified number of 32-bit words. This is function can be used instead of GRB__pktNext when the length of the packet has already been extracted or when advancing by more than 1 packet. It is assumed the len32 came from adding one or more packet lengths. If not, there is no guarantee that what is returned has anything to do with a packet header.

Returns:
A pointer to the next packet.
Parameters:
hdr The packet header
len32 The number of 32-bit words to advance header by

static __inline void GRB__pktClose ( GRB_pktHdr hdr,
GRB_pktCloseReason  reason 
) [static]

Declares that a packet is closed.

Parameters:
hdr The packet header
reason The packet close reason of type GRB_PKT_CLOSE_REASON

static __inline GRB_pktCloseReason GRB__pktCloseReason ( const GRB_pktHdr hdr  )  [static]

Accessor function to return the packet's close reason.

Returns:
The packet's close reason
Parameters:
hdr The packet header to extract the packet's close reason

static __inline void GRB__pktConstruct ( GRB_pktHdr hdr,
unsigned char  src,
GRB_pktOpenReason  reason,
unsigned int  seq 
) [static]

Constructs a packet header.

Parameters:
hdr The packet header to construct
src The data source, usually something denoting EPU0/EPU1/EPU2
reason The packet open reason
seq The sequence number to assign this packet

References _GRB_pktHdr::len32, _GRB_pktHdr::rsvd_1, and _GRB_pktHdr::seq.

static __inline void GRB__pktConstructNext ( GRB_pktHdr hdr,
GRB_pktOpenReason  reason 
) [static]

Constructs the next packet header. This is just a short-hand routine that can be used when constructing subsequent packets. It presumes that GRBP__pktConstruct has already been called, thus establishing the source and sequence values. This routine retains the source field and increments the sequence field.

Parameters:
hdr The packet header to construct
reason The packet open reason

References _GRB_pktHdr::len32, and _GRB_pktHdr::seq.

static __inline GRB_msgHdr * GRB__pktFirstMsg ( const GRB_pktHdr hdr  )  [static]

Accessor function to return the packet's first message.

Returns:
The packet's first message
Parameters:
hdr The packet header to extract the first message

static __inline void GRB__pktHdrSwap ( GRB_pktHdr dst,
const GRB_pktHdr hdr 
) [static]

Ensures the packet header is in big-endian style.

Parameters:
dst The swapped packet header
hdr The packet header to swap
On big endian machines, this is a noop. The dst address and hdr address may be the same address.

static __inline unsigned int GRB__pktLength ( const GRB_pktHdr hdr  )  [static]

Accessor function to return the length in 32-bit words.

Returns:
The length, in 32-bit words, of the packet. This includes the packet header + all the messages
Parameters:
hdr The packet header to extract the length from

References _GRB_pktHdr::len32.

static __inline unsigned short int GRB__pktMsgCount ( const GRB_pktHdr hdr  )  [static]

Accessor function to return the number of messages in the packet.

Returns:
The number of messages
Parameters:
hdr The packet header to extract the message count

static __inline int GRB__pktMsgDeclare ( GRB_pktHdr hdr,
unsigned int  len32 
) [static]

Declares that a new message of length len32 has been added to packet.

Returns:
The updated length of the packet. This includes the packet header and the just declare message. The units are 32-bit words.
Parameters:
hdr The packet header
len32 The length, in 32-bit words, of the message

References _GRB_pktHdr::len32.

static __inline GRB_pktHdr * GRB__pktNext ( const GRB_pktHdr hdr  )  [static]

Returns a pointer to the next packet.

Returns:
A pointer to the next packet.
Parameters:
hdr The packet header

References _GRB_pktHdr::len32.

static __inline GRB_pktOpenReason GRB__pktOpenReason ( const GRB_pktHdr hdr  )  [static]

Accessor function to return the packet's open reason.

Returns:
The packet's open reason
Parameters:
hdr The packet header to extract the packet's open reason

static __inline unsigned int GRB__pktSequence ( const GRB_pktHdr hdr  )  [static]

Accessor function to return the packet's sequence number. This is primarily used as an integrity check, ensuring that all packets from a given source ID have been seen.

Returns:
The packet's sequence number
Parameters:
hdr The packet header to extract the packet's sequence number

References _GRB_pktHdr::seq.

static __inline unsigned char GRB__pktSource ( const GRB_pktHdr hdr  )  [static]

Accessor function to return the source CPU identifier.

Returns:
The source CPU identifier
Parameters:
hdr The packet header to extract the source identifier


Generated on Fri Mar 25 16:25:00 2011 by  doxygen 1.5.8