GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LHK / V12-2-4 > lhk / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

LHK_diagnostic.c File Reference

Facilities to run housekeeping packets as demand diagnostics. More...

#include <string.h>
#include <ITC/ITC_apidefs.h>
#include <ITC/ITC_pubdefs.h>
#include <LHK/LHK_msgs.h>
#include <MDB/MDB_pubdefs.h>
#include <PBS/FFS.ih>
#include <PBS/INT.ih>
#include <PBS/MBA.h>
#include <PBS/WCT.h>
#include <LHK_prvdefs.h>

Functions

static WUT_cb_status expireTimer (void *prm, WUT_tmr *wut)
 Timer callback to produce a diagnostic packet.
static FORK_cb_status forkBlip (FORK_cb_prm *prm, FORK_msg_hdr *hdr)
 Task level target of the diagnostic timer interrupt.
static FORK_cb_status forkTimer (FORK_cb_prm *prm, FORK_msg_hdr *hdr)
 Task level target of the diagnostic timer interrupt.
static void freePacket (ITC_QueueItem *qitem, unsigned int status, void *prm0, void *prm1, void *prm2, unsigned int tx)
 An ITC completion routine to free a queue item after use.
static void initializePacket (void *prm, void *pkt, int siz, int off)
 Initialize the ITC elements of diagnostic packets.
static LHK_PacketStatus noPacket (void *prm, unsigned int abas, unsigned int aidx, unsigned int seq, unsigned char *out)
 If a packet is not defined, then requests for that packet come here.
static unsigned int sendDiagnostic (unsigned int aidx)
 Timer callback to produce a diagnostic packet.
unsigned int LHK_diagnosticCancel (unsigned int aidx)
 Cancel a diagnostic packet request.
unsigned int LHK_diagnosticInitialize (LHK_Control *lcb)
 Initialize the resources needed to produce diagnostic packets.
unsigned int LHK_diagnosticRequest (unsigned int aidx, unsigned int count, unsigned int delta)
 Cancel a diagnostic packet request.
unsigned int LHK_diagnosticStart (unsigned int aidx, unsigned int count, unsigned int delta)
 Service a diagnostic packet request.

Variables

LHK_Packet LHK_packet [ITC_L_APID_HOUSE]
 Packet description and control data, per APID.
unsigned int LHK_noPacketDiagnostic [ITC_L_APID_HOUSE]
 Counters/timeouts for undefined diagnostic packets.
unsigned int LHK_noPacketHousekeeping [ITC_L_APID_HOUSE]
 Counters/timeouts for undefined diagnostic packets.


Detailed Description

Facilities to run housekeeping packets as demand diagnostics.

CVS $Id: LHK_diagnostic.c,v 1.3 2011/03/29 01:45:00 apw Exp $
Author:
A.P.Waite
LHK_diagnostic.c provides the facilities to generate housekeeping packets as diagnostic packets on a different cadence to the regular housekeeping schedule. Think of it as "demand houekeeping". Such diagnostic packets can be requested as a one-shot, or repetitively. For repetitive requests, both the repetition count and period can be specified.

Function Documentation

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

Timer callback to produce a diagnostic packet.

Parameters:
prm (in) User parameter (unused)
wut (in) Wake-up timers

References forkTimer(), _LHK_Control::fqi, _LHK_Timeout::frk, and _LHK_Control::msg.

Referenced by LHK_diagnosticStart().

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

Task level target of the diagnostic timer interrupt.

Parameters:
prm (in) Fork parameter (unused)
hdr (in) Pointer to message

References _LHK_Blip::aidx, _LHK_Control::bpa, LHK_diagnosticStart(), and LHK_lcb.

Referenced by LHK_diagnosticRequest().

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

Task level target of the diagnostic timer interrupt.

Parameters:
prm (in) Fork parameter (unused)
hdr (in) Pointer to message (unused)

References _LHK_Control::active, _LHK_Control::aidx, _LHK_Packet::alarm, _LHK_Packet::count, _LHK_Packet::delta, LHK_lcb, _LHK_Packet::noend, sendDiagnostic(), and _LHK_Control::tmr.

Referenced by expireTimer().

static void freePacket ( ITC_QueueItem *  qitem,
unsigned int  status,
void *  prm0,
void *  prm1,
void *  prm2,
unsigned int  tx 
) [static]

An ITC completion routine to free a queue item after use.

Parameters:
qitem (in) Queue item
status (in) Status from ITC
prm0 (in) User param 0 (LHK control block)
prm1 (in) User param 1 (unused)
prm2 (in) User param 2 (unused)
tx (in) Failure during send phase of ITC_send() (unused)
freePacket() is the callback routine that's called once a diagnostic packet has been delivered to the spacecraft across the CTDB (a standard ITC completion routine).

