GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LHK / V11-4-2

Constituent: lhk     Tag: mv2304


Interface   Data Structures   File List   Data Fields   Globals  

LHK_p.h File Reference

Private definitions for LAT housekeeping. More...

#include "PBS/FPA.h"
#include "PBI/Endianness.h"
#include "LCBD/LCBD_cr.h"
#include "LEM/encode_structs.h"
#include "MSG/MSG_pubdefs.h"
#include "CTDB/CTDB_config.h"
#include "ITC/ITC_pubdefs.h"
#include "IMM/FPM_pubdefs.h"
#include "IMM/RBM_pubdefs.h"
#include "LHK/LHK.h"
#include "LHK/LHK_tlmdefs.h"
#include "LHK/LHK_cmddefs.h"
#include "LHK_cfg_p.h"
#include "LHK_lcb_p.h"
#include "LRA/LRA.h"
#include "TRC/TRC_pubdefs.h"

Include dependency graph for LHK_p.h:

This graph shows which files directly or indirectly include this file:


Data Structures

struct  _LHK_AdcBfl
 ADC value and status. More...
union  _LHK_AdcWord
 ADC word structure. More...
struct  _LHK_RegAddrBfl
 Address bitfield structure. More...
union  _LHK_RegAddr
 Address bitfield structure. More...
struct  _LHK_DataDesc
 Telemetry data descriptor. More...
struct  _LHK_TlmPkt
 Telemetry packet storage. More...
struct  _LHK_PktDesc
 Telemetry packet descriptor. More...
struct  _LHK_PktTbl
 Telemetry packet addressing table. More...
struct  _LHK_DiagMap
 Diagnostic apid map. More...
struct  _LHK_TaskMsg
 LHK task message descriptor. More...
struct  _LHK_Ci
 Housekeeping collection item data structure. More...
struct  _LHK_Ccb
 Collection table control block. More...
struct  _LHK_Ctl
 Application control block descriptor. More...

Defines

#define LHK_MAX_CI   1024
#define LHK_MAX_CI_ADDRS   16
#define LHK_MAX_CCB   256
#define LHK_MAX_TMSGS   128
#define LHK_MAX_SCH_PER   1000
#define LHK_MIN_SCH_PER   32
#define LHK_MAX_DIAG_PKTS   1024
#define LHK_MIN_DIAG_PKTS   1
#define LHK_MAX_DIAG_INTERVAL   240000
#define LHK_MIN_DIAG_INTERVAL   100
#define LHK_DEF_MRK_TO   300
#define LHK_CTDB_BUFSIZE   128
#define LHK_MST_TASK_ID   "mLHKc"
#define LHK_MST_TASK_PRI   135
#define LHK_SCHED_TASK_ID   "mLHKs"
#define LHK_SCHED_TASK_PRI   137
#define LHK_SLV_TASK_ID   "sLHKc"
#define LHK_SLV_TASK_PRI   139
#define LHK_PID_IN   1
#define LHK_PID_OUT   2
#define LHK_PID_SEL   7
#define LHK_PID_SC_0   23
#define LHK_PID_SC_1   24
#define LHK_PID_SC_2   25
#define LHK_GET_PID(_pn, _pv)
 Set programmable Interrupt Discrete to specified value.
#define LHK_CNF_PID(_pn, _t, _s, _o)
 Configure PIDS for reading and writing.

Typedefs

typedef enum _LHK_LimStatCode LHK_LimStatCode
 Typedef for enum _LHK_LimStatCode.
typedef enum _LHK_TaskMsgType LHK_TaskMsgType
 Typedef for enum _LHK_TaskMsgType.
typedef enum _LHK_TaskState LHK_TaskState
 Typedef for enum _LHK_TaskState.
typedef enum _LHK_CcbOpcode LHK_CcbOpcode
 Typedef for enum _LHK_CcbOpcode.
typedef enum _LHK_CiOpcode LHK_CiOpcode
 Typedef for enum _LHK_CiOpcode.
