Functions

Lower level functions used internally which can used to get more detailed control.

Functions

int xsp3_do_config (int ncards, int num_tf, char *baseIPaddress, int basePort, char *baseMACaddress, int num_chan, int create_module, char *modname, int debug, int card_index)
 Configure the complete xspress3 system.
int xsp3_config_tcp (char femHostName[][XSP3_MAX_IP_CHARS], int femPort, int ncards, int num_chan, int debug)
 Configure the xspress3 system and create a 1Gb TCP socket link to each card in the system.
int xsp3_set_num_chan (int path, int num_chan)
 Set the number of channels to be used in system.
int xsp3_resolve_path (int path, int chan, int *thisPath, int *chanIdx)
 Determine which card and consequently the handle, a particular channel is configured on and the channel number within that card, given the top level system handle and the channel number.
int xsp3_set_trigger_regs_b (int path, int chan, u_int32_t trigb_thres, u_int32_t trigb_timea, u_int32_t trigb_timeb)
 Set the raw trigger B registers, however the preferred method is to use xsp3_set_trigger_b.
int xsp3_set_trigger_regs_c (int path, int chan, u_int32_t trigc_otd_servo, u_int32_t trigc_thres)
 Set the raw trigger C registers, however the preferred method is to use xsp3_set_trigger_c.
int xsp3_set_format_reg (int path, int chan, u_int32_t format)
 Set the format register.
int xsp3_get_trigger_regs_b (int path, int chan, u_int32_t *trigb_thres, u_int32_t *trigb_timea, u_int32_t *trigb_timeb)
 Get the raw trigger B registers, however the preferred method is to use xsp3_get_trigger_b.
int xsp3_get_trigger_regs_c (int path, int chan, u_int32_t *trigc_otd_servo, u_int32_t *trigc_thres)
 Get the raw trigger C registers, however the preferred method is to use xsp3_get_trigger_c.
int xsp3_get_format_reg (int path, int chan, u_int32_t *format)
 Get the format register.
int xsp3_set_clock_control (int path, int card, u_int32_t clock)
 Set the global clock control register.
int xsp3_set_scope (int path, int card, u_int32_t scope_chn, u_int32_t scope_src, u_int32_t scope_nwd, u_int32_t scope_alt)
 Sets the scope mode registers.
int xsp3_write_reg (int path, int chan, int region, int offset, int size, u_int32_t *value)
 Write a series of values into the region registers for all or each specified channel.
int xsp3_read_reg (int path, int chan, int region, int offset, int size, u_int32_t *value)
 Read a series of values from the region registers for each specified channel.
int xsp3_write_glob_reg (int path, int card, int offset, int size, u_int32_t *value)
 Write a series of values into the global region register for all or each specified card.
int xsp3_read_glob_reg (int path, int card, int offset, int size, u_int32_t *value)
 Read a series of values from the global region register for each specified card.
int xsp3_read_raw_reg (int path, int card, u_int32_t address, int size, u_int32_t *value)
 Read a series of values from an address for each specified card.
int xsp3_get_dma_status_block (int path, int card, XSP3_DMA_StatusBlock *statusBlock)
 Get the status and settings of all the DMA streams.
int xsp3_write_rdma_reg (int path, int card, int address, int size, u_int32_t *value)
 Write a series of values into the UDP core registers for all or each specified card.
int xsp3_read_rdma_reg (int path, int card, int address, int size, u_int32_t *value)
 Read a series of values from the UPD core registers for each specified card.
int xsp3_write_spi_reg (int path, int card, int address, int size, u_int32_t *value)
 Write a series of values into the SPI registers for all or each specified card.
int xsp3_read_spi_reg (int path, int card, int address, int size, u_int32_t *value)
 Read a series of values from the SPI registers for each specified card.
int xsp3_write_soft_lut (int path, int chan, int region_num, int nwords, u_int32_t *data)
 Write Software lookup table equivalent to BRAM.
int xsp3_read_soft_lut (int path, int chan, int region_num, int nwords, u_int32_t *data)
 Read Software lookup table equivalent to BRAM.
int xsp3_dma_reset (int path, int card, u_int32_t stream_mask)
 Reset the DMA engines.
int xsp3_dma_build_desc (int path, int card, u_int32_t stream, XSP3_DMA_MsgBuildDesc *msg)
 Instruct PPC1 in the Virtex-5 to build a series of DMA descriptors.
int xsp3_dma_build_debug_desc (int path, int card, u_int32_t stream, XSP3_DMA_MsgBuildDebugDesc *msg)
 Instruct PPC1 in the Virtex-5 to build a series of DMA descriptors for debug.
int xsp3_dma_start (int path, int card, u_int32_t stream, XSP3_DMA_MsgStart *msg)
 Instruct PPC1 in the Virtex-5 to start a single DMA engine.
int xsp3_dma_resend (int path, int card, u_int32_t stream, u_int32_t first, u_int32_t num)
 Instruct PPC1 in the Virtex-5 to reset the status in an existing set of descriptors so they can be sent again.
int xsp3_system_start_count_enb (int path, int card, int count_enb)
 Start the xspress3 system with control over count enable in software framing mode.
void * xspress3FemInitialise (const char *hostname, int port)
 Initialises client connection to a FEM.
void xspress3FemClose (void *femHandle)
 Closes the xspress3 client connection to a FEM/.
int xspress3FemSetInt (void *femHandle, int chan, int region, int offset, u_int32_t value)
 Perform a single integer write transaction to the FEM.
int xspress3FemSetIntArray (void *femHandle, int chan, int region, int offset, size_t size, u_int32_t *value)
 Write an array of integers to the FEM.
int xspress3FemPersonalityWrite (void *femHandle, u_int32_t sub_command, u_int32_t stream_mask, size_t size, u_int32_t *value)
 Perform a write transaction to the FEM.
