GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LIH / V0-2-7 > lih / linux-gcc
#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>
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. |
CVS $Id: LIH_limit.c,v 1.8 2011/03/29 22:38:00 apw Exp $
static __inline unsigned int isInvalid | ( | const LIH_DB_Limit * | adc | ) | [static] |
Check an ADC limit set.
adc | (in) An ADC limit set |
0 | ADC limit definitions is valid | |
1 | ADC limit definitions is not valid |
Referenced by LIH_limitCheckCDM().
unsigned int LIH_limitAble | ( | unsigned int | able | ) |
Enable/disable taking actions on the basis of ADC states.
able | (in) Enable/disable state (boolean, 1 => enable) |
References _LIH_Control::enable, and LIH_hcb.
Referenced by LIH_EnableActions().
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.
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) |
References LIH_hcb, and _LIH_Control::tbl.
Referenced by LIH_SetActionsAdc().
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.
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) |
0 | Output of corresponding diagnostic packet -not- requested | |
1 | Output of corresponding diagnostic packet -requested- |
References _LIH_LimitAlert_Tlm::adx, _LIH_Control::afp, _LIH_LimitSave::confirm, _LIH_LimitAlert_Tlm::cur, _LIH_LimitSave::deltaNag, _LIH_LimitSave::deltaPersist, _LIH_LimitSave::deltaSettle, _LIH_Control::enable, _LIH_LimitSave::lastTime, LIH_Adc2source, LIH_Adc2string, LIH_K_SETTLE_SETTLING, LIH_K_SETTLE_STABLE, LIH_K_SETTLE_UNSTABLE, LIH_LIMITALERT_TLM_APID, _LIH_LimitAlert_Tlm::limit, _LIH_LimitAlert_Tlm::name, _LIH_Source::off, _LIH_LimitAlert_Tlm::prv, _LIH_Control::sav, sendCTDB_cb(), _LIH_LimitSave::settleState, _LIH_LimitSave::suspect, _LIH_Control::tbl, and _LIH_LimitAlert_Tlm::value.
Referenced by AEMacquire(), PDUacquire(), and TEMacquire().
unsigned int LIH_limitCheckCDM | ( | LIH_DB_Schema * | ldb | ) |
Check the contents of an LIH CDM database.
ldb | (in) Handle to the CDM database data |
References isInvalid().
Referenced by initializeLimits(), and LIH_LoadLimits().
void LIH_limitExternalDefault | ( | LIH_Control * | hcb, | |
LIH_DB_Schema * | ldb | |||
) |
Use an external default limit set to initialize the limit table.
hcb | (in) LIH control block | |
ldb | (in) Handle to the CDM database data |
References _LIH_Control::tbl.
Referenced by initializeLimits(), and LIH_LoadLimits().
void LIH_limitExternalTable | ( | LIH_Control * | hcb, | |
LIH_DB_Schema * | ldb | |||
) |
Use an external default limit set to initialize the limit table.
hcb | (in) LIH control block | |
ldb | (in) Handle to the CDM database data |
References _LIH_Control::tbl.
Referenced by initializeLimits(), and LIH_LoadLimits().
void LIH_limitInternalDefault | ( | LIH_Control * | hcb | ) |
Use internal defaults to initialize the limit table.
hcb | (in) LIH control block |
References _LIH_Control::tbl.
Referenced by initializeLimits().
unsigned int LIH_limitLimit | ( | LIH_DB_ADC | adx, | |
const signed short | limit[LIH_DB_L_LIMIT] | |||
) |
Set the limit boundaries for monitoring an ADC.
adx | (in) ADC index on which to set limits | |
limit | (in) New limit set (negative => leave value as is) |
References LIH_hcb, and _LIH_Control::tbl.
Referenced by LIH_SetLimitsAdc().
unsigned int LIH_limitNag | ( | LIH_DB_ADC | adx, | |
LIH_DB_ADCState | state, | |||
unsigned int | delta | |||
) |
Change nag time for an ADC/state.
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) |
References LIH_hcb, and _LIH_Control::tbl.
Referenced by LIH_SetNagTimesAdc().
unsigned int LIH_limitPersist | ( | LIH_DB_ADC | adx, | |
unsigned int | persist | |||
) |
Change persistence time for an ADC.
adx | (in) ADC index on which to set the persistence | |
persist | (in) Persistence time (milliseconds, 0 => no persistence) |
References LIH_hcb, and _LIH_Control::tbl.
Referenced by LIH_SetPersistAdc().
unsigned int LIH_limitSendAdc | ( | LIH_DB_ADC | adx | ) |
Send the limit set for an ADC via diagnostic telemetry.
adx | (in) ADC index on which to disable limit checking |
References _LIH_LimitAdc_Tlm::adx, _LIH_LimitAdc_Tlm::deltaNag, _LIH_LimitAdc_Tlm::deltaPersist, _LIH_LimitAdc_Tlm::deltaSettle, _LIH_Control::dfp, LIH_hcb, LIH_LIMITADC_TLM_APID, _LIH_LimitAdc_Tlm::limit, sendCTDB_cb(), and _LIH_Control::tbl.
Referenced by LIH_DumpLimitsAdc(), LIH_SetActionsAdc(), LIH_SetLimitsAdc(), LIH_SetNagTimesAdc(), LIH_SetPersistAdc(), and LIH_SetSettleAdc().
unsigned int LIH_limitSendAll | ( | unsigned int | reason, | |
unsigned int | source, | |||
unsigned int | ident | |||
) |
Test ADC limits and take requested action.
reason | (in) Reason for generating this dump | |
source | (in) The source of the request | |
ident | (in) User provided dump identifier |
\retval |
References _LIH_LimitHeader::cpu, _LIH_LimitHeader::deflate, _LIH_Control::enable, _LIH_LimitHeader::enable, _LIH_LimitHeader::header, _LIH_LimitHeader::ident, _LIH_LimitHeader::inflate, LIH_hcb, LIH_LIMITALL_TLM_APID, _LIH_Control::lock, _LIH_LimitHeader::reason, _LIH_LimitHeader::rsv, _LIH_Control::rwi, _LIH_LimitHeader::secs, sendSDI_cb(), _LIH_LimitHeader::source, _LIH_Control::tbl, _LIH_Control::tlm, _LIH_LimitHeader::usec, zlibAlloc(), and zlibFree().
Referenced by LIH_DumpLimits().
unsigned int LIH_limitSettle | ( | LIH_DB_ADC | adx, | |
unsigned int | settle | |||
) |
Limit the time an ADC state has to settle.
adx | (in) ADC index on which to set the persistence | |
settle | (in) Maximum settling time (milliseconds) |
References LIH_hcb, and _LIH_Control::tbl.
Referenced by LIH_SetSettleAdc().
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.
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) |
Referenced by LIH_limitCheck(), and LIH_limitSendAdc().
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.
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) |
References _LIH_Control::lock.
Referenced by LIH_limitSendAll().
static void * zlibAlloc | ( | void * | prm, | |
unsigned int | cnt, | |||
unsigned int | siz | |||
) | [static] |
Allocate memory for ZLIB.
prm | (in) User parameter (unused) | |
cnt | (in) Count of objects | |
siz | (in) Size of object (in bytes) |
NULL | Cannot allocate | |
x | Pointer to allocated memory |
Referenced by LIH_limitSendAll().
static void zlibFree | ( | void * | prm, | |
void * | add | |||
) | [static] |
Free memory for ZLIB.
prm | (in) User parameter (unused) | |
add | (in) Address to free |
NULL | Cannot allocate | |
x | Pointer to allocated memory |
Referenced by LIH_limitSendAll().
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" }