GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTDB / V5-5-5 > vsbc_bc_pmc1553 / mv2304
#include <CTDB/CO1553_bc.h>
#include <PBS/TOC.h>
#include <PBS/TASK.h>
#include <MSG/MSG_pubdefs.h>
Classes | |
struct | _VSBC_BC_Bus_Cmd |
struct | _VSBC_BC_Bus_Frame |
struct | _VSBC_BC_Bus_Config |
struct | _VSBC_BC_Pkt_Config |
struct | _VSBC_BC_Task_Config |
struct | _VSBC_BC_Callback_Config |
Defines | |
#define | VSBC_BC_NUM_BUS_CMD 32 |
#define | VSBC_BC_NUM_BUS_FRAME 25 |
Typedefs | |
typedef struct _VSBC_BC | VSBC_BC |
typedef enum _VSBC_BC_Subaddr | VSBC_BC_Subaddr |
typedef enum _VSBC_BC_Bus_Flags | VSBC_BC_Bus_Flags |
typedef enum _VSBC_BC_Bus_Side | VSBC_BC_Bus_Side |
typedef struct _VSBC_BC_Bus_Cmd | VSBC_BC_Bus_Cmd |
typedef struct _VSBC_BC_Bus_Frame | VSBC_BC_Bus_Frame |
typedef struct _VSBC_BC_Bus_Config | VSBC_BC_Bus_Config |
typedef struct _VSBC_BC_Pkt_Config | VSBC_BC_Pkt_Config |
typedef struct _VSBC_BC_Task_Config | VSBC_BC_Task_Config |
typedef void | VSBC_BC_Pkt_Free (void *pkt, void *arg) |
typedef unsigned int | VSBC_BC_Sync_Cmd_Handler (VSBC_BC_Subaddr subAddr, void *buf, void *arg) |
typedef struct _VSBC_BC_Callback_Config | VSBC_BC_Callback_Config |
Enumerations | |
enum | _VSBC_BC_Subaddr { VSBC_BC_SUBADDR_CMD_RX = 0x0001, VSBC_BC_SUBADDR_CMD_TX = 0x0002, VSBC_BC_SUBADDR_TELEM_DATA = 0x0004, VSBC_BC_SUBADDR_TELEM_END = 0x0008, VSBC_BC_SUBADDR_CMD_TT = 0x0010, VSBC_BC_SUBADDR_CMD_ANC = 0x0020, VSBC_BC_SUBADDR_CMD_ATT = 0x0040 } |
enum | _VSBC_BC_Bus_Flags { VSBC_BC_BUS_FLAG_SKIP = 0x0001, VSBC_BC_BUS_FLAG_BCAST = 0x0002 } |
enum | _VSBC_BC_Bus_Side { VSBC_BC_BUS_SIDE_A = 0, VSBC_BC_BUS_SIDE_B = 1 } |
Functions | |
Device Control Functions | |
unsigned int | VSBC_bcSizeof (void) |
Get the size of a bus controller driver descriptor. | |
VSBC_BC * | VSBC_bcGet (void) |
Get a pointer to the bus controller driver static descriptor. | |
unsigned int | VSBC_bcInit (VSBC_BC *bc, const VSBC_BC_Bus_Config *busConfig, const VSBC_BC_Pkt_Config *pktConfig, const VSBC_BC_Callback_Config *cbConfig, const VSBC_BC_Task_Config *taskConfig) |
Intialize a bus controller driver and 1553 device hardware. | |
unsigned int | VSBC_bcStart (VSBC_BC *bc) |
Start the bus controller processing 1553 bus commands. | |
unsigned int | VSBC_bcStop (VSBC_BC *bc) |
unsigned int | VSBC_bcExit (VSBC_BC *bc) |
Shutdown a bus controller driver and 1553 device hardware. | |
unsigned int | VSBC_bcSyncCmdSet (VSBC_BC *bc, VSBC_BC_Sync_Cmd_Handler *syncHandler, void *syncArg) |
Change the sync telecommand application callback. | |
unsigned int | VSBC_bcSyncCmdGet (VSBC_BC *bc, VSBC_BC_Sync_Cmd_Handler **syncHandler, void **syncArg) |
Get current sync telecommand application callback information. | |
unsigned int | VSBC_bcBusSwitch (VSBC_BC *bc, VSBC_BC_Bus_Side side) |
Switch primary bus side. | |
Packet Queue Functions | |
unsigned int | VSBC_bcPktTelemRecv (VSBC_BC *bc, void **pkt, const TOC *timeout) |
Receive a CCSDS telemetry packet. | |
unsigned int | VSBC_bcPktTelemFree (VSBC_BC *bc, void *pkt) |
Free a CCSDS telemtry packet. | |
unsigned int | VSBC_bcPktCmdTxRecv (VSBC_BC *bc, void **pkt, const TOC *timeout) |
Receive a CCSDS telecommand transmit packet. | |
unsigned int | VSBC_bcPktCmdTxFree (VSBC_BC *bc, void *pkt) |
Free a CCSDS telecommand transmit packet. | |
unsigned int | VSBC_bcPktCmdRxSend (VSBC_BC *bc, void *pkt, VSBC_BC_Pkt_Free *freeHandler, void *freeArg, const TOC *timeout) |
Send a CCSDS telecommand receive packet. |
This driver provides a 1553 bus controller 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 type of packet in one direction. 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 bus controller.
In addition, the VSBC driver support synchronous delivery of SC broadcast telecommands through user callbacks. The driver treats these reserved telecommand slots as special subaddresses:
Subaddress | Direction | Description |
SC Time Tone (CmdTT) | Receive (BC->RT) | SITIMETONE telecommands |
SC Ancillary Data (CmdAnc) | Receive (BC->RT) | SIANCILLARY telecommands |
SC Attitude Data (CmdAtt) | Receive (BC->RT) | SIATTITUDE telecommands
|
The callbacks allow the application to synchronize to the bus schedule.
The Summit BC drivers are supported for different target boards.
Library | Board | Tags |
libvsbc_bc_pmc1553.o | Alphi PMC-1553B | mv2304 mcp750
|
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 |
Telecommand packet output queue | queue size * 24 bytes |
Telemetry packet input queue | queue size * 850 bytes |
Telemetry block buffer | 960 bytes |
Telecommand block buffer | 128 bytes |
BC event service task Stack | user parameter
|
#define VSBC_BC_NUM_BUS_CMD 32 |
The maximum number of bus commands supported by the VSBC_BC_Bus_Config configuration structure. This is the number of commands for a 40 msec bus frame.
#define VSBC_BC_NUM_BUS_FRAME 25 |
The number 40 msec bus frames in each bus frame cycle.
Referenced by VSBC_bcConfigure(), VSBC_bcFrame(), VSBC_bcMsg(), and VSBC_bcSwitchHandle().
An interrupt mode driver bus controller descriptor. The driver interface functions will take a pointer to an instance of one of these structures as a parameter.
The typedef for _VSBC_BC_Bus_Cmd.
The typedef for _VSBC_BC_Bus_Config.
The typedef for _VSBC_BC_Bus_Flags.
The typedef for _VSBC_BC_Bus_Frame.
The typedef for _VSBC_BC_Bus_Side.
The typedef for _VSBC_BC_Callback_Config.
The typedef for _VSBC_BC_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 VSBC_BC_Pkt_Free(void *pkt, void *arg)
pkt | A pointer to the packet buffer to release. | |
arg | The user defined argument. |
The typedef for _VSBC_BC_Subaddr.
This callback is invoked by the VSBC driver when the upcomming telecommand slot is marked as reserved for SITIMETONE, SIANCILLARY, or SIATTITUDE synchronous SC commands. The user should copy the telecommand packet, with properly formatted CCSDS header, into the buf memory.
unsigned int VSBC_BC_Sync_Cmd_Handler(VSBC_BC_Subaddr subAddr, void *buf, void *arg)
subAddr | A value indicating which type of synchronous command is requested. | |
buf | A driver buffer to accept the telecommand packet contents. | |
arg | A user supplied argument. |
The typedef for _VSBC_BC_Task_Config.
enum _VSBC_BC_Bus_Flags |
Configuration bitmask values for the flags member of VSBC_BC_Bus_Cmd.
enum _VSBC_BC_Bus_Side |
enum _VSBC_BC_Subaddr |
Subaddress ID values.
unsigned int VSBC_bcBusSwitch | ( | VSBC_BC * | bc, | |
VSBC_BC_Bus_Side | side | |||
) |
Switch primary bus side.
Switches the 1553 primary bus to the value requested by the side parameter.
bc | A device descriptor. | |
side | VSBC_BC_BUS_SIDE_A = make bus A primary VSBC_BC_BUS_SIDE_B = make bus B primary |
References _VSBC_BC::check, _VSBC_BC::task_queue, VSBC_BC_EVENT_BUS_A, and VSBC_BC_EVENT_BUS_B.
unsigned int VSBC_bcExit | ( | VSBC_BC * | bc | ) |
Shutdown a bus controller driver and 1553 device hardware.
Stops the bus contoller from sending 1553 bus commands and releases system resources claimed by the driver. The bus contoller event service task will be deleted.
bc | A device descriptor. |
References _VSBC_BC::check, MEM_FREE, _VSBC_BC::task_id, _VSBC_BC::task_queue, and VSBC_BC_EVENT_EXIT.
VSBC_BC * VSBC_bcGet | ( | void | ) |
Get a pointer to the bus controller 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. VSBC_bcInit() must be called before use.
unsigned int VSBC_bcInit | ( | VSBC_BC * | bc, | |
const VSBC_BC_Bus_Config * | busConfig, | |||
const VSBC_BC_Pkt_Config * | pktConfig, | |||
const VSBC_BC_Callback_Config * | cbConfig, | |||
const VSBC_BC_Task_Config * | taskConfig | |||
) |
Intialize a bus controller driver and 1553 device hardware.
Intializes the Summit bus controller 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.
bc | 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 BC service task. |
References _VSBC_BC::bc_lock, _VSBC_BC::bus_switch, _VSBC_BC::check, _VSBC_BC::cmd_blk, _VSBC_BC::cmd_rx_inter, _VSBC_BC_Pkt_Config::cmd_rx_pkt_size, _VSBC_BC_Pkt_Config::cmd_rx_queue_size, _VSBC_BC::cmd_tx_inter, _VSBC_BC_Pkt_Config::cmd_tx_pkt_size, _VSBC_BC_Pkt_Config::cmd_tx_queue_size, CO1553_bcCmdRxInit(), CO1553_bcCmdTxInit(), CO1553_bcTelemInit(), CO1553_MSG_SIZE, _VSBC_BC::data_buf, _VSBC_BC::frame_timer, _VSBC_BC::log_list, _VSBC_BC::mem_addr, MEM_ALLOC, _VSBC_BC::mem_size, SUMT_DMAF, SUMT_EOL, SUMT_ILLCMD, SUMT_ILLOP, SUMT_memSet(), SUMT_MERR, SUMT_MSEL_BC, SUMT_PPEN, SUMT_REG_CONTROL, SUMT_REG_IRQ_MASK, SUMT_REG_STATUS, _VSBC_BC::sumt_regs, SUMT_reset(), SUMT_test(), SUMT_WORD_READ, SUMT_WORD_WRITE, SUMT_WRAPF, _VSBC_BC_Callback_Config::sync_cmd_arg, _VSBC_BC::sync_cmd_arg, _VSBC_BC::sync_cmd_buf, _VSBC_BC_Callback_Config::sync_cmd_handler, _VSBC_BC::sync_cmd_handler, _VSBC_BC_Task_Config::task_attr, _VSBC_BC::task_id, _VSBC_BC_Task_Config::task_level, _VSBC_BC::task_level, _VSBC_BC::task_msg, _VSBC_BC::task_queue, _VSBC_BC::telem_data, _VSBC_BC::telem_inter, _VSBC_BC::telem_msg_count, _VSBC_BC_Bus_Config::telem_msg_count, _VSBC_BC_Pkt_Config::telem_pkt_size, _VSBC_BC_Pkt_Config::telem_queue_size, VSBC_BC_EVENT_INIT, VSBC_BC_LOG_SIZE, VSBC_BC_N_INTR, VSBC_bcBoardInit(), VSBC_bcBoardIntrAck(), VSBC_bcBoardIntrConnect(), VSBC_bcBoardIntrDisable(), VSBC_bcBoardIntrEnable(), VSBC_bcConfigure(), and VSBC_bcTask().
unsigned int VSBC_bcPktCmdRxSend | ( | VSBC_BC * | bc, | |
void * | pkt, | |||
VSBC_BC_Pkt_Free * | freeHandler, | |||
void * | freeArg, | |||
const TOC * | timeout | |||
) |
Send a CCSDS telecommand receive packet.
Places a CCSDS telecommand receive packet on the bus controller output queue. The packet will be sent when bandwidth becomes available.
bc | 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 _VSBC_BC::check, _VSBC_BC::cmd_rx_inter, and CO1553_bcCmdRxPktSend().
unsigned int VSBC_bcPktCmdTxFree | ( | VSBC_BC * | bc, | |
void * | pkt | |||
) |
Free a CCSDS telecommand transmit packet.
Returns a CCSDS telecommand transmit packet buffer to the driver. This function should be called for every telecommand packet received from the function VSBC_bcPktCmdTxRecv().
bc | A device descriptor. | |
pkt | A pointer to the packet buffer to free. |
References _VSBC_BC::check, _VSBC_BC::cmd_tx_inter, and CO1553_bcCmdTxPktFree().
unsigned int VSBC_bcPktCmdTxRecv | ( | VSBC_BC * | bc, | |
void ** | pkt, | |||
const TOC * | timeout | |||
) |
Receive a CCSDS telecommand transmit packet.
Waits for a new CCSDS telecommand transmit packet on the bus controller 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 VSBC_bcPktCmdTxFree().
bc | A device descriptor. | |
pkt | Holds a pointer to the telecommand packet. | |
timeout | The time to wait for a packet on the queue. |
References _VSBC_BC::check, _VSBC_BC::cmd_tx_inter, and CO1553_bcCmdTxPktRecv().
unsigned int VSBC_bcPktTelemFree | ( | VSBC_BC * | bc, | |
void * | pkt | |||
) |
Free a CCSDS telemtry packet.
Returns a CCSDS telemetry packet buffer to the driver. This function should be called for every telemetry packet received from the function VSBC_bcPktTelemRecv().
bc | A device descriptor. | |
pkt | A pointer to the packet buffer to free. |
References _VSBC_BC::check, CO1553_bcTelemPktFree(), and _VSBC_BC::telem_inter.
unsigned int VSBC_bcPktTelemRecv | ( | VSBC_BC * | bc, | |
void ** | pkt, | |||
const TOC * | timeout | |||
) |
Receive a CCSDS telemetry packet.
Waits for a new CCSDS telemetry packet on the bus controller input queue. The function will place a pointer to the new packet buffer in pkt if everything is working correctly. The user should return the packet buffer to the driver by calling VSBC_bcPktTelemFree().
bc | A device descriptor. | |
pkt | Holds a pointer to the telemetry packet. | |
timeout | The time to wait for a packet on the queue. |
References _VSBC_BC::check, CO1553_bcTelemPktRecv(), and _VSBC_BC::telem_inter.
unsigned int VSBC_bcStart | ( | VSBC_BC * | bc | ) |
Start the bus controller processing 1553 bus commands.
Stop the bus controller processing 1553 bus commands.
Starts the bus controller processing bus commands to send to the remote terminal. A 40 millisecond second frame timer is also started, so that once the current list of bus commands is processed, the BCRTM device is restarted the next frame tick with a new command list.
bc | A device descriptor. |
References _VSBC_BC::base_addr, _VSBC_BC::check, _VSBC_BC::frame_cmd_blk, _VSBC_BC::frame_count, _VSBC_BC::frame_timer, _VSBC_BC::log_list, SUMT_addrLocalToChip(), SUMT_REG_CONTROL, SUMT_REG_IRQ_LLP, SUMT_REG_SRT_DP, _VSBC_BC::sumt_regs, SUMT_STEX, SUMT_WORD_READ, SUMT_WORD_WRITE, VSBC_BC_FRAME_PERIOD, and VSBC_bcFrame().
unsigned int VSBC_bcStop | ( | VSBC_BC * | bc | ) |
Stops the bus controller from sending 1553 bus commands. In actuallity, the device is not stopped immediately, but simply will not be restarted for the next one second frame.
bc | A device descriptor. |
References _VSBC_BC::check, and _VSBC_BC::frame_timer.
Referenced by VSBC_bcTerminate().
unsigned int VSBC_bcSyncCmdGet | ( | VSBC_BC * | bc, | |
VSBC_BC_Sync_Cmd_Handler ** | syncHandler, | |||
void ** | syncArg | |||
) |
Get current sync telecommand application callback information.
Retrieves the synchronous telecommand application callback function and arguments current values.
bc | A device descriptor. | |
syncHandler | Stores the pointer to the application telecommand function. | |
syncArg | Stores user argument for syncHandler. |
References _VSBC_BC::bc_lock, _VSBC_BC::check, _VSBC_BC::sync_cmd_arg, and _VSBC_BC::sync_cmd_handler.
unsigned int VSBC_bcSyncCmdSet | ( | VSBC_BC * | bc, | |
VSBC_BC_Sync_Cmd_Handler * | syncHandler, | |||
void * | syncArg | |||
) |
Change the sync telecommand application callback.
Changes the synchronous telecommand application callback function and arguments to new values. The old values, set either in VSBC_bcInit() or in the last call to this function, are replaced.
bc | A device descriptor. | |
syncHandler | The synchronous callback to handle insertion of synchronous telecommand packets into the bus slots. | |
syncArg | A user argument for syncHandler. |
References _VSBC_BC::bc_lock, _VSBC_BC::check, _VSBC_BC::sync_cmd_arg, and _VSBC_BC::sync_cmd_handler.