typedef _LHK_AdcBfl LHK_AdcBfl
 Typedef for telemetry bitfield structure _LHK_AdcBfl.
typedef _LHK_AdcWord LHK_AdcWord
 Typedef for ADC word structure _LHK_AdcWord.
typedef _LHK_RegAddrBfl LHK_RegAddrBfl
 Typedef for addressing bitfield structure _LHK_RegAddrBfl.
typedef _LHK_RegAddr LHK_RegAddr
 Typedef for addressing bitfield structure _LHK_RegAddr.
typedef _LHK_DataDesc LHK_DataDesc
 Typedef for structure _LHK_DataDesc.
typedef _LHK_TlmPktLHK_TlmPkt
 Pointer typedef for structure _LHK_TlmPkt.
typedef _LHK_PktDesc LHK_PktDesc
 Typedef for structure _LHK_PktDesc.
typedef _LHK_PktTbl LHK_PktTbl
 Typedef for structure _LHK_PktTbl.
typedef _LHK_DiagMap LHK_DiagMap
 Typedef for structure _LHK_DiagMap.
typedef unsigned int LHK_Ccb_Cb (void *arg0, void *arg1)
 Typedef for collection list callback function.
typedef _LHK_TaskMsg LHK_TaskMsg
 Typedef for struct _LHK_TaskMsg.
typedef _LHK_Ci LHK_Ci
 Typedef for struct _LHK_Ci.
typedef _LHK_Ccb LHK_Ccb
 Typedef for struct _LHK_Ccb.
typedef _LHK_Ctl LHK_Ctl
 Typedef for struct _LHK_Ctl.

Enumerations

enum  _LHK_LimStatCode {
  LHKSTATOK = 0x0,
  LHKSTATUNDF = 0x1,
  LHKSTATMSK = 0x2,
  LHKSTATRED = 0x3
}
 ADC status codes.
enum  _LHK_TaskMsgType {
  LHK_TMSG_START = 0x1,
  LHK_TMSG_STOP = 0x2,
  LHK_TMSG_PROC = 0x3,
  LHK_TMSG_LCB_RSP = 0x4
}
 Task message types.
enum  _LHK_TaskState {
  LHK_TSK_UNINITIALIZED = 0,
  LHK_TSK_INITIALIZED = 1,
  LHK_TSK_STARTED = 2,
  LHK_TSK_STOPPING = 3,
  LHK_TSK_ALLOCATED = 4
}
 Task message types. More...
enum  _LHK_CcbOpcode {
  LHK_CCB_UNDEF = 0x00,
  LHK_CCB_TEMENV = 0x01,
  LHK_CCB_AEMENV = 0x02,
  LHK_CCB_PDUENV = 0x03,
  LHK_CCB_PDUPWR = 0x04,
  LHK_CCB_GEMLRS = 0x05,
  LHK_CCB_FILEST = 0x06,
  LHK_CCB_COMMST = 0x07,
  LHK_CCB_CPUMET = 0x08,
  LHK_CCB_RTSTAT = 0x09,
  LHK_CCB_MEMSTAT = 0x0a,
  LHK_CCB_LTCTLM = 0x0b,
  LHK_CCB_LIMTLM = 0x0c,
  LHK_CCB_EBMST = 0x0d,
  LHK_CCB_ITCST = 0x0e
}
 Collection ctl blk opcodes.
enum  _LHK_CiOpcode {
  LHK_CI_UNDEF = 0x0,
  LHK_CI_TEMENV = 0x1,
  LHK_CI_AEMENV = 0x2,
  LHK_CI_PDUENV = 0x3,
  LHK_CI_PDUPWR = 0x4,
  LHK_CI_AEMPWR = 0x5,
  LHK_CI_GEMLIVE = 0x6,
  LHK_CI_GEMPRSC = 0x7,
  LHK_CI_GEMDISC = 0x8,
  LHK_CI_GEMSENT = 0x9,
  LHK_CI_GEMDEAD = 0xa,
  LHK_CI_FILEST = 0xb,
  LHK_CI_COMMST = 0xc,
  LHK_CI_CPUMET = 0xd,
  LHK_CI_RTSTAT = 0xe,
  LHK_CI_MEMSTAT = 0xf,
  LHK_CI_PIDSTAT = 0x10,
  LHK_CI_LTCTLM = 0x11,
  LHK_CI_LIMTLM = 0x12,
  LHK_CI_EBMST = 0x13,
  LHK_CI_ITCST = 0x14
}
 Collection item opcodes.

