GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CTDB / V5-5-6 > sumt_rt_sib / rad750


Interface   Data Structures   File List   Data Fields   Globals  

SUMT_rt_core.c File Reference

Primary Summit device interface functions. More...

#include <vxWorks.h>
#include <string.h>
#include <sysLib.h>
#include <CTDB/SUMT_rt.h>
#include <CTDB/CO1553_rt.h>
#include <CTDB/CO1553_util.h>
#include <PBS/FORK.h>
#include <PBS/FPA.h>
#include <PBS/TASK.h>
#include <PBS/RW.h>
#include <PBS/MBA.h>
#include <PBS/WUT.h>
#include <MSG/MSG_pubdefs.h>
#include <SUMT_private.h>
#include <SUMT_rt_private.h>
#include <SUMT_rt_board.h>

Defines

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

Functions

static unsigned int SUMT_rtConfigure (SUMT_RT *rt, const SUMT_RT_Bus_Config *config)
static int SUMT_rtTask (SUMT_RT *rt, SUMT_RT_Msg *msg)
static void SUMT_rtTerminate (SUMT_RT *rt)
unsigned int SUMT_rtSizeof (void)
 Get the size of a remote terminal driver descriptor.
SUMT_RTSUMT_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_rtExit (SUMT_RT *rt)
 Shutdown 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_rtDiagGet (SUMT_RT *rt, SUMT_RT_Diag *diag)
 Read the diagnostics information.
unsigned int SUMT_rtDiagClear (SUMT_RT *rt)
 Clear the diagnostics information.
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.

Variables

static SUMT_RT rtDesc
static CO1553_RT_Telem telemDesc
static CO1553_RT_Cmd_Rx cmdRxDesc
static CO1553_RT_Cmd_Tx cmdTxDesc


Detailed Description

Primary Summit device interface functions.

Author:
D.L. Wood
Functions to handle initialization and control of the Summit remote terminal.

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

static unsigned int SUMT_rtConfigure ( SUMT_RT rt,
const SUMT_RT_Bus_Config config 
) [static]

Performs the work necessary to configure the Summit remote terminal device. A RT descriptor structure table is layed out, with all of the subaddresses initially disabled. Each subaddress is given a data buffer large enough to hold one 1553 message. Shared memory space is also reserved for the Summit event interrupt log. After the initial setup, those subaddresses actually in use, as indicated by the config structure, are allowed to generate interrupt events. Information about the subaddresses in use is cached in the rt structure.

The low part of the shared memory is devoted to the Summit RT descriptor table. Data buffers are set out for every subaddress, whether or not the subaddresses are actually used. The Summit requires a buffer of 34 16-bit words for each subaddress. Two of the words in the buffer are for control information. The descriptors for the recongnized subaddresses are initialized to proper values and pertinent information cached in the driver control structure. Special handling of the wrap data buffers allows the wrap command to be handled without futher driver intervention.

At the end, the device illegalization registers are initialzed to mask out any bus activity not described in the config settings. This will cause the device to generate error interrupts on detecting illegal bus activity directed at the remote terminal.

Parameters:
rt A device descriptor.
config A 1553 bus configuration structure.
Returns:
A CTDB MSG code.

References _SUMT_RT::base_addr, _SUMT_RT::cmd_rx_data, _SUMT_RT::cmd_rx_desc, _SUMT_RT_Bus_Config::cmd_rx_subaddr, _SUMT_RT::cmd_tx_data, _SUMT_RT::cmd_tx_desc, _SUMT_RT_Bus_Config::cmd_tx_subaddr, CO1553_MSG_SIZE, _SUMT_RT::data_buf, _SUMT_RT::desc_blk, _SUMT_RT_Bus_Config::mode_flags, _SUMT_RT::rt_addr, _SUMT_RT_Bus_Config::rt_addr, SUMT_addrChipToLocal(), SUMT_addrLocalToChip(), SUMT_DESC_CONTROL, SUMT_DESC_DATA_A_PTR, SUMT_DESC_SIZE, 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_WRITE, _SUMT_RT::sumt_regs, SUMT_RT_CTRL_IWA, SUMT_RT_MODE_FLAG_VALID, SUMT_rtLegalize(), SUMT_WMASK_ILL, SUMT_WORD_READ, SUMT_WORD_WRITE, _SUMT_RT::telem_data, _SUMT_RT::telem_desc, _SUMT_RT_Bus_Config::telem_msg_count, _SUMT_RT_Bus_Config::telem_subaddr, _SUMT_RT::wrap_data, _SUMT_RT::wrap_rx_desc, _SUMT_RT_Bus_Config::wrap_subaddr, and _SUMT_RT::wrap_tx_desc.

Referenced by SUMT_rtInit().

unsigned int SUMT_rtDiagClear ( SUMT_RT rt  ) 

Clear the diagnostics information.

Sets to zero the current diagnostics counter values.

Parameters:
rt A device descriptor.
Returns:
A CTDB MSG code.

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.

Parameters:
rt A device descriptor.
diag Contains diagnostics info upon return.
Returns:
A CTDB MSG code.

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.

Parameters:
rt A device descriptor.
Returns:
A CTDB MSG code.

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.

Returns:
A pointer to the RT driver descriptor.

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.

Parameters:
rt A device descriptor.
hkpHandler Stores the pointer to the application HKP function.
hkpArg Stores user argument for hkpHandler.
Returns:
A CTDB MSG code.

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.

Parameters:
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.
Returns:
A CTDB MSG code.

References _SUMT_RT::check, CO1553_rtTelemHkpSet(), and _SUMT_RT::telem_inter.

Referenced by CTDB_rtHkpSet().

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.

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.

Parameters:
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.
Returns:
A CTDB MSG code.

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_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().

Returns:
The size in bytes of the device descriptor.

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.

Parameters:
rt A device descriptor.
Returns:
A CTDB MSG code.

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.

Parameters:
rt A device descriptor.
Returns:
A CTDB MSG code.

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().

static int SUMT_rtTask ( SUMT_RT rt,
SUMT_RT_Msg msg 
) [static]

The remote terminal event service task. This task listens for new event descriptor messages placed on a queue by other driver functions. The event information is parsed to determine the appropriate action.

Parameters:
rt A device descriptor.
msg A pointer to the event message.
Returns:
FORK_C_CONTINUE

References _SUMT_RT_Msg::event, SUMT_RT_EVENT_EXIT, SUMT_RT_EVENT_INIT, SUMT_RT_EVENT_SUBADDR, SUMT_rtMsg(), SUMT_rtTerminate(), _SUMT_RT::task_fpa, and _SUMT_RT::task_level.

Referenced by SUMT_rtInit().

static void SUMT_rtTerminate ( SUMT_RT rt  )  [static]


Variable Documentation

cmdRxDesc [static]

An instance of the telecommand receive interface descriptor.

cmdTxDesc [static]

An instance of the telecommand transmit interface descriptor.

rtDesc [static]

An instance of the driver descriptor; used for SUMT_rtGet().

telemDesc [static]

An instance of the telemetry interface descriptor.


Generated on Wed Nov 21 20:04:38 2012 by  doxygen 1.5.8