GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LCBD / V1-2-10

Constituent: lcbb     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

LCBB.c File Reference

LCB polled mode interface routines. More...

#include <string.h>
#include "PBS/SPIN.h"
#include "PBS/SPIN.ih"
#include "PBS/BSWP.ih"
#include "LCBD/LCBB.h"
#include "LCBD/LATP.h"
#include "LCBD/LCBB_msgs.h"
#include "LCBD/LCB_cr.h"

Include dependency graph for LCBB.c:

Include dependency graph

Data Structures

struct  _LCBB_err_evt_maps
 Maps to take an event transfer/receive error/status value, into a standard message code. More...

struct  _LCBB_err_maps
 Provides mapping arrays to take an LCB hardware error code into a LCB message code. More...

struct  _LCBB_err_rst_maps
 Maps to take a result transfer/receive error/status value, into a standard message code. More...


Defines

#define CHECK_EQ(n, a, b)   struct Check_ ## n { int x[1 / (a == b) ]; }
 Checks is a = b, and if not the compiler will issue an error.

#define LCBB_XTIME_REGISTER   10000
 Estimate of a register access time, in nanoseconds.

#define LCBB_XTIME_FUNCTION   10000
 Estimate of a function execution time, in nanoseconds.

#define LCBB_XTIME_EVENT_TRANSFER   10000
 Estimate of a event transfer overhead, in nanoseconds.

#define LCBB_XTIME_TIMEOUT   60000000
 Estimate of LCB event transfer timeout period.

#define LCBB_CLK_FREQ   20000000
 The default LCB LATp clock frequency (nominally 20MHz).

#define LCBB_NSECS_PER_TICK   50
 The default LCB LATp clock speed (nominally 20MHz = 50nsec/tick).

#define LCBB_BITS_PER_TICK   1
 The default LCB DMA output transfer speed. This is always 1 bit/tick (20Mbits/sec) independent of the bit/byte of the input interface.

#define LCBB_RST_DRAIN_TIMEOUT   ((unsigned int)(3 * LCBB_CLK_FREQ))
 The result drain timeout period, in units of LCBB clock ticks. This is the maximum time that the function will wait for the sweeping transaction to be returned.

#define LCBB_XTIME_EVENT_TRANSFER_BY_INTS(_nints)
 Estimates the time to get submit and get the result descriptor back for an event transfer of _nints.


Typedefs

typedef _LCBB_err_rst_maps LCBB_err_rst_maps
 Typedef for struct _LCBB_err_rst_maps.

typedef _LCBB_err_evt_maps LCBB_err_evt_maps
 Typedef for struct _LCBB_err_evt_maps.

typedef _LCBB_err_maps LCBB_err_maps
 Typedef for struct _LCBB_err_maps.


Functions

__inline void pciStore32 (volatile unsigned int *dst, unsigned int w)
 Write a 32-bit integer to PCI Memory.

__inline unsigned int pciLoad32 (volatile unsigned int *src)
 Read a 32-bit integer from PCI Memory.

__inline unsigned int clear_faults (LCBB lcb, unsigned short timeout)
 Clears the FIFO faults register.

unsigned int access_function (LCBB lcb, unsigned short stall, unsigned int header, unsigned int poll_timeout)
 Performs an access to the specified LCB slave-side LATP function.

unsigned int access_reg (LCBB lcb, unsigned int value, unsigned int field_select, unsigned short int stall, unsigned int *prv, unsigned int *cur, unsigned int header, unsigned int poll_timeout)
 Performs an access to the specified LCB slave-side LATP register.

unsigned int poll (LCBB lcb, unsigned int poll_period, unsigned int timeout, unsigned short int op_len, const void *result, const LCB_ri_err *ri_err)
 Polls the RESULT FIFO every nsecs for @ iterations.

__inline unsigned int submit (LCBB lcb, unsigned int request)
 Submits the specified request list to the LCB for execution.

unsigned int execute (LCBB lcb, unsigned int request, unsigned int xtime, unsigned int timeout, unsigned short int op_len, void *result, LCB_ri_err *ri_err)
 Has the LCB's command execution routine execute the specified single item request. The result list and result item is checked for successful completion.

unsigned int init_pci (LCBB lcb)
 Initializes the LCB structure -- probes the PCI bus.

