GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBC / V4-12-4 > pbc / rad750


Interface   Data Structures   File List   Data Fields   Globals  

PBC_control.c File Reference

PBC application-level control functions. More...

#include <string.h>
#include <CDM/CDM_pubdefs.h>
#include <ITC/ITC_pubdefs.h>
#include <LCBD/LCBD.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/INT.ih>
#include <PBS/MBA.h>
#include <PBS/RW.ih>
#include <PBC/PBC_cmdxtrn.h>
#include <PBC/PBC_msgs.h>
#include <PBC/PBC_pubdefs.h>
#include <PBC_DB/PBC_DB_schema.h>
#include <PBC_control.h>
#include <PBC_tlm.h>

Defines

#define INT_FAKE_OK
 Acknowledges that we realize interrupts can't be disabled on host machines.

Functions

static unsigned int pbc_pool_init (FPA_fcb **fcb_pp, void **buf_pp, int *in_use_p, unsigned int num_pkt, unsigned int pkt_bytes)
 Initialize an FPA pool.
static void pbc_pool_free (ITC_QueueItem *qitem_p, unsigned int status, void *parm_0, void *parm_1, void *parm_2, unsigned int tx)
 Free a packet from an FPA pool.
static void * pbc_pool_alloc (void *prm, unsigned int size, ITC_cb_Completion **free_cb, void **cb_parm_0, void **cb_parm_1, void **cb_parm_2)
 Allocate a packet from an FPA pool.
static unsigned int pbc_pool_release (FPA_fcb **fcb_pp, void **buf_pp, int *in_use_p)
 Release the FPA pool memory.
static unsigned int pbc_create_control_block (void)
 Allocate and adopt a PBC control information block.
static unsigned int pbc_lock_access (PBC_Control *ctl_p)
 Lock access to a PBC control block.
static unsigned int pbc_unlock_access (PBC_Control *ctl_p, unsigned int status)
 Unlock access to a PBC control block.
static unsigned int pbc_change_state (PBC_Control *ctl_p, unsigned int valid_state, PBC_ControlState new_state)
 Change the state of the PBC functions.
unsigned int PBC_initialize (ITC_Task *task_p, ITC_TaskID tid)
 Initialize the PBC application-level functions.
unsigned int PBC_init (void)
 Initialize the PBC application-level functions using CDM.
unsigned int PBC_shutdown (void)
 Shut down the PBC application-level functions.

Variables

PBC_ControlPBC_pbc = NULL
 Control block for PBC.
static const PBC_DB_Schema Pbc_def_db
 Default PBC configuration database.


Detailed Description

PBC application-level control functions.

    CVS $Id: PBC_control.c,v 1.10 2011/03/29 23:14:58 apw Exp $
    

Control functions for the application-level portion of the PBC. These functions are used within the context of another task, so they do not actually start and configure a task of their own.


Function Documentation

unsigned int pbc_change_state ( PBC_Control ctl_p,
unsigned int  valid_state,
PBC_ControlState  new_state 
) [static]

Change the state of the PBC functions.

Parameters:
ctl_p Pointer to PBC control block.
valid_state Valid current state.
new_state New state.
Returns:
MSG code.

References pbc_lock_access(), pbc_unlock_access(), and _PBC_Control::state.

Referenced by PBC_initialize(), and PBC_shutdown().

unsigned int pbc_create_control_block ( void   )  [static]

Allocate and adopt a PBC control information block.

Returns:
MSG code.

References _PBC_Control::mtx, PBC_CTL_UNINITIALIZED, and _PBC_Control::state.

Referenced by PBC_initialize().

unsigned int PBC_init ( void   ) 

Initialize the PBC application-level functions using CDM.

This function is a wrapper for PBC_initialize() that uses CDM to determine its parameters.

Returns:
Zero if successful.

A MSG code if an error occurs.

References PBC_initialize().

unsigned int PBC_initialize ( ITC_Task *  task_p,
ITC_TaskID  tid 
)

Initialize the PBC application-level functions.

This function initializes the application-level portion of the PBC package. At the application level, there is no PBC task. Instead, the handlers for the PBC telecommands are attached to another task. If a valid value is provided for either the task_p or the tid parameter, then this function will attach the PBC command handlers to the corresponding task. If neither parameter is specified (by setting task_p to NULL and tid to -1), then it is assumed that the controlling task is responsible for attaching the PBC command handlers.