References _LHK_Control::dpa.

Referenced by initializePacket().

static void initializePacket ( void *  prm,
void *  pkt,
int  siz,
int  off 
) [static]

Initialize the ITC elements of diagnostic packets.

Parameters:
prm (in) User parameter (actually the LHK control block pointer)
pkt (in) Packet pointer
siz (in) Packet size (unused)
off (in) Offset to packet control structure (unused)

References freePacket().

Referenced by LHK_diagnosticInitialize().

unsigned int LHK_diagnosticCancel ( unsigned int  aidx  ) 

Cancel a diagnostic packet request.

Parameters:
aidx (in) Diagnostic packet APID index (repeat, index)
LHK_cancelDiagnostic() cancels a request to send a diagnostic packet.

References _LHK_Control::active, _LHK_Packet::alarm, _LHK_Packet::count, _LHK_Packet::delta, LHK_lcb, and _LHK_Packet::noend.

Referenced by LHK_CancelDiag(), and LHK_StopDiag().

unsigned int LHK_diagnosticInitialize ( LHK_Control lcb  ) 

Initialize the resources needed to produce diagnostic packets.

Parameters:
lcb (in) LHK control block

References _LHK_Control::aidx, _LHK_Control::bpa, _LHK_Control::dpa, initializePacket(), LHK_definePacket(), noPacket(), and _LHK_Control::tmr.

Referenced by LHK_initialize().

unsigned int LHK_diagnosticRequest ( unsigned int  aidx,
unsigned int  count,
unsigned int  delta 
)

Cancel a diagnostic packet request.

Parameters:
aidx (in) Diagnostic packet APID index (repeat, index)
count (in) Number of packets to send (zero implies "forever")
delta (in) Interval between packets (milliseconds)
Return values:
LHK_BADAIDX Invalid APID index
LHK_DIAGTIME Must specify a repetition time (unless count is zero)
LHK_SUCCESS Success
LHK_diagnosticRequest() builds a request for a diagnostic packet, which will be queued, like a command, to the housekeeping task.

References _LHK_Blip::aidx, _LHK_Control::dpa, forkBlip(), _LHK_Control::fqi, _LHK_Blip::frk, and LHK_lcb.

unsigned int LHK_diagnosticStart ( unsigned int  aidx,
unsigned int  count,
unsigned int  delta 
)

Service a diagnostic packet request.

Parameters:
aidx (in) Diagnostic packet APID index (repeat, index)
count (in) Number of packets to send (zero implies "forever")
delta (in) Interval between packets (milliseconds)
Return values:
LHK_BADAIDX Invalid APID index
LHK_DIAGSEND Send of diagnostic packet failed
LHK_DIAGTIME Must specify a repetition time (unless count is zero)
LHK_SUCCESS Success
LHK_startDiagnostic() services a request to send a diagnostic packet. With the exception noted below, a request for a diagnostic packet that is already being produced will overwrite the previous settings (of count and delta) for that packet.

The exception is for a count of one. This will never alter the parameters of a diagnostic packet already being produced. The idea here is that a singleton request might come internally from software (e.g. as part of the response to some other command that changes the contents of one of these packets). The software request is essentially orthogonal to a "commanded" request, so the software request should not interfere with "commanded" request.

References _LHK_Control::active, _LHK_Control::aidx, _LHK_Packet::alarm, _LHK_Packet::count, _LHK_Packet::delta, expireTimer(), LHK_lcb, _LHK_Packet::noend, sendDiagnostic(), and _LHK_Control::tmr.

Referenced by forkBlip(), and LHK_ReqDiagPacket().

static LHK_PacketStatus noPacket ( void *  prm,
unsigned int  abas,
unsigned int  aidx,
unsigned int  seq,
unsigned char *  out 
) [static]

If a packet is not defined, then requests for that packet come here.

Parameters:
prm (in) User parameter (varies by housekeeping/diagnostic mode)
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

References LHK_PKT_TIMEOUT.

Referenced by LHK_diagnosticInitialize().

static unsigned int sendDiagnostic ( unsigned int  aidx  )  [static]

Timer callback to produce a diagnostic packet.

Parameters:
aidx (in) Diagnostic packet APID index (repeat, index)
Return values:
LHK_ALLOCPKT Cannot allocate diagnostic packet
LHK_DIAGSEND Cannot send diagnostic packet
LHK_SUCCESS Success

References _LHK_Packet::dia, _LHK_Control::dpa, LHK_lcb, LHK_PKT_TIMEOUT, and _LHK_Packet::rtn.

Referenced by forkTimer(), and LHK_diagnosticStart().


Generated on Tue Nov 29 19:04:01 2011 by  doxygen 1.5.8