unsigned int init_latp (LCBB lcb)
 Laundry list of LCB initializations to do on the LATp side.

void init_circ (LCBB lcb)
 Allocates memory for and sets it up to be used as the circular buffer.

unsigned int drain_result (LCBB lcb)
 Drains the result FIFOs.

unsigned int drain_event (LCBB lcb)
 Drains the event FIFOs.

__inline unsigned int mapXfrErr (const LCBB_err_rst_maps *maps, unsigned int err)
 Maps a result descriptor status into an error code.

__inline unsigned int mapRcvErr (const LCBB_err_rst_maps *maps, unsigned int err)
 Maps a result item status into an error code.

LCBB LCBB_configure (unsigned int latp, void *requestList, void *resultList, void *circBuffer)
 Returns a pointer to the LCB control structure, with the specified configuration parameters.

unsigned int LCBB_init (LCBB lcb)
 Initializes the LCB structure for polled mode.

unsigned int LCBB_check (LCBB lcb, LCBB_msg *msg)
 Maps the LCB error codes to a LCB message code.

unsigned int LCBB_free (LCBB lcb, LCBB_msg *msg)
unsigned char * LCBB_locate (LCBB lcb)
 Returns a pointer to payload.

LCBB_msgLCBB_receive (LCBB lcb)
 Reads the event FIFO for descriptors.

unsigned int LCBB_send (LCBB lcb, unsigned int dst, unsigned int proto, int nbytes)
 Sends the data.

unsigned int LCBB_start (LCBB lcb)
 Enables the LCB for taking event data.

unsigned int LCBB_mark_time (LCBB lcb, unsigned short int stall)
 Issues a Mark Time command to the LCB.

unsigned int LCBB_lat_reset (LCBB lcb, unsigned short int stall)
 Issues a LAT reset.

unsigned int LCBB_csr_access (LCBB lcb, unsigned int value, unsigned int field_select, unsigned short int timeout, unsigned int *prv, unsigned int *cur)
 Does an access of the LATp CSR register.

unsigned int LCBB_faults_access (LCBB lcb, unsigned int value, unsigned int field_select, unsigned short int timeout, unsigned int *prv, unsigned int *cur)
 Does an access of the LATp CSR register.

unsigned int LCBB_rxstats_access (LCBB lcb, unsigned int value, unsigned int field_select, unsigned short int timeout, unsigned int *prv, unsigned int *cur)
 Does an access of the LATp Receive Statistics/Status register.


Variables

const LCBB_err_maps LcbbErrMaps
 Realization of the LCB error to message code mapping arrays.

_LCBB Lcbb
 The LCB driver control block.


Detailed Description

LCB polled mode interface routines.

Author:
Curt Brune -- curt@slac.stanford.edu

JJRussell -- russell@slac.stanford.edu

  CVS $Id

Overview
This one file is the total implementation of the boot mode driver.
This driver implements only enough of the LCB functionality to perform the boot phase. As one expects in a boot mode driver, it is a completely synchronous version of the driver. In addition, or perhaps one should say, in subtraction, it does not provide any help in building command lists or parsing the corresponding result lists. Of course, nothing precludes the user from doing this, and, it is in fact, quite easy to do, see LCB_cr.h for all the relevant definitions.
Anticipated Usage
Except for the initialization phase, the only anticipated functionality is to send and receive bulk messages over the event fabric. While not precluded, the boot code likley has no desire or need to use the command/response fabric nor even the internal registers after the initialization phase. However, given that these are used internally, an interface to a limited set of the LATp side functionality and registers is provided.
Modularity Requirements
Given that there is only one customer for this code (the EPU boot code) and given that this code is directly linked into the boot code, the modularity requirements are greatly lessened. To this end, the LCBB control block is exposed, allowing the user to access its members. In particular items that may be of interest are

