#include "BBC/LLI.h"
#include "BFU/BFI.h"
Data Structures | |
| struct | _BFC_msg |
| A standard BFC message. More... | |
| struct | _BFC_msgStream |
| Defines a BFC message stream. More... | |
| struct | _BFC_runInfo |
| The publically defined portion of the run control structure. More... | |
Typedefs | |
| typedef enum _BFC_runState | BFC_runState |
| Typedef for the enum _BFC_runState. More... | |
| typedef enum _BFC_status | BFC_status |
| Typedef of enum _BFC_status. More... | |
| typedef _BFC_runCtl | BFC_runCtl |
| Typedef for struct _BFC_runCtl. More... | |
| typedef enum _BFC_quantity | BFC_quantity |
| Typedef of the enum _BFC_quantity. More... | |
| typedef _BFC_runInfo | BFC_runInfo |
| Typedef of struct _BFC_runInfo. More... | |
| typedef enum _BFC_msgState | BFC_msgState |
| Typedef for the enum _BFC_msgState. More... | |
| typedef _BFC_msgStream | BFC_msgStream |
| Typedef for struct _BFC_msgStream. More... | |
| typedef _BFC_msg | BFC_msg |
| Typedef for struct _BFC_msg. More... | |
| typedef int(* | BFC_runUsrRtn )(void *prm1, void *prm2) |
| Signature for a state transition user callback routine. More... | |
Enumerations | |
| enum | _BFC_runState { BFC_K_STATE_FAILED = 0x00, BFC_K_STATE_INITING = 0x01, BFC_K_STATE_READY = 0x02, BFC_K_STATE_STARTING = 0x03, BFC_K_STATE_STARTED = 0x04, BFC_K_STATE_PAUSING = 0x05, BFC_K_STATE_PAUSED = 0x06, BFC_K_STATE_RESUMING = 0x07, BFC_K_STATE_UNUSED = 0x08, BFC_K_STATE_STOPPING = 0x09, BFC_K_STATE_STOPPED = 0x0a } |
| Indicates the current state of the run. More... | |
| enum | _BFC_status { BFC_C_SUCCESS = 0, BFC_C_WRONG_STATE = 0xFFFF8000, BFC_C_BAD_NAME = 0xFFFF8020, BFC_C_MSG_ERROR = 0xFFFF8021 } |
| Enumeration of the return status codes. More... | |
| enum | _BFC_quantity { BFC_K_QUANTITY_MIN = 0, BFC_K_QUANTITY_BLIMIT = 1, BFC_K_QUANTITY_ELIMIT = 2, BFC_K_QUANTITY_TLIMIT = 3, BFC_K_QUANTITY_RUN_NUMBER = 4, BFC_K_QUANTITY_MAX = 5 } |
| The names of various run control parameters/quantities. More... | |
| enum | _BFC_msgState { BFC_K_MSGSTATE_FREE = 0, BFC_K_MSGSTATE_ALLOCATED = 1, BFC_K_MSGSTATE_SENT = 2, BFC_K_MSGSTATE_RECEIVED = 3, BFC_K_MSGSTATE_ACKNOWLEDGED = 4, BFC_K_MSGSTATE_RETURNED = 5 } |
| Enumerates the current state of the message. More... | |
Functions | |
| int | BFC_msgStreamInit (BFC_msgStream *mstrm, BFC_runCtl *rc, int ackTo) |
| Initializes a message stream. More... | |
| BFC_msg * | BFC_msgAllocate (BFC_msgStream *mstrm, int timeout) |
| Allocates a command message. More... | |
| int | BFC_msgQue (BFC_msgStream *mstrm, BFC_msg *msg, unsigned int type, unsigned int prm) |
| Ques a previously allocate message. More... | |
| int | BFC_msgSend (BFC_msgStream *mstrm, unsigned int type, unsigned int prm) |
| Sends a message to the event taking task. More... | |
| BFC_msg * | BFC_msgReceive (BFC_runCtl *rc) |
| Returns the message at the head of the send message que. More... | |
| int | BFC_msgAcknowledge (BFC_msg *msg, int status) |
| Acknowledges the receipt of the specified message. More... | |
| int | BFC_configure (BFC_runCtl *rc, unsigned int elimit, unsigned int tlimit, unsigned int blimit) |
| Convenience routine to set up some of the initial parameters. More... | |
| BFC_runCtl * | BFC_get (void) |
| Return a handle to the run control structure. More... | |
| int | BFC_init (BFC_runCtl *rc, BFI_group group, unsigned int rto_signal, unsigned int msg_signal, int nmsgs, int msgSize) |
| Initializes a previously allocated BFC run control structure. More... | |
| int | BFC_quantitySet (BFC_runCtl *rc, BFC_quantity name, unsigned int value) |
| Sets one of the run control quantities. More... | |
| int | BFC_blimitSet (BFC_runCtl *rc, unsigned int nbytes) |
| Sets the byte limit for the run duration. More... | |
| int | BFC_elimitSet (BFC_runCtl *rc, unsigned int nevts) |
| Sets the event limit for the run duration. More... | |
| int | BFC_tlimitSet (BFC_runCtl *rc, unsigned int msecs) |
| Sets the time limit for the run duration. More... | |
| int | BFC_maxBlimitSet (BFC_runCtl *rc, unsigned int nbytes) |
| Sets the max byte limit for files. More... | |
| int | BFC_runNumberSet (BFC_runCtl *rc, unsigned int runNumber) |
| Assigns the number to be to designate the next run. More... | |
| int | BFC_runUpdate (BFC_runCtl *rc, unsigned int nevts, unsigned int nbytes) |
| Updates the number of bytes of data taken during this run. More... | |
| int | BFC_runStart (BFC_runCtl *rc, BFC_runUsrRtn usr, void *prm1, void *prm2) |
| Starts a run. More... | |
| int | BFC_runPause (BFC_runCtl *rc, BFC_runUsrRtn usr, void *prm1, void *prm2) |
| Pause a run. More... | |
| int | BFC_runResume (BFC_runCtl *rc, BFC_runUsrRtn usr, void *prm1, void *prm2) |
| Pause a run. More... | |
| int | BFC_runStop (BFC_runCtl *rc, BFC_runUsrRtn usr, void *prm1, void *prm2) |
| Stops a run. More... | |
| BFC_runState | BFC_runStateGet (const BFC_runCtl *rc) |
| Returns the current run state. More... | |
| int | BFC_runIsActive (const BFC_runCtl *rc) |
| Indicates whether the specified run state occurs while a run is active. More... | |
| const BFC_runInfo * | BFC_runInfoGet (const BFC_runCtl *rc) |
| int | BFC_tlimitGet (const BFC_runCtl *rc) |
| Returns the run time limit in ticks. More... | |
| int | BFC_timeLeftGet (const BFC_runCtl *rc) |
| Returns the time left in the current run. More... | |
| int | BFC_nbytesLeftGet (const BFC_runCtl *rc) |
| Returns the number of bytes to be accumulated before the current run is finished. More... | |
| int | BFC_nevtsLeftGet (const BFC_runCtl *rc) |
| Returns the number of events to be accumulated before the current run is finished. More... | |
| int | BFC_maxBlimitGet (const BFC_runCtl *rc) |
| Returns the max number of bytes one can ever write. More... | |
| unsigned int | BFC_runNumberGet (const BFC_runCtl *rc) |
| Returns the current run state. More... | |
|
|
Typedef for struct _BFC_msg.
While this is not strictly part of run control, it is used almost exclusively to when sending a run control message between a command interpreter and the command action routine. See BFC_msgAllocate(), VFC_msgQue(), BFC_msgReceive(), BFC_msgSend (). |
|
|
Typedef for the enum _BFC_msgState.
A message can be in one of a number of states. This is meant primarily as a debugging aid, but could prove useful to recover timed out messages.
The normal lifecycle of a message is
The routines responsiblbe for these state transitions are Because of the synchronous nature of some the protocal, some of these state transitions can only be seen during the execution of the BFC_msg routines. For example, when a message is returned, it goes from ACKNOWLEDGED => RETURNED => FREE within BFC_msgSend() or BFC_msgQue(). |
|
|
Typedef for struct _BFC_msgStream.
A BFC message stream is used to establish a full duplex communication path between a sender and a receiver. The receiver in this case is the application which fields run control requests. The sender is any application which wishes to send a run control request. Since the exchange of information is deemed to be synchronous, a application must send a request to the command handler. The sender then is blocked until the this request has been handled. After handling the request, the command handler returns the original message to the sender along with the completion status of the command. This unblocks the sender. The message stuff is strictly not part of the Run Control, but finds its must usage there. This stuff should really be split off to its own facility, but there is no time at this point. |
|
|
Typedef of the enum _BFC_quantity.
This enumeration is used to specify which quantity is being set when using the generic BFC_quantitySet() routine. |
|
|
Typedef for struct _BFC_runCtl.
This contains all the information, both dynamic and static needed to control a run. It includes state information and the control structures needed to pass requests and acknowledgements between processes. Access to this structure is strictly controlled via a call interface, although one of the calls allows direct readout only access to the state information. |
|
|
Typedef of struct _BFC_runInfo.
Readonly access to this structure is obtained using BFC_runInfoGet(). The caller is then allowed to examine the current state of the run control parameters, but not set them. Setting them requires going through one of the more formal interfaces, such as BFC_blimitSet() or the generic BFC_quantitySet(). Given that these are dynamic quantities, the caller is encouraged to use them wisely and to understand the conditions and environment to determine viability. |
|
|
Typedef for the enum _BFC_runState.
This enumerates the state of the run. The group breaks into two distinct classes, resting states and transitory states. One normally finds the run in one of the resting states, either STARTED, PAUSED or STOPPED. The transitory states capture the transition of one state to the next. This is useful because it may take a finite amount to time to make the transition. Until the transition is complete, the meaning of some variables may be undefined. |
|
|
Signature for a state transition user callback routine.
A user start transition callback routine is activitated when one of the run control routines, BFC_runStart(), BFC_runPause(), BFC_runResume() or BFC_runStop() is called. This allows these routines to perform a set of integrity checks to determine if the transition is permitted, call an action routine to perform user specific actions associated with the transition, then complete the transition upon success. |
|
|
Typedef of enum _BFC_status.
A modest attempt at providing semi-unique status codes for BFC. |
|
|
|
The names of various run control parameters/quantities.
|
|
|
Indicates the current state of the run.
|
|
|
Enumeration of the return status codes.
|
|
||||||||||||
|
Sets the byte limit for the run duration.
If this number is specified as 0, then no byte limit will be imposed. This number is ultimately limited by the 'max_blimit'. This is limiting is not down until a run is actually started. This preserves the set value for as long as possible. This is somewhat of a kludge. The right way to handle this sort of problem is to have a current limit and an active limit. The current limit is only set be this routine. The active limit is meaningful only when a run is in progress and would be the minimum of the current and maximum. |
|
||||||||||||||||||||
|
Convenience routine to set up some of the initial parameters.
The byte limit parameter is used to set both the current limit and the maximum limit. If the user wishes to set the limit for the current run, BFC_blimitSet() should be called. |
|
||||||||||||
|
Sets the event limit for the run duration.
If this number is specified as 0, then no event limit will be imposed. |
|
|
Return a handle to the run control structure.
|
|
||||||||||||||||||||||||||||
|
Initializes a previously allocated BFC run control structure.
|
|
|
Returns the max number of bytes one can ever write.
|
|
||||||||||||
|
Sets the max byte limit for files.
If this number is specified as 0, there is no maximum in effect. |
|
||||||||||||
|
Acknowledges the receipt of the specified message.
|
|
||||||||||||
|
Allocates a command message.
|
|
||||||||||||||||||||
|
Ques a previously allocate message.
|
|
|
Returns the message at the head of the send message que.
|
|
||||||||||||||||
|
Sends a message to the event taking task.
|
|
||||||||||||||||
|
Initializes a message stream.
|
|
|
Returns the number of bytes to be accumulated before the current run is finished.
|
|
|
Returns the number of events to be accumulated before the current run is finished.
|
|
||||||||||||||||
|
Sets one of the run control quantities.
Note that this is only a convenience routine. The more specific set routines should be used when possible. This routine supports a more generic 'set' interface routine such as that found in a command parser. |
|
|
|
|
|
Indicates whether the specified run state occurs while a run is active.
|
|
|
Returns the current run state.
|
|
||||||||||||
|
Assigns the number to be to designate the next run.
|
|
||||||||||||||||||||
|
Pause a run.
|
|
||||||||||||||||||||
|
Pause a run.
|
|
||||||||||||||||||||
|
Starts a run.
|
|
|
Returns the current run state.
|
|
||||||||||||||||||||
|
Stops a run.
|
|
||||||||||||||||
|
Updates the number of bytes of data taken during this run.
|
|
|
Returns the time left in the current run.
|
|
|
Returns the run time limit in ticks.
|
|
||||||||||||
|
Sets the time limit for the run duration.
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002