Functions

unsigned int LHK_sched_create (const TASK_attr *attr)
 Spawns the LHK scheduler task.
unsigned int LHK_sched_activate (void)
 Starts the LHK scheduler task timer.
unsigned int LHK_sched_exit (void)
 Exits the LHK scheduler task.
unsigned int LHK_sched_reset (LHK_CfgDesc *cfg)
 Reconfigures the scheduler.
unsigned int LHK_reset_cl (void *ccb_ptr)
 Resets the ci list.
unsigned int LHK_sched_replace (LHK_Ccb *ccb)
 Queus a ccb replace message to the scheduler task.
unsigned int LHK_destroy_ccb (LHK_Ccb *ccb)
 Destroys a ccb.
unsigned int LHK_build_rt (void)
unsigned int LHK_build_alrt (unsigned short dev, unsigned short adc, unsigned short val, unsigned short lim)
unsigned int LHK_encode_lists (LHK_CfgDesc *cfg, LI_head *ccb_list)
 Initializes the collection table control block lists.
unsigned int LHK_init_pktTbl (void)
unsigned int LHK_scan_pkt (LHK_PktTbl *pkt_tbl, unsigned short apid, LHK_PktDesc **pkt)
 Scans the packet table for a matching apid.
unsigned int LHK_limChkAem (LHK_AdcWord *value, LHK_DataDesc *data, LHK_LimStatCode *adcstat)
 Limit checks an AEM adc value.
FORK_cb_status LHK_decode_rl (void *ccb, void *prm)
 Processes a LCB result lists.
FORK_cb_status LHK_svc_diag (FORK_cb_prm *prm, FORK_msg_hdr *hdr)
 Services request for a diagnostic packet.
unsigned int LHK_decode_slv (void *prm, const struct _ITC_QueueItem *qitem, void *pay, unsigned int len)
 Decodes a slave data response.
unsigned int LHK_ctdb_cb (void *pkt, void *arg)
 This function is the CTDB 1553 callback routine. The CTDB driver requests a new telemetry packet at 4Hz.
unsigned int LHK_diag_cb (void *pay)
 Initiaites construction of a diagnostic packet.
unsigned int LHK_stopDiag_cb (void)
 Cancels current diagnostic.
unsigned int LHK_reset_cb (void *pay)
 Initiates a system reset.
unsigned int LHK_lcb_cb (void *prm, LCBD_xcb *xcb)
 Callback for the LCB result list.
unsigned int LHK_ccb_cb (LHK_Ccb *ccb)
 Simple callback for non-hardware ccbs.
void LHK_free_fpm (ITC_QueueItem *qitem, unsigned int status, void *prm0, void *prm1, void *prm2)
 Frees a qitem from FPA pool memory.
unsigned int LHK_noop (void)
 LHK noop.

Variables

_LHK_Ctl LHK_ctl
 The application control block.
LHK_PktTbl LHK_pktTbl
 The housekeeping packet addressing table.
LHK_DiagMap LHK_diagApidTbl
 The housekeeping diag apid mapping table.

Detailed Description

Private definitions for LAT housekeeping.

Author:
Sergio Maldonado -- smaldona@slac.stanford.edu

Define Documentation

#define LHK_CNF_PID _pn,
_t,
_s,
_o   ) 
 

Value:

{                                                                       \
    if( pidCnf( _pn, _t, _s, _o ) < 0 )                                 \
                  _msg_report( LHK_PIDCNF, 1, _pn);                     \
}
Configure PIDS for reading and writing.