int32_t femAccessRead (FemHandle *femHandle, u_int32_t bus, u_int32_t width, u_int32_t address, u_int32_t num, u_int8_t *payload)
 Execute a read transaction on the connected FEM.
int32_t femAccessWrite (FemHandle *femHandle, u_int32_t bus, u_int32_t width, u_int32_t address, u_int8_t *payload, u_int32_t size)
 Execute a write transaction on the connected FEM.
int32_t femPersonalityWrite (FemHandle *femHandle, u_int32_t subCommand, u_int32_t width, u_int32_t streamMask, u_int8_t *payload, size_t size)
 Execute a personality write transaction on the connected FEM.
unsigned char * getMacAddressFromIP (char *ipName)
 Get the MAC address corresponding to the given IP address.
int xsp3_features_unpack (int path, int card)
 Read the features registers and expand into the features structure.
int xsp3_histogram_mkmod (int path, int chan, char *root_name, int num_tf)
 Creates Data modules to store the histogram data.
int xsp3_config_histogram_udp (int path, int card, char *hostIPaddress, int hostPort, char *femIPaddress, int femPort)
 Configure the upd connection between the server and the xspress3 card and subsequently initializes a thread to perform the histogramming.
int xsp3_config_histogram_threads (int path, int card)
 Start event list processing threads for 1 or all cards in farm mode.
int xsp3_histogram_start_count_enb (int path, int card, int count_enb)
 Start system and histogramming after resetting the UDP port and frame numbers as necessary.
int xsp3_histogram_is_busy (int path, int chan)
 Check if the histogarmming thread is busy or waiting for data.
int xsp3_mdio_write_reg (int path, int card, u_int32_t value)
 Write single value to MDIO firmware.
int xsp3_mdio_read_reg (int path, int card, u_int32_t *reg)
 Read single value from MDIO firmware.
MOD_IMAGE * xsp3_mkmod (char *name, u_int32_t num_x, u_int32_t num_y, char *x_lab, char *y_lab, int data_float, mh_com **mod_head)
 Make a 2-d shared data module.
MOD_IMAGE3D * xsp3_mkmod3d (char *name, int num_x, int num_y, int num_t, char *x_lab, char *y_lab, char *t_lab, char **labels, int data_float, mh_com **mod_head)
 Make a 3-d shared data module.
u_int32 * xsp3_mod_get_ptr (void *p, int x, int y, int t)
 Calculate the pointer to a given element of a 2-d or 3-d shared data module.
int xsp3_config_scaler (int path)
 Configure the scaler arrangement using the current memory allocation within the FEM.
XSP3ScopeModulexsp3_scope_mod_create (char *name, int num_cards, int lwords_per_card, mh_com **mod_head, int layout)
 Create a shared data module in /dev/shm to store Scope mode data.
int xsp3_config_soft_scaler (int path, char *mod_name, int num_tf)
 Build a shared data module for the software scalers.
int xsp3_soft_scaler_clear (int path, int first_chan, int first_frame, int num_chan, int num_frames)
 Clear region of the software scalers data module.
int xsp3_soft_scaler_read (int path, u_int32_t *dest, unsigned first_scaler, unsigned first_chan, unsigned first_t, unsigned n_scalers, unsigned n_chan, unsigned dt)
 Read a block of software scaler data.
int xsp3_set_udp_port (int path, int card, int hostPort)
 Set the UDP port number.
int xsp3_config_udp (int path, int card, char *femMACaddress, char *femIPaddress, int femPort, char *hostIPaddress, int hostPort)
 Configure all the parameters for a UDP connection to the xspress3 card.
int xsp3_create_data_module (int path, char *modname, int layout)
 Create the scope mode data module.
int xsp3_set_udp_packet_size (int path, int card, int size_bytes)
 Set the UDP packet size in bytes.
int xsp3_udp_init (UDPconnection *udpsock, char *hostIPaddress, int hostPort, char *femIPaddress, int femPort)
 Initialise the UDP connection.
int xsp3_udp_close (int path, int card)
 Shutdown the UDP connection between the xspress3 card and the host server.
int xsp3_read_scope_data_int (int path, int card, int swap)
 Read scope data from 10G ethernet using UDP protocol.
void * xsp3_read_scope_data_card (Xsp3ReadScopeArgs *args)
 Read scope data from 10G ethernet using UDP protocol.
int xsp3_read_data_10g (int path, int card, int stream, int offset_bytes, int size_bytes, unsigned char *buff)
 Read data from the 10G ethernet using UDP protocol.
int xsp3_read_data_10g_receive (int path, int card, XSP3_DMA_StatusBlock *statusBlock, unsigned char *buff_base, u_int32_t first_frame, u_int32_t num_frames, u_int32_t *frame_flags)
 Data receiver for 10G UDP ethernet including resent frames.
int xsp3_reset_10g_frame_counter (int path, int card)
 Reset the 10G frame counter to zero.
int xsp3_write_data_10g (int path, int card, u_int32_t *buffer, int dst_stream, int offset_bytes, size_t nbytes)
 Write data into xspress3 utilising the 10G ethernet.
int xsp3_write_data_10g_transmit (int path, u_int32_t *buffer, size_t nbytes)
 Write data using the 10G ethernet.

Function Documentation

int32_t femAccessRead ( FemHandle femHandle,
u_int32_t  bus,
u_int32_t  width,
u_int32_t  address,
u_int32_t  num,
u_int8_t *  payload 
)

Execute a read transaction on the connected FEM.

Parameters:
femHandle Pointer to FemHandle returned by xspress3FemInitialise
bus FEM bus to write to
width width of each write (byte, word, long)
address address of first write transaction
num number of successive addresses to read
payload a buffer to accept the return data
Returns:
the number of values read
int32_t femAccessWrite ( FemHandle femHandle,
u_int32_t  bus,
u_int32_t  width,
u_int32_t  address,
u_int8_t *  payload,
u_int32_t  size 
)

