GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTS / V2-3-2 > cts_lcp_enet / rhel4-32


Interface   Data Structures   File List   Data Fields   Globals  

CTX_lcp.c File Reference

CTX service callback (LAT/SIU specific). More...

#include <string.h>
#include <PBS/MBA.h>
#include <MSG/MSG_pubdefs.h>
#include <CCSDS/CCSDS_pkt.h>
#include <CTDB/CTDB_config.h>
#include <CTDB/CTDB_rt.h>
#include <CTDB/SUMT_rt.h>
#include <ITC/ITC_apidefs.h>
#include <ITC/ITC_drvdefs.h>
#include <ITC/ITC_pubdefs.h>
#include <ITC/ITC_msgs.h>
#include <CTS/CTS_pubdefs.h>
#include <CTS/CTS_msgs.h>
#include <CTS_prvdefs.h>

Functions

static void CTX_freePacket (void *pkt, void *prm)
 Free a queue item.
unsigned int CTX_createService (ITC_TaskID tid, unsigned int nim, ITC_cb_Memory *rtn, void *prm)
 Initialize an CTX service control block.
unsigned int CTX_sendCmd (void *prm, const ITC_QueueItem *qitem, void *pay, unsigned int len)
 CTDB service layer callback.
unsigned int CTX_sendTlm (void *prm, const ITC_QueueItem *qitem, void *pay, unsigned int len)
 CTDB service layer callback.


Detailed Description

CTX service callback (LAT/SIU specific).

CVS $Id: CTX_lcp.c,v 1.6 2011/03/28 23:55:14 apw Exp $
Author:
A.P.Waite

Function Documentation

unsigned int CTX_createService ( ITC_TaskID  tid,
unsigned int  nim,
ITC_cb_Memory *  rtn,
void *  prm 
)

Initialize an CTX service control block.

Parameters:
tid (in) ITC task ID for this service
nim (in) Mask of ITC nodes served by this service (not implemented)
rtn (in) Memory allocator for diagnostic stream
prm (in) Memory allocator for diagnostic stream - parameter
Return values:
CTS_SUCCESS Success
CTS_QCREATE Cannot create queue
CTX_createService() creates and intializes an CTX service control block

References _CTS_Control::cnt, CTS_ccb, CTS_CTL_INITIALIZED, CTS_ctl_states, _CTS_Control::ctx, CTX_createQ(), CTX_deleteQ(), CTX_sendCmd(), CTX_sendTlm(), CTX_SVC_INITIALIZED, _CTS_Control::mtx, and _CTS_Control::state.

Referenced by CTS_configure().

static void CTX_freePacket ( void *  pkt,
void *  prm 
) [static]

Free a queue item.

Parameters:
pkt Packet to free (unused)
prm User context parameter (queue item)

Referenced by CTX_sendCmd(), and CTX_sendTlm().

unsigned int CTX_sendCmd ( void *  prm,
const ITC_QueueItem *  qitem,
void *  pay,
unsigned int  len 
)

CTDB service layer callback.

Parameters:
prm (in) User context parameter
qitem (in) Queue item
pay (in) Queue item payload pointer
len (in) Queue item payload length
CTX_sendCmd() reads one ITC queue, ITC_QID_CMD, looking for commands that LAT side applications want to send to the spacecraft. Commands are expected to be valid CCSDS packets contained in ITC protocol (though CTX_sendCmd() will check CCSDS integrity, see below).

Warning:
Byte ordering:
  • CTX_sendCdm() requires that incoming packets have their CCSDS header in machine-local byte order.
  • Because the CTDB driver expects the packet in network (big-endian) order, CTX_sendCmd() will perform any necessary byte-swapping on CCSDS headers and checksum fields only. (A service layer routine such as CTX_sendCmd() has no basis to perform CCSDS packet payload byte-swapping).
