GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTDB / V5-5-6 > sumt_rt_sib / rad750
#include <CTDB/CTDB_msg.h>
#include <PBS/TOC.h>
#include <PBS/TASK.h>
#include <MSG/MSG_pubdefs.h>
Classes | |
struct | _SUMT_RT_Bus_Config |
struct | _SUMT_RT_Pkt_Config |
struct | _SUMT_RT_Task_Config |
struct | _SUMT_RT_Diag |
struct | _SUMT_RT_Callback_Config |
Typedefs | |
typedef enum _SUMT_RT_Priority | SUMT_RT_Priority |
typedef enum _SUMT_RT_Mode_Flags | SUMT_RT_Mode_Flags |
typedef struct _SUMT_RT | SUMT_RT |
typedef enum _SUMT_RT_Subaddr | SUMT_RT_Subaddr |
typedef unsigned int | SUMT_RT_Hkp_Handler (void *buf, void *arg) |
typedef void | SUMT_RT_Pkt_Free (void *pkt, void *arg) |
typedef struct _SUMT_RT_Bus_Config | SUMT_RT_Bus_Config |
typedef struct _SUMT_RT_Pkt_Config | SUMT_RT_Pkt_Config |
typedef struct _SUMT_RT_Task_Config | SUMT_RT_Task_Config |
typedef struct _SUMT_RT_Diag | SUMT_RT_Diag |
typedef struct _SUMT_RT_Callback_Config | SUMT_RT_Callback_Config |
Enumerations | |
enum | _SUMT_RT_Priority { SUMT_RT_PRIORITY_LOW = 0, SUMT_RT_PRIORITY_HIGH = 1 } |
enum | _SUMT_RT_Mode_Flags { SUMT_RT_MODE_FLAG_VALID = 0x0001, SUMT_RT_MODE_FLAG_BCAST = 0x0002 } |
enum | _SUMT_RT_Subaddr { SUMT_RT_SUBADDR_CMD_RX = 0x0001, SUMT_RT_SUBADDR_CMD_TX = 0x0002, SUMT_RT_SUBADDR_TELEM_DATA = 0x0004, SUMT_RT_SUBADDR_TELEM_END = 0x0008, SUMT_RT_SUBADDR_WRAP = 0x0010 } |
Functions | |
Device Control Functions | |
unsigned int | SUMT_rtSizeof (void) |
Get the size of a remote terminal driver descriptor. | |
SUMT_RT * | SUMT_rtGet (void) |
Get a pointer to the remote terminal driver static descriptor. | |
unsigned int | SUMT_rtInit (SUMT_RT *rt, const SUMT_RT_Bus_Config *busConfig, const SUMT_RT_Pkt_Config *pktConfig, const SUMT_RT_Callback_Config *cbConfig, const SUMT_RT_Task_Config *taskConfig) |
Intialize a remote terminal driver and 1553 device hardware. | |
unsigned int | SUMT_rtStart (SUMT_RT *rt) |
Start the remote terminal listening for 1553 bus commands. | |
unsigned int | SUMT_rtStop (SUMT_RT *rt) |
Stop the remote terminal from listening for 1553 bus commands. | |
unsigned int | SUMT_rtExit (SUMT_RT *rt) |
Shutdown a remote terminal driver and 1553 device hardware. | |
unsigned int | SUMT_rtHkpSet (SUMT_RT *rt, SUMT_RT_Hkp_Handler *hkpHandler, void *hkpArg) |
Change the HKP application callback. | |
unsigned int | SUMT_rtHkpGet (SUMT_RT *rt, SUMT_RT_Hkp_Handler **hkpHandler, void **hkpArg) |
Get current HKP application callback information. | |
Packet Queue Functions | |
unsigned int | SUMT_rtPktTelemSend (SUMT_RT *rt, void *pkt, SUMT_RT_Pkt_Free *freeHandler, void *freeArg, SUMT_RT_Priority priority, const TOC *timeout) |
Send a CCSDS telemetry packet. | |
unsigned int | SUMT_rtPktCmdTxSend (SUMT_RT *rt, void *pkt, SUMT_RT_Pkt_Free *freeHandler, void *freeArg, const TOC *timeout) |
Send an outgoing CCSDS command transmit packet. | |
unsigned int | SUMT_rtPktCmdRxRecv (SUMT_RT *rt, void **pkt, const TOC *timeout) |
Receive an incomming CCSDS command receive packet. | |
unsigned int | SUMT_rtPktCmdRxFree (SUMT_RT *rt, void *pkt) |
Free a CCSDS command receive packet. | |
Diagnostics Functions | |
unsigned int | SUMT_rtDiagGet (SUMT_RT *rt, SUMT_RT_Diag *diag) |
Read the diagnostics information. | |
unsigned int | SUMT_rtDiagClear (SUMT_RT *rt) |
Clear the diagnostics information. |
This driver provides a 1553 remote terminal interface through a UTMC Summit controller device. The user is provided function to initialize, control, and transfer data on the 1553 bus. The interface for sending data is through CCSDS packet queues.
The driver recognizes a set of subaddress types. Each type can transfer one packet. The recognized subaddress types are shown below,
Subaddress | Direction | Description |
Command Receive (CmdRx) | Receive (BC->RT) | Telecommand input |
Command Transmit(CmdTx) | Transmit (RT->BC) | Telecommand output |
Telemetry (Telem) | Transmit (RT->BC) | Low rate telemetry
|
Each subaddress is provided with queues and callback mechanisms to transfer packets to and from the 1553 remote terminal.
The Summit RT drivers are supported for different target boards.
Library | Board | Tags |
libsumt_rt_pmc1553.o | Alphi PMC-1553B | mv2304 mcp750 |
libsumt_rt_sib.o | LAT SIB | rad750 mcp750
|
LAT SIB Board
The Summit driver for the LAT SIB board assumes that the PCI configuration header of the board has been setup by the PCI autoconfig process or something similar. The driver will obtain the PCI MEM address from the SIB/sib constituent function SIB_queury(). The driver will invoke pciIntConnect() to setup the interrupt handler.
Alphi PMC-1553B Board
The Summit driver for the PMC1553 board assumes that the PCI configuration header of the board has been setup by the PCI autoconfig process or something similar. The driver will obtain the PCI MEM addresses from the config Base Address registers #0, #1, and #3. The driver will call sysPciToLocalAdrs() to map the BAR values into local address space. The driver will invoke pciIntConnect() to setup the interrupt handler based on the value contained in the config Interrupt Line register.
Driver Memory Usage
The Summit driver requires a small amount of memory for internal data objects. The primary memory requirements, however, derive from the packet queue buffers. The Summit remote terminal driver memory requirements are summarized below:
Driver data structures | < 1 KB |
Telecommand packet input queue | queue size * (72 bytes + user) |
Telecommand packet output queue | queue size * 24 bytes |
Telemetry packet output queue | queue size * 24 bytes |
Telemetry block buffer | 960 bytes |
RT event service task Stack | 8192 bytes |
RT event service task queue | 896 bytes
|
An interrupt mode driver remote terminal descriptor. The driver interface functions will take a pointer to an instance of one of these structures as a parameter.
The typedef for _SUMT_RT_Bus_Config.
The typedef for _SUMT_RT_Callback_Config.
The typedef for _SUMT_RT_Diag.
The format of the real-time housekeeping remote terminal callback. The user provides this function so that the HKP data packet may be inserted into the 1553 frame. The user should copy the HKP packet, with properly formatted CCSDS header, into the buf memory.
unsigned int SUMT_RT_Hkp_Handler(void *buf, void *arg)
buf | A local buffer to accept the HKP packet contents. | |
arg | A user supplied argument. |
The typedef for _SUMT_RT_Mode_Flags.
The typedef for _SUMT_RT_Pkt_Config.
The definition of a packet buffer memory free callback function. These callbacks are employeed when users are sending packets on a transmit queue. The packet memory is borrowed while the packet is on the queue. When the packet contents have been transmitted, the free handler is called with a user supplied argument.
void SUMT_RT_Pkt_Free(void *pkt, void *arg)
pkt | A pointer to the packet buffer to release. | |
arg | The user defined argument. |
The typedef for _SUMT_RT_Priority.
The typedef for _SUMT_RT_Subaddr.
The typedef for _SUMT_RT_Task_Config.
enum _SUMT_RT_Mode_Flags |
Configuration bitmask values for the mode_flags member of _SUMT_RT_Bus_Config.
enum _SUMT_RT_Priority |
enum _SUMT_RT_Subaddr |
Subaddress ID values for keying the polled mode driver.
unsigned int SUMT_rtDiagClear | ( | SUMT_RT * | rt | ) |
Clear the diagnostics information.
Sets to zero the current diagnostics counter values.
rt | A device descriptor. |
References _SUMT_RT::check, _SUMT_RT::rt_diag, and _SUMT_RT::rt_lock.
Referenced by CTDB_rtDiagClear().
unsigned int SUMT_rtDiagGet | ( | SUMT_RT * | rt, | |
SUMT_RT_Diag * | diag | |||
) |
Read the diagnostics information.
Places the current diagnostics counter values into diag.
rt | A device descriptor. | |
diag | Contains diagnostics info upon return. |
References _SUMT_RT::check, _SUMT_RT::rt_diag, and _SUMT_RT::rt_lock.
Referenced by CTDB_rtDiagGet().
unsigned int SUMT_rtExit | ( | SUMT_RT * | rt | ) |
Shutdown a remote terminal driver and 1553 device hardware.
Stops the remote terminal from processing 1553 bus events and releases system resources claimed by the driver. The remote terminal event service task will be deleted.
rt | A device descriptor. |
References _SUMT_RT::check, _SUMT_RT_Msg::event, _SUMT_RT_Msg::hdr, MEM_FREE, SUMT_RT_EVENT_EXIT, _SUMT_RT::task_fpa, _SUMT_RT::task_id, _SUMT_RT::task_msg, and _SUMT_RT::task_queue.
Referenced by CTDB_rtExit().
SUMT_RT * SUMT_rtGet | ( | void | ) |
Get a pointer to the remote terminal driver static descriptor.
Returns a pointer to a static instance of the driver descriptor. This pointer may be passed in as the first paramter to all of the other driver functions. SUMT_rtInit() must be called before use.
Referenced by CTDB_rtGet().
unsigned int SUMT_rtHkpGet | ( | SUMT_RT * | rt, | |
SUMT_RT_Hkp_Handler ** | hkpHandler, | |||
void ** | hkpArg | |||
) |
Get current HKP application callback information.
Retrieves the HKP application callback function and arguments current values.
rt | A device descriptor. | |
hkpHandler | Stores the pointer to the application HKP function. | |
hkpArg | Stores user argument for hkpHandler. |
References _SUMT_RT::check, CO1553_rtTelemHkpGet(), and _SUMT_RT::telem_inter.
Referenced by CTDB_rtHkpGet().
unsigned int SUMT_rtHkpSet | ( | SUMT_RT * | rt, | |
SUMT_RT_Hkp_Handler * | hkpHandler, | |||
void * | hkpArg | |||
) |
Change the HKP application callback.
Changes the HKP application callback function and arguments to new values. The old values, set either in SUMT_rtInit() or in the last call to this function, are replaced.
rt | A device descriptor. | |
hkpHandler | The synchronous callback to handle insertion of HKP telemety packets into the telemetry blocks. | |
hkpArg | A user argument for hkpHandler. |
References _SUMT_RT::check, CO1553_rtTelemHkpSet(), and _SUMT_RT::telem_inter.
Referenced by CTDB_rtHkpSet().
int SUMT_rtInit | ( | SUMT_RT * | rt, | |
const SUMT_RT_Bus_Config * | busConfig, | |||
const SUMT_RT_Pkt_Config * | pktConfig, | |||
const SUMT_RT_Callback_Config * | cbConfig, | |||
const SUMT_RT_Task_Config * | taskConfig | |||
) |
Intialize a remote terminal driver and 1553 device hardware.
Intializes the Summit remote terminal device descriptor and device hardware. The device and associated software structures are configured according to the contents of the busConfig, boardConfig, pktConfig, and cbConfig structures.
The device internal registers are initialized to remote terminal mode. The function SUMT_rtConfigure() is called to setup the shared memory structures as well as the device RT illegallization registers. At the end, the device sercive task is spawned, and the device interrupts are enabled. The device is still not listening on the bus. Call SUMT_rtStart() to enable activity.
rt | An uninitialized device descriptor. | |
busConfig | The configuration values for the 1553 bus schedule. | |
pktConfig | The configuration values for the application packet interface. | |
cbConfig | The configuration values for the sychronous callback handlers. | |
taskConfig | The configuration values for the RT service task. |
References _SUMT_RT::check, _SUMT_RT::cmd_rx_inter, _SUMT_RT_Pkt_Config::cmd_rx_pkt_size, _SUMT_RT_Pkt_Config::cmd_rx_queue_size, _SUMT_RT_Pkt_Config::cmd_rx_user_size, _SUMT_RT::cmd_tx_inter, _SUMT_RT_Pkt_Config::cmd_tx_pkt_size, _SUMT_RT_Pkt_Config::cmd_tx_queue_size, _SUMT_RT_Bus_Config::cmd_tx_timeout, _SUMT_RT::cmd_tx_timeout, _SUMT_RT::cmd_tx_timer, CO1553_rtCmdRxInit(), CO1553_rtCmdTxInit(), CO1553_rtTelemInit(), _SUMT_RT::data_buf, _SUMT_RT::desc_blk, _SUMT_RT_Msg::event, _SUMT_RT_Msg::hdr, _SUMT_RT_Callback_Config::hkp_arg, _SUMT_RT_Callback_Config::hkp_handler, _SUMT_RT_Pkt_Config::hkp_pkt_size, _SUMT_RT::log_list, _SUMT_RT::mem_addr, MEM_ALLOC, _SUMT_RT::mem_size, _SUMT_RT_Bus_Config::rt_addr, _SUMT_RT::rt_lock, SUMT_CHAEN, SUMT_CHBEN, SUMT_DMAF, SUMT_ILCMD, SUMT_memSet(), SUMT_MERR, SUMT_MSEL_RT, SUMT_READY, SUMT_REG_BIT_WORD, SUMT_REG_COMMAND, SUMT_REG_CONTROL, SUMT_REG_I_RCV_0, SUMT_REG_I_RCV_1, SUMT_REG_I_XMT_0, SUMT_REG_I_XMT_1, SUMT_REG_IBRD_RCV_0, SUMT_REG_IBRD_RCV_1, SUMT_REG_IBRD_XMT_0, SUMT_REG_IBRD_XMT_1, SUMT_REG_IMOD_BRD_RCV_0, SUMT_REG_IMOD_BRD_RCV_1, SUMT_REG_IMOD_BRD_XMT_0, SUMT_REG_IMOD_BRD_XMT_1, SUMT_REG_IMOD_RCV_0, SUMT_REG_IMOD_RCV_1, SUMT_REG_IMOD_XMT_0, SUMT_REG_IMOD_XMT_1, SUMT_REG_IRQ_LLP, SUMT_REG_IRQ_MASK, SUMT_REG_IRQ_PEND, SUMT_REG_SRT_DP, SUMT_REG_STATUS, SUMT_REG_STATUS_WORD, SUMT_REG_WRITE, _SUMT_RT::sumt_regs, SUMT_reset(), SUMT_RT_DESC_SIZE, SUMT_RT_EVENT_INIT, SUMT_RT_LOG_SIZE, SUMT_RT_N_INTR, SUMT_RTA, SUMT_rtBoardInit(), SUMT_rtBoardIntrAck(), SUMT_rtBoardIntrConnect(), SUMT_rtBoardIntrDisable(), SUMT_rtBoardIntrEnable(), SUMT_rtConfigure(), SUMT_RTPTY, SUMT_rtTask(), SUMT_SSYSF, SUMT_SUBAD, SUMT_test(), SUMT_TPARF, SUMT_WMASK_CONTROL, SUMT_WMASK_IRQ_MASK, SUMT_WMASK_STATUS, SUMT_WORD_READ, SUMT_WRAPF, _SUMT_RT_Task_Config::task_attr, _SUMT_RT::task_fpa, _SUMT_RT::task_id, _SUMT_RT_Task_Config::task_level, _SUMT_RT::task_level, _SUMT_RT::task_msg, _SUMT_RT::task_queue, _SUMT_RT::telem_data, _SUMT_RT_Pkt_Config::telem_high_queue_size, _SUMT_RT::telem_inter, _SUMT_RT_Pkt_Config::telem_low_queue_size, _SUMT_RT_Bus_Config::telem_msg_count, _SUMT_RT_Pkt_Config::telem_pkt_size, _SUMT_RT_Bus_Config::telem_timeout, _SUMT_RT::telem_timeout, and _SUMT_RT::telem_timer.
unsigned int SUMT_rtPktCmdRxFree | ( | SUMT_RT * | rt, | |
void * | pkt | |||
) |
Free a CCSDS command receive packet.
Returns a CCSDS telecommand input packet buffer to the driver. This function should be called for every command packet received from the function SUMT_rtPktCmdRxRecv().
rt | A device descriptor. | |
pkt | A pointer to the packet buffer to free. |
References _SUMT_RT::check, _SUMT_RT::cmd_rx_inter, and CO1553_rtCmdRxPktFree().
Referenced by CTDB_rtPktCmdRxFree().
unsigned int SUMT_rtPktCmdRxRecv | ( | SUMT_RT * | rt, | |
void ** | pkt, | |||
const TOC * | timeout | |||
) |
Receive an incomming CCSDS command receive packet.
Waits for a new CCSDS telecommand receive packet on the remote terminal input queue. The function will place a pointer to the new packet buffer in pkt. The user should return the packet buffer to the driver by calling SUMT_rtPktCmdRxFree().
rt | A device descriptor. | |
pkt | Holds a pointer to the telecommand packet. | |
timeout | The time to wait for a packet on the queue. |
References _SUMT_RT::check, _SUMT_RT::cmd_rx_inter, and CO1553_rtCmdRxPktRecv().
Referenced by CTDB_rtPktCmdRxRecv().
unsigned int SUMT_rtPktCmdTxSend | ( | SUMT_RT * | rt, | |
void * | pkt, | |||
SUMT_RT_Pkt_Free * | freeHandler, | |||
void * | freeArg, | |||
const TOC * | timeout | |||
) |
Send an outgoing CCSDS command transmit packet.
Places a CCSDS telecommand packet on the remote terminal output queue. The packet will be sent when bandwidth becomes available.
rt | A device descriptor. | |
pkt | A pointer to the packet to send. The packet buffer should start with a properly formatted CCSDS packet header. | |
freeHandler | The function to be called after the packet has been sent. | |
freeArg | A user argument to be passed to the freeHandler function. | |
timeout | The time to wait for a packet on the queue. |
References _SUMT_RT::check, _SUMT_RT::cmd_tx_inter, and CO1553_rtCmdTxPktSend().
Referenced by CTDB_rtPktCmdTxSend().
unsigned int SUMT_rtPktTelemSend | ( | SUMT_RT * | rt, | |
void * | pkt, | |||
SUMT_RT_Pkt_Free * | freeHandler, | |||
void * | freeArg, | |||
SUMT_RT_Priority | priority, | |||
const TOC * | timeout | |||
) |
Send a CCSDS telemetry packet.
Places a CCSDS telemetry packet on one of the remote terminal output queues. The packet will be sent when bandwidth becomes available.
rt | A device descriptor. | |
pkt | A pointer to the packet to send. The packet buffer should start with a properly formatted CCSDS packet header. | |
freeHandler | The function to be called after the packet has been sent. | |
freeArg | A user argument to be passed to the freeHandler function. | |
priority | The priority of the packet: SUMT_RT_PRIORITY_HIGH or SUMT_RT_PRIORITY_LOW. | |
timeout | The time to wait for a packet on the queue. |
References _SUMT_RT::check, CO1553_rtTelemPktSend(), and _SUMT_RT::telem_inter.
Referenced by CTDB_rtPktTelemSend().
unsigned int SUMT_rtSizeof | ( | void | ) |
Get the size of a remote terminal driver descriptor.
Returns the size of a Summit remote terminal driver descriptor. The user is responsible for allocating this memory before calling SUMT_rtInit().
Referenced by CTDB_rtSizeof().
unsigned int SUMT_rtStart | ( | SUMT_RT * | rt | ) |
Start the remote terminal listening for 1553 bus commands.
Starts the remote terminal listening on the 1553 bus for commands from the bus controller.
rt | A device descriptor. |
References _SUMT_RT::base_addr, _SUMT_RT::check, _SUMT_RT::desc_blk, _SUMT_RT::log_list, _SUMT_RT::rt_diag, _SUMT_RT::rt_lock, SUMT_addrLocalToChip(), SUMT_REG_CONTROL, SUMT_REG_IRQ_LLP, SUMT_REG_SRT_DP, SUMT_REG_WRITE, _SUMT_RT::sumt_regs, SUMT_STEX, SUMT_WMASK_CONTROL, SUMT_WMASK_IRQ_LLP, SUMT_WMASK_SRT_DP, and SUMT_WORD_READ.
Referenced by CTDB_rtStart().
unsigned int SUMT_rtStop | ( | SUMT_RT * | rt | ) |
Stop the remote terminal from listening for 1553 bus commands.
Stops the remote terminal from listening on the 1553 bus for commands from the bus controller.
rt | A device descriptor. |
References _SUMT_RT::check, SUMT_REG_CONTROL, SUMT_REG_WRITE, _SUMT_RT::sumt_regs, SUMT_STEX, SUMT_WMASK_CONTROL, and SUMT_WORD_READ.
Referenced by CTDB_rtStop(), and SUMT_rtTerminate().