Execute a write transaction on the connected FEM.

Parameters:
femHandle Pointer to FemHandle returned by xspress3FemInitialise
bus FEM bus to write to
width width of each write (byte, word, long)
address address of first write transaction
payload vector of writes of appropriate width
size number of bytes to write
Returns:
number of writes completed in transaction
int32_t femPersonalityWrite ( FemHandle femHandle,
u_int32_t  subCommand,
u_int32_t  width,
u_int32_t  streamMask,
u_int8_t *  payload,
size_t  size 
)

Execute a personality write transaction on the connected FEM.

This function executes a write transaction on the connected FEM.

Parameters:
femHandle Pointer to FemHandle returned by xspress3FemInitialise
subCommand 
width width of each write (byte, word, long)
streamMask address of first write transaction
payload vector of writes of appropriate width
size size of payload in bytes
Returns:
number of writes completed in transaction
unsigned char * getMacAddressFromIP ( char *  ipName  ) 

Get the MAC address corresponding to the given IP address.

Parameters:
ipName byte array containing the IP address
Returns:
the mac address of the interface as a byte array or NULL if not found
int xsp3_config_histogram_threads ( int  path,
int  card 
)

Start event list processing threads for 1 or all cards in farm mode.

Cancel existing threads if there have already been created.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, -1 will do all cards in system.
Returns:
XSP3_OK or a negative error code.
int xsp3_config_histogram_udp ( int  path,
int  card,
char *  hostIPaddress,
int  hostPort,
char *  femIPaddress,
int  femPort 
)

Configure the upd connection between the server and the xspress3 card and subsequently initializes a thread to perform the histogramming.

For firmware outputing 32 address offset, this implementation uses a single thread per FPGA card. For firware using the farm-mode UDP core output event lists with more processing to be done in the PC, a thread is created per channel.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
hostIPaddress IP address of the host server in dotted quad format (e.g. 192.123.456.789).
hostPort port number of the host server.
femIPaddress IP address of the xspress3 system in dotted quad format (e.g. 192.123.456.789).
femPort port number of the xspress3 system.
Returns:
XSP3_OK or a negative error code.
int xsp3_config_scaler ( int  path  ) 

Configure the scaler arrangement using the current memory allocation within the FEM.

Must be called after the number of channels used has been set, usually within xsp3_config.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
Returns:
XSP3_OK or a negative error code.
int xsp3_config_soft_scaler ( int  path,
char *  mod_name,
int  num_tf 
)

Build a shared data module for the software scalers.

Must be called after the number of channels used has been set, usually within config.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
mod_name Name of the module.
num_tf Maxmimum number of time frames to make space for.
Returns:
XSP3_OK or a negative error code.
int xsp3_config_tcp ( char  femHostName[][XSP3_MAX_IP_CHARS],
int  femPort,
int  ncards,
int  num_chan,
int  debug 
)

Configure the xspress3 system and create a 1Gb TCP socket link to each card in the system.

Parameters:
femHostName an array of strings representing each of the xspress3 system card's IP address in dotted quad format (e.g. 192.123.456.789).
femPort the IP port number.
ncards the number of xspress3 cards that constitute the xspress3 system, between 1 and XSP3_MAX_CARDS.
num_chan the number of channels to be configured in the xspress3 system. between 1 and (ncards * XSP3_MAX_CHANS_PER_CARD).
debug a integer flag to turn debug messages off/on/verbose.
Returns:
a handle to the top level of the xspress3 system or a negative error code.
int xsp3_config_udp ( int  path,
int  card,
char *  femMACaddress,
char *  femIPaddress,
int  femPort,
char *  hostIPaddress,
int  hostPort 
)

Configure all the parameters for a UDP connection to the xspress3 card.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
femMACaddress MAC address of the xspress3 card
femIPaddress the IP address of the xspress3 card in dotted quad format
femPort the IP port number of the xspress3 card.
hostIPaddress the IP address of the host server in dotted quad format
hostPort the IP port number of the host server.
Returns:
XSP3_OK or a negative error code.
int xsp3_create_data_module ( int  path,
char *  modname,
int  layout 
)

Create the scope mode data module.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
modname the data module name
layout Module layout to suit firmware. See XSP3_SCOPE_MOD_LAYOUT.
Returns:
XSP3_OK or a negative error code.
int xsp3_dma_build_debug_desc ( int  path,
int  card,
u_int32_t  stream,
XSP3_DMA_MsgBuildDebugDesc msg 
)

Instruct PPC1 in the Virtex-5 to build a series of DMA descriptors for debug.

The debug type descriptors use a range of frame sizes to fully test the 10 Ge UDP core.

The following describes the layout of the structure. xspress3_dma_protocol.h XSP3_DMA_MSG_BUILD_DEBUG_DESC

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
stream Stream number to build descriptors for defined in XSP3_DMA_STREAM_NUMBER.
msg 
Returns:
XSP3_OK or a negative error code.
int xsp3_dma_build_desc ( int  path,
int  card,
u_int32_t  stream,
XSP3_DMA_MsgBuildDesc msg 
)

Instruct PPC1 in the Virtex-5 to build a series of DMA descriptors.



The following describes the layout of the structure. xspress3_dma_protocol.h XSP3_DMA_MSG_BUILD_DESC

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
stream Stream number to build descriptors for defined in XSP3_DMA_STREAM_NUMBER.
msg 
Returns:
XSP3_OK or a negative error code.
int xsp3_dma_resend ( int  path,
int  card,
u_int32_t  stream,
u_int32_t  first,
u_int32_t  num 
)

Instruct PPC1 in the Virtex-5 to reset the status in an existing set of descriptors so they can be sent again.

Used particularly when re-trying send scope moed data via the 10 GE UDP core.

