Doxygen Documentation

Main Index

Package Index

Package:

GDAB

Version:

dev

Marked:

(not marked)

Constituent:

gdab

Tag:

mv2304


Interface   Compound List   File List   Compound Members   File Members  

gDAB.c File Reference

Implements command/response for the DAB. More...

#include <string.h>
#include "GDAB/gDAB.h"
#include "GDAB/gdab_err.h"
#include "GNAT/log.h"
#include "GNAT/gnat.h"
#include "GNAT/latp.h"
#include "gDAB_p.h"

Functions

int calcShortParity (unsigned short nWords, unsigned short *arr)
 Calculates the odd parity in arr.

void setAD (gdabHandle gdab, unsigned short func, unsigned short block, unsigned short reg, gdabLATpAD *ad)
 initializes an access descriptor structure for a DAB

void packPayloadDAB (gdabHandle gdab, unsigned short ad, unsigned short nWords, unsigned short *value, unsigned short *payload)
 Packs the ad and value into the payload.

int __gDABcmd (gdabHandle gdab, unsigned short dabAddr, unsigned short block, unsigned short opcode)
 Sends a dataless command to the DAB address.

int __gDABload (gdabHandle gdab, unsigned short dabAddr, unsigned short block, unsigned short reg, unsigned short nWords, unsigned short *value)
 Loads a register with value.

int __gDABread (gdabHandle gdab, unsigned short dabAddr, unsigned short block, unsigned short reg, unsigned short nWords, unsigned short *value)
 Reads a register returing value in val.

int gDABlam (gdabHandle gdab, unsigned short dabAddr)
 Sends the "Look At Me" message to the DAB.

int setCellHeaderParity (gdabHandle gdab, unsigned short p)
 p determines if the LATp CellHeader Parity is inverted

int getCellHeaderParity (gdabHandle gdab, unsigned short *p)
 Returns the current LATp cell header parity setting in p.

int setCellBodyParity (gdabHandle gdab, unsigned short p)
 p determines if the LATp Cell Body Parity is inverted

int getCellBodyParity (gdabHandle gdab, unsigned short *p)
 Returns the current LATp cell body parity setting in p.

int setCmdStrParityDAB (gdabHandle gdab, unsigned short p)
 p determines if the DAB command string parity is inverted

int getCmdStrParityDAB (gdabHandle gdab, unsigned short *p)
 Returns the current DAB command string parity.

int setAccessDescParityDAB (gdabHandle gdab, unsigned short p)
 p determines if the DAB access descriptor parity is inverted

int getAccessDescParityDAB (gdabHandle gdab, unsigned short *p)
 Returns the current DAB access descriptor parity.

int setCmdPayloadParityDAB (gdabHandle gdab, unsigned short p)
 p determines if the DAB command payload parity is inverted

int getCmdPayloadParityDAB (gdabHandle gdab, unsigned short *p)
 Returns current DAB command payload parity.

int gDAB_SetGEMAddr (gdabHandle gdab, unsigned short addr)
 Address of GEM on the C/R fabric.

int gDAB_GetGEMAddr (gdabHandle gdab, unsigned short *addr)
 Gets system wide LATp address of GEM.

int gDAB_SetEBMAddr (gdabHandle gdab, unsigned short addr)
 Address of EBM on the C/R fabric.

int gDAB_GetEBMAddr (gdabHandle gdab, unsigned short *addr)
 Gets system wide LATp address of EBM.

int gDAB_SetCRUAddr (gdabHandle gdab, unsigned short addr)
 Address of CRU on the C/R fabric.

int gDAB_GetCRUAddr (gdabHandle gdab, unsigned short *addr)
 Gets system wide LATp address of CRU.

int gDAB_GetBlockAddr (gdabHandle gdab, short *addr)
 Gets the block address being used to overide default values (as used inside eg CRU functions).

int gDAB_SetBlockAddr (gdabHandle gdab, short addr)
 Block address for registers.


Detailed Description

Implements command/response for the DAB.

Author:
James Swain -- jswain@slac.stanford.edu

Function Documentation

int __gDABcmd gdabHandle  gdab,
unsigned short  dabAddr,
unsigned short  block,
unsigned short  opcode
 

Sends a dataless command to the DAB address.

Parameters:
gdab gdabHandle for DAB
dabAddr DAB address of command
block block to whom the command is addressed
opcode opcode of command to send
Returns:
G_OK on success
Sends the dataless command specified by opcode to the block specified by block at DAB address specified by dabAddr.