If any of the following conditions is true, the packet is dropped:
  • Packet size is less than the sum of: a telecommand primary header, a telecommand secondary header, a telecommand checksum.
  • Packet length is greater than a maximum size defined by CTDB_CONFIG_PKT_SIZE_CMD_RX.
  • The packet is an odd number of bytes.
  • The packet is not CCSDS version 1.
  • Packet secondary header bit is clear.
  • Packet command bit is clear.
  • APID is outside the allowed range for telecommands from spacecraft to LAT.
For packets passing these tests, CTX_sendCmd() will:
  • Insert the CCSDS header sequence number (maintained per APID).
  • Calculate and insert the checksum.
  • Do any necessary byte-swapping on headers and checksums.
?????
Return values:
CTS_BADQUEU CTX does not accept packets this queue
CTS_CMDAPID Telecommand APID not in valid range
CTS_CMDBITC Telecommand bit clear in telecommand packet
CTS_CMDEVEN Telecommand packet length not an even number of bytes
CTS_CMDHEAD Telecommand packet header verification failed
CTS_CMDLEN Telecommand packet length not in valid range
CTS_CMDQUEU Error queueing telecommmand packet to CTDB driver
ITC_FORWARD Service completed successfully, do not free packet

References _CTX_Service::cmd, CTS_getDevice(), and CTX_freePacket().

Referenced by CTX_createService().

unsigned int CTX_sendTlm ( void *  prm,
const ITC_QueueItem *  qitem,
void *  pay,
unsigned int  len 
)

CTDB service layer callback.

Parameters:
prm (in) User context parameter
qitem (in) Queue item
pay (in) Queue item payload pointer
len (in) Queue item payload length
CTX_sendTlm() reads two ITC queues, ITC_QID_CTL_X and ITC_QID_CTL, looking for telemetry that LAT side applications want to send to the spacecraft. Telemtry is expected to be in the form of valid CCSDS packets contained in ITC protocol (though CTX_sendTlm() will check CCSDS integrity, see below). The two queues have dedicated purposes:
  • ITC_QID_CTL_X Alert telemetry
  • ITC_QID_CTL Diagnostic telemetry
Warning:
Byte ordering:
  • CTX_sendTlm() requires that incoming packets have their CCSDS header in machine-local byte order.
  • Because the CTDB driver expects the packet in network (big-endian) order, CTX_sendTlm() will perform any necessary byte-swapping on CCSDS headers only. (A service layer routine such CTX_sendTlm() has no basis to perform CCSDS packet payload byte-swapping).
If any of the following conditions is true, the packet is dropped:
  • Packet size is less than the sum of a telemetry primary header and a telemetry secondary header.
  • Packet length is greater than a maximum size defined by CTDB_CONFIG_PKT_SIZE_TELEM.
  • The packet is not CCSDS version 1.
  • Packet secondary header bit is clear.
  • Packet command bit is set.
  • For packets arriving on the ITC_QID_CTL_X queue, the APID is outside the valid range for alert telemetry.
  • For packets arriving on the ITC_QID_CTL queue, the APID is outside the valid range for diagnostic telemetry.
For packets passing these tests, CTX_sendTlm() will:
  • Insert the CCSDS header sequence number (maintained per APID).
  • Do any necessary byte-swapping on headers.
?????
Return values:
CTS_BADQUEU CTX does not accept packets this queue
CTS_TLMAPID Telemetry APID not in valid range
CTS_TLMBITS Telecommand bit set in telemetry packet
CTS_TLMEVEN Telemetry packet length not an even number of bytes
CTS_TLMHEAD Telemetry packet header verification failed
CTS_TLMLEN Telemetry packet length not in valid range
CTS_TLMQUEU Error queueing telemetry to CTDB driver
ITC_FORWARD Service completed successfully, do not free packet

References CTS_getDevice(), CTX_freePacket(), and _CTX_Service::tlm.

Referenced by CTX_createService().


Generated on Fri Sep 30 18:49:59 2011 by  doxygen 1.5.8