The following describes the layout of the structure. xspress3_dma_protocol.h XSP3_DMA_MSG_RESEND

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
stream Stream number to resend descriptors for defined in XSP3_DMA_STREAM_NUMBER.
first First descriptor
num Number of descriptors
Returns:
XSP3_OK or a negative error code.
int xsp3_dma_reset ( int  path,
int  card,
u_int32_t  stream_mask 
)

Reset the DMA engines.

This is done by instruct PPC1 in the Virtex-5 to reset the DMA. This should not usually be called directly in user code.

See also:
xsp3_read_data_10g()
xsp3_write_data_10g()
xsp3_system_start()

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
stream_mask flag to notify which dma stream to reset defined as XSP3_DMA_STREAM_MASK. Can be multiple.
Returns:
XSP3_OK or a negative error code.
int xsp3_dma_start ( int  path,
int  card,
u_int32_t  stream,
XSP3_DMA_MsgStart msg 
)

Instruct PPC1 in the Virtex-5 to start a single DMA engine.



The following describes the layout of the structure. xspress3_dma_protocol.h XSP3_DMA_MSG_START

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
stream Stream number to start defined in XSP3_DMA_STREAM_NUMBER.
msg Pointer to a msg, all 0 for default operation, or override for start and number of descriptors.
Returns:
XSP3_OK or a negative error code.
int xsp3_do_config ( int  ncards,
int  num_tf,
char *  baseIPaddress,
int  basePort,
char *  baseMACaddress,
int  num_chan,
int  create_module,
char *  modname,
int  debug,
int  card_index 
)

Configure the complete xspress3 system.

This should be called only once. It is used internally by xsp3_config. The number of card and number of time frame parameters must be specified. The debug and create_module parameters are boolean and should be specified as 0 or 1. All other parameters can be used as default by specifying either NULL or -1.

 * Using the default baseIPaddress, for the host server, of 192.168.0.1 the following values are calculated for the complete xspress3 system.
 *
 * xspress3 1Gb tcp IP address 		card 1		192.168.0.2
 * 									card 2		192.168.0.3
 * 									card 3		192.168.0.4
 * 									...
 *
 * host 10Gb udp IP address 		card 1		192.168.0.65
 * 									card 2		192.168.0.69
 * 									card 3		192.168.0.73
 * 									...
 *
 * xspress3 10Gb udp IP address 	card 1		192.168.0.66
 * 									card 2		192.168.0.70
 * 									card 3		192.168.0.74
 * 									...
 *
 * Using the default MAC address of 02.00.00.00.00.00 the following values are calculated for the complete xspress3 system.
 *
 * xspress3 MAC address 			card 1		02.00.00.00.00.00
 * 									card 2		02.00.00.00.00.02
 * 									card 3		02.00.00.00.00.04
 * 									...
 *
 * For all xspress3 cards the default basePort for the tcp connection is 30123 and for the udp connection 30124.
 *
 * 
Parameters:
ncards the number of xspress3 cards that constitute the xspress3 system, between 1 and XSP3_MAX_CARDS.
num_tf the number of time frames
baseIPaddress the IP address of the host server in dotted quad format (e.g. 192.168.0.1) from which all other address's are calculated or NULL to use the default
basePort the IP port number or -1 to use the default
baseMACaddress the base MAC address (e.g. 02.00.00.00.00) for card 1, from which all other card MAC address's are calculated or NULL to use the default
num_chan the number of channels to be configured in the xspress3 system. between 1 and (ncards * XSP3_MAX_CHANS_PER_CARD) or -1 to configure all available channels.
create_module a boolean flag to determine whether to create a data module
modname the module name or NULL to use the default.
debug a integer flag to turn debug messages off/on/verbose.
card_index starting card number ie 0 = card1, 1 = card2 etc. -1 assumes card_index 0)
Returns:
a handle to the top level of the xspress3 system or a negative error code.
int xsp3_features_unpack ( int  path,
int  card 
)

Read the features registers and expand into the features structure.

The rest of the library uses the feaures structure to work correctly with the hardware. This is called in xsp3_config to allow the correct processing/histogramming threads to be started.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card Specified the card in multi card system. Supported is usage is that the top code calls with card = -1 and this code recures card 0..n-1 if necessary.
Returns:
0 on success, or negativeerror code on error
int xsp3_get_dma_status_block ( int  path,
int  card,
XSP3_DMA_StatusBlock statusBlock 
)

Get the status and settings of all the DMA streams.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
statusBlock a XSP3_DMA_StatusBlock structure to receive the status.
Returns:
XSP3_OK or a negative error code.
int xsp3_get_format_reg ( int  path,
int  chan,
u_int32_t *  format 
)

Get the format register.

usually retrieve the foramt information using xsp3_get_format

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1)
format the format register
Returns:
XSP3_OK or a negative error code.
int xsp3_get_trigger_regs_b ( int  path,
int  chan,
u_int32_t *  trigb_thres,
u_int32_t *  trigb_timea,
u_int32_t *  trigb_timeb 
)

Get the raw trigger B registers, however the preferred method is to use xsp3_get_trigger_b.



The following definitions describe the layout of the threshold register xspress3.h XSP3_TRIGGERB_THRESHOLD_REGISTER The following definitions describe the layout of the time register xspress3.h XSP3_TRIGGERB_TIMEA_REGISTER The following definitions describe the layout of the time register xspress3.h XSP3_TRIGGERB_TIMEB_REGISTER

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1)
trigb_thres the threshold register
trigb_timea the timea register
trigb_timeb the timeb register
Returns:
XSP3_OK or a negative error code.
int xsp3_get_trigger_regs_c ( int  path,
int  chan,
u_int32_t *  trigc_otd_servo,
u_int32_t *  trigc_thres 
)

Get the raw trigger C registers, however the preferred method is to use xsp3_get_trigger_c.