Warning:
Using the memory map, one can directly access the PCI side registers. Please to use this capability in a read-only fashion. Although the driver is currently stateless, future versions may not be. If writes are performed to the PCI registers outside the context of the driver, a mismatch between the hardware and software can occur.
Please also note that one should exercise caution when reading the various queues, since the act of reading removes an item on the queue that the driver may have reason to believe is there. Again this can cause an inconsistency between the hardware and the software.
Warning:
These is one feature of the initialization sequence that may be an issue. When draining the result queue, any rogue and NULL descriptor transactions are somewhat quietly dismissed. The drain function does counts such transactions,lcbb->rogue_count and lcbb->null_count and stores them (at least the most recent 8) in its transaction trace (history) buffer.
The cause of concern is that the poll loop times-out after a fixed amount of time. If the loop expends this time servicing a large number of NULL or rogue descriptors, this could leave the transaction used to sweep any stale transactions left lingering in the result queue, itself becoming a stale transaction. While in principle this is a problem (since NULL descriptors are the end-product of unsolicited and externally issued LAM commands, see the next paragraph for more information on NULL descriptors) in practice, this can only be a problem if the
  1. The source issuing these LAMs is out of control
  2. The LCB hardware is broken
So far, all proposed solutions to this problem appear to be worse than the disease.
NULL Descriptors
NULL descriptors are the result of a LAM message being sent to the LCB by another CPU. As long as the sender does not send continuous LAMs, the NULL descriptors will eventually drain. The most probable cause of them not draining is broken hardware. Given that this code executes in the boot phase, there is little one can do to recover. Checking the counters and the history buffers can help in diagnosing the root cause.
Rogue Descriptors
Rogue Descriptors are result descriptors that the code is not expecting. Rogue descriptors do not lead to the same problems as NULL descriptors. Such descriptors are the result of commands issued by the host CPU, but which software has lost track of, likely because of a reboot being issued between the time they were submitted to the hardware and the time the hardware returned them in the result que. Because such commands are knowingly issued by the host CPU and because the LCB hardware itself has a limit of approximately 10-13 transaction that it can internally hold, the drain time of such transaction is finite and more under the control of the host CPU.
Trace History Buffer
In order to keep aid in diagnostics and debugging, the LCBB driver maintains a trace buffer of the last 8 (or so) non-timeout result descriptors returned. While, in principle, each transaction should produce only one such trace record, in practice the driver must be handle, the case where the expected result descriptor is not the first non-timeout descriptor received. It may instead find either a NULL descriptor or a rogue descriptor. Each trace record includes a transaction sequence number. The rare case where multiple descriptors are encountered while polling for a result can be recognized because all will have the same transaction sequence number.

Define Documentation

#define CHECK_EQ n,
a,
 )     struct Check_ ## n { int x[1 / (a == b) ]; }
 

Checks is a = b, and if not the compiler will issue an error.

Parameters:
n Unique identifying string (helps isolate the error)
a The value to check
b The value to check
This is a trick used to generate a compile time error when a compile time assumption has been violated.

#define LCBB_XTIME_EVENT_TRANSFER_BY_INTS _nints   ) 
 

Value:

Estimates the time to get submit and get the result descriptor back for an event transfer of _nints.

The time for the result descriptor to be returned is

     time = Submit_Time + Pci_Dma_Time + Lat_Dma_Time + Lcb_timeout
          + Lat_Result_Dsc_Write + Pci_Result_Dsc_Write
  
This breaks into 2 pieces, a fixed piece and a piece proportional to the amount of data being sent.

    Fixed_Time = Submit_Time + Lat_Result_Dsc_Write + Pci_Result_Dsc_Write
    Dma_Time   = Pci_Dma_Time + Lat_Dma_Time
  
The PCI DMA term will be ignore since it is so much faster (about a factor of 50) that, for purposes of this estimate it will be ignored.


Typedef Documentation

LCBB_err_maps
 

Typedef for struct _LCBB_err_maps.

Combines the Result and Event mapping data structures


Function Documentation

unsigned int access_function LCBB  lcb,
unsigned short  stall,
unsigned int  header,
unsigned int  poll_timeout
[static]
 

Performs an access to the specified LCB slave-side LATP function.

Returns:
Status
Parameters:
lcb The LCB driver handle
stall The stall time, in units of LATp clocks
header The header word, giving the length and opcode
poll_timeout The poll loop timeout value, in units of nanoseconds
The poll loop timeout value is a timeout value that is added to an internal estimate of how long the transaction will take. This is usually specified as 0, unless on suspects that there are pending transactions ahead of one in the que.

