GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > LEM / V4-7-0

Constituent: lem_cli     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

cli_macros.h File Reference

Several macros used inside the command-line interface, presented here in case they are of use to others. More...

#include "LEM/list_macros.h"

Include dependency graph for cli_macros.h:

This graph shows which files directly or indirectly include this file:


Defines

#define LEM_ALLOCATE_CMD
 Create the lists for a responseless command.
#define LEM_ALLOCATE_RSP
 Create the lists for a command with response.
#define LEM_DO_SEND(encode, op, parity, p, args...)
 Encode and send the command across the LATp fabric, waiting for the response and checking for LCB transmit or receive errors encode Function to use to encode the arguments parity Function to use to set the parity bits p Bit mask indicating which parity bits (if any) to invert op Operation (CMD_LOAD | CMD_DATALESS | CMD_READ) args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_XXX).
#define LEM_DO_CMD(encode, args...)
 Creates responsless command and result lists, sends the dataless command and returns a status encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_DATALESS) and the last (which is always 0).
#define LEM_DO_LOAD(encode, args...)
 Creates responsless command and result lists, sends the load command and returns a status encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_LOAD).
#define LEM_DO_READ(encode, args...)
 Creates response command and result lists and sends the read command. encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_READ).
#define LEM_DO_LOAD_LL(encode, upper, lower, args...)
 Handles loads where a 64 bit payload is split into 32 bit chunks encode Function to use to encode the arguments upper Most significant 32 bits of the payload lower Least significant 32 bits of the payload args The arguments to the encode function.
#define LEM_DO_ACD_CMD(encode, args...)
 Creates responsless command and result lists, sends the dataless command and returns a status encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and ACD_CMD_DATALESS) and the last (which is always 0).
#define LEM_DO_ACD_LOAD(encode, args...)
 Creates responsless command and result lists, sends the load command and returns a status encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_LOAD).
#define LEM_DO_ACD_READ(encode, args...)
 Creates response command and result lists and sends the read command. encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_READ).
#define LEM_DO_DECODE(decode, args...)
 Decode the response from a read command. decode Function to use to decode the arguments args Usually a single pointer to location to place the decoded result, although for the TIC_ENV_decode routine this will be a set of three pointers.

Detailed Description

Several macros used inside the command-line interface, presented here in case they are of use to others.

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

Define Documentation

#define LEM_ALLOCATE_CMD
 

Value:

unsigned      status = LEM_SUCCESS; \
  LEM_sicl     *request; \
  LEM_cmd_sirl *result;  \
  unsigned      buffer_size = LCB_REQUEST_LIST_ALIGN + sizeof(*request) + LCB_RESULT_LIST_ALIGN  + sizeof(*result);\
  unsigned char buffer[buffer_size]; \
  request = (LEM_sicl*    )LEM_ALIGN_REQUEST(buffer, 0); \
  result  = (LEM_cmd_sirl*)LEM_ALIGN_RESULT (request, sizeof(*request));
Create the lists for a responseless command.

#define LEM_ALLOCATE_RSP
 

Value:

unsigned      status = LEM_SUCCESS; \
  LEM_sicl     *request; \
  LEM_rsp_sirl *result;  \
  unsigned      buffer_size = LCB_REQUEST_LIST_ALIGN + sizeof(*request) + LCB_RESULT_LIST_ALIGN  + sizeof(*result);\
  unsigned char buffer[buffer_size]; \
  request = (LEM_sicl*    )LEM_ALIGN_REQUEST(buffer, 0); \
  result  = (LEM_rsp_sirl*)LEM_ALIGN_RESULT (request, sizeof(*request));
Create the lists for a command with response.

#define LEM_DO_ACD_CMD encode,
args...   ) 
 

Value:

LEM_ALLOCATE_CMD; \
  LEM_DO_SEND(encode, ACD_CMD_DATALESS, ## args, 0) \
  return status;
Creates responsless command and result lists, sends the dataless command and returns a status encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and ACD_CMD_DATALESS) and the last (which is always 0).

#define LEM_DO_ACD_LOAD encode,
args...   ) 
 

Value:

LEM_ALLOCATE_CMD; \
  LEM_DO_SEND(encode, ACD_CMD_LOAD, ## args); \
  return status;
Creates responsless command and result lists, sends the load command and returns a status encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_LOAD).

#define LEM_DO_ACD_READ encode,
args...   ) 
 

Value:

LEM_ALLOCATE_RSP; \
  LEM_DO_SEND(encode, ACD_CMD_READ, ## args, 0)
Creates response command and result lists and sends the read command. encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_READ).

#define LEM_DO_CMD encode,
args...   ) 
 

Value:

LEM_ALLOCATE_CMD; \
  LEM_DO_SEND(encode, CMD_DATALESS, ## args, 0) \
  return status;
Creates responsless command and result lists, sends the dataless command and returns a status encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_DATALESS) and the last (which is always 0).

#define LEM_DO_DECODE decode,
args...   ) 
 

Value:

decode(result->ri.payload.cell.data, ## args); \
  return status;
Decode the response from a read command. decode Function to use to decode the arguments args Usually a single pointer to location to place the decoded result, although for the TIC_ENV_decode routine this will be a set of three pointers.

#define LEM_DO_LOAD encode,
args...   ) 
 

Value:

LEM_ALLOCATE_CMD; \
  LEM_DO_SEND(encode, CMD_LOAD, ## args); \
  return status;
Creates responsless command and result lists, sends the load command and returns a status encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_LOAD).

#define LEM_DO_LOAD_LL encode,
upper,
lower,
args...   ) 
 

Value:

unsigned long long payload = ((unsigned long long)(upper) << 32) | lower; \
  LEM_DO_LOAD(encode, ## args, payload);
Handles loads where a 64 bit payload is split into 32 bit chunks encode Function to use to encode the arguments upper Most significant 32 bits of the payload lower Least significant 32 bits of the payload args The arguments to the encode function.

#define LEM_DO_READ encode,
args...   ) 
 

Value:

LEM_ALLOCATE_RSP; \
  LEM_DO_SEND(encode, CMD_READ, ## args, 0)
Creates response command and result lists and sends the read command. encode Function to use to encode the arguments args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_READ).

#define LEM_DO_SEND encode,
op,
parity,
p,
args...   ) 
 

Value:

{\
  encode(&request->ci, op, ## args); \
  parity(&request->ci, p); \
  status = LCBD_qioW(LCBD_get(), sizeof(*request)/(2*sizeof(int)), (LCBD_cl*)request, (LCBD_rl*)result); \
  if(_msg_failure(status)) return status; \
  if(result->xcb.usr.rd.bf.xstatus) status = LCBD_rst_xfr_err_map(result->xcb.usr.rd.bf.xstatus);\
  if(result->ri.err.ui)             status = LCBD_rst_rcv_err_map(result->ri.err.ui); \
  LEM_timestamp = result->ri.header.bf.timestamp; \
}
Encode and send the command across the LATp fabric, waiting for the response and checking for LCB transmit or receive errors encode Function to use to encode the arguments parity Function to use to set the parity bits p Bit mask indicating which parity bits (if any) to invert op Operation (CMD_LOAD | CMD_DATALESS | CMD_READ) args The arguments to the encode function, except for the first two (which are always the LATpCommand structure and CMD_XXX).


Generated on Mon Jan 23 20:35:47 2006 by  doxygen 1.4.4