Parameters:
_pn - PID number.
_t - DISABLE, IN, OUT, IN_OUT
_s - Input sensitivity IN_LEVEL, IN_EDGE
_o - OUT_REG or OUT_TIMER

#define LHK_CTDB_BUFSIZE   128
 

CTDB packet buffer size in bytes

#define LHK_DEF_MRK_TO   300
 

Default timeout for LCB markers in sysclks

#define LHK_GET_PID _pn,
_pv   ) 
 

Value:

{                                                                       \
    if( (_pv = pidGet( _pn )) < 0 )                                     \
                  _msg_report( LHK_PIDGET, 1, _pn);                     \
}
Set programmable Interrupt Discrete to specified value.

Parameters:
_pn - PID number.
_pv - Value

#define LHK_MAX_CCB   256
 

The maximum collection control blocks

#define LHK_MAX_CI   1024
 

The maximum collection items

#define LHK_MAX_CI_ADDRS   16
 

The maximum addresses for a collection item

#define LHK_MAX_DIAG_INTERVAL   240000
 

The maximum milliseconds for a diagnostic interval

#define LHK_MAX_DIAG_PKTS   1024
 

The maximum packets to deliver in a diagnostic sample

#define LHK_MAX_SCH_PER   1000
 

The maximum scheduler period in milliseconds

#define LHK_MAX_TMSGS   128
 

The maximum allocation for task messages

#define LHK_MIN_DIAG_INTERVAL   100
 

The minimum milliseconds for a diagnostic interval

#define LHK_MIN_DIAG_PKTS   1
 

The minumum packets to deliver for a diagnostic sample

#define LHK_MIN_SCH_PER   32
 

The minimum scheduler period in milliseconds

#define LHK_MST_TASK_ID   "mLHKc"
 

Master task id

#define LHK_MST_TASK_PRI   135
 

Master task priority

#define LHK_PID_IN   1
 

SC input PID

#define LHK_PID_OUT   2
 

SC output PID

#define LHK_PID_SC_0   23
 

SC input PID register 0

#define LHK_PID_SC_1   24
 

SC input PID register 1

#define LHK_PID_SC_2   25
 

SC input PID register 2

#define LHK_PID_SEL   7
 

PID interface selector

#define LHK_SCHED_TASK_ID   "mLHKs"
 

The scheduler task id

#define LHK_SCHED_TASK_PRI   137
 

The scheduler task priority

#define LHK_SLV_TASK_ID   "sLHKc"
 

Slave handler task id

#define LHK_SLV_TASK_PRI   139
 

Slave handler task priority


Typedef Documentation

unsigned int LHK_Ccb_Cb
 

Typedef for collection list callback function.

Parameters:
arg0 callback argument
arg1 callback argument
Returns:
LHK MSG code


Enumeration Type Documentation

enum _LHK_TaskState
 

Task message types.

Enumerator:
LHK_TSK_UNINITIALIZED  Unknown state (guard value)
LHK_TSK_INITIALIZED  Task description initialized
LHK_TSK_STARTED  Task started
LHK_TSK_STOPPING  Task trying to stop
LHK_TSK_ALLOCATED  Task memory allocated


Function Documentation

unsigned int LHK_build_alrt unsigned short  dev,
unsigned short  adc,
unsigned short  val,
unsigned short  lim
 

Parameters:
dev Device
adc ADC Number
val ADC Value
lim ADC Limit
Returns:
A LHK MSG code.

unsigned int LHK_build_rt void   ) 
 

Returns:
A LHK MSG code.

unsigned int LHK_ccb_cb LHK_Ccb ccb  ) 
 

Simple callback for non-hardware ccbs.

Parameters:
ccb Collection control block
Returns:
LHK_SUCCESS on success

unsigned int LHK_ctdb_cb void *  pkt,
void *  arg
 

This function is the CTDB 1553 callback routine. The CTDB driver requests a new telemetry packet at 4Hz.

Parameters:
pkt Packet buffer pointer
arg User supplied argument
Returns:
LHK_SUCCESS on success

FORK_cb_status LHK_decode_rl void *  ccb_ptr,
void *  prm
 