Here is the call graph for this function:

unsigned int access_reg LCBB  lcb,
unsigned int  value,
unsigned int  field_select,
unsigned short int  stall,
unsigned int *  prv,
unsigned int *  cur,
unsigned int  header,
unsigned int  poll_timeout
[static]
 

Performs an access to the specified LCB slave-side LATP register.

Returns:
Status
Parameters:
lcb The LCB driver handle
value The 32-bit value to write
field_select A bit mask indicating which fields should be written
stall A stall or timeout value (in units of LATp clocks)
prv Pointer to return the previous value of the register
cur Pointer to return the current value of the register
header The header word
poll_timeout The poll loop timeout value, in units of nanoseconds
Note that the parameters prv and cur refer to the values of the register prior to writing and after writing, respectively.
The poll loop timeout value is a timeout value that is added to an internal estimate of how long the transaction will take. This is usually specified as 0, unless on suspects that there are pending transactions ahead of one in the que.

Here is the call graph for this function:

unsigned int clear_faults LCBB  lcb,
unsigned short  timeout
[static]
 

Clears the FIFO faults register.

Returns:
Status
Parameters:
lcb The LCB driver handle
timeout A timeout value (in units of LATp clocks)

Here is the call graph for this function:

unsigned int drain_event LCBB  lcb  )  [static]
 

Drains the event FIFOs.

Return values:
0,if successfully drained
LCB message code it had errors
Parameters:
lcb Initialized LCBB handle
Overview
The EVENT FIFO is drained by reading it until dry or for a maximum of 1024. Note that, as opposed to the RESULT FIFO where no transactions are being launched (they are all solicited, except for the BOARD ID transaction and that is just a fly-in-the-ointment), the EVENT FIFO can be continually filled by external agents. This why the loop is capped.

Here is the call graph for this function:

unsigned int drain_result LCBB  lcb  )  [static]
 

Drains the result FIFOs.

Return values:
0,if successfully drained
LCB message code it had errors
Parameters:
lcb Initialized LCBB handle
Overview
The result buffer is drained by launching an internal command and waiting for the transaction to arrive back in the result FIFO. This routine uses the same underlying submission/poll routines as the user callable routines eventually call. The only difference is that the absolute poll timeout time is set to be very high under the assumption that there could be other 'things' lingering in the result queue. These other 'things' could be stale transactions leftover from a previous boot or could be NULL descriptors from externally issued LAM commnands.
Side Effects
The drain function uses an access of the LATp CSR register as its sweeping transaction. This access has the side effect of setting the fields as specified in the LCBB_cfg_latp structure.
Return Values
The drain function returns an error if it encountered any rogue transactions during the drain operation. NULL descriptors are quietly ignored, but their existence may be noted by looking at the NULL descriptor counter (lcb->null_counts) in the LCBB control structure as while as by pawing through the history buffer (presuming that it is deep enough to contain such them.)

Here is the call graph for this function:

unsigned int execute LCBB  lcb,
unsigned int  request,
unsigned int  xtime,
unsigned int  timeout,
unsigned short int  op_len,
void *  result,
LCB_ri_err ri_err
[static]
 

Has the LCB's command execution routine execute the specified single item request. The result list and result item is checked for successful completion.

Return values:
LCBB_OK,if okay
LCBB_REQFULL,if the transaction could not submitted to the LCB because the request queue is full
LCBB_NULLDSC,if,when polling for the result, the NULL descriptor was the only transaction found
LCBB_ROGUE,if,when polling for the result, a ROGUE transaction was the only transaction found.
Returns:
Any of the result list or result item error codes.
Parameters:
lcb The LCBB driver handle
request A pointer to a properly built (address | length) request. The transformation for local to PCI space is done in this routine.
xtime The estimate time to do the transaction, in nanoseconds
timeout An additional timeout period to be added to the transaction time, in nanoseconds
op_len Opcode and length piece of the ols field
result Address of the expected result list.
ri_err Pointer to the result item's error field.
This is just a convenience function, combining the submission, polling and checking of a single item command list.
The somewhat awkward call (passing a pointer to the result item's error field is purely for expediency, making it easier to implement this routine. In principle, this field could be decoded translated by backtracking the pointer to the command list buried in the result list back to the command's opcode and then translating the opcode into a result item length, thus locating the result item's error field. Passing it in just seemed a lot simpler.

Here is the call graph for this function:

void init_circ LCBB  lcb  )  [static]
 

