Help: ICE_SRVICE



This file contains a text description of the application srvice.c located
in the test subdirectory of the ICE tree.  It is a C program that reads in
simple script files to control basic functions of an ICE card including
configuration, reset, dma, fileIO, and status.

If the filename has the form  port=xxxx, a network socket is setup on the
specified port to receive command lines from a remote client.

The script files treat any line starting with a !, /, or # as a comment.
White space is trimmed from the front and back of each line.
Tokens are delimited by a white space, usually 2 or 3 per line.
The first token is the command followed by 1 or more arguments.  
Valid commands and their arguments are:

  CARD N config		! defines configuration of card number N
  RESET N1 N2	 	! reset cards N1 through N2
  DMA M config		! defines configuration of DMA channel M
  CORE M config		! run the configured CORE setup parameters on DMA channel M
  LOADFC M file		! load the filter coefficients onto DMA channel M 
  START M1 ... M2	! starts DMA channels M1 through M2 in specified order (-1=all -1 default)
  PAUSE sec		! pause the indicated number of seconds 
  WAIT M		! wait for DMA channel M to complete
  STOP M1 ... M2	! stops DMA channels M1 through M2 in specified order (-1=all -1 default)
  SET M keyname value	! set run time parameter
  GET M keyname value	! get run time parameter
  LOG text		! copies text to screen and/or log file
  EXIT			! exits the service application

The CARD and DMA indices N and M can be 0 or 1 based.

The CARD config string is stored by index for use in the RESET and DMA commands.
The string is passed as is to the RESET routine, and substituted for the CARD=N
in the DMA command config string.  This config string is passed to pic_open() 
for that operation.

The RESET command performs a pic_reset() on card indices N1 through N2.  
If N2 is not supplied, it defaults to N1.

The DMA command sets up a DMA channel operation.  The config string contains a 
list of flags using a key=value syntax to define the operation.  
Pertinent flags are:

  CARD=N		! config string for card N is inserted here
  PORT=port		! port on card to use (ie. MODULE1,TUNER2,TBANK21)
  RATE=rate		! sample rate in MHz
  FORM=fmt		! sample size in Midas format (CL,CI,CJ,CB,SL,SI,SN,SB,SP)
  BITS=bits		! sample size in bits
  LENGTH=len		! length of circular memory buffer in seconds (def=1)
  FREQ=freq		! center frequency int Hertz for tuner
  DEC=dec		! decimation for tuner (def=1)
  GAIN=gain		! gain in dB for tuner (def=0)
  DIR=io		! direction of transfer (-1=input 1=output) (def=-1)
  XFER=xlen		! transfer length in bytes
  SKIP=skip		! only capture every skip frames where frame=XFER 
  FUNC=func		! argument to pic_dmafunc() (-2=continuous, >0=#passes)
  FILE=filename		! filename to write into or read from
  PKT=pktype		! output pktype=ICE|SDDS|VRT packets (FILE=udp:address)

A list of all flags available may be found in flags.hlp.
These include CFIR, PFIR, and RFIR for loading filter taps.

The CORE command runs the setup for a CORE as described by the ICECORE paradigm.
The syntax for this may be found in jvcc.hlp.

The LOADFC command loads the filter coefficients found in the file into the designated
tuner or filter core.  The tuner filter location CFIR, RFIR, or PFIR is determined by
the filter length.

The START command starts a thread for each dma indices M1 through M2.  
If M2 is not supplied, it defaults to M1.

The PAUSE command pauses the script for the specified number of seconds.
This is intended to be used for testing purposes only.

The WAIT command waits for the dma thread on index M to complete.  
If M = -1, it waits for a user keypress.

The STOP command stops the thread performing a dma on indices M1 through M2.  
If M2 is not supplied, it defaults to M1.

The SET and GET commands will set or get any of the named keys found in keys.hlp.
If keyname begins with '0x', it is assumed to be a core control register offset for that DMA channel.

The LOG command copies the text argument to the screen or log file

The EXIT command closes all cards and exits the service.

At the end of the script, all cards are closed before exiting (implicit EXIT).

Here is an example script:

!!!!!!!!!!!!!!!!!!!!!!!!!
! Example srvice script
! CARD=x in DMA subs that into config
!!!!!!!!!!!!!!!!!!!!!!!!!
CARD 0 ICEPIC,DEVNO=0,IOM1=LB2DR3,IOM2=D2AWGR3,MUXCLK=P,
CARD 1 ICEPIC,DEVNO=2,IOM1=LB2DR3,IOM2=D2RF,MUXCLK=P,
RESET 0 1
DMA 0 CARD=0,PORT=PM0TUNER1,RATE=100,BITS=-16,LENGTH=1,DEC=4,RFFREQ=950,RFBW=40,RFGAIN=15,RFOPTS=(ENABLE|DCS|AIS|LNA|XREF),XMTGO,TC=CPUP0
DMA 1 CARD=0,PORT=MODULE2,RATE=25,BITS=-16,LENGTH=1,DIR=1,RFFREQ=70,RFATTEN=0
DMA 2 CARD=1,PORT=PM0TUNER1,RATE=100,FORM=CI,LENGTH=1,DEC=4,RFFREQ=950,RFBW=40,RFGAIN=15,RFOPTS=(ENABLE|DCS|AIS|LNA|XREF),XMTGO,TC=CPUP0
DMA 3 CARD=1,PORT=MODULE2,RATE=25,FORM=CI,LENGTH=1,DIR=1,RFFREQ=70,RFATTEN=0
START 0 1 2 3
PAUSE 1
SET 0 FREQ 1.23e6
PAUSE 1.2
SET 0 GAIN -6
WAIT