Parameters:
task_p Pointer to controlling task's description block.
tid ID of the controlling task.
Returns:
MSG code.

References PBC_Apid640, PBC_bootTlmCb(), pbc_change_state(), pbc_create_control_block(), PBC_CTL_INITIALIZED, PBC_CTL_INITIALIZING, PBC_CTL_UNINITIALIZED, pbc_pool_alloc(), pbc_pool_init(), _PBC_Control::pkt_buf_p, _PBC_Control::pkt_bytes, _PBC_Control::pkt_fcb_p, _PBC_Control::pkt_in_use, _PBC_Control::state, and _PBC_Control::task_p.

Referenced by PBC_init().

unsigned int pbc_lock_access ( PBC_Control ctl_p  )  [static]

Lock access to a PBC control block.

Parameters:
ctl_p Pointer to PBC control block.
Returns:
MSG code.

References _PBC_Control::mtx.

Referenced by pbc_change_state().

void * pbc_pool_alloc ( void *  prm,
unsigned int  size,
ITC_cb_Completion **  free_cb,
void **  cb_parm_0,
void **  cb_parm_1,
void **  cb_parm_2 
) [static]

Allocate a packet from an FPA pool.

Parameters:
prm Pointer to PBC control block.
size Size of allocation request, in bytes.
free_cb Location to store pointer to packet free callback.
cb_parm_0 Location to store callback parameter 0.
cb_parm_1 Location to store callback parameter 1.
cb_parm_2 Location to store callback parameter 2.
Returns:
Pointer to allocated packet.

References pbc_pool_free(), _PBC_Control::pkt_bytes, _PBC_Control::pkt_fcb_p, and _PBC_Control::pkt_in_use.

Referenced by PBC_initialize().

void pbc_pool_free ( ITC_QueueItem *  qitem_p,
unsigned int  status,
void *  parm_0,
void *  parm_1,
void *  parm_2,
unsigned int  tx 
) [static]

Free a packet from an FPA pool.

Parameters:
qitem_p Pointer to queue item.
status Completion code.
parm_0 Callback parameter 0 (pointer to FPA control block).
parm_1 Callback parameter 1 (pointer to FPA packet).
parm_2 Callback parameter 2 (pointer to PBC control block).
tx Flag indicating sender-side failure (unused).
Returns:
Nothing.

References _PBC_Control::pkt_in_use.

Referenced by pbc_pool_alloc().

unsigned int pbc_pool_init ( FPA_fcb **  fcb_pp,
void **  buf_pp,
int *  in_use_p,
unsigned int  num_pkt,
unsigned int  pkt_bytes 
) [static]

Initialize an FPA pool.

Parameters:
fcb_pp Pointer to location to store FPA control block pointer.
buf_pp Pointer to location to store pool data buffer pointer.
in_use_p Pointer to count of packets in use.
num_pkt Number of packets to include in the pool.
pkt_bytes Size of each packet, in bytes.
Returns:
MSG code.

Referenced by PBC_initialize().

unsigned int pbc_pool_release ( FPA_fcb **  fcb_pp,
void **  buf_pp,
int *  in_use_p 
) [static]

Release the FPA pool memory.

Parameters:
fcb_pp Pointer to FPA control block pointer.
buf_pp Pointer to pool data buffer pointer.
in_use_p Pointer to count of packets in use.
Returns:
MSG code.

Referenced by PBC_shutdown().

unsigned int PBC_shutdown ( void   ) 

unsigned int pbc_unlock_access ( PBC_Control ctl_p,
unsigned int  status 
) [static]

Unlock access to a PBC control block.

Parameters:
ctl_p Pointer to PBC control block.
status Previous status code.
Returns:
MSG code.

References _PBC_Control::mtx.

Referenced by pbc_change_state().


Variable Documentation

PBC_DB_Schema * Pbc_def_db [static]

Initial value:

    {
        10,                             
        ITC_TID_LCM,                    
    }
Default PBC configuration database.

PBC_Control * PBC_pbc = NULL

Control block for PBC.

Pointer to the control block (state) for the PBC application-level functions. The actual control block buffer is allocated during PBC_initialize().

Pointer to the control block (state) for the PBC application-level functions.


Generated on Wed Nov 21 22:02:50 2012 by  doxygen 1.5.8