GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LIH / V0-2-7 > lih / linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

LIH_control.c File Reference

Control functions for the LIH hardware moitoring facility. More...

#include <string.h>
#include <CCSDS/CCSDS_pkt.h>
#include <CDM/CDM_pubdefs.h>
#include <IMM/FPM_pubdefs.h>
#include <IMM/RBM_pubdefs.h>
#include <ITC/ITC_drvdefs.h>
#include <ITC/ITC_pubdefs.h>
#include <LCBD/LCBD_drv.h>
#include <LIH_DB/LIH_DB_schema.h>
#include <LHK/LHK_pubdefs.h>
#include <MDB/MDB_pubdefs.h>
#include <PBS/FPA.h>
#include <PBS/MBA.h>
#include <PBS/MTX.h>
#include <PBS/RW.ih>
#include <PBS/WUT.h>
#include <LIH/LIH_cmdxtrn.h>
#include <LIH/LIH_msgs.h>
#include <LIH/LIH_tlmdefs.h>
#include <LIH_packet.h>
#include <LIH_prvdefs.h>
#include <LIH_source.h>

Functions

static LHK_PacketStatus capture (unsigned int *prv, unsigned int abas, unsigned int aidx, unsigned int seq, unsigned char *out)
 Copy hardware monitoring housekeeping packets from packet database.
static unsigned int control_rx (void *prm, const ITC_QueueItem *qitem, void *pay, unsigned int len)
 Process messages arriving on the control queue.
static WUT_cb_status expireTimer (void *prm, WUT_tmr *tmr)
 Timer callback routine (called at interrupt level).
static FORK_cb_status forkTimer (FORK_cb_prm *prm, FORK_msg_hdr *hdr)
 Task level target of the cyclic interrupt timer.
static unsigned int initializeAcq (LIH_Control *hcb, LIH_DB_Schema *ldb)
 Initialize the hardware acquisition facilities.
static unsigned int initializeLCB (LIH_Control *hcb, LIH_DB_Schema *ldb)
 Initialize the LCB controls.
static unsigned int initializeLimits (LIH_Control *hcb, LIH_DB_Schema *ldb)
 Initialize the ADC limit monitoring controls.
static unsigned int initializeTask (LIH_Control *hcb, LIH_DB_Schema *ldb)
 Initialize the LIH hardware monitoring task.
static void taskOnce (void *prm)
 One-time call (in task context) to initialize the cLIH task.
unsigned int LIH_initialize ()
 Initialize the LIH hardware monitoring facility.
unsigned int LIH_start ()
 Start the LIH hardware monitoring task.

Variables

LIH_ControlLIH_hcb
 Control block for the LIH hardware monitoring facility.
unsigned int LIH_aidx2hpk [ITC_L_APID_HOUSE]
 Reverse map from APID index to hardware packet.
static const char * s_offon [2] = { "off", "on" }
 Strings used in error reporting.


Detailed Description

Control functions for the LIH hardware moitoring facility.

CVS $Id: LIH_control.c,v 1.5 2011/03/29 22:38:00 apw Exp $
Author:
A.P.Waite
LIH_control.c provides all the infrastucture to run hardware monitoring facilities for LAT housekeeping.

Function Documentation

static LHK_PacketStatus capture ( unsigned int *  sav,
unsigned int  abas,
unsigned int  aidx,
unsigned int  seq,
unsigned char *  out 
) [static]

Copy hardware monitoring housekeeping packets from packet database.

Parameters:
sav (in) User parameter (update counter of last packet copy)
abas (in) Base of APID table (ITC_K_APID_HOUSE or ITC_K_APID_DIAG)
aidx (in) APID index
seq (in) CCSDS sequence count
out (in) Output buffer (beginning of CCSDS telemetry header)
Returns:
A member of the LIH_PacketStatus enumeration

References _LIH_Database::cnt, _LIH_Database::hpk, _LIH_Control::pdb, and _LIH_Packet::tim.

Referenced by initializeAcq().

static unsigned int control_rx ( void *  prm,
const ITC_QueueItem *  qitem,
void *  pay,
unsigned int  len 
) [static]

Process messages arriving on the control queue.

