GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > CTDB / V5-2-2

Constituent: co1553_rt     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

CO1553_rt_cmd.c File Reference

Function definitions for 1553 CCSDS command packet buffers, queues, and state machines. More...

#include "string.h"
#include "CTDB/CO1553_rt.h"
#include "CTDB/CO1553_util.h"
#include "CCSDS/CCSDS_pkt.h"
#include "PBS/LI.h"
#include "PBS/FPA.h"
#include "PBS/RW.h"
#include "PBS/TOC.h"
#include "PBS/MBA.h"
#include "MSG/MSG_pubdefs.h"

Include dependency graph for CO1553_rt_cmd.c:

Include dependency graph

Command Receive Interface Functions

unsigned int CO1553_rtCmdRxSizeof (void)
 Get the size of a command receive interface descriptor.

unsigned int CO1553_rtCmdRxInit (CO1553_RT_Cmd_Rx *cmd, unsigned int queueSize, unsigned int pktSize, unsigned int usrSize)
 Initialize a command receive interface descriptor.

unsigned int CO1553_rtCmdRxExit (CO1553_RT_Cmd_Rx *cmd)
 Destroy a command receive interface descriptor.

unsigned int CO1553_rtCmdRxMsg (CO1553_RT_Cmd_Rx *cmd, unsigned int devPtr, CO1553_RT_Mem_Copy *copyFunc, CO1553_RT_Diag *diag, RW_ctl *lock)
 Process a 1553 message receive for the command receive interface.

unsigned int CO1553_rtCmdRxPktRecv (CO1553_RT_Cmd_Rx *cmd, void **pkt, const TOC *timeout)
 Receive a CCSDS command packet from the 1553 command receive interface.

unsigned int CO1553_rtCmdRxPktFree (CO1553_RT_Cmd_Rx *cmd, void *pkt)
 Free a CCSDS command receive packet buffer.


Command Transmit Interface Functions

unsigned int CO1553_rtCmdTxSizeof (void)
 Get the size of a command transmit interface descriptor.

unsigned int CO1553_rtCmdTxInit (CO1553_RT_Cmd_Tx *cmd, unsigned int queueSize, unsigned int pktSize)
 Initialize a command transmit interface descriptor.

unsigned int CO1553_rtCmdTxExit (CO1553_RT_Cmd_Tx *cmd)
 Destroy a command transmit interface descriptor.

unsigned int CO1553_rtCmdTxMsg (CO1553_RT_Cmd_Tx *cmd, unsigned int devPtr, CO1553_RT_Mem_Copy *copyFunc, int wordSize, CO1553_RT_Diag *diag, RW_ctl *lock)
 Process a 1553 message transmit for the command transmit interface.

unsigned int CO1553_rtCmdTxPktSend (CO1553_RT_Cmd_Tx *cmd, void *pkt, CO1553_RT_Pkt_Free *freeHandler, void *freeArg, const TOC *timeout)
 Send a CCSDS command packet to the the 1553 command transmit interface.


Defines

#define MEM_ALLOC(_size)   MBA_alloc((_size))
#define MEM_FREE(_mem)   MBA_free((_mem))

Detailed Description

Function definitions for 1553 CCSDS command packet buffers, queues, and state machines.

Author:
D.L. Wood

The functions are for use by a remote terminal 1553 controller device driver.


Define Documentation

#define MEM_ALLOC _size   )     MBA_alloc((_size))
 

Helper macro to call user defined memory allocator.

Parameters:
_size The size in bytes of memory to allocate.
Returns:
A pointer to the memory, or NULL on error.

#define MEM_FREE _mem   )     MBA_free((_mem))
 

Helper macro to call user defined memory allocator.

Parameters:
_mem A pointer to the memory to free.


Function Documentation

unsigned int CO1553_rtCmdRxExit CO1553_RT_Cmd_Rx cmd  ) 
 

Destroy a command receive interface descriptor.

Release resources from a 1553 CCSDS command receive interface.

Parameters:
cmd A command interface descriptor.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdRxInit CO1553_RT_Cmd_Rx cmd,
unsigned int  queueSize,
unsigned int  pktSize,
unsigned int  usrSize
 

Initialize a command receive interface descriptor.

Initializes a 1553 CCSDS telecommand command packet receive interface for a remote terminal. The telecommand packet input queue is created.

Parameters:
cmd A command receive interface descriptor.
queueSize The maximum number of command packets to allow on the CCSDS input queue.
pktSize The maximum size in bytes, including header, of a telecommand packet on this subaddress interface.
usrSize The size in bytes of user space to reserve at the head of the CmdRx telecommand packet buffers.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdRxMsg CO1553_RT_Cmd_Rx cmd,
unsigned int  devPtr,
CO1553_RT_Mem_Copy copyFunc,
CO1553_RT_Diag diag,
RW_ctl *  lock
 

