GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LIH / V0-2-3

Constituent: lih     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

LIH_limit.c File Reference

Control functions the ADC limit monitoring facility. More...

#include <string.h>
#include "CCSDS/CCSDS_pkt.h"
#include "CDM/CDM_pubdefs.h"
#include "LIH_DB/LIH_DB_ADCdefs.h"
#include "LIH_DB/LIH_DB_schema.h"
#include "LSF/LSF.h"
#include "LSF/LSF_ids.h"
#include "MDB/MDB_pubdefs.h"
#include "PBS/MBA.h"
#include "PBS/RW.ih"
#include "ZLIB/zlib.h"
#include "LIH/LIH_msgs.h"
#include "LIH/LIH_tlmdefs.h"
#include "LIH_prvdefs.h"

Include dependency graph for LIH_limit.c:


Functions

static void sendCTDB_cb (ITC_QueueItem *qitem, unsigned int status, void *prm0, void *prm1, void *prm2, unsigned int tx)
 Clean up after sending an alert message.
static void sendSDI_cb (ITC_QueueItem *qitem, unsigned int status, void *prm0, void *prm1, void *prm2, unsigned int tx)
 Clean up after sending a trace snapshot to the SDI.
static void * zlibAlloc (void *prm, unsigned int cnt, unsigned int siz)
 Allocate memory for ZLIB.
static void zlibFree (void *prm, void *add)
 Free memory for ZLIB.
static __inline unsigned int isInvalid (const LIH_DB_Limit *adc)
 Check an ADC limit set.
unsigned int LIH_limitAble (unsigned int able)
 Enable/disable taking actions on the basis of ADC states.
unsigned int LIH_limitAction (LIH_DB_ADC adx, LIH_DB_ADCState prv, LIH_DB_ADCState cur, int alert, int diag, int msg)
 Change nag time for an ADC/state.
unsigned int LIH_limitCheck (LIH_Control *hcb, unsigned int adx, unsigned short *val, WCT_time tim, WCT_time_sat_u sat)
 Test ADC limits and take requested action.
unsigned int LIH_limitCheckCDM (LIH_DB_Schema *ldb)
 Check the contents of an LIH CDM database.
void LIH_limitExternalDefault (LIH_Control *hcb, LIH_DB_Schema *ldb)
 Use an external default limit set to initialize the limit table.
void LIH_limitExternalTable (LIH_Control *hcb, LIH_DB_Schema *ldb)
 Use an external default limit set to initialize the limit table.
void LIH_limitInternalDefault (LIH_Control *hcb)
 Use internal defaults to initialize the limit table.
unsigned int LIH_limitLimit (LIH_DB_ADC adx, const signed short limit[LIH_DB_L_LIMIT])
 Set the limit boundaries for monitoring an ADC.
unsigned int LIH_limitNag (LIH_DB_ADC adx, LIH_DB_ADCState state, unsigned int delta)
 Change nag time for an ADC/state.
unsigned int LIH_limitPersist (LIH_DB_ADC adx, unsigned int persist)
 Change persistence time for an ADC.
unsigned int LIH_limitSendAdc (LIH_DB_ADC adx)
 Send the limit set for an ADC via diagnostic telemetry.
unsigned int LIH_limitSendAll (unsigned int reason, unsigned int source, unsigned int ident)
 Test ADC limits and take requested action.
unsigned int LIH_limitSettle (LIH_DB_ADC adx, unsigned int settle)
 Limit the time an ADC state has to settle.

Variables

static const char * LIH_AdcStateString [LIH_DB_L_ADC_STATE]
 String constants for the various ADC limit states.
static const char * s_able [2] = { "disabled", "enabled" }
 Strings used in enable/disable error reporting.
static const char * s_pktType [2] = { "an alert", "a diagnostic" }
 Strings used in telemetry error reporting.

Detailed Description

Control functions the ADC limit monitoring facility.

CVS $Id: LIH_limit.c,v 1.7 2008/11/13 23:47:02 apw Exp $
Author:
A.P.Waite
LIH_limit.c provides all the control functions (enabling/disabling, setting limits and so on) for managing the ADC limit monitoring facility.

Function Documentation

static __inline unsigned int isInvalid const LIH_DB_Limit *  adc  )  [static]
 

Check an ADC limit set.

Parameters:
adc (in) An ADC limit set
Return values:
0 ADC limit definitions is valid
1 ADC limit definitions is not valid

unsigned int LIH_limitAble unsigned int  able  ) 
 

Enable/disable taking actions on the basis of ADC states.

Parameters:
able (in) Enable/disable state (boolean, 1 => enable)

unsigned int LIH_limitAction LIH_DB_ADC  adx,
LIH_DB_ADCState  prv,
LIH_DB_ADCState  cur,
int  alert,
int  diag,
int  msg
 

Change nag time for an ADC/state.

