GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCBD / V1-5-1 > lcbd / sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

LCBC.c File Reference

Implementation of the LCB command list and command item utility routines. More...

#include "LCBD/LCBC.h"
#include "LCBD/LCB_cr.h"
#include <stdio.h>

Functions

unsigned int LCBC_process (const LCB_ci *ci, const LCB_ci *end, LCBC_processor rtn, void *prm)
 Executes the user specified handler for each command item in the range ci to end.
static unsigned int show (void *prm, const LCB_ci *ci)
 Shows (prints) a single command item.
void LCBC_show (unsigned int options, const LCB_ci *beg, const LCB_ci *end)
 Dumps the result items to stdout.
static LCB_cifill_simple (LCB_ci_simple *simple, unsigned short int stall, unsigned int header)
 Constructs a simple LCB command. A simple LCB command consists of only a header word, containing the command length and an opcode, plus a stall word.
static LCB_cifill_reg (LCB_ci_reg *reg, unsigned int field_select, unsigned int value, unsigned short int stall, unsigned int header)
 Constructs a LCB register access command.
static LCB_cifill_cmd (LCB_ci_cmd *cmd, const LCB_ci_cmd_payload *payload, unsigned short int stall_timeout, unsigned int header)
 Constructs transmit command, with or without a response.
LCB_ciLCBC_cmd_xmit_fill (LCB_ci_cmd *ci, const LCB_ci_cmd_payload *payload, unsigned short int stall)
 Constructs transmit command, without a response.
LCB_ciLCBC_cmdr_xmit_fill (LCB_ci_cmdr *ci, const LCB_ci_cmd_payload *payload, unsigned short int timeout)
 Constructs transmit command, with a response.
LCB_ciLCBC_mark_time_fill (LCB_ci_mark_time *ci, unsigned short int stall)
 Constructs a mark time LCB command.
LCB_ciLCBC_lat_reset_fill (LCB_ci_lat_reset *ci, unsigned short int stall)
 Constructs a LAT reset LCB command.
LCB_ciLCBC_csr_access_fill (LCB_ci_csr *ci, unsigned int value, unsigned int field_select, unsigned short int stall)
 Constructs a LCB CSR register access command.
LCB_ciLCBC_faults_access_fill (LCB_ci_faults *ci, unsigned int value, unsigned int field_select, unsigned short int stall)
 Constructs a LCB FIFO FAULTS register access command.
LCB_ciLCBC_rxstats_access_fill (LCB_ci_rxstats *ci, unsigned int value, unsigned int field_select, unsigned short int stall)
 Constructs a LCB RECEIVE STATISTICS/STATUS register access command.
unsigned int LCBC_cmd_xmit (LCBD lcb, const LCB_ci_cmd_payload *payload, unsigned short int stall)
 Utility routine to compose and submit a command with no response command (department of redundancy department?).
unsigned int LCBC_mark_time (LCBD lcb, unsigned short int stall)
 Utility routine to compose and execute an LCB mark time command.
unsigned int LCBC_lat_reset (LCBD lcb, unsigned short int stall)
 Utility routine to compose and execute an LCB LAT reset command.
unsigned int LCBC_cmdr_xmit (LCBD lcb, const LCB_ci_cmd_payload *ci_payload, unsigned short int timeout, LCB_ri_cmd_payload *ri_payload)
 Utility routine to compose and submit a command with response command (department of redundancy department?).
unsigned int LCBC_csr_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *old_val, unsigned int *cur_val)
 Utility routine to compose and execute an access command to LCB's CSR register.
unsigned int LCBC_faults_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *old_val, unsigned int *cur_val)
 Utility routine to compose and execute an access command to LCB's FIFO FAULTS register.
unsigned int LCBC_rxstats_access (LCBD lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *old_val, unsigned int *cur_val)
 Utility routine to compose and execute an access command to LCB's RECEIVE STATISTICS/STATS register.


Detailed Description

Implementation of the LCB command list and command item utility routines.

Author:
JJRussell -- russell@slac.stanford.edu
  CVS $Id

Function Documentation

static LCB_ci * fill_cmd ( LCB_ci_cmd cmd,
const LCB_ci_cmd_payload payload,
unsigned short int  stall_timeout,
unsigned int  header 
) [static]

Constructs transmit command, with or without a response.

Returns:
Pointer to the next command item to be filled
Parameters:
cmd The command item to be filled.
payload The transmit command's payload. This consists of a LATp header plus a highly encoded bit pattern which determines further routing and the action to be taken at the destination
stall_timeout The stall or timeout period, in units of 20MHz clock ticks
header The header plus op code

static LCB_ci * fill_reg ( LCB_ci_reg reg,
unsigned int  field_select,
unsigned int  value,
unsigned short int  stall,
unsigned int  header 
) [static]