Allocates memory for and sets it up to be used as the circular buffer.

Parameters:
lcb The lcb handle

Here is the call graph for this function:

unsigned int init_latp LCBB  lcb  )  [static]
 

Laundry list of LCB initializations to do on the LATp side.

Parameters:
lcb A previously PCI initialized LCBB handle
Returns:
LCBB_OK or a status code

To be successful, the clocks on the LATp need to be running.

Here is the call graph for this function:

unsigned int init_pci LCBB  lcb  )  [static]
 

Initializes the LCB structure -- probes the PCI bus.

Parameters:
lcb Pointer to the private LCBB structure
Return values:
LCBB_OK for success,
LCBB_PCIFAIL,if the board cannot be found.
LCBB_PCIMAPPL,if the translation of local address to PCI address fails
LCBB_PCIMAPLP,if the address mapping fails
This routine initializes the PCI portion of the lcb handle. If the lcb handle is specified as NULL, the internal handle available by calling
See also:
LCBB_configure(), is used.
The steps are
  1. Probe the PCI bus, looking for the LCB.
  2. When the board is found, store the mapping for the PCI memory space. Both the mapping LOCAL -> PCI and PCI -> LOCAL are stored.
  3. Disable interrupts

Here is the call graph for this function:

unsigned int LCBB_check LCBB  lcb,
LCBB_msg msg
 

Maps the LCB error codes to a LCB message code.

Return values:
LCBB_OK if message is okay
LCB message code if not
Parameters:
lcb Pointer to private LCB structure
msg The LCB message
This maps the LCB transfer and receive errors into standard LCBB message codes. If there are no transfer or receive errors, LCBB_OK is returned.

LCB LCBB_configure unsigned int  latp,
void *  requestList,
void *  resultList,
void *  circBuffer
 

Returns a pointer to the LCB control structure, with the specified configuration parameters.

Returns:
A pointer to the LCB control structure
Parameters:
latp The LATp configuration information presented as 16 select bits and 16 value bits. Only those bits with their corresponding select bits set will be altered.
requestList An array of 4096 bytes aligned on a 512 byte boundary. This memory will be used to construct request lists. It is from this memory that space for LCB-to-LCB traffic,
See also:
LCBB_send, is carved.
Parameters:
resultList As array of 4096 bytes aligned on a 16 byte boundary. This memory will be used to hold result lists.
circBuffer An array of LCB_CIRC_BUFFER_TOTAL (640Kbytes) align on a LCB_CIRC_BUFFER_ALIGN (1Mbyte) boundary. This memory will be used to hold incoming 'event' traffic.
The last three parameters are self-explanatory. The latp parameter deserves some special attention. There are a number of values that configure the LATp side behaviour of the LCB. The latp parameter provides a method of altering only those values that the caller wishes. It does this by defining the lower 16 bits as the value bits and the upper 16 bits as the selection bits. Only value bits with corresponding field selection bits set will be altered.
The set-up of this parameter is largely determined by whether the LCB is acting as a commander (SIU) or a responder (EPU). A typical configuration might be
                           SIU     EPU       
       commander             1       -
       evt_path              -       -
       cmd_path              -       -
       hdr_parity            -       -
       payload_parity        -       -
       pause_test            -       -
       pause_stick           -       -
       board_id              v       -
       byte_wide             v       -

Where the v's represent a configurable value and the @ -'s represent bits that should not be altered. The corresponding code would look like for an SIU would look like
      LCBB_latp_cfg  latp;

      latp.ui                  = 0;
      latp.sv.value.command    = 1;
      latp.sv.value.board_id   = board_id;
      latp.sv.value.byte_wide  = 1;
      latp.sv.select.command   = LCBB_LATP_SELECT;
      latp.sv.select.board_id  = LCBB_LATP_SELECT;
      latp.sv.select.byte_wide = LCBB_LATP_SELECT;
      LCBB_configure (latp.ui,
                      requestList,
                      resultList,
                      circBuffer);