int __gDABload gdabHandle  gdab,
unsigned short  dabAddr,
unsigned short  block,
unsigned short  reg,
unsigned short  nWords,
unsigned short *  value
 

Loads a register with value.

Parameters:
gdab gdabHandle for DAB
dabAddr DAB address of command
block block to whom this write is directed.
reg register of DABC to load
nWords number of 16-bit words in the value.
value array of 16-bit words to load into DABC register
Returns:
G_OK on success
Loads the DAB register specified by reg in block specified by block with value

int __gDABread gdabHandle  gdab,
unsigned short  dabAddr,
unsigned short  block,
unsigned short  reg,
unsigned short  nWords,
unsigned short *  value
 

Reads a register returing value in val.

Parameters:
gdab gdabHandle for DAB
dabAddr DAB address of command
block block for whence the register value is to be read.
reg register of DABC to read
nWords number of words expected
value pointer to storage to hold the response of the read command
Returns:
G_OK on success
Reads the register specified by reg. val is filled on return.

The following error codes are returned when LATp errors occur:

  • GERR_LATP_HEADER_PARITY
  • GERR_LATP_CELL_PARITY
  • GERR_LATP_TRUNCATE

int calcShortParity unsigned short  nWords,
unsigned short *  arr
 

Calculates the odd parity in arr.

Parameters:
nWords Number of unsigned shorts in @ arr
arr Array of unsigned shorts
Returns:
odd parity of the bits contained in @ arr.

int gDAB_GetBlockAddr gdabHandle  gdab,
short *  addr
 

Gets the block address being used to overide default values (as used inside eg CRU functions).

Parameters:
gdab gdabHandle for cpt on the DAB
addr pointer to hold address
Returns:
G_OK on success
See also:
gDAB_SetBlockAddr()

int gDAB_GetCRUAddr gdabHandle  gdab,
unsigned short *  addr
 

Gets system wide LATp address of CRU.

Parameters:
gdab gdabHandle for cpt on the DAB
addr pointer to hold address
Returns:
G_OK on success
See also:
gDAB_SetCRUAddr()
Gets the system-wide LATp address of CRU

int gDAB_GetEBMAddr gdabHandle  gdab,
unsigned short *  addr
 

Gets system wide LATp address of EBM.

Parameters:
gdab gdabHandle for cpt on the DAB
addr pointer to hold address
Returns:
G_OK on success
See also:
gDAB_SetEBMAddr()
Gets the system-wide LATp address of EBM

int gDAB_GetGEMAddr gdabHandle  gdab,
unsigned short *  addr
 

Gets system wide LATp address of GEM.

Parameters:
gdab gdabHandle for cpt on the DAB
addr pointer to hold address
Returns:
G_OK on success
See also:
gDAB_SetGEMAddr()
Gets the system-wide LATp address of GEM

int gDAB_SetBlockAddr gdabHandle  gdab,
short  addr
 

Block address for registers.

Parameters:
gdab gdabHandle for cpt on the DAB
addr Block address to be used instead of default inside CRU functions
Returns:
G_OK on success
This overides the usual settings for block address in some commands. Used for testing the LATp engine using the CRU as a test bed. Should be set to -1 for normal operation.

int gDAB_SetCRUAddr gdabHandle  gdab,
unsigned short  addr
 

Address of CRU on the C/R fabric.

Parameters:
gdab gdabHandle for cpt on the DAB
addr LATp address of CRU
Returns:
G_OK on success
Sets the system-wide LATp address of CRU. This function is intended to be called once during system initialization. It might also be useful during testing.

int gDAB_SetEBMAddr gdabHandle  gdab,
unsigned short  addr
 

Address of EBM on the C/R fabric.

Parameters:
gdab gdabHandle for cpt on the DAB
addr LATp address of EBM
Returns:
G_OK on success
Sets the system-wide LATp address of EBM. This function is intended to be called once during system initialization. It might also be useful during testing.

int gDAB_SetGEMAddr gdabHandle  gdab,
unsigned short  addr
 

Address of GEM on the C/R fabric.

Parameters:
gdab gdabHandle for cpt on the DAB
addr LATp address of GEM
Returns:
G_OK on success
Sets the system-wide LATp address of GEM. This function is intended to be called once during system initialization. It might also be useful during testing.

int gDABlam gdabHandle  gdab,
unsigned short  dabAddr
 

Sends the "Look At Me" message to the DAB.

Parameters:
gdab gdabHandle for DAB
dabAddr DAB address of command
Returns:
G_OK on success
Sends the "Look At Me" message to the DAB. This is used to switch the command/response wire used by the DAB. If the DAB decodes the "Look At Me" message on either it's A or B command channel it will switch to that channel for future commanding.