The following definitions describe the layout of the threshold register xspress3.h XSP3_TRIGGERC_OVER_THRESHOLD_SERVO_REGISTER The following definitions describe the layout of the threshold register xspress3.h XSP3_TRIGGERC_THRESHOLD_REGISTER

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1)
trigc_otd_servo the over threshold discriminator servo register
trigc_thres the threshold register
Returns:
XSP3_OK or a negative error code.
int xsp3_histogram_is_busy ( int  path,
int  chan 
)

Check if the histogarmming thread is busy or waiting for data.

Usually use xsp3_histogram_is_any_busy to check for any channel.card in system being busy. Usually the histogramming thread will keep up with the list of events and will idle in a blocking read. If the system is used at high rate and CPU load or page faults stall the histogram thread may take some time to finish processing data from the network stack byffers. To safely stop the system, the supply of histogram data should be stopped either by the external timing generator negating the count enable input or by calling xsp3_histogram_stop() to negate the Run bit in the timing control register. After this the calling program should repeat sleeping 10 ms and checking this busy flag until it is seen to be not busy twice on the run.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1) For single histogramming thread per car versions, there is only 1 busy flag per card so reading any channel on that card should give the same answer.
Returns:
1 if busy 0 idle or a negative error code.
int xsp3_histogram_mkmod ( int  path,
int  chan,
char *  root_name,
int  num_tf 
)

Creates Data modules to store the histogram data.

These are created and sized at program startup and left unchanged. If existing module of the correct size are found, they are used. The modules are cleared. Changing the size currently requires deletion of the data module from /dev/shm or /run/shm as appropriate.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1) if chan is less than 0 then all channels are selected.
root_name String containing the first part of the module names to be created. Channel number 0..(xsp3_get_num_chan() - 1) is appended
num_tf Number of full single Spectra to allocate space for per channel, which is the number of time frames if no auxiliary data is used.
Returns:
XSP3_OK or a negative error code.
int xsp3_histogram_start_count_enb ( int  path,
int  card,
int  count_enb 
)

Start system and histogramming after resetting the UDP port and frame numbers as necessary.

The UDP port reset is only required when it is not in farm mode as the scope mode also uses the UDP connection on a different port.

The the system is started using xsp3_system_start_count_enb.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration. card == -1 causes all cards in a multi card system to start.
count_enb In software timed mode 0=> start system but do not enable counting, 1=> start system and enable counting.
Returns:
XSP3_OK or a negative error code.
int xsp3_mdio_read_reg ( int  path,
int  card,
u_int32_t *  reg 
)

Read single value from MDIO firmware.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
reg 
Returns:
XSP3_OK or a negative error code.
int xsp3_mdio_write_reg ( int  path,
int  card,
u_int32_t  value 
)

Write single value to MDIO firmware.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
value 
Returns:
XSP3_OK or a negative error code.
MOD_IMAGE* xsp3_mkmod ( char *  name,
u_int32_t  num_x,
u_int32_t  num_y,
char *  x_lab,
char *  y_lab,
int  data_float,
mh_com **  mod_head 
)

Make a 2-d shared data module.

These shared data modules are in /dev/shm. They are used to hold the MCA spectra data. They can be viewed using imgd and manipulated using xspress3.server. These function track libimg_mod.a, but are copied here to make libxspress3.a standalone.

Parameters:
name the name of the data module
num_x Size of data module in x, width.
num_y Size of data module in x, Height
x_lab label for x values, NULL for default.
y_lab label for y values, NULL for default.
data_float data type: 0 => u_int32_t, 1 => float, 2 => double.
mod_head return pointer to the data module header
Returns:
a pointer to the data module or NULL.
MOD_IMAGE3D* xsp3_mkmod3d ( char *  name,
int  num_x,
int  num_y,
int  num_t,
char *  x_lab,
char *  y_lab,
char *  t_lab,
char **  labels,
int  data_float,
mh_com **  mod_head 
)

Make a 3-d shared data module.

These shared data modules are in /dev/shm. They are currently used for the software scaler data, but may be used to hold the MCA spectra data in later releases. They can be viewed using imgd, but have limited (growing support) in xspress3.server These function track libimg_mod.a, but are copied here to make libxspress3.a standalone.

Parameters:
name the name of the data module
num_x Size of data module in x, width.
num_y Size of data module in x, Height
num_t Size of data module in t direction.
x_lab label for x values, NULL for default.
y_lab label for y values, NULL for default.
t_lab label for t values, NULL for default.
labels pointer to array of pointers to individual row labels, to be used for for y. NULL to omit.
data_float data type: 0 => u_int32_t, 1 => float, 2 => double.
mod_head return pointer to the data module header
Returns:
a pointer to the data module or NULL.
u_int32* xsp3_mod_get_ptr ( void *  p,
int  x,
int  y,
int  t 
)

Calculate the pointer to a given element of a 2-d or 3-d shared data module.

These shared data modules are in /dev/shm. They cane be 2-d or 3-d. The data types can be u_int32_t, u_int16_t, float or double. These function track libimg_mod.a, but are copied here to make libxspress3.a standalone.

Parameters:
p Pointer to the data module as a MOD_IMAGE or MOD_IMAGE3D.
x X Coordinate.
y Y Coordinate.
t T Coordinate if P points to a MOD_IMAGE3D
Returns:
Pointer to the requested data element or NULL on error.
int xsp3_read_data_10g ( int  path,
int  card,
int  stream,
int  offset_bytes,
int  size_bytes,
unsigned char *  buff 
)

Read data from the 10G ethernet using UDP protocol.

Check and correct for missing frames.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
stream which DMA stream to read data from
offset_bytes an offset into the buffer
size_bytes size of buffer (in bytes)
buff pointer to a buffer to receive data
Returns:
number of frames greater than 0 is success else 0 or negative error code is fail.
int xsp3_read_data_10g_receive ( int  path,
int  card,
XSP3_DMA_StatusBlock statusBlock,
unsigned char *  buff_base,
u_int32_t  first_frame,
u_int32_t  num_frames,
u_int32_t *  frame_flags 
)

