GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBC / dev > pbc / rhel5-32
#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_Control * | PBC_pbc = NULL |
Control block for PBC. | |
static const PBC_DB_Schema | Pbc_def_db |
Default PBC configuration database. |
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.
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.
ctl_p | Pointer to PBC control block. | |
valid_state | Valid current state. | |
new_state | New state. |
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.
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.
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.
task_p | Pointer to controlling task's description block. | |
tid | ID of the controlling task. |
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.
ctl_p | Pointer to PBC control block. |
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.
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. |
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.
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). |
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.
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. |
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.
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. |
Referenced by PBC_shutdown().
unsigned int PBC_shutdown | ( | void | ) |
Shut down the PBC application-level functions.
References PBC_Apid640, pbc_change_state(), PBC_CTL_INITIALIZED, PBC_CTL_SHUTDOWN, PBC_CTL_UNINITIALIZED, pbc_pool_release(), _PBC_Control::pkt_buf_p, _PBC_Control::pkt_fcb_p, _PBC_Control::pkt_in_use, _PBC_Control::state, and _PBC_Control::task_p.
unsigned int pbc_unlock_access | ( | PBC_Control * | ctl_p, | |
unsigned int | status | |||
) | [static] |
Unlock access to a PBC control block.
ctl_p | Pointer to PBC control block. | |
status | Previous status code. |
References _PBC_Control::mtx.
Referenced by pbc_change_state().
PBC_DB_Schema * Pbc_def_db [static] |
Initial value:
{ 10, ITC_TID_LCM, }
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.