GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > CTS / V2-0-0

Constituent: cts_scp_enet     Tag: mv2304


Interface   Data Structures   File List   Data Fields   Globals  

CTX_scp.c File Reference

CTX service callback ("spacecraft" 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_bc.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"

Include dependency graph for CTX_scp.c:

Include dependency graph

Functions

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)
 Callback for service task sending telecommands to LAT.


Detailed Description

CTX service callback ("spacecraft" specific).

CVS $Id: CTX_scp.c,v 1.3 2005/04/12 00:15:24 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_GENERROR Generic error
CTX_createService() creates and intializes an CTX service control block

Here is the call graph for this function:

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

Free a queue item.

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

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

Callback for service task sending telecommands to LAT.

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 spacecraft side applications want to send to the LAT. 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_sendCmd() 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:
CTX_BADQUEU CTX does not accept packets this queue
CTX_CMDAPID Telecommand APID not in valid range
CTX_CMDBITC Telecommand bit clear in telecommand packet
CTX_CMDEVEN Telecommand packet length not an even number of bytes
CTX_CMDHEAD Telecommand packet header verification failed
CTX_CMDLEN Telecommand packet length not in valid range
CTX_CMDQUEU Error queueing telecommmand packet to CTDB driver
ITC_FORWARD Service completed successfully, do not free packet

Here is the call graph for this function:


Generated on Sun Apr 24 23:53:42 2005 by doxygen 1.3.3