Parameters:
adx (in) ADC index on which to set set a nag time
prv (in) ADC state on previous read
cur (in) ADC state on current read
alert (in) Send alert (-1 => no change, 0 => don't, 1 => do)
diag (in) Send diag (-1 => no change, 0 => don't, 1 => do)
msg (in) Send msg (-1 => no change, 0 => don't, 1-3 => severity)

unsigned int LIH_limitCheck LIH_Control hcb,
unsigned int  adx,
unsigned short *  val,
WCT_time  tim,
WCT_time_sat_u  sat
 

Test ADC limits and take requested action.

Parameters:
hcb (in) Control block
adx (in) ADC index
val (in/out) ADC value
tim (in) ADC acquisition timestamp (internal representation)
sat (in) ADC acquisition timestamp (satellite representation)
Return values:
0 Output of corresponding diagnostic packet -not- requested
1 Output of corresponding diagnostic packet -requested-

unsigned int LIH_limitCheckCDM LIH_DB_Schema *  ldb  ) 
 

Check the contents of an LIH CDM database.

Parameters:
ldb (in) Handle to the CDM database data

void LIH_limitExternalDefault LIH_Control hcb,
LIH_DB_Schema *  ldb
 

Use an external default limit set to initialize the limit table.

Parameters:
hcb (in) LIH control block
ldb (in) Handle to the CDM database data
Warning:
This routine does no validation. It assumes that the database file has already been validted using LIH_limitCheckCDM().
LIH_limitExternalDefault() uses the default limit set in the CDM to initialize all ADC limits to default values. If there is no default limit set in the CDM, this routine does nothing.

void LIH_limitExternalTable LIH_Control hcb,
LIH_DB_Schema *  ldb
 

Use an external default limit set to initialize the limit table.

Parameters:
hcb (in) LIH control block
ldb (in) Handle to the CDM database data
Warning:
This routine does no validation. It assumes that the database file has already been validated using LIH_limitCheckCDM().
LIH_limitExternalTable() uses the list of individual ADC limit sets in the CDM database to set up individual ADC limits. The list is allowed to be empty.

void LIH_limitInternalDefault LIH_Control hcb  ) 
 

Use internal defaults to initialize the limit table.

Parameters:
hcb (in) LIH control block

unsigned int LIH_limitLimit LIH_DB_ADC  adx,
const signed short  limit[LIH_DB_L_LIMIT]
 

Set the limit boundaries for monitoring an ADC.

Parameters:
adx (in) ADC index on which to set limits
limit (in) New limit set (negative => leave value as is)

unsigned int LIH_limitNag LIH_DB_ADC  adx,
LIH_DB_ADCState  state,
unsigned int  delta
 

Change nag time for an ADC/state.

Parameters:
adx (in) ADC index on which to set a nag time
state (in) ADC state on which to set a nag time
delta (in) Interval between nags (milliseconds, 0 => don't nag)

unsigned int LIH_limitPersist LIH_DB_ADC  adx,
unsigned int  persist
 

Change persistence time for an ADC.

Parameters:
adx (in) ADC index on which to set the persistence
persist (in) Persistence time (milliseconds, 0 => no persistence)

unsigned int LIH_limitSendAdc LIH_DB_ADC  adx  ) 
 

Send the limit set for an ADC via diagnostic telemetry.

Parameters:
adx (in) ADC index on which to disable limit checking

unsigned int LIH_limitSendAll unsigned int  reason,
unsigned int  source,
unsigned int  ident
 

Test ADC limits and take requested action.

Parameters:
reason (in) Reason for generating this dump
source (in) The source of the request
ident (in) User provided dump identifier
Return values:
\retval 

unsigned int LIH_limitSettle LIH_DB_ADC  adx,
unsigned int  settle
 

Limit the time an ADC state has to settle.

Parameters:
adx (in) ADC index on which to set the persistence
settle (in) Maximum settling time (milliseconds)

static void sendCTDB_cb ITC_QueueItem *  qitem,
unsigned int  status,
void *  prm0,
void *  prm1,
void *  prm2,
unsigned int  tx
[static]
 

Clean up after sending an alert message.

Parameters:
qitem (in) Queue item
status (in) Status from ITC_send()
prm0 (in) User param 0 (LIH control block)
prm1 (in) User param 1 (unused)
prm2 (in) User param 2 (unused)
tx (in) Failure during send phase of ITC_send() (unused)
sendCTDB_cb() is the callback routine that's called once a telemetry record has been delivered (a standard ITC completion routine).

static void sendSDI_cb ITC_QueueItem *  qitem,
unsigned int  status,
void *  prm0,
void *  prm1,
void *  prm2,
unsigned int  tx
[static]
 

Clean up after sending a trace snapshot to the SDI.

Parameters:
qitem (in) Queue item
status (in) Status from ITC_send()
prm0 (in) User param 0 (Snapshot buffer)
prm1 (in) User param 1 (unused)
prm2 (in) User param 2 (unused)
tx (in) Failure during send phase of ITC_send() (unused)
sendSDI_cb() is a standard ITC completion routine. It simply frees the the snapshot back into its FPA pool (unless it's the start line trace ... it never frees the start line trace).

static void * zlibAlloc void *  prm,
unsigned int  cnt,
unsigned int  siz
[static]
 

Allocate memory for ZLIB.

Parameters:
prm (in) User parameter (unused)
cnt (in) Count of objects
siz (in) Size of object (in bytes)
Return values:
NULL Cannot allocate
x Pointer to allocated memory
Allocate memory for ZLIB.

static void zlibFree void *  prm,
void *  add
[static]
 

Free memory for ZLIB.

Parameters:
prm (in) User parameter (unused)
add (in) Address to free
Return values:
NULL Cannot allocate
x Pointer to allocated memory
Free memory for ZLIB.


Variable Documentation

static const char LIH_AdcStateString[LIH_DB_L_ADC_STATE] [static]
 

Initial value:

 
{
    "unread",
    "red low",
    "yellow low",
    "green",
    "yellow high",
    "red high",
    "unphysical",
    "unstable"
}
String constants for the various ADC limit states.


Generated on Fri Nov 14 01:10:00 2008 by  doxygen 1.4.4