Parameters:
prm (in) User context parameter
qitem (in) Queue item to process
pay (in) Queue item payload
len (in) Queue item payload length
control_rx() is the callback routine for any raw protocol ITC traffic arriving on the control queue. For now, there is no such traffic, and this routine is a NOOP.

Referenced by initializeTask().

static WUT_cb_status expireTimer ( void *  prm,
WUT_tmr *  tmr 
) [static]

Timer callback routine (called at interrupt level).

Parameters:
prm (in) User parameter (harware monitoring control block)
tmr (in) Wake up timer handle
expireTimer() is a timer callback routine. It simply wakes up the harware monitoring task.

References forkTimer(), _LIH_Control::fqi, _LIH_Message::frk, and _LIH_Control::msg.

Referenced by taskOnce().

static FORK_cb_status forkTimer ( FORK_cb_prm *  prm,
FORK_msg_hdr *  hdr 
) [static]

Task level target of the cyclic interrupt timer.

Parameters:
prm (in) FORK parameter (not used) (cannot be used!)
hdr (in) The fork message (not used)
forkTimer() drives the cyclic hardware monitoring functions.

References _LIH_Device::acq, _LIH_Control::count, _LIH_Control::delta, _LIH_Control::dvc, _LIH_Control::lcbd, LIH_L_DEVICE, _LIH_Control::major, _LIH_Device::minor, _LIH_Control::minor, _LIH_Control::online, _LIH_Device::prm, and _LIH_Control::tmr.

Referenced by expireTimer().

static unsigned int initializeAcq ( LIH_Control hcb,
LIH_DB_Schema *  ldb 
) [static]

static unsigned int initializeLCB ( LIH_Control hcb,
LIH_DB_Schema *  ldb 
) [static]

Initialize the LCB controls.

Parameters:
hcb (in) LIH hardware monitoring control block
ldb (in) LIH data handle (from CDM)
initializeLCB() initializes the LCB controls

References _LIH_Control::count, _LIH_Control::lcbd, and _LIH_Control::online.

Referenced by LIH_initialize().

static unsigned int initializeLimits ( LIH_Control hcb,
LIH_DB_Schema *  ldb 
) [static]

Initialize the ADC limit monitoring controls.

Parameters:
hcb (in) LIH hardware monitoring control block
ldb (in) LIH data handle (from CDM)
initializeLimits() initializes the ADC limit checking system

References _LIH_Control::afp, _LIH_LimitSave::confirm, _LIH_Control::dfp, LIH_limitCheckCDM(), LIH_limitExternalDefault(), LIH_limitExternalTable(), LIH_limitInternalDefault(), _LIH_Control::sav, _LIH_Control::tbl, and _LIH_Control::tlm.

Referenced by LIH_initialize().

static unsigned int initializeTask ( LIH_Control hcb,
LIH_DB_Schema *  ldb 
) [static]

Initialize the LIH hardware monitoring task.

Parameters:
hcb (in) LIH hardware monitoring control block
ldb (in) LIH data handle (from CDM)
initializeTask() builds up the LIH hardware monitoring task.

References control_rx(), _LIH_Control::itc, LIH_Apid654, _LIH_Control::pcb, and _LIH_Control::rcb.

Referenced by LIH_initialize().

unsigned int LIH_initialize (  ) 

Initialize the LIH hardware monitoring facility.

LIH_initialize() does all the initialization required by the hardware monitoring facilities in LIH.

References _LIH_Control::cdm, _LIH_Control::fil, initializeAcq(), initializeLCB(), initializeLimits(), initializeTask(), LIH_CTL_BROKEN, LIH_CTL_INITIALIZED, LIH_CTL_UNINITIALIZED, _LIH_Control::mtx, _LIH_Control::rwi, and _LIH_Control::state.

unsigned int LIH_start (  ) 

Start the LIH hardware monitoring task.

LIH_start() starts the LIH hardware monitoring task

References _LIH_Control::itc, LIH_CTL_BROKEN, LIH_CTL_INITIALIZED, LIH_CTL_STARTING, _LIH_Control::mtx, _LIH_Control::state, and taskOnce().


Generated on Fri Sep 30 19:15:35 2011 by  doxygen 1.5.8