GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDS / V2-11-6 > ebfio / rhel5-64
#include <EDS/io/EBF_pkts.h>
#include <EDS/LCBV.h>
Typedefs | |
typedef enum _EBF_STREAM_TYPE_K | EBF_STREAM_TYPE_K |
Standard typedef for _enum EBF_STREAM_TYPE_K. | |
typedef enum _EBF_STREAM_TYPE_K | EBF_streamType |
Typedef for _enum EBF_STREAM_TYPE_K, used in procedure calls. | |
typedef enum _EBF_STREAM_UNIT_K | EBF_STREAM_UNIT_K |
Typedef for enum _EBF_STREAM_UNIT_K. | |
typedef enum _EBF_STREAM_UNIT_K | EBF_streamUnit |
Typedef for enum _EBF_streamUnit. | |
typedef int(* | EBF_streamDirSizer )(EBF_stream *stream, const EBF_dir *dir, int maxPktSize) |
Typedef for routines that sizes an event, as specified by a directory to the output stream. | |
typedef int(* | EBF_streamDirWriter )(EBF_stream *stream, const EBF_dir *dir, int maxPktSize) |
Typedef for routines that write an event, as specified by a directory to the output stream. | |
Enumerations | |
enum | _EBF_STREAM_TYPE_K { EBF_STREAM_TYPE_K_FILE = 0, EBF_STREAM_TYPE_K_DATA = 1, EBF_STREAM_TYPE_K_FILESEG = 2 } |
enum | _EBF_STREAM_UNIT_K { EBF_STREAM_UNIT_K_PKTS = 0, EBF_STREAM_UNIT_K_EVTS = 1 } |
Enumeration of how to treat the input stream, as packets or events. More... | |
enum | _EBF_STREAM_PKT_SIZE_K_MAX { EBF_STREAM_PKT_SIZE_K_MAX = -1, EBF_STREAM_PKT_SIZE_K_DEF = 0 } |
Enumerates the sentinal values used when specifying a packet size. More... | |
Functions | |
EBF_stream * | EBF_streamOpen (EBF_streamType type, const void *name, int segment) |
Opens a EBF file or data for reading. | |
int | EBF_streamRead (EBF_stream *stream) |
Reads the EBF file associated with the event stream handle istream. | |
int | EBF_streamRewind (EBF_stream *stream) |
Sets the read pointer back to the initial point. | |
EBF_pkts | EBF_streamLocate (const EBF_stream *stream) |
Returns a packets iterator. | |
int | EBF_streamProcess (EBF_stream *stream, EBF_streamUnit evtsPkts, int nskip, int nprocess, LCBV_pktCb process, void *processPrm) |
Processes the specified stream of as events or packets. | |
EBF_stream * | EBF_streamCreate (EBF_streamType type, const char *name, int maxPktSize) |
Creates a file to receive the EBF data. | |
int | EBF_streamWrite (EBF_stream *stream, const unsigned int *data, int nwrds) |
Writes the specified data to the output fil. | |
int | EBF_streamDirWrite (EBF_stream *stream, const EBF_dir *dir, int maxPktSize) |
Writes the event described by the event directory to the output stream. | |
int | EBF_streamEvtWrite (EBF_stream *stream, const void *evt, int nwrds) |
Routine to an event to the output stream. | |
int | EBF_streamEvtxWrite (EBF_stream *stream, const void *evt, int nwrds, int maxPktSize) |
Routine to an event to the output stream. | |
int | EBF_streamEvtSize (const EBF_stream *stream, int evt_size, int maxPktSize) |
For a given event size (includes the initialize packet header) returns the size, in bytes, of the output packet. | |
int | EBF_streamDirCopy (EBF_stream *stream, const EBF_dir *dir, int maxPktSize) |
Copies the packets ASIS to the output stream. | |
int | EBF_streamPktSizeFind (const EBF_stream *stream, int evtSize, int maxPktCnt, int maxPktSize) |
Returns the packet size, in bytes, required to accommodate an output event. | |
int | EBF_streamDirWriteSize (const EBF_stream *stream, const EBF_dir *dir, int maxPktSize) |
Checks if the directory event can be written using the maximum packet size as a constraint. If it can, the routine returns the size, in bytes, of the output event. | |
int | EBF_streamDirCopySize (const EBF_stream *stream, const EBF_dir *dir, int maxPktSize) |
Checks if the directory packets can be copied asis. If they can routine returns the size, in bytes, of the output event. | |
int | EBF_streamChange (EBF_stream *stream, const char *name) |
Changes the stream to the new file. | |
int | EBF_streamClose (EBF_stream *stream) |
Closes the file after it has been read. | |
int | EBF_streamFree (EBF_stream *stream) |
Frees the memory associated with the contents of the file. | |
Variables | |
enum _EBF_STREAM_PKT_SIZE_K_MAX | EBF_STREAM_PKT_SIZE_K |
CVS $Id: EBF_stream.h,v 1.6 2011/03/25 22:16:55 russell Exp $
int(* EBF_streamDirSizer)(EBF_stream *stream, const EBF_dir *dir, int maxPktSize) |
Typedef for routines that sizes an event, as specified by a directory to the output stream.
stream | The output stream handle | |
dir | The event directory | |
maxPktSize | May be used to override the packet size, |
int(* EBF_streamDirWriter)(EBF_stream *stream, const EBF_dir *dir, int maxPktSize) |
Typedef for routines that write an event, as specified by a directory to the output stream.
stream | The output stream handle | |
dir | The event directory | |
maxPktSize | May be used to override the packet size, |
enum _EBF_STREAM_TYPE_K |
enum _EBF_STREAM_UNIT_K |
int EBF_streamChange | ( | EBF_stream * | stream, | |
const char * | name | |||
) |
Changes the stream to the new file.
stream | The stream handle | |
name | The name of the new file |
References _EBF_stream::bdy, _EBF_streamHeader::close, _EBF_ostreamBody::file, _EBF_stream::hdr, _EBF_ostreamBody::name, _EBF_streamBody::out, and _streamCloseCbp::prm.
Referenced by ESX_change().
int EBF_streamClose | ( | EBF_stream * | stream | ) |
Closes the file after it has been read.
This function only closes the file after its contents have been read into memory. To free the memory associated with the contents of the file, the user must call EBF_free().
References _EBF_streamHeader::close, _EBF_stream::hdr, _streamCloseCbp::prm, and _streamCloseCbp::rtn.
Referenced by ESX_close().
EBF_stream * EBF_streamCreate | ( | EBF_streamType | type, | |
const char * | name, | |||
int | maxPktSize | |||
) |
Creates a file to receive the EBF data.
type | The type of stream to open EBF_STREAM_TYPE_K_FILE or EBF_STREAM_TYPE_K_DATA | |
name | The name of the section or file to create | |
maxPktSize | The maximum number of byte to write per packet. This number will be rounded up to the nearest 128 byte boundary in keeping with how the hardware writes data. If 0 this defaults to 4096 - 128. If greater than 4096 - 128, it defaults to 4096-128 |
References _EBF_stream::bdy, _EBF_streamHeader::close, _EBF_streamHeader::dir, EBF_STREAM_DIR_K_WRITE, EBF_STREAM_TYPE_K_DATA, EBF_STREAM_TYPE_K_FILE, _EBF_ostreamBody::file, _EBF_streamHeader::free, _EBF_stream::hdr, max_pkt_size(), _EBF_ostreamBody::maxPktSize, mem_alloc(), _EBF_ostreamBody::name, _EBF_streamBody::out, _streamCloseCbp::prm, _streamCloseCbp::rtn, and _EBF_streamHeader::type.
int EBF_streamDirCopy | ( | EBF_stream * | stream, | |
const EBF_dir * | dir, | |||
int | maxPktSize | |||
) |
Copies the packets ASIS to the output stream.
stream | The output stream handle | |
dir | The directory | |
maxPktSize | May be used to override the packet size, |
References _EBF_stream::bdy, EBF_streamDirWrite(), EBF_streamWrite(), max_pkt_size(), _EBF_ostreamBody::maxPktSize, _EBF_dirPktDsc::nbytes, _EBF_dirTruncated::npktDscs, _EBF_streamBody::out, _EBF_dirPktDsc::pkt, _EBF_dirTruncated::pktDscs, and _EBF_dir::truncated.
Referenced by ESX_dir_write().
int EBF_streamDirCopySize | ( | const EBF_stream * | stream, | |
const EBF_dir * | dir, | |||
int | maxPktSize | |||
) |
Checks if the directory packets can be copied asis. If they can routine returns the size, in bytes, of the output event.
==-1 Event cannot be committed as is
stream | The output stream handle | |
dir | The directory | |
maxPktSize | Limits the maximum packet size, |
References _EBF_stream::bdy, max_pkt_size(), _EBF_ostreamBody::maxPktSize, _EBF_dirPktDsc::nbytes, _EBF_dirTruncated::npktDscs, _EBF_streamBody::out, _EBF_dirTruncated::pktDscs, and _EBF_dir::truncated.
Referenced by ESX_dir_write().
int EBF_streamDirWrite | ( | EBF_stream * | stream, | |
const EBF_dir * | dir, | |||
int | maxPktSize | |||
) |
Writes the event described by the event directory to the output stream.
stream | The output event stream | |
dir | The event directory | |
maxPktSize | May be used to override the streams packet size, |
References copy_event(), EBF_streamEvtxWrite(), _EBF_dir::evt, _EBF_dirRedux::evt_len, MAX_EVT_SIZE, _EBF_dirTruncated::npktDscs, _EBF_dir::redux, and _EBF_dir::truncated.
Referenced by EBF_streamDirCopy(), and ESX_dir_write().
int EBF_streamDirWriteSize | ( | const EBF_stream * | stream, | |
const EBF_dir * | dir, | |||
int | maxPktSize | |||
) |
Checks if the directory event can be written using the maximum packet size as a constraint. If it can, the routine returns the size, in bytes, of the output event.
==-1 Event cannot be committed as is
stream | The output stream handle | |
dir | The directory | |
maxPktSize | Limits the maximum packet size, |
References EBF_streamEvtSize(), _EBF_dirRedux::evt_len, and _EBF_dir::redux.
Referenced by ESX_dir_write().
int EBF_streamEvtSize | ( | const EBF_stream * | stream, | |
int | evt_size, | |||
int | maxPktSize | |||
) |
For a given event size (includes the initialize packet header) returns the size, in bytes, of the output packet.
stream | The output stream | |
evt_size | The size, in bytes, of the event. This is defined to be the sum of all the contributors + the packet header | |
maxPktSize | May be used to override the streams packet size, |
References _EBF_stream::bdy, max_pkt_size(), _EBF_ostreamBody::maxPktSize, and _EBF_streamBody::out.
Referenced by EBF_streamDirWriteSize().
int EBF_streamEvtWrite | ( | EBF_stream * | stream, | |
const void * | ebf_evt, | |||
int | len | |||
) |
Routine to an event to the output stream.
0 | on success | |
errno | on failure |
stream | The output stream | |
ebf_evt | The event to write | |
len | The length, in bytes, of the event |
This routine differs from EBF_streamEvtxWrite in that it defaults the maximum packet size to that specified in the stream handle.
References EBF_streamEvtxWrite().
int EBF_streamEvtxWrite | ( | EBF_stream * | stream, | |
const void * | ebf_evt, | |||
int | len, | |||
int | maxPktSize | |||
) |
Routine to an event to the output stream.
0 | on success | |
errno | on failure |
stream | The output stream | |
ebf_evt | The event to write | |
len | The length, in bytes, of the event | |
maxPktSize | May be used to override the streams packet size > 0 use this as the packet size == 0 use packet size specified in the stream handle
|
References _EBF_stream::bdy, _EBF_ebw::bf, _EBF_edw::bf, _RestartPkt::cell, EBF_EDW_RSTATUS_K_PACKET_TRUNCATED, EBF_EDW_RSTATUS_K_SUCCESS, EBF_EDW_XSTATUS_K_SUCCESS, EBF_streamWrite(), _EBF_pktRestartCell::ebw, _EBF_ostreamBody::file, _RestartPkt::hdr, _EBF_evt::hdr, _EBF_edw_bf::len, max_pkt_size(), _EBF_ostreamBody::maxPktSize, _EBF_streamBody::out, restart_construct(), _EBF_edw_bf::rstatus, _EBF_ebw::ui, _EBF_edw::ui, _EBF_pktHdr::undef, and _EBF_edw_bf::xstatus.
Referenced by EBF_streamDirWrite(), and EBF_streamEvtWrite().
int EBF_streamFree | ( | EBF_stream * | stream | ) |
Frees the memory associated with the contents of the file.
stream | The event builder stream handle |
References _EBF_streamHeader::free, _EBF_stream::hdr, and mem_free().
Referenced by ESX_close().
EBF_pkts EBF_streamLocate | ( | const EBF_stream * | stream | ) |
Returns a packets iterator.
stream | The event builder stream handle |
References _EBF_stream::bdy, _EBF_streamBody::in, _EBF_pkts_u::p, and _EBF_istreamBody::pkts.
Referenced by EBF_streamProcess().
EBF_stream * EBF_streamOpen | ( | EBF_streamType | type, | |
const void * | name, | |||
int | segment | |||
) |
Opens a EBF file or data for reading.
type | The type of stream to open
| |
name | The name of the EBF file or the address of data section to open | |
segment | Interpretation is dependent on type. If type is
|
References EBF_STREAM_TYPE_K_DATA, EBF_STREAM_TYPE_K_FILE, EBF_STREAM_TYPE_K_FILESEG, fileOpen(), and map().
int EBF_streamPktSizeFind | ( | const EBF_stream * | stream, | |
int | evtSize, | |||
int | maxPktCnt, | |||
int | maxPktSize | |||
) |
Returns the packet size, in bytes, required to accommodate an output event.
stream | The output stream | |
evtSize | The number of bytes in the event to be output. Includes the initial event header. | |
maxPktCnt | The maximum number of packets allowed | |
maxPktSize | If, this value is greater than the minimum need, use this value > 0 use this as the packet size == 0 use packet size specified in the stream handle
|
References _EBF_stream::bdy, max_pkt_size(), _EBF_ostreamBody::maxPktSize, and _EBF_streamBody::out.
Referenced by ESX_dir_write().
int EBF_streamProcess | ( | EBF_stream * | stream, | |
EBF_streamUnit | evtsPkts, | |||
int | nskip, | |||
int | nprocess, | |||
LCBV_pktCb | process, | |||
void * | processPrm | |||
) |
Processes the specified stream of as events or packets.
=0 | Processed all values requested, either hit EOF or application requested to stop | |
<0 | Error, an errno value | |
=1 | Application requested a pause, caller is expected to recall EBF_streamProcess to resume processing |
stream | The stream of packets to process | |
evtsPkts | When positioning the stream, position in units of packets (EBF_STREAM_UNIT_K_PKTS) or events (EBF_STREAM_UNIT_K_EVTS). | |
nskip | The number of packets/events to skip | |
nprocess | The number of packets/events to process | |
process | The LCBV processing routine | |
processPrm | The processing parameter |
References _EBF_stream::bdy, EBF__evtsFromPkts(), EBF__evtsToPkts(), EBF_evtsSetup(), EBF_pktsSetup(), EBF_STREAM_UNIT_K_PKTS, EBF_streamLocate(), EBF_streamRead(), _EBF_istreamBody::fate, fileProcess(), _EBF_streamBody::in, _EBF_istreamBody::lcb, LCBP_create(), LCBP_edm_reset(), LCBP_evt_cb_set(), LCBP_evt_enable(), LCBP_pktsConnect(), LCBP_pktsDeliver(), LCBV_PKT_FATE_M_EOF, LCBV_PKT_FATE_M_IOERR, LCBV_PKT_FATE_M_PAUSE, and _EBF_istreamBody::status.
int EBF_streamRead | ( | EBF_stream * | stream | ) |
Reads the EBF file associated with the event stream handle istream.
stream | A previously opened event builder stream handle |
0,if | successful | |
-1,if | not |
References _EBF_stream::bdy, _EBF_istreamBody::buf, EBF_STREAM_TYPE_K_FILE, fileRead(), _EBF_stream::hdr, _EBF_streamBody::in, _EBF_pkts_ps::pkt, _EBF_istreamBody::pkts, _EBF_pkts_u::ps, _EBF_istreamBody::seg_size, _EBF_pkts_ps::size, and _EBF_streamHeader::type.
Referenced by EBF_streamProcess().
int EBF_streamRewind | ( | EBF_stream * | stream | ) |
Sets the read pointer back to the initial point.
References _EBF_stream::bdy, _EBF_istreamBody::cur_pkt, _EBF_istreamBody::cur_size, _EBF_streamHeader::dir, EBF_STREAM_DIR_K_READ, EBF_STREAM_DIR_K_WRITE, EBF_STREAM_TYPE_K_FILE, _EBF_istreamBody::fate, _EBF_istreamBody::fd, _EBF_ostreamBody::file, _EBF_stream::hdr, _EBF_streamBody::in, _EBF_istreamBody::nprocess, _EBF_streamBody::out, _EBF_istreamBody::tot_left, _EBF_istreamBody::tot_size, _EBF_streamHeader::type, and _EBF_istreamBody::which.
int EBF_streamWrite | ( | EBF_stream * | stream, | |
const unsigned int * | data, | |||
int | nwrds | |||
) |
Writes the specified data to the output fil.
stream | The output stream handle | |
data | The data to write | |
nwrds | The number of 32-bit words to write |
References _EBF_stream::bdy, _EBF_ostreamBody::buf, _EBF_ostreamBody::file, and _EBF_streamBody::out.
Referenced by EBF_streamDirCopy(), and EBF_streamEvtxWrite().