ET System
16.5
|
These routines use the ET system as a FIFO. More...
Functions | |
int | et_fifo_openProducer (et_sys_id id, et_fifo_id *fid, const int *bufIds, int idCount) |
int | et_fifo_openConsumer (et_sys_id id, et_fifo_id *fid) |
void | et_fifo_close (et_fifo_id fid) |
Routine to close the fifo handle opened with et_fifo_openProducer or et_fifo_openConsumer. More... | |
et_fifo_entry * | et_fifo_entryCreate (et_fifo_id fid) |
Routine to allocate a structure holding a fifo entry (array of ET events) associated with the given fifo id. More... | |
void | et_fifo_freeEntry (et_fifo_entry *entry) |
Routine to free a fifo entry created with et_fifo_entryCreate. More... | |
int | et_fifo_newEntry (et_fifo_id fid, et_fifo_entry *entry) |
This routine is called when a user wants an array of related, empty buffers from the ET system into which data can be placed. More... | |
int | et_fifo_newEntryTO (et_fifo_id fid, et_fifo_entry *entry, struct timespec *deltatime) |
This routine is called when a user wants an array of related, empty buffers from the ET system into which data can be placed. More... | |
int | et_fifo_getEntry (et_fifo_id fid, et_fifo_entry *entry) |
This routine is called when a user wants an array of related, data-filled buffers from the ET system. More... | |
int | et_fifo_getEntryTO (et_fifo_id fid, et_fifo_entry *entry, struct timespec *deltatime) |
This routine is called when a user wants an array of related, data-filled buffers from the ET system. More... | |
int | et_fifo_putEntry (et_fifo_entry *entry) |
This routine is called when a user wants to place an array of related, data-filled buffers (single FIFO entry) back into the ET system. More... | |
et_event ** | et_fifo_getBufs (et_fifo_entry *entry) |
This routine gives access to the ET events or buffers in a fifo entry obtained by calling either et_fifo_getEntry, et_fifo_getEntryTO, et_fifo_newEntry, or et_fifo_newEntryTO. More... | |
int | et_fifo_getEntryCount (et_fifo_id id) |
This routine gets the max number of fifo entries possibly available to consumer. More... | |
int | et_fifo_getFillLevel (et_fifo_id id) |
size_t | et_fifo_getBufSize (et_fifo_id id) |
This routine gets the max size of each buffer in bytes. More... | |
int | et_fifo_getEntryCapacity (et_fifo_id id) |
This routine gets the max number of buffers in each FIFO entry. More... | |
int | et_fifo_getIdCount (et_fifo_id id) |
This routine gets the number of buffers assigned an id in each FIFO entry. More... | |
int | et_fifo_getBufIds (et_fifo_id id, int *bufIds) |
This routine gets the array of ids assigned to buffers in each FIFO entry. More... | |
void | et_fifo_setId (et_event *ev, int id) |
This routine sets an id value associated with this ET event/buffer. More... | |
int | et_fifo_getId (et_event *ev) |
This routine gets an id value associated with this ET event/buffer. More... | |
void | et_fifo_setHasData (et_event *ev, int hasData) |
This routine sets whether this ET event has data in it. More... | |
int | et_fifo_hasData (et_event *ev) |
This routine gets whether this ET event has data in it or not. More... | |
int | et_fifo_allHaveData (et_fifo_id id, et_fifo_entry *entry, int *incompleteBufs, size_t *incompleteBytes) |
This routine gets whether all events (associated with an id) in the given ET fifo entry have data in it or not. More... | |
et_event * | et_fifo_getBuf (int id, et_fifo_entry *entry) |
Find the event/buffer in the fifo entry corresponding to the given id. More... | |
These routines use the ET system as a FIFO.
int et_fifo_allHaveData | ( | et_fifo_id | id, |
et_fifo_entry * | entry, | ||
int * | incompleteBufs, | ||
size_t * | incompleteBytes | ||
) |
This routine gets whether all events (associated with an id) in the given ET fifo entry have data in it or not.
This routine is geared towards ejfat and the reassembly of UDP packets into buffers. It returns, in its args, how many buffers and bytes are associated with incompletely reassembled data.
id | ET fifo handle. |
entry | ET fifo entry. |
incompleteBufs | filled with # of bufs not listed has having data (having incomplete data). |
incompleteBytes | filled with # of bytes contained in events not listed has having data (having incomplete data). |
References et_fifo_entry_t::bufs, et_event_t::control, ET_ERROR, et_event_getlength(), and et_fifo_context_t::idCount.
void et_fifo_close | ( | et_fifo_id | fid | ) |
Routine to close the fifo handle opened with et_fifo_openProducer or et_fifo_openConsumer.
Closing the ET system must be done separately.
fid | fifo id. |
References et_fifo_context_t::attId, et_fifo_context_t::bufIds, et_station_detach(), and et_fifo_context_t::openId.
et_fifo_entry* et_fifo_entryCreate | ( | et_fifo_id | fid | ) |
Routine to allocate a structure holding a fifo entry (array of ET events) associated with the given fifo id.
This memory must be freed with et_fifo_freeEntry.
fid | fifo id. |
References et_fifo_entry_t::bufs, et_fifo_context_t::capacity, and et_fifo_entry_t::fid.
void et_fifo_freeEntry | ( | et_fifo_entry * | entry | ) |
Routine to free a fifo entry created with et_fifo_entryCreate.
entry | pointer to fifo entry. |
References et_fifo_entry_t::bufs.
et_event* et_fifo_getBuf | ( | int | id, |
et_fifo_entry * | entry | ||
) |
Find the event/buffer in the fifo entry corresponding to the given id.
If none, get the first unused buffer, assign it that id, and return it. The id value for an event is stored in its first control integer. NOT threadsafe.
id | data source id. |
entry | fifo entry. |
References et_fifo_entry_t::bufs, et_fifo_context_t::capacity, et_event_t::control, and et_fifo_entry_t::fid.
int et_fifo_getBufIds | ( | et_fifo_id | id, |
int * | bufIds | ||
) |
This routine gets the array of ids assigned to buffers in each FIFO entry.
The same as the bufIds argument of et_fifo_openProducer. Assumes the user is passing in an array of length found by calling et_fifo_getIdCount.
id | ET fifo handle. |
bufIds | array of buffer id numbers. |
References et_fifo_context_t::bufIds, ET_ERROR, and et_fifo_context_t::idCount.
et_event** et_fifo_getBufs | ( | et_fifo_entry * | entry | ) |
This routine gives access to the ET events or buffers in a fifo entry obtained by calling either et_fifo_getEntry, et_fifo_getEntryTO, et_fifo_newEntry, or et_fifo_newEntryTO.
The size of the returned array can be found by calling et_fifo_getEntryCapacity.
entry | ET fifo entry. |
References et_fifo_entry_t::bufs.
size_t et_fifo_getBufSize | ( | et_fifo_id | id | ) |
This routine gets the max size of each buffer in bytes.
id | ET fifo handle. |
References ET_ERROR, and et_fifo_context_t::evSize.
int et_fifo_getEntry | ( | et_fifo_id | fid, |
et_fifo_entry * | entry | ||
) |
This routine is called when a user wants an array of related, data-filled buffers from the ET system.
This routine will block until the buffers become available. Access the buffers by calling et_fifo_getBufs. Each call to this routine MUST be accompanied by a following call to et_fifo_putEntry!
fid | ET fifo handle. |
entry | pointer to fifo entry to be filled with data from next fifo element. |
References et_fifo_context_t::attId, et_fifo_entry_t::bufs, et_fifo_context_t::capacity, ET_ERROR, et_events_get(), et_logmsg(), ET_OK, ET_SLEEP, et_fifo_context_t::openId, and et_fifo_context_t::producer.
int et_fifo_getEntryCapacity | ( | et_fifo_id | id | ) |
This routine gets the max number of buffers in each FIFO entry.
id | ET fifo handle. |
References et_fifo_context_t::capacity, and ET_ERROR.
int et_fifo_getEntryCount | ( | et_fifo_id | id | ) |
This routine gets the max number of fifo entries possibly available to consumer.
id | ET fifo handle. |
References ET_ERROR, and et_fifo_context_t::userEntries.
int et_fifo_getEntryTO | ( | et_fifo_id | fid, |
et_fifo_entry * | entry, | ||
struct timespec * | deltatime | ||
) |
This routine is called when a user wants an array of related, data-filled buffers from the ET system.
This routine will block until it times out. Access the buffers by calling et_fifo_getBufs. Each call to this routine MUST be accompanied by a following call to et_fifo_putEntry!
fid | ET fifo handle. |
entry | pointer to fifo entry to be filled with data from next fifo element. |
deltatime | time to wait before returning. |
References et_fifo_context_t::attId, et_fifo_entry_t::bufs, et_fifo_context_t::capacity, ET_ERROR, et_events_get(), et_logmsg(), ET_OK, ET_TIMED, et_fifo_context_t::openId, and et_fifo_context_t::producer.
int et_fifo_getFillLevel | ( | et_fifo_id | id | ) |
This routine gets the number of fifo entries containing unconsumed data available to the consumer. This is the fill level of the fifo. This should be compared to the max number of fifo entries obtained by calling et_fifo_getEntryCount.
Note: there are actually more entries in the ET system, 5% with at least 2, that exist but cannot be placed in the Users station input list due to its nonblocking nature.
id | ET fifo handle. |
References ET_ERROR, ET_OK, et_station_getinputcount_rt(), et_fifo_context_t::openId, and et_fifo_context_t::userStatId.
int et_fifo_getId | ( | et_event * | ev | ) |
This routine gets an id value associated with this ET event/buffer.
ev | ET event. |
References et_event_t::control, and ET_ERROR.
int et_fifo_getIdCount | ( | et_fifo_id | id | ) |
This routine gets the number of buffers assigned an id in each FIFO entry.
The same as the idCount argument of et_fifo_openProducer.
id | ET fifo handle. |
References ET_ERROR, and et_fifo_context_t::idCount.
int et_fifo_hasData | ( | et_event * | ev | ) |
This routine gets whether this ET event has data in it or not.
ev | ET event. |
References et_event_t::control, and ET_ERROR.
int et_fifo_newEntry | ( | et_fifo_id | fid, |
et_fifo_entry * | entry | ||
) |
This routine is called when a user wants an array of related, empty buffers from the ET system into which data can be placed.
This routine will block until the buffers become available. Access the buffers by calling et_fifo_getBufs. Each call to this routine MUST be accompanied by a following call to et_fifo_putEntry!
fid | fifo id. |
entry | pointer to fifo entry to be filled with empty fifo entry. |
References et_fifo_context_t::attId, et_fifo_context_t::bufIds, et_fifo_entry_t::bufs, et_fifo_context_t::capacity, et_event_t::control, ET_ERROR, et_events_new(), et_logmsg(), ET_OK, ET_SLEEP, et_fifo_context_t::evSize, et_fifo_context_t::idCount, et_event_t::length, et_fifo_context_t::openId, and et_fifo_context_t::producer.
int et_fifo_newEntryTO | ( | et_fifo_id | fid, |
et_fifo_entry * | entry, | ||
struct timespec * | deltatime | ||
) |
This routine is called when a user wants an array of related, empty buffers from the ET system into which data can be placed.
This routine will block until it times out. Access the buffers by calling et_fifo_getBufs. Each call to this routine MUST be accompanied by a following call to et_fifo_putEntry!
fid | fifo id. |
entry | pointer to fifo entry to be filled with empty fifo entry. |
deltatime | time to wait before returning. |
References et_fifo_context_t::attId, et_fifo_context_t::bufIds, et_fifo_entry_t::bufs, et_fifo_context_t::capacity, et_event_t::control, ET_ERROR, et_events_new(), et_logmsg(), ET_OK, ET_TIMED, et_fifo_context_t::evSize, et_fifo_context_t::idCount, et_event_t::length, et_fifo_context_t::openId, and et_fifo_context_t::producer.
int et_fifo_openConsumer | ( | et_sys_id | id, |
et_fifo_id * | fid | ||
) |
This routine creates a handle (et_fifo_id) with which to interact with an ET system by treating it as a FIFO in which each element has multiple buffers (events). The caller acts only as a data consumer , with calls to et_fifo_getEntry allowed, but calls to et_fifo_newEntry forbidden.
In order for this to work, the ET system being used must be started by et_start_fifo, NOT et_start.
id | id of an opened ET system. |
fid | pointer to fifo id which gets filled in if ET system successfully opened and defined in a fifo-consistent manner. |
int et_fifo_openProducer | ( | et_sys_id | id, |
et_fifo_id * | fid, | ||
const int * | bufIds, | ||
int | idCount | ||
) |
This routine creates a handle (et_fifo_id) with which to interact with an ET system by treating it as a FIFO in which each element has multiple buffers (events). The caller acts only as a data producer, with calls to et_fifo_newEntry allowed, but calls to et_fifo_getEntry forbidden.
In order for this to work, the ET system being used must be started by et_start_fifo, NOT et_start.
id | id of an opened ET system. |
fid | pointer to fifo id which gets filled in if ET system successfully opened and defined in a fifo-consistent manner. |
bufIds | array of ids, assign one to each buffer of each fifo entry. If more provided than needed, only the first are used. |
idCount | number of ints in bufIds array. |
int et_fifo_putEntry | ( | et_fifo_entry * | entry | ) |
This routine is called when a user wants to place an array of related, data-filled buffers (single FIFO entry) back into the ET system.
This must be called after calling either et_fifo_getEntry, et_fifo_getEntryTO, et_fifo_newEntry, or et_fifo_newEntryTO. This routine will never block.
entry | fifo entry to release back to ET. |
References et_fifo_context_t::attId, et_fifo_entry_t::bufs, et_fifo_context_t::capacity, ET_ERROR, et_events_put(), ET_OK, et_fifo_entry_t::fid, and et_fifo_context_t::openId.
void et_fifo_setHasData | ( | et_event * | ev, |
int | hasData | ||
) |
This routine sets whether this ET event has data in it.
Stored in event's second control word.
ev | ET event. |
hasData | 1 if this event as data, 0 if it does not. |
References et_event_t::control.
void et_fifo_setId | ( | et_event * | ev, |
int | id | ||
) |
This routine sets an id value associated with this ET event/buffer.
Stored in event's first control word. This should never be used.
ev | ET event. |
id | id of this event. |
References et_event_t::control.