Data receiver for 10G UDP ethernet including resent frames.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
statusBlock DMA status
buff_base pointer to data buffer
first_frame first frame to capture
num_frames number of frames
frame_flags received frame flag
Returns:
the number of frames received or a negative error code
int xsp3_read_glob_reg ( int  path,
int  card,
int  offset,
int  size,
u_int32_t *  value 
)

Read a series of values from the global region register for each specified card.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
offset an address offset from the start of the global region.
size the size of the array of values to read.
value an array to receive a series of 32 bit integer values.
Returns:
XSP3_OK or a negative error code.
int xsp3_read_raw_reg ( int  path,
int  card,
u_int32_t  address,
int  size,
u_int32_t *  value 
)

Read a series of values from an address for each specified card.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
address an address.
size the size of the array of values to read.
value an array to receive a series of 32 bit integer values.
Returns:
XSP3_OK or a negative error code.
int xsp3_read_rdma_reg ( int  path,
int  card,
int  address,
int  size,
u_int32_t *  value 
)

Read a series of values from the UPD core registers for each specified card.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
address an address offset into the UDP core registers.
size the size of the array of values to read.
value an array to receive a series of 32 bit integer values.
Returns:
XSP3_OK or a negative error code.
int xsp3_read_reg ( int  path,
int  chan,
int  region,
int  offset,
int  size,
u_int32_t *  value 
)

Read a series of values from the region registers for each specified channel.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1) if chan is less than 0 then all channels are selected.
region an offset from the channel (0 ... XSP3_REGION_RAM_MAX)
offset an address offset from the start of the region.
size the size of the array of values to read.
value an array to receive a series of 32 bit integer values.
Returns:
XSP3_OK or a negative error code.
void * xsp3_read_scope_data_card ( Xsp3ReadScopeArgs args  ) 

Read scope data from 10G ethernet using UDP protocol.

Parameter in a single structure, sos can be called as a thread function, per card.

Parameters:
args Pointer to structure containing args, path, card and swap.
Returns:
number of frames greater than 0 is success else 0 or negative error code is fail.
int xsp3_read_scope_data_int ( int  path,
int  card,
int  swap 
)

Read scope data from 10G ethernet using UDP protocol.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
swap byte swap the data
Returns:
number of frames greater than 0 is success else 0 or negative error code is fail.
int xsp3_read_soft_lut ( int  path,
int  chan,
int  region_num,
int  nwords,
u_int32_t *  data 
)

Read Software lookup table equivalent to BRAM.

This isused in system which move processing into the PC.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan Channel number in the system -1 for all.
region_num Region number of the BRAM equivalent function.
nwords the size of the array of values to writtem, which must match the LUT size.
data Pointer to array of value 32 bit aligned for all BRAM/LUT widths
Returns:
XSP3_OK or a negative error code.
int xsp3_read_spi_reg ( int  path,
int  card,
int  address,
int  size,
u_int32_t *  value 
)

Read a series of values from the SPI registers for each specified card.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
address an address offset into the SPI registers.
size the size of the array of values to read.
value an array to receive a series of 32 bit integer values.
Returns:
XSP3_OK or a negative error code.
int xsp3_reset_10g_frame_counter ( int  path,
int  card 
)

Reset the 10G frame counter to zero.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
Returns:
XSP3_OK or a negative error code.
int xsp3_resolve_path ( int  path,
int  chan,
int *  thisPath,
int *  chanIdx 
)

Determine which card and consequently the handle, a particular channel is configured on and the channel number within that card, given the top level system handle and the channel number.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1).
thisPath the handle to the particular card for the given channel.
chanIdx the channel within the card specified by the 'thisPath' handle.
Returns:
XSP3_OK or a negative error code.
XSP3ScopeModule* xsp3_scope_mod_create ( char *  name,
int  num_cards,
int  lwords_per_card,
mh_com **  mod_head,
int  layout 
)

Create a shared data module in /dev/shm to store Scope mode data.

Usually called by xsp3_config

Parameters:
name Name for data module
num_cards Number of Cards (XSPRESS3 boxes) in the system
lwords_per_card Number of LWords on FEM DRAM used in each card, which must match
mod_head Pointer to return Module header pointer to allow unlinking of module.
layout Layout of scope mode module see XSP3_SCOPE_MOD_LAYOUT
Returns:
Pointer to the beginning of the header of the data module.
int xsp3_set_clock_control ( int  path,
int  card,
u_int32_t  clock 
)

Set the global clock control register.



The following definitions describe the layout of the global time A register xspress3.h XSP3_GLOBAL_CLOCK

However, clock setup is more involved, so shouldusually bedone via xsp3_clocks_setup.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration. If card is less than 0 then all cards are selected.
clock the clock control register
Returns:
XSP3_OK or a negative error code.
int xsp3_set_format_reg ( int  path,
int  chan,
u_int32_t  format 
)

Set the format register.

The format control register is usually controlled vai the function xsp3_format_run.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1). If chan is less than 0 then all channels are selected.
format the format register.
Returns:
XSP3_OK or a negative error code.
int xsp3_set_num_chan ( int  path,
int  num_chan 
)

Set the number of channels to be used in system.

This is generally called from xsp3_config. Trying to change this afterwards may leave the wrong number of histogram threads running, so is not recommended. If the requested number is -1 all available channels will be used, else it is assumed that each card uses its full allocation of channels, the cards are contiguous so that any non-full remainder is in the last card. There is no current provision for a sparse allocation of channels across cards. A later API may address this.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
num_chan the number of channels requested or -1 for all available channels
Returns:
XSP3_OK or a negative error code.
int xsp3_set_scope ( int  path,
int  card,
u_int32_t  scope_chn,
u_int32_t  scope_src,
u_int32_t  scope_nwd,
u_int32_t  scope_alt 
)

