GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTS / dev > cts_scp_enet / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

CTX_control.c File Reference

The basic control of the CTDB service layer. More...

#include <string.h>
#include <PBS/FFS.ih>
#include <PBS/MBA.h>
#include <PBS/MTX.h>
#include <PBS/RW.ih>
#include <MSG/MSG_pubdefs.h>
#include <ITC/ITC_drvdefs.h>
#include <ITC/ITC_pubdefs.h>
#include <CTS/CTS_pubdefs.h>
#include <CTS/CTS_msgs.h>
#include <CTS_prvdefs.h>

Functions

static unsigned int checkState (CTS_ControlState creq, CTX_ServiceState sreq, const char *func)
 Check the state of master and task control blocks.
unsigned int CTX_createQ (ITC_Task *itc, unsigned int want, void *rtn, void *prm)
 Create a set of queues.
unsigned int CTX_deleteQ (ITC_Task *itc, unsigned int want)
 Delete a set of queues.
unsigned int CTX_deleteService ()
 Delete an CTX task block and release the associated resources.
unsigned int CTX_setCmdCallback (ITC_cb_Processor *rtn)
 Insert a callback in CTX command processing (just before the "send").
unsigned int CTX_setTlmCallback (ITC_cb_Processor *rtn)
 Insert a callback in CTX telemetry processing (just before the "send").
unsigned int CTX_startService (TASK_attr *attr)
 Start the CTX service task.
unsigned int CTX_stopService ()
 Stop the task implementing the CTX service layer.

Variables

const char * CTX_svc_states [CTX_L_SVC_STATES]
 String constants for CTX service block states.


Detailed Description

The basic control of the CTDB service layer.

CVS $Id: CTX_control.c,v 1.9 2011/03/28 23:55:14 apw Exp $
Author:
D.L.Wood

A.P.Waite


Function Documentation

static unsigned int checkState ( CTS_ControlState  creq,
CTX_ServiceState  sreq,
const char *  func 
) [inline, static]

Check the state of master and task control blocks.

Parameters:
creq (in) Required state of CTS master control block
sreq (in) Required state of CTX service control block
func (in) Name of function calling this routine
Return values:
CTS_CTLSTAT CTS master control block not in requested state
CTS_NOTINIT CTS master control block does not exist
CTS_SUCCESS Success
CTS_SVCSTAT CTX service control block not in requested state
checkState() is a state integrity checker. It demands that the master control exists and be in state creq, it also demands that the service control block exists and be in state sreq. If these conditions are met, the routine returns CTS_SUCCESS, otherwise it generates a message and returns with a non-CTS_SUCCESS message.

Warning:
If successful, the master control block will be returned with the mutex locked. Any failure and the mutex is returned unlocked.

References _CTX_Service::chk, CTS_ccb, CTS_ctl_states, _CTS_Control::ctx, _CTS_Control::mtx, _CTX_Service::state, _CTS_Control::state, and _CTX_Service::tid.

Referenced by CRX_deleteService(), CRX_startService(), CRX_stopService(), CTS_deleteDevice(), CTS_startDevice(), CTS_stopDevice(), CTX_deleteService(), CTX_setCmdCallback(), CTX_setTlmCallback(), CTX_startService(), and CTX_stopService().

unsigned int CTX_createQ ( ITC_Task *  itc,
unsigned int  want,
void *  rtn,
void *  prm 
)

Create a set of queues.

Parameters:
itc ITC task handle
want Mask of queues to create
rtn Raw routine to attach
prm Raw routine parameter to attach
Return values:
have Mask of queues created (may not be all of them)

Referenced by CTX_createService().

unsigned int CTX_deleteQ ( ITC_Task *  itc,
unsigned int  want 
)

Delete a set of queues.

Parameters:
itc ITC task handle
want Mask of queues to delete
Return values:
have Mask of queues deleted (may not be all of them)

Referenced by CTX_createService().

unsigned int CTX_deleteService ( void   ) 

Delete an CTX task block and release the associated resources.

