GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTDB / V5-5-5 > vsbc_bc_pmc1553 / mv2304
#include <vxWorks.h>
#include <sysLib.h>
#include <CTDB/VSBC_bc.h>
#include <CTDB/CO1553_util.h>
#include <CTDB/CO1553_bc.h>
#include <PBS/LI.h>
#include <PBS/FPA.h>
#include <PBS/FORK.h>
#include <PBS/TASK.h>
#include <PBS/MBA.h>
#include <PBS/WUT.h>
#include <PBS/TOV.h>
#include <PBS/RW.h>
#include <MSG/MSG_pubdefs.h>
#include <SUMT_private.h>
#include <VSBC_bc_private.h>
#include <VSBC_bc_board.h>
Defines | |
#define | MEM_ALLOC(_size) MBA_alloc((_size)) |
#define | MEM_FREE(_mem) MBA_free((_mem)) |
#define | VSBC_CONTROL_MASK |
Functions | |
static unsigned int | VSBC_bcConfigure (VSBC_BC *bc, const VSBC_BC_Bus_Config *busConfig) |
static int | VSBC_bcTask (VSBC_BC *bc, FORK_msg_sys *msg) |
static void | VSBC_bcTerminate (VSBC_BC *bc) |
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_bcExit (VSBC_BC *bc) |
Shutdown 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_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. | |
Variables | |
static VSBC_BC | bcDesc |
static CO1553_BC_Telem | telemDesc |
static CO1553_BC_Cmd_Rx | cmdRxDesc |
static CO1553_BC_Cmd_Tx | cmdTxDesc |
Functions to handle initialization and control of the Summit bus cotroller.
#define MEM_ALLOC | ( | _size | ) | MBA_alloc((_size)) |
Helper macro to call user defined memory allocator.
_size | The size in bytes of memory to allocate. |
#define MEM_FREE | ( | _mem | ) | MBA_free((_mem)) |
Helper macro to call user defined memory allocator.
_mem | A pointer to the memory to free. |
#define VSBC_CONTROL_MASK |
Value:
(SUMT_BC_RTRY_1 | SUMT_BC_MSG_ERR | SUMT_BC_ME | SUMT_BC_BUSY | SUMT_BC_TF | \ SUMT_BC_SSYSF | SUMT_BC_INS | SUMT_BC_SRQ)
Referenced by VSBC_bcConfigure().
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.
static unsigned int VSBC_bcConfigure | ( | VSBC_BC * | bc, | |
const VSBC_BC_Bus_Config * | config | |||
) | [static] |
Performs the work necessary to configure the BCRTM bus controller device. A BC command block structure list is layed out in the device shared memory with an end-of-list marker on the last command . Each bus command is given a data buffer large enough to hold one 1553 message. Shared memory space is also reserved for the BCRTM event interrupt log. Information about the bus command list in use is cached in the bc structure.
bc | A device descriptor. | |
config | A 1553 bus configuration structure. |
References _VSBC_BC::base_addr, _VSBC_BC_Bus_Frame::bus_cmd, _VSBC_BC_Bus_Config::bus_frame, _VSBC_BC_Bus_Config::bus_side, _VSBC_BC::cmd_blk, _VSBC_BC::cmd_rx_cmd_blk, _VSBC_BC::cmd_rx_data, _VSBC_BC_Bus_Config::cmd_rx_subaddr, _VSBC_BC::cmd_tx_cmd_blk, _VSBC_BC::cmd_tx_data, _VSBC_BC_Bus_Config::cmd_tx_subaddr, CO1553_MSG_SIZE, CO1553_MSG_WORDS, CO1553_utilCmdCreate(), _VSBC_BC::data_buf, _VSBC_BC_Bus_Cmd::flags, _VSBC_BC::frame_cmd_blk, _VSBC_BC::frame_flags, _VSBC_BC_Bus_Frame::num_cmd, _VSBC_BC_Bus_Config::rt_addr, _VSBC_BC_Bus_Cmd::sub_addr, SUMT_addrLocalToChip(), SUMT_BC_CHA, SUMT_BC_CHB, SUMT_BC_EOL, SUMT_BC_EXE, SUMT_BC_SKIP, SUMT_CMD_BRANCH_ADDR, SUMT_CMD_COMMAND_1, SUMT_CMD_COMMAND_2, SUMT_CMD_CONTROL, SUMT_CMD_DATA_PTR, SUMT_CMD_SIZE, SUMT_CMD_STATUS_1, SUMT_CMD_STATUS_2, SUMT_CMD_TIME_DELAY, SUMT_WORD_WRITE, _VSBC_BC::telem_data, _VSBC_BC::telem_data_cmd_blk, _VSBC_BC::telem_end_cmd_blk, _VSBC_BC::telem_end_data, _VSBC_BC_Bus_Config::telem_msg_count, _VSBC_BC_Bus_Config::telem_subaddr, _VSBC_BC_Bus_Cmd::time_delay, VSBC_BC_BUS_FLAG_BCAST, VSBC_BC_BUS_FLAG_SKIP, VSBC_BC_NUM_BUS_FRAME, VSBC_BC_SUBADDR_CMD_ANC, VSBC_BC_SUBADDR_CMD_ATT, VSBC_BC_SUBADDR_CMD_RX, VSBC_BC_SUBADDR_CMD_TT, VSBC_BC_SUBADDR_CMD_TX, VSBC_BC_SUBADDR_TELEM_DATA, VSBC_BC_SUBADDR_TELEM_END, and VSBC_CONTROL_MASK.
Referenced by VSBC_bcInit().
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_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.
static int VSBC_bcTask | ( | VSBC_BC * | bc, | |
FORK_msg_sys * | msg | |||
) | [static] |
The bus controller event service task. This task listens for new interrupt descriptor messages placed on a queue by VSBC_bcIntr(). The interrupt event information is parsed to determine the appropriate action. If the interrupt event is an error, then the user error callback is invoked. Otherwise, if the event is a data message transmit or receive, the VSBC_bcMsg() function is called to further process the event.
bc | A device descriptor. | |
msg | A pointer to the event message. |
References _VSBC_BC::task_level, VSBC_BC_EVENT_BUS_A, VSBC_BC_EVENT_BUS_B, VSBC_BC_EVENT_EXIT, VSBC_BC_EVENT_FRAME, VSBC_BC_EVENT_INIT, VSBC_bcMsg(), VSBC_bcSwitchPost(), and VSBC_bcTerminate().
Referenced by VSBC_bcInit().
static void VSBC_bcTerminate | ( | VSBC_BC * | bc | ) | [static] |
Stops the bus controller event service loop and returns all resources claimed by the driver.
bc | A device descriptor. |
References _VSBC_BC::bc_lock, _VSBC_BC::cmd_rx_inter, _VSBC_BC::cmd_tx_inter, CO1553_bcCmdRxExit(), CO1553_bcCmdTxExit(), CO1553_bcTelemExit(), _VSBC_BC::frame_timer, MEM_FREE, SUMT_REG_IRQ_MASK, _VSBC_BC::sumt_regs, SUMT_WORD_WRITE, _VSBC_BC::sync_cmd_buf, _VSBC_BC::telem_data, _VSBC_BC::telem_inter, VSBC_bcBoardIntrDisable(), VSBC_bcBoardIntrDisconnect(), and VSBC_bcStop().
Referenced by VSBC_bcTask().
bcDesc [static] |
An instance of the driver descriptor; used for VSBC_bcGet().
cmdRxDesc [static] |
An instance of the telecommand receive interface descriptor.
cmdTxDesc [static] |
An instance of the telecommand transmit interface descriptor.
telemDesc [static] |
An instance of the telemetry interface descriptor.