Sets the scope mode registers.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration. If card is less than 0 then all cards are selected.
scope_chn 
scope_src 
scope_nwd 
scope_alt 
Returns:
XSP3_OK or a negative error code.
int xsp3_set_trigger_regs_b ( int  path,
int  chan,
u_int32_t  trigb_thres,
u_int32_t  trigb_timea,
u_int32_t  trigb_timeb 
)

Set the raw trigger B registers, however the preferred method is to use xsp3_set_trigger_b.



The following definitions describe the layout of the threshold register xspress3.h XSP3_TRIGGERB_THRESHOLD_REGISTER The following definitions describe the layout of the timea register xspress3.h XSP3_TRIGGERB_TIMEA_REGISTER The following definitions describe the layout of the timeb register xspress3.h XSP3_TRIGGERB_TIMEB_REGISTER

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1) if chan is less than 0 then all channels are selected.
trigb_thres the threshold register
trigb_timea the timea register
trigb_timeb the timeb register
Returns:
XSP3_OK or a negative error code.
int xsp3_set_trigger_regs_c ( int  path,
int  chan,
u_int32_t  trigc_otd_servo,
u_int32_t  trigc_thres 
)

Set the raw trigger C registers, however the preferred method is to use xsp3_set_trigger_c.



The following definitions describe the layout of the threshold register xspress3.h XSP3_TRIGGERC_THRESHOLD_REGISTER The average mode bits 27-28 are defined as: xspress3.h XSP3_TRIGGERC_AVEMODE_BITS 27-28

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1). If chan is less than 0 then all channels are selected.
trigc_otd_servo the overthreshold register
trigc_thres the threshold register
Returns:
XSP3_OK or a negative error code.
int xsp3_set_udp_packet_size ( int  path,
int  card,
int  size_bytes 
)

Set the UDP packet size in bytes.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
size_bytes the size of the packet (bytes)
Returns:
XSP3_OK or a negative error code.
int xsp3_set_udp_port ( int  path,
int  card,
int  hostPort 
)

Set the UDP port number.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
hostPort the port number
Returns:
XSP3_OK or a negative error code.
int xsp3_soft_scaler_clear ( int  path,
int  first_chan,
int  first_frame,
int  num_chan,
int  num_frames 
)

Clear region of the software scalers data module.

Note that clearing prior to acquistion is required for software scalers, unlike the hardware scalers which overwrite the memory. This is called from xsp3_histogram_clear so use code need not change.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
first_chan First Channel to clear
first_frame First Time Frame to clear
num_chan Number of Channels to clear.
num_frames Number of Time frames to clear.
Returns:
XSP3_OK or a negative error code.
int xsp3_soft_scaler_read ( int  path,
u_int32_t *  dest,
unsigned  first_scaler,
unsigned  first_chan,
unsigned  first_t,
unsigned  n_scalers,
unsigned  n_chan,
unsigned  dt 
)

Read a block of software scaler data.

Called by xsp3_scaler_read when required, so user code does not need to know.

 * The data block will comprise of
 * time frame[t]		channel[chan]			scaler[scaler]				data[0]
 *																			...
 * 												scaler[scaler+n_scaler-1]	data[n_scaler-1]
 * 																			...
 * 						channel[chan+n_chan-1]	scaler[scaler]				data[(n_chan-1)*n_scaler]
 * 																			...
 * 												scaler[n_scaler]			data[n_chan*n_scaler-1]
 * 																			...
 * time frame[t+dt-1]	channel[chan]			scaler[scaler]				data[(dt-1)*n_chan*n_scaler]
 *																			...
 * 												scaler[scaler+n_scaler-1]	data[dt*(nchan-1)*n_scaler-1]
 * 																			...
 * 						channel[chan+n_chan-1]	scaler[scaler]				data[(dt*nchan-1)*n_scaler]
 * 																			...
 * 												scaler[scaler+n_scaler-1]	data[dt*n_chan*n_scaler-1]
 *
 * where the scalers are defined as:
 * scaler 0 - Time
 * scaler 1 - ResetTicks
 * scaler 2 - ResetCount
 * scaler 3 - AllEvent
 * scaler 4 - AllGood
 * scaler 5 - InWIn 0
 * scaler 6 - In Win 1
 * scaler 7 - PileUp
 * 
Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
dest a pointer to the data buffer to receive scaler data
first_scaler is the first scaler number to read
first_chan is the first channel to read
first_t the first time frame to read
n_scalers the number of scaler to read
n_chan number of channels to read
dt number of time frame to read
Returns:
XSP3_OK or a negative error code.
int xsp3_system_start_count_enb ( int  path,
int  card,
int  count_enb 
)

Start the xspress3 system with control over count enable in software framing mode.

If the run mode has been set to include playback, it is started. If the run mode include scope mode, the scope mode DMAs are started. See xsp3_set_run_flags. However, for full control of the histogramming threads and UDP ports it is usual to use xsp3_histogram_start or xsp3_histogram_arm instead

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config.
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration. If card is less than 0 then all cards are selected.
count_enb In software timed mode 0=> start system but do not enable counting, 1=> start system and enable counting.
Returns:
XSP3_OK or a negative error code.
int xsp3_udp_close ( int  path,
int  card 
)

Shutdown the UDP connection between the xspress3 card and the host server.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
Returns:
XSP3_OK or a negative error code.
int xsp3_udp_init ( UDPconnection udpsock,
char *  hostIPaddress,
int  hostPort,
char *  femIPaddress,
int  femPort 
)

Initialise the UDP connection.