Constructs a LCB register access command.

Returns:
Pointer to the next command item to be filled
Parameters:
reg The command item to be filled
field_select A word indicating the bits from value that will be written. For example, if 0, then no bits will be written, if -1, then all bits will be written.
value The value to be written
stall The stall time, in units of 20MHz clock ticks
header The header word, opcode + command length
LCB Register Access Commands
A LCB register access command consists of the header word, containing the command length and the opcode, plus two command specific parameters, the value to write to the register and a word indicating which bits of the value to write, plus a stall parameter. There are three such registers on the LCB
  • CSR
  • FIFO FAULTS
  • RECEIVE STATISTICS/STATUS

static LCB_ci * fill_simple ( LCB_ci_simple simple,
unsigned short int  stall,
unsigned int  header 
) [static]

Constructs a simple LCB command. A simple LCB command consists of only a header word, containing the command length and an opcode, plus a stall word.

Returns:
Pointer to the next command item to be filled
Parameters:
simple The command item to be filled.
stall The stall time, in units of 20MHz clock ticks
header The header plus op code
Simple commands
The set of LCB simple commands consist of
  • Mark Time
  • LAT Reset

unsigned int LCBC_cmd_xmit ( LCBD  lcb,
const LCB_ci_cmd_payload payload,
unsigned short int  stall 
)

Utility routine to compose and submit a command with no response command (department of redundancy department?).

Returns:
Status
Parameters:
lcb The LCB driver handle
payload The payload of the command access command. The format of this beast is dependent on the target (PDU, TEM, GTFE) and is non-trivial. However, this routine does not concern itself with the formatting, deferring that as someone else's problem.
stall The stall time, in units of 20Mhz clock ticks

LCB_ci * LCBC_cmd_xmit_fill ( LCB_ci_cmd ci,
const LCB_ci_cmd_payload payload,
unsigned short int  stall 
)

Constructs transmit command, without a response.

Returns:
Pointer to the next command item to be filled
Parameters:
ci The command item to be filled.
payload The transmit command's payload. This consists of a LATp header plus a highly encoded bit pattern which determines further routing and the action to be taken at the destination
stall The stall time, in units of 20MHz clock ticks

unsigned int LCBC_cmdr_xmit ( LCBD  lcb,
const LCB_ci_cmd_payload ci_payload,
unsigned short int  timeout,
LCB_ri_cmd_payload ri_payload 
)

Utility routine to compose and submit a command with response command (department of redundancy department?).

Returns:
Status
Parameters:
lcb The LCB driver handle
ci_payload The payload of the command access command. The format of this beast is dependent on the target (PDU, TEM, GTFE) and is non-trivial. However, this routine does not concern itself with the formatting, deferring that as someone else's problem.
timeout The LCB timeout period, in units of 20MHz clock ticks to wait for a response to be returned.
ri_payload The resulting (returned) payload. As is in the case of the command item payload, ci_payload, the format of this payload is highly dependent on the target. However, this routine merely returns the payload results to the user, again adopting the philosopy of not my problem,

LCB_ci * LCBC_cmdr_xmit_fill ( LCB_ci_cmdr ci,
const LCB_ci_cmd_payload payload,
unsigned short int  timeout 
)

Constructs transmit command, with a response.

Returns:
Pointer to the next command item to be filled
Parameters:
ci The command item to be filled.
payload The transmit command's payload. This consists of a LATp header plus a highly encoded bit pattern which determines further routing and the action to be taken at the destination
timeout The timeout period, in units of 20MHz clock ticks

unsigned int LCBC_csr_access ( LCBD  lcb,
unsigned int  value,
unsigned int  field_select,
unsigned short int  stall,
unsigned int *  old_val,
unsigned int *  cur_val 
)

Utility routine to compose and execute an access command to LCB's CSR register.

Returns:
Status
Parameters:
lcb The LCB driver handle
value The value to write. Only bits matching those in the field_select parameter will actually be written.
field_select Pattern of those bits in value to write
stall The stall time, in units of 20MHz clock ticks, for the LCB to wait for completion.
old_val Pointer to receive the value of the register before modification. This may be NULL.
cur_val Pointer to receive the value of the register after modification. This may be NULL.

LCB_ci * LCBC_csr_access_fill ( LCB_ci_csr ci,
unsigned int  field_select,
unsigned int  value,
unsigned short int  stall 
)

Constructs a LCB CSR register access command.

Returns:
Pointer to the next command item to be filled
Parameters:
ci The command item to be filled
field_select A word indicating the bits from value that will be written. For example, if 0, then no bits will be written, if -1, then all bits will be written.
value The value to be written
stall The stall time, in units of 20MHz clock ticks