Return values:
CTS_CTLSTAT CTS master control block not in requested state
CTS_NOTINIT CTS master control block does not exist
CTS_SUCCESS Success
CTS_SVCSTAT CTX service control block not in requested state
CTX_deleteTask() deletes an CTX task block and releases the associated resources.

References checkState(), _CTX_Service::chk, _CTS_Control::cnt, CTS_ccb, CTS_CTL_INITIALIZED, _CTS_Control::ctx, CTX_SVC_INITIALIZED, CTX_SVC_UNINITIALIZED, _CTX_Service::itc, _CTX_Service::msk, _CTS_Control::mtx, _CTX_Service::nim, _CTX_Service::state, and _CTX_Service::tid.

Referenced by CTS_rundown().

unsigned int CTX_setCmdCallback ( ITC_cb_Processor *  rtn  ) 

Insert a callback in CTX command processing (just before the "send").

Parameters:
rtn (in) Routine to call
Return values:
CTS_CTLSTAT CTS master control block not in requested state
CTS_NOTINIT CTS master control block does not exist
CTS_SUCCESS Success
CTS_SVCSTAT CTX service control block not in requested state
Warning:
This entry point is provided specifically to support tests based on LATTE 4. It is not a general purpose entry point, and if you do not know how and why it was implemented, you should not use it.
CTX_setCmdCallback() inserts the specified routine as a callback in the CTX service just before the telecommand is sent.

References checkState(), _CTX_Service::cmd, CTS_ccb, CTS_CTL_INITIALIZED, _CTS_Control::ctx, CTX_SVC_INITIALIZED, and _CTS_Control::mtx.

unsigned int CTX_setTlmCallback ( ITC_cb_Processor *  rtn  ) 

Insert a callback in CTX telemetry processing (just before the "send").

Parameters:
rtn (in) Routine to call
Return values:
CTS_CTLSTAT CTS master control block not in requested state
CTS_NOTINIT CTS master control block does not exist
CTS_SUCCESS Success
CTS_SVCSTAT CTX service control block not in requested state
Warning:
This entry point is provided specifically to support tests based on LATTE 4. It is not a general purpose entry point, and if you do not know how and why it was implemented, you should not use it.
CTX_setTlmCallback() inserts the specified routine as a callback in the CTX service just before the telemetry is sent.

References checkState(), CTS_ccb, CTS_CTL_INITIALIZED, _CTS_Control::ctx, CTX_SVC_INITIALIZED, _CTS_Control::mtx, and _CTX_Service::tlm.

unsigned int CTX_startService ( TASK_attr *  attr  ) 

Start the CTX service task.

Parameters:
attr (in) Task attributes
Return values:
CTS_CTLSTAT CTS master control block not in requested state
CTS_NOTINIT CTS master control block does not exist
CTS_SUCCESS Success
CTS_SVCSTAT CTX service control block not in requested state
CTX_startService() starts the CTX service task.

References checkState(), CTS_ccb, CTS_CTL_INITIALIZED, _CTS_Control::ctx, CTX_SVC_INITIALIZED, CTX_SVC_STARTED, _CTX_Service::itc, _CTS_Control::mtx, and _CTX_Service::state.

Referenced by CTS_configure().

unsigned int CTX_stopService ( void   ) 

Stop the task implementing the CTX service layer.

Return values:
CTS_CTLSTAT CTS master control block not in requested state
CTS_NOTINIT CTS master control block does not exist
CTS_SUCCESS Success
CTS_SVCSTAT CTX service control block not in requested state
CTX_stopService() stops the task implementing the CTX service layer.

References checkState(), CTS_ccb, CTS_CTL_INITIALIZED, _CTS_Control::ctx, CTX_SVC_INITIALIZED, CTX_SVC_STARTED, _CTX_Service::itc, _CTS_Control::mtx, and _CTX_Service::state.

Referenced by CTS_rundown().


Variable Documentation

const char * CTX_svc_states[CTX_L_SVC_STATES]

Initial value:

{
    "uninitialized",
    "initialized",
    "started"
}
String constants for CTX service block states.


Generated on Mon Mar 28 16:58:03 2011 by  doxygen 1.5.8