The EPU would simple passs a 0, since it does wish to alter any fields.
Note:
For the most current usage of these bits, see the corresponding fields in the LCB_csr definitions (LCB_cr.h). Some of these bits have only have meaning in on the SIU or EPU and some only have meaning when not in a system with a GASU. An example of the latter is the commander select. In a GASU based system, this functionality is set on the

unsigned int LCBB_csr_access LCBB  lcb,
unsigned int  value,
unsigned int  field_select,
unsigned short int  timeout,
unsigned int *  prv,
unsigned int *  cur
 

Does an access of the LATp CSR register.

Returns:
Status
Parameters:
lcb Pointer to the LCBB control structure
value The value to write to the register
field_select A bit map indicating which fields of value should be written to the register.
timeout The number of 20MHz ticks that the LCB should wait for a response before timing out.
prv A pointer to receive the previous value
cur A pointer to receive the current value

Here is the call graph for this function:

unsigned int LCBB_faults_access LCBB  lcb,
unsigned int  value,
unsigned int  field_select,
unsigned short int  timeout,
unsigned int *  prv,
unsigned int *  cur
 

Does an access of the LATp CSR register.

Returns:
Status
Parameters:
lcb Pointer to the LCBB control structure
value The value to write to the register
field_select A bit map indicating which fields of value should be written to the register.
timeout The number of 20MHz ticks that the LCB should wait for a response before timing out.
prv A pointer to receive the previous value
cur A pointer to receive the current value

Here is the call graph for this function:

unsigned int LCBB_free LCBB  lcb,
LCBB_msg msg
 

Parameters:
lcb Pointer to private LCB structure
msg Pointer to a pointer to a message

Here is the call graph for this function:

unsigned int LCBB_init LCBB  lcb  ) 
 

Initializes the LCB structure for polled mode.

Parameters:
lcb Pointer to private LCB structure
Returns:
LCBB_OK for success
Probe the PCI bus looking for the LCB. When the board is found store the mapping for the PCI I/O space and PCI Memory space.

Here is the call graph for this function:

unsigned int LCBB_lat_reset LCBB  lcb,
unsigned short int  stall
 

Issues a LAT reset.

Parameters:
lcb Pointer to the LCBB control structure
stall The stall time, in units of 20MHz ticks until the next command can be issued.
It would be rare to issue a LAT reset in the context of the boot code, but it has been included for completeness.

Here is the call graph for this function:

unsigned char * LCBB_locate LCBB  lcb  ) 
 

Returns a pointer to payload.

Parameters:
lcb Pointer to private LCB structure
Returns:
Pointer to store the payload
The pointer is guaranteed to be 32-bit aligned.

Warning:
It is the user responsibility to limit the transfer to LCB_TRANSFER_MAX bytes.

unsigned int LCBB_mark_time LCBB  lcb,
unsigned short int  stall
 

Issues a Mark Time command to the LCB.

Returns:
Status
Parameters:
lcb Pointer to the LCBB control structure
stall The amount of time to stall, in units of 20MHz ticks
It would be rare that a mark time command would be issued in the boot code environment. Mainly, this is a command to meter out items in a command list. The one possible use is as a 'innocous' command to see if the LATp side of the LCB is alive; i.e. a probe usage.

Here is the call graph for this function:

LCBB_msg * LCBB_receive LCBB  lcb  ) 
 

Reads the event FIFO for descriptors.

Parameters:
lcb Pointer to private LCBB structure
Return values:
If there is a message, a pointer to the received message
If these is no message, NUL,
Call this function to check if any event data has been received. When a descriptor is found the LCBB_msg pointer is initialized and the event descriptor read from the FIFO is returned. Since this is a non-blocking routine, it is meant to be used in a polling mode style, returning a non-NULL LCBB_msg pointer only when there is a message available. Note that the user data starts after the pad area, defined bu LCB_msg_hdr.
The caller of this function must absolutely check the event descriptor for errors before trying to use the LCBB_msg pointer. This can be done either by the user directly accessing the status fields in the event descriptor (stored in the LCBB_msg itself) or by using the LCBB_check function.

Here is the call graph for this function:

unsigned int LCBB_rxstats_access LCBB  lcb,
unsigned int  value,
unsigned int  field_select,
unsigned short int  timeout,
unsigned int *  prv,
unsigned int *  cur
 

