GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCBD / V1-3-2

Constituent: lcbd     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

LCBD_nut.c File Reference

Implementation of LCBD notification routines. More...

#include <string.h>
#include "LCBD/LCBD_nut.h"
#include "LCBD_p.h"
#include "LCBD/LCBD_msgs.h"
#include "PBS/TASK.h"
#include "PBS/FORK.h"
#include "PBS/Q.ih"
#include "PBS/LI.ih"
#include "PBS/MTX.ih"
#include "PBS/INT.ih"

Include dependency graph for LCBD_nut.c:

Include dependency graph

Functions

unsigned int notify (FORK_cb_prm prm, FORK_msg_hdr *msg_hdr)
 Fork callback routine used to notify users of transitions.

int wait (void *nut)
 Callback routine for TASK_block in the LCBD_nut_notifyW.

unsigned int fork (LCBD_nut *nut, LCBD lcb, LCBD_state state)
 Notification callback routine that dispatchs to a FORK que.

unsigned int post (LCBD_nut *nut, LCBD lcb, LCBD_state state)
 Internal LCBD notification callback routine to post a NUT block to a pending que.

unsigned int wake (LCBD_nut *nut, LCBD lcb, LCBD_state state)
 LCBD_nut_notifyW callback routine for notification.

unsigned int LCBD_nut_handler_create (LCBD lcb, int priority)
 Creates the notification handler task.

unsigned int LCBD_nut_que_install (LCBD lcb, FORK_que *que)
 Installs the specified fork que.

LCBD_state LCBD_nut_notifyW (LCBD lcb, unsigned int states)
 Wait until the LCB driver is in one of the list of specified states.

unsigned int LCBD_nut_fork (LCBD lcb, unsigned int states, LCBD_nut *nut, FORK_que *que, FORK_cb_rtn rtn)
 Ques a NUT block using a fork callback as the synchronization mechanism.

unsigned int LCBD_nut_head_create (LCBD_nut_head *head)
 Creates and initializes a NUT head posting que.

unsigned int LCBD_nut_head_destroy (LCBD_nut_head *head)
 Initializes a NUT head posting que.

unsigned int LCBD_nut_post (LCBD lcb, unsigned int states, LCBD_nut *nut, LCBD_nut_head *nut_head)
 Posts a NUT block using a que as a synchronization mechanism.

LCBD_nutLCBD_nut_pendW (LCBD_nut_head *head)
 Pends for the next notification block on this que head.

unsigned int LCBD_nut_notify (LCBD lcb, LCBD_nut *nut)
 Ques a notification block.

unsigned int LCBD_nut_cancel (LCBD lcb, LCBD_nut *nut)
 Cancels the specified user notification block.

unsigned int lcbd_nut_handler_destroy (LCBD lcb, unsigned int *exit_status)
 Destroys the notification service task.

unsigned int lcbd_nut_post (LCBD lcb)
 Posts a message to the notify service task.


Detailed Description

Implementation of LCBD notification routines.

Author:
JJRussell -- russell@slac.stanford.edu
  CVS $Id

Function Documentation

unsigned int fork LCBD_nut nut,
LCBD  lcb,
LCBD_state  state
[static]
 

Notification callback routine that dispatchs to a FORK que.

Returns:
0, Indicating the driver should delete this NUT block from the notification que and continue processing
Parameters:
nut The NUT block to post
lcb The LCB driver handle
state The current driver state

unsigned int LCBD_nut_cancel LCBD  lcb,
LCBD_nut nut
 

Cancels the specified user notification block.

Parameters:
lcb The LCB driver handle
nut The notification user of transition block to cancel
The que will be locked for time it takes to determine whether the item is on the que.

unsigned int LCBD_nut_fork LCBD  lcb,
unsigned int  states,
LCBD_nut nut,
FORK_que *  que,
FORK_cb_rtn  rtn
 

Ques a NUT block using a fork callback as the synchronization mechanism.

Returns:
Status
Parameters:
lcb The LCB driver handle
states The states to wait on
nut The NUT block to post
que The FORK que to post to
rtn The FORK dispatch routine
LCBD_notify_fork is a convenience routine prepackaging parameters needed to dispatch the complete NUT block to a FORK dispatch routine. The message received in the FORK dispatch routine is the NUT block. The nut callback parameter (nut->prm[0]) contains the LCB driver handle

Here is the call graph for this function:

unsigned int LCBD_nut_handler_create LCBD  lcb,
int  priority
 

Creates the notification handler task.

Returns:
Status
Parameters:
lcb The LCB driver handle
priority The priority of the created task. This may be specified as LCBD_K_DEFAULT_PRIORITY, in which case the driver will assign a defaulty task priority.

Here is the call graph for this function:

unsigned int lcbd_nut_handler_destroy LCBD  lcb,
unsigned int *  exit_status
 

Destroys the notification service task.

Returns:
The status of from FORK_destroy
Parameters:
lcb The LCB driver handle
exit_status Pointer to receive the exit status of the notification routine.