int getAccessDescParityDAB gdabHandle  gdab,
unsigned short *  p
 

Returns the current DAB access descriptor parity.

Parameters:
gdab gdabHandle for DAB
p pointer to hold boolean value
Returns:
STATUS
if p is non-zero then all out going DAB commands will have their access descriptor parity inverted. This is used for testing parity errors. The default value is 0.

int getCellBodyParity gdabHandle  gdab,
unsigned short *  p
 

Returns the current LATp cell body parity setting in p.

Parameters:
gdab gdabHandle for DAB
p pointer to hold boolean value
Returns:
STATUS
If p is non-zero then all out going LATp packets will have their cell body parity inverted. This is used for testing parity errors. The default value is 0.

int getCellHeaderParity gdabHandle  gdab,
unsigned short *  p
 

Returns the current LATp cell header parity setting in p.

Parameters:
gdab gdabHandle for DAB
p pointer to hold boolean value
Returns:
STATUS
If p is non-zero then all out going LATp packets will have their cell header parity inverted. This is used for testing parity errors. The default value is 0.

int getCmdPayloadParityDAB gdabHandle  gdab,
unsigned short *  p
 

Returns current DAB command payload parity.

Parameters:
gdab gdabHandle for DAB
p pointer to hold boolean value
Returns:
STATUS
if p is non-zero then all out going DAB commands will have their command payload parity inverted. This is used for testing parity errors. The default value is 0.

int getCmdStrParityDAB gdabHandle  gdab,
unsigned short *  p
 

Returns the current DAB command string parity.

Parameters:
gdab gdabHandle for DAB
p pointer to hold boolean value
Returns:
STATUS
if p is non-zero then all out going DAB commands will have their command string parity inverted. This is used for testing parity errors. The default value is 0.

void packPayloadDAB gdabHandle  gdab,
unsigned short  ad,
unsigned short  nWords,
unsigned short *  value,
unsigned short *  payload
 

Packs the ad and value into the payload.

Parameters:
gdab gdabHandle for DAB
ad 16-bit access descriptor
nWords number of words in value
value array of 16-bit words to load into register
payload pointer to pre-allocated storage
Returns:
void
Packs the bits of ad and value into the storage pointed to by payload.

int setAccessDescParityDAB gdabHandle  gdab,
unsigned short  p
 

p determines if the DAB access descriptor parity is inverted

Parameters:
gdab gdabHandle for DAB
p boolean value
Returns:
G_OK
if p is non-zero then all out going DAB commands will have their access descriptor parity inverted. This is used for testing parity errors. The default value is 0.

void setAD gdabHandle  gdab,
unsigned short  func,
unsigned short  block,
unsigned short  reg,
gdabLATpAD ad
 

initializes an access descriptor structure for a DAB

Parameters:
gdab gdabHandle for DAB
block Sepcifies the register block
func DAB fucntion code
reg register of DAB
ad reference to GDAB access descriptor structure
Returns:
void

int setCellBodyParity gdabHandle  gdab,
unsigned short  p
 

p determines if the LATp Cell Body Parity is inverted

Parameters:
gdab gdabHandle for DAB
p boolean value
Returns:
STATUS
If p is non-zero then all out going LATp packets will have their cell body parity inverted. This is used for testing parity errors. The default value is 0.

int setCellHeaderParity gdabHandle  gdab,
unsigned short  p
 

p determines if the LATp CellHeader Parity is inverted

Parameters:
gdab gdabHandle for DAB
p boolean value
Returns:
STATUS
If p is non-zero then all out going LATp packets will have their cell header parity inverted. This is used for testing parity errors. The default value is 0.

int setCmdPayloadParityDAB gdabHandle  gdab,
unsigned short  p
 

p determines if the DAB command payload parity is inverted

Parameters:
gdab gdabHandle for DAB
p boolean value
Returns:
G_OK
if p is non-zero then all out going DAB commands will have their command payload parity inverted. This is used for testing parity errors. The default value is 0.

int setCmdStrParityDAB gdabHandle  gdab,
unsigned short  p
 

p determines if the DAB command string parity is inverted

Parameters:
gdab gdabHandle for DAB
p boolean value
Returns:
G_OK
if p is non-zero then all out going DAB commands will have their command string parity inverted. This is used for testing parity errors. The default value is 0.


Generated on Wed Nov 19 14:55:02 2003 by doxygen 1.3.3