Processes a LCB result lists.

Parameters:
ccb_ptr Pointer to collection ctl blk
prm unsued
Returns:
LHK status code

unsigned int LHK_decode_slv void *  prm,
const struct _ITC_QueueItem qitem,
void *  pay,
unsigned int  len
 

Decodes a slave data response.

Parameters:
prm User context parameter
qitem Queue item to process
pay Queue item payload
len Queue item payload length
Returns:
LHK_SUCCESS on success

unsigned int LHK_destroy_ccb LHK_Ccb ccb  ) 
 

Destroys a ccb.

Parameters:
ccb ccb pointer
Returns:
LHK_SUCCESS on success

unsigned int LHK_diag_cb void *  item  ) 
 

Initiaites construction of a diagnostic packet.

Parameters:
item ITC queue item
Returns:
LHK_SUCCESS on success

unsigned int LHK_encode_lists LHK_CfgDesc cfg,
LI_head *  ccb_list
 

Initializes the collection table control block lists.

Parameters:
cfg Configuration descriptor
ccb_list Collection control block list
Returns:
LHK_SUCCESS on success

void LHK_free_fpm ITC_QueueItem *  qitem,
unsigned int  status,
void *  prm0,
void *  prm1,
void *  prm2
 

Frees a qitem from FPA pool memory.

Parameters:
qitem Pointer to ITC qitem
status status code
prm0 Parameter 0
prm1 Parameter 1
prm2 Parameter 2

unsigned int LHK_init_pktTbl void   ) 
 

Returns:
A LHK MSG code.

unsigned int LHK_lcb_cb void *  prm,
LCBD_xcb *  xcb
 

Callback for the LCB result list.

Parameters:
prm Callback parameter
xcb Transaction control block pointer
Returns:
LHK_SUCCESS on success

unsigned int LHK_limChkAem LHK_AdcWord value,
LHK_DataDesc data,
LHK_LimStatCode adcstat
 

Limit checks an AEM adc value.

Parameters:
value Data word
data ADC data descriptor
adcstat Pointer to storage for the resultant status
Returns:
LHK_SUCCESS on success

unsigned int LHK_noop void   ) 
 

LHK noop.

Returns:
LHK_SUCCESS on success

unsigned int LHK_reset_cb void *  pay  ) 
 

Initiates a system reset.

Parameters:
pay Telecommand packet payload
Returns:
LHK_SUCCESS on success

unsigned int LHK_reset_cl void *  ccb_ptr  ) 
 

Resets the ci list.

Parameters:
ccb_ptr Pointer to previsouly initialized ccb
Returns:
LHK_SUCCESS on success

unsigned int LHK_scan_pkt LHK_PktTbl pkt_tbl,
unsigned short  apid,
LHK_PktDesc **  pkt
 

Scans the packet table for a matching apid.

Parameters:
pkt_tbl Packet table pointer
apid Packet apid
pkt Packet pointer storage
Returns:
LHK_SUCCESS

unsigned int LHK_sched_activate void   ) 
 

Starts the LHK scheduler task timer.

Returns:
LHK_SUCCESS

unsigned int LHK_sched_create const TASK_attr *  attr  ) 
 

Spawns the LHK scheduler task.

Returns:
LHK_SUCCESS

unsigned int LHK_sched_exit void   ) 
 

Exits the LHK scheduler task.

Returns:
LHK_SUCCESS

unsigned int LHK_sched_reset LHK_CfgDesc cfg  ) 
 

Reconfigures the scheduler.

Parameters:
cfg Configuration block

unsigned int LHK_stopDiag_cb void   ) 
 

Cancels current diagnostic.

Returns:
LHK_SUCCESS on success

FORK_cb_status LHK_svc_diag FORK_cb_prm *  prm,
FORK_msg_hdr *  hdr
 

Services request for a diagnostic packet.

Parameters:
prm Pointer to callback parameter
hdr Pointer to the message


Generated on Tue Aug 14 02:42:08 2007 by  doxygen 1.4.4