Here is the call graph for this function:

unsigned int LCBD_nut_head_create LCBD_nut_head head  ) 
 

Creates and initializes a NUT head posting que.

Returns:
Status
See also:
LCBD_nut_head_destroy

LCBD_nut_post

LCBD_nut_pendW

Parameters:
head The NUT head to initialize
The routines LCBD_nut_post and LCBD_nut_pendW are convenience routines that pre-can the a notification wake-up mechanism as que. That is, one initializes an LCBD_nut_head structure. The user is submits notification items (NUTs) using LCBD_nut_post and waits for their completion using LCBD_nut_pendW.

unsigned int LCBD_nut_head_destroy LCBD_nut_head head  ) 
 

Initializes a NUT head posting que.

Returns:
Status
See also:
LCBD_nut_head_destroy

LCBD_nut_post

LCBD_nut_pendW

Parameters:
head The NUT head to initialize
The routines LCBD_nut_post and LCBD_nut_pendW are convenience routines that pre-can the a notification wake-up mechanism as que. That is, one initializes an LCBD_nut_head structure. The user is submits notification items (NUTs) using LCBD_nut_post and waits for their completion using LCBD_nut_pendW.

unsigned int LCBD_nut_notify LCBD  lcb,
LCBD_nut nut
 

Ques a notification block.

Returns:
Status, The only meaningful error is from the mutex locking routines, and even here, they can only fail if the handle is corrupted.
Parameters:
lcb The LCB driver handle
nut The Notify User of Transition control structure.
Note:
The NUT item is always queued. If the current state of the driver is one of the ones being keyed on, the notification service task is awaken to service this item.
This strategies introduces some inefficiency in the system, effectively going through a queing, task switch and a dequeing sequence, but doing this presents a consistent handling. The user can avoid this by polling the state first, LCBD_state_get.

Here is the call graph for this function:

LCBD_state LCBD_nut_notifyW LCBD  lcb,
unsigned int  states
 

Wait until the LCB driver is in one of the list of specified states.

Returns:
The current state of the LCB driver, one of LCBD_STATE_xxx
Return values:
LCBD_STATE_ERROR if an error occurred
Parameters:
lcb The LCB driver handle
states A bit list of the acceptable states. When the driver is in one of these states, it returns.
Trick
The coy user may specify states as -1, essentially any state, in which case the driver will return immediately with the current state

Here is the call graph for this function:

LCBD_nut * LCBD_nut_pendW LCBD_nut_head head  ) 
 

Pends for the next notification block on this que head.

Returns:
The next NUT block
See also:
LCBD_nut_head_init

LCBD_nut_post

Parameters:
head The que head to pend on
LCBD_nut_post and LCBD_nut_pendW are prepackaged notification routines using a que as the synchronization device.

unsigned int lcbd_nut_post LCBD  lcb  ) 
 

Posts a message to the notify service task.

Returns:
Status from FORK_qusr
Parameters:
lcb The LCB driver handle

Here is the call graph for this function:

unsigned int LCBD_nut_post LCBD  lcb,
unsigned int  states,
LCBD_nut nut,
LCBD_nut_head nut_head
 

Posts a NUT block using a que as a synchronization mechanism.

Returns:
Status
See also:
LCBD_nut_head_init

LCBD_nut_pendW

Parameters:
lcb The LCB driver handle
states The states to wait on
nut The NUT block to post
nut_head The head of the que to post to
LCBD_nut_post and LCBD_nut_pendW are prepackaged notification routines using a que as the synchronization device.

Here is the call graph for this function:

unsigned int LCBD_nut_que_install LCBD  lcb,
FORK_que *  que
 

Installs the specified fork que.

Returns:
Status
Parameters:
lcb The driver handle
que The FORK que to post notification messages to

unsigned int notify FORK_cb_prm  prm,
FORK_msg_hdr *  msg_hdr
[static]
 

Fork callback routine used to notify users of transitions.

Return values:
FORK_C_CONTINUE 
Parameters:
prm The fork callback parameter, here it is the LCB driver handle
msg_hdr The message

unsigned int post LCBD_nut nut,
LCBD  lcb,
LCBD_state  state
[static]
 

Internal LCBD notification callback routine to post a NUT block to a pending que.

Returns:
0, Indicating the driver should delete this NUT block from the notification que and continue processing
Parameters:
nut The NUT block to post
lcb The LCB driver handle
state The current driver state

int wait void *  nut  )  [static]
 

Callback routine for TASK_block in the LCBD_nut_notifyW.

Parameters:
nut The Notify User of Transition control structure

Here is the call graph for this function:

unsigned int wake LCBD_nut nut,
LCBD  lcb,
LCBD_state  state
[static]
 

LCBD_nut_notifyW callback routine for notification.

Return values:
0,indicating to the servicing routine (notify) that this callback routine should be removed from the list.
Parameters:
nut The NUT block
lcb The LCB driver handle
state The state that initiated the wake-up


Generated on Fri Sep 30 21:02:35 2005 by doxygen 1.3.3