unsigned int LCBC_faults_access ( LCBD  lcb,
unsigned int  value,
unsigned int  field_select,
unsigned short int  stall,
unsigned int *  old_val,
unsigned int *  cur_val 
)

Utility routine to compose and execute an access command to LCB's FIFO FAULTS register.

Returns:
Status
Parameters:
lcb The LCB driver handle
value The value to write. Only bits matching those in the field_select parameter will actually be written.
field_select Pattern of those bits in value to write
stall The stall time, in units of 20MHz clock ticks, for the LCB to wait for completion.
old_val Pointer to receive the value of the register before modification. This may be NULL.
cur_val Pointer to receive the value of the register after modification. This may be NULL.

LCB_ci * LCBC_faults_access_fill ( LCB_ci_faults ci,
unsigned int  field_select,
unsigned int  value,
unsigned short int  stall 
)

Constructs a LCB FIFO FAULTS register access command.

Returns:
Pointer to the next command item to be filled
Parameters:
ci The command item to be filled
field_select A word indicating the bits from value that will be written. For example, if 0, then no bits will be written, if -1, then all bits will be written.
value The value to be written
stall The stall time in units of 20MHz clock ticks

unsigned int LCBC_lat_reset ( LCBD  lcb,
unsigned short int  stall 
)

Utility routine to compose and execute an LCB LAT reset command.

Returns:
Status
Parameters:
lcb The LCB driver handle
stall The stall time, in units of 20Mhz clock ticks
To be used only with great discretion; i.e. in case of emergency break glass.

LCBC_ci LCBC_lat_reset_fill ( LCB_ci_lat_reset ci,
unsigned short int  stall 
)

Constructs a LAT reset LCB command.

Returns:
Pointer to the next command item to be filled
Parameters:
ci The command item to be filled.
stall The stall time, in units of 20MHz clock ticks

unsigned int LCBC_mark_time ( LCBD  lcb,
unsigned short int  stall 
)

Utility routine to compose and execute an LCB mark time command.

Returns:
Status
Parameters:
lcb The LCB driver handle
stall The stall time, in units of 20Mhz clock ticks
The utility of a bare mark time command, outside the context of command list, is dubious, but is provided for completeness. With a minimal stall time, one could use effectively as a NOP.

LCB_ci * LCBC_mark_time_fill ( LCB_ci_mark_time ci,
unsigned short int  stall 
)

Constructs a mark time LCB command.

Returns:
Pointer to the next command item to be filled
Parameters:
ci The command item to be filled.
stall The stall time, in units of 20MHz clock ticks

unsigned int LCBC_process ( const LCB_ci ci,
const LCB_ci end,
LCBC_processor  rtn,
void *  prm 
)

Executes the user specified handler for each command item in the range ci to end.

Returns:
The status of the last processing call
Parameters:
ci The first command item to process
end One past the last command item to process
rtn User provided callback routine to process one item
prm User provided parameter passed to rtn

unsigned int LCBC_rxstats_access ( LCBD  lcb,
unsigned int  value,
unsigned int  field_select,
unsigned short int  stall,
unsigned int *  old_val,
unsigned int *  cur_val 
)

Utility routine to compose and execute an access command to LCB's RECEIVE STATISTICS/STATS register.

Returns:
Status
Parameters:
lcb The LCB driver handle
value The value to write. Only bits matching those in the field_select parameter will actually be written.
field_select Pattern of those bits in value to write
stall The stall time, in units of 20MHz clock ticks, for the LCB to wait for completion.
old_val Pointer to receive the value of the register before modification. This may be NULL.
cur_val Pointer to receive the value of the register after modification. This may be NULL.

LCB_ci * LCBC_rxstats_access_fill ( LCB_ci_rxstats ci,
unsigned int  field_select,
unsigned int  value,
unsigned short int  stall 
)

Constructs a LCB RECEIVE STATISTICS/STATUS register access command.

Returns:
Pointer to the next command item to be filled
Parameters:
ci The command item to be filled
field_select A word indicating the bits from value that will be written. For example, if 0, then no bits will be written, if -1, then all bits will be written.
value The value to be written
stall The stall time, in units of 20MHz clock ticks

void LCBC_show ( unsigned int  options,
const LCB_ci beg,
const LCB_ci end 
)

Dumps the result items to stdout.

Parameters:
options Show options
beg Pointer to the first result descriptor to show
end Pointer to one past the lst result descriptor to show
Returns:
void

static unsigned int show ( void *  prm,
const LCB_ci ci 
) [static]

Shows (prints) a single command item.

Parameters:
prm Arbitrary user parameter, unused
ci Pointer to command item
Returns:
0
Useful when passed to LCBC_process () to print all result items.


Generated on Tue Aug 31 18:52:29 2010 by  doxygen 1.5.3