Does an access of the LATp Receive Statistics/Status register.

Returns:
Status
Parameters:
lcb Pointer to the LCBB control structure
value The value to write to the register
field_select A bit map indicating which fields of value should be written to the register.
timeout The number of 20MHz ticks that the LCB should wait for a response before timing out.
prv A pointer to receive the previous value
cur A pointer to receive the current value

Here is the call graph for this function:

unsigned int LCBB_send LCBB  lcb,
unsigned int  dst,
unsigned int  proto,
int  nbytes
 

Sends the data.

Parameters:
lcb Pointer to private LCBB structure
dst LATp destination fabric address, physical
proto 2-bit LATp protocol to use when sending bulk data
nbytes The number of bytes to send. Note that this length must include the 4 bytes of the LATP packet header
Returns:
LCBB_OK for success
Warning:
Make sure the nbytes parameter includes the length of the data plus the 4 bytes of the LATP packet header word. This was a struggle, trying to define whether the length word should be only the length of what has traditionally been called the user data (excludes the the LATp header and the word that the EBM would fill) or whether it should include the 4 bytes of the LATp and EBM word. In the end, the decision was driven by the fact that the numbers floating around describing the limits on the data transfer size have been quoted as including the 4 bytes.

Here is the call graph for this function:

unsigned int LCBB_start LCBB  lcb  ) 
 

Enables the LCB for taking event data.

Parameters:
lcb Pointer to private LCBB structure
Returns:
LCBB_OK for success

Here is the call graph for this function:

static __inline unsigned int mapRcvErr const LCBB_err_rst_maps maps,
unsigned int  err
[static]
 

Maps a result item status into an error code.

Parameters:
maps The error maps for result codes
err The error (status) code to map

static __inline unsigned int mapXfrErr const LCBB_err_rst_maps maps,
unsigned int  err
[static]
 

Maps a result descriptor status into an error code.

Parameters:
maps The error maps for result codes
err The error (status) code to map

unsigned int pciLoad32 volatile unsigned int *  src  )  [static]
 

Read a 32-bit integer from PCI Memory.

Parameters:
src Pointer source memory location
Returns:
value at memory location pointed to be src
See also:
pciStore32()
This function performs the necessary byte swapping when reading PCI Memory (PCI bus is inherently little-endian).

void pciStore32 volatile unsigned int *  dst,
unsigned int  w
[static]
 

Write a 32-bit integer to PCI Memory.

Parameters:
dst Pointer destination memory
w 32-bit value to store
Returns:
LCBB_OK on success
This function performs the necessary byte swapping when writing PCI Memory (PCI bus is inherently little-endian). For the PowerPC the function also issues an "eieio" instruction to insure the write instruction complete before other loads and stores.

unsigned int poll LCBB  lcb,
unsigned int  poll_period,
unsigned int  timeout,
unsigned short int  op_len,
const void *  result,
const LCB_ri_err ri_err
[static]
 

Polls the RESULT FIFO every nsecs for @ iterations.

Returns:
The status of the transaction
Parameters:
lcb The LCBB driver handle
poll_period The polling period, in nanoseconds
timeout The timeout period, in nanoseconds
op_len The opcode and length of the transaction
result Address of the expected result list.
ri_err Pointer to the result item's error field. s
Routine polls on the result descriptor que until either
  1. A result descriptor comes back
  2. The timeout period is reached

Even a list of up to 3 seconds is possible (pretty bizarre), can be covered by the range of the SPIN counter. The smallest range is

      MV2304, MCP750: 2**32 *  60 nsecs ~= 240 seconds
      RAD750        : 2**32 * 120 nsecs ~= 480 seconds
  

Here is the call graph for this function:

unsigned int submit LCBB  lcb,
unsigned int  request
[static]
 

Submits the specified request list to the LCB for execution.

Return values:
LCBB_OK,if the transaction was successfully submitted
LCBB_REQFULL,if the transaction could not be submitted because the request queue was full.
Parameters:
lcb The LCBB driver handle
request A pointer to a properly built (address | length) request. The transformation for local to PCI space is done in this routine.

Here is the call graph for this function:


Generated on Mon Jun 20 22:22:36 2005 by doxygen 1.3.3