Process a 1553 message receive for the command receive interface.

Announces to the 1553 command receive packet interface the reception of a 1553 command input message. This function is called by a 1553 controller driver when the next 1553 command message in a frame has been received by the 1553 device.

The next 1553 command message is copied from the device memory and is delivered to the command input queue as a CCSDS telecommand packet.

Parameters:
cmd A command receive interface descriptor.
devPtr A pointer to the 1553 device memory where the incomming 1553 message should be copied from.
copyFunc A device specific memory copy function for accessing 1553 device memory.
diag A pointer to a RT diagnostics structure for update.
lock A RW lock to protect the diag structure updates.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdRxPktFree CO1553_RT_Cmd_Rx cmd,
void *  pkt
 

Free a CCSDS command receive packet buffer.

Returns a borrowed CCSDS command packet buffer to the remote terminal command receive interface.

Parameters:
cmd A command receive interface descriptor.
pkt A pointer to the packet buffer to free.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdRxPktRecv CO1553_RT_Cmd_Rx cmd,
void **  pkt,
const TOC *  timeout
 

Receive a CCSDS command packet from the 1553 command receive interface.

Attempts to get the next available command packet from the remote terminal command packet input queue. The command packet receive interface places new packets on this queue as 1553 command input messages arrive on the bus.

The packet buffer memory is loaned to the user. Call CO1553_rtCmdRxPktFree() to return the packet buffer to the remote terminal command interface.

Parameters:
cmd A command receive interface descriptor.
pkt Upon success, a pointer to the packet buffer is returned here.
timeout The time to wait for a packet on the queue.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdRxSizeof void   ) 
 

Get the size of a command receive interface descriptor.

Returns:
The size of the command receive interface descriptor.

unsigned int CO1553_rtCmdTxExit CO1553_RT_Cmd_Tx cmd  ) 
 

Destroy a command transmit interface descriptor.

Release resources from a 1553 CCSDS command transmit interface.

Parameters:
cmd A command interface descriptor.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdTxInit CO1553_RT_Cmd_Tx cmd,
unsigned int  queueSize,
unsigned int  pktSize
 

Initialize a command transmit interface descriptor.

Initializes a 1553 CCSDS telecommand command packet transmit interface for a remote terminal. The telecommand packet output queue is created.

Parameters:
cmd A command transmit interface descriptor.
queueSize The maximum number of command packets to allow on the CCSDS output queue.
pktSize The maximum size in bytes, including header, of a telecommand packet on this subaddress interface.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdTxMsg CO1553_RT_Cmd_Tx cmd,
unsigned int  devPtr,
CO1553_RT_Mem_Copy copyFunc,
int  wordSize,
CO1553_RT_Diag diag,
RW_ctl *  lock
 

Process a 1553 message transmit for the command transmit interface.

Announces to the 1553 command transmit packet interface the transmission of a 1553 command output message. This function is called by a 1553 controller driver when the last 1553 telecommand output message in a frame has been sent by the 1553 device.

The CCSDS telecommand output packet queue is checked for any new pending output packets. If a new packet is ready for transmission, the packet data is copied to the device memory and the command transmit transfer counter is updated. The packet message will be sent on the next bus schedule telecommand transmit slot.

Parameters:
cmd A command transmit interface descriptor.
devPtr A pointer to the 1553 device memory where the outgoing 1553 message should be copied to.
copyFunc A device specific memory copy function for accessing 1553 device memory.
wordSize The size in terms of 16-bit words between successive device locations.
diag A pointer to a RT diagnostics structure for update.
lock A RW lock to protect the diag structure updates.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdTxPktSend CO1553_RT_Cmd_Tx cmd,
void *  pkt,
CO1553_RT_Pkt_Free freeHandler,
void *  freeArg,
const TOC *  timeout
 

Send a CCSDS command packet to the the 1553 command transmit interface.

Places a CCSDS command transmit packet on the remote terminal command output queue. The command transmit subaddress interface will remove packets from this queue and send them as fast as 1553 command transmit message bandwidth allows.

The packet buffer memory remains allocated as long as the packet is on the output queue. After the packet has been transmitted, a user supplied callback freeHandler will be called to release the packet memory.

Parameters:
cmd An command transmit interface descriptor.
pkt A pointer to the CCSDS packet header of the packet to send.
freeHandler The packet buffer memory free callback.
freeArg The argument passed to the freeHandler callback.
timeout The time to wait for space on the queue.
Returns:
A CTDB MSG code.

unsigned int CO1553_rtCmdTxSizeof void   ) 
 

Get the size of a command transmit interface descriptor.

Returns:
The size of the command transmit interface descriptor.


Generated on Thu May 5 22:02:36 2005 by doxygen 1.3.3