Parameters:
udpsock a pointer to a structure containing all the parameters pertinent to the UDP connection
hostIPaddress the IP address of the host server in dotted quad format
hostPort the IP port number of the host server.
femIPaddress the IP address of the xspress3 card in dotted quad format
femPort the IP port number of the xspress3 card.
Returns:
XSP3_OK or a negative error code.
int xsp3_write_data_10g ( int  path,
int  card,
u_int32_t *  buffer,
int  dst_stream,
int  offset_bytes,
size_t  nbytes 
)

Write data into xspress3 utilising the 10G ethernet.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration.
buffer data buffer
dst_stream the DMA stream flag
offset_bytes offset from beginning address
nbytes number of bytes of data in buffer
Returns:
greater or equal to 0 for success else negative error code
int xsp3_write_data_10g_transmit ( int  path,
u_int32_t *  buffer,
size_t  nbytes 
)

Write data using the 10G ethernet.

Internal use only.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
buffer the data
nbytes the number of bytes of daata
Returns:
number of bytes sent or negative error code.
int xsp3_write_glob_reg ( int  path,
int  card,
int  offset,
int  size,
u_int32_t *  value 
)

Write a series of values into the global region register for all or each specified card.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration. If card is less than 0 then all cards are selected.
offset an address offset from the start of the global region.
size the size of the array of values to write.
value an array of 32 bit integer values to write.
Returns:
XSP3_OK or a negative error code.
int xsp3_write_rdma_reg ( int  path,
int  card,
int  address,
int  size,
u_int32_t *  value 
)

Write a series of values into the UDP core registers for all or each specified card.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration. If card is less than 0 then all cards are selected.
address an address offset into the UDP core registers.
size the size of the array of values to write.
value an array of 32 bit integer values to write.
Returns:
XSP3_OK or a negative error code.
int xsp3_write_reg ( int  path,
int  chan,
int  region,
int  offset,
int  size,
u_int32_t *  value 
)

Write a series of values into the region registers for all or each specified channel.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan is the number of the channel in the xspress3 system, 0 to (xsp3_get_num_chan() - 1) if chan is less than 0 then all channels are selected.
region an offset from the channel (0 ... XSP3_REGION_RAM_MAX).
offset an address offset from the start of the region.
size the size of the array of values to write.
value an array of 32 bit integer values to write.
Returns:
XSP3_OK or a negative error code.
int xsp3_write_soft_lut ( int  path,
int  chan,
int  region_num,
int  nwords,
u_int32_t *  data 
)

Write Software lookup table equivalent to BRAM.

This isused in system which move processing into the PC.

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
chan Channel number in the system -1 for all.
region_num Region number of the BRAM equivalent function.
nwords the size of the array of values to writtem, which must match the LUT size.
data Pointer to array of value 32 bit aligned for all BRAM/LUT widths
Returns:
XSP3_OK or a negative error code.
int xsp3_write_spi_reg ( int  path,
int  card,
int  address,
int  size,
u_int32_t *  value 
)

Write a series of values into the SPI registers for all or each specified card.



The following definitions describe the layout of the SPI register xspress3.h XSP3_SPI_REGISTER

Parameters:
path a handle to the top level of the xspress3 system returned from xsp3_config().
card is the number of the card in the xspress3 system, 0 for a single card system and up to (xsp3_get_num_cards() - 1) for a multi-card system, where this value has been passed to xsp3_config() at xspress3 system configuration. If card is less than 0 then all cards are selected.
address an address offset into the SPI registers.
size the size of the array of values to write.
value an array of 32 bit integer values to write.
Returns:
XSP3_OK or a negative error code.
void xspress3FemClose ( void *  femHandle  ) 

Closes the xspress3 client connection to a FEM/.

Parameters:
femHandle an instance of the connected FEM
void* xspress3FemInitialise ( const char *  hostname,
int  port 
)

Initialises client connection to a FEM.

Parameters:
hostname string representation of FEM IP address in dotted quad format
port integer port number to connect to
Returns:
a handle for connected FEM
int xspress3FemPersonalityWrite ( void *  femHandle,
u_int32_t  sub_command,
u_int32_t  stream_mask,
size_t  size,
u_int32_t *  value 
)

Perform a write transaction to the FEM.

Parameters:
femHandle Pointer to FemHandle returned by xspress3FemInitialise
sub_command Command to pass through FEM personality route to the PPC1
stream_mask Mask to tell FEM PPC1 which DMA channle to perform command on.
size Size of the different XSP3_DMA_Mgs type structures being used in lwords.
value Pointer to the message to bepassed to FEM PPC1. bus_target = Sub Command data_width = WIDTH_LONG state = 0 (ignored) -- Suggest set Write bit so in future can consider read command. address = Function mask payload = Different XSP3_DMA_Mgs type for each command
int xspress3FemSetInt ( void *  femHandle,
int  chan,
int  region,
int  offset,
u_int32_t  value 
)

Perform a single integer write transaction to the FEM.

This function performs an write transaction to the FEM into the xspress3 register space, at an address caclulated from the channel number, region number within channel and offset within region specified in the arguments for 1 off 32 bit int.

Parameters:
femHandle an instance of the connected FEM
chan Channel number to calculate an offset from the base address
region region number to offset within the channel
offset the offset from region start in lwords
value a single 32 bit integer value to write
Returns:
0 if success
int xspress3FemSetIntArray ( void *  femHandle,
int  chan,
int  region,
int  offset,
size_t  size,
u_int32_t *  value 
)

Write an array of integers to the FEM.

This function performs an write transaction to the FEM into the xspress3 register space, at an address caclulated from the channel number, region number within channel and offset within region specified in the arguments for size off 32 bit ints.

Parameters:
femHandle an instance of the connected FEM
chan Channel number to calculate an offset from the base address
region region number to offset within the channel
offset the offset from region start in lwords
size Number of 32 bit ints to write
value Pointer to an array of 32 bit integer values to write
Returns:
0 if success