Help: ICE_ICELIB_PIC_IOPORT

Set up an I/O Port for DMA transfer

Function PIC_IOPORT - Set up an I/O Port for DMA transfer

PIC	p	Handle to Device 
int	ptype   Type of IO Port to use (-1=useDefault from pic_open)
int	pindex	Index of port to use (-1=useDefault from pic_open)
int	dmac	DMA Channel (0=noDMA, -1=useDefault)
int	dir	Transfer direction (1=output/playback, -1=input/acquisition)
int	bits	Number of bits per data sample (1,8,16,32) (negate for complex)
int	rate	Internal clock rate in Hertz
double	fcyn	Tuner frequency/nyquist
int	dec	Tuner decimation
int	gain	Tuner gain in dB
int	flags	Run-time modifiers

Sets up an IO port for data acquisition/playback.  

This routine branches on the ptype parameter to call the appropriate port 
setup routine.  It allows generic data acquisition/playback routines to be 
written without regard to the actual type of port being used.

If the port and module types are specified in the parameter list to pic_open()
the ptype and pindex parameters can be defaulted by entering -1.

The port types are defined in icelib.inc or icelib.h.  The port index refers 
to the channel number of the port.  The following are available:

  IOPT_NONE	- no port defined (access entire board)
  IOPT_MODULE	- IO Module Site (1-2 or 3)
  IOPT_TUNER	- On-board Tuner (1-32)
  IOPT_TBANK	- On-board Bank of Tuners (1-2 or 3)
  IOPT_CORE     - FPGA Single Channel Core algorithm (1-2, 11-12, 21-22)
  IOPT_MCORE    - FPGA Multi Channel Core algorithm (1-32, 33-64)
  IOPT_INTERNAL	- Internal Application algorithm (1-8)

Resources that reside on processor modules (TUNERS,CORES,MCORES) may be addressed 
by module and local index, or the global card index.  If the index is not in the
range of a global, it will be placed on the default processor module.  If no
processor modules exist, it will default to the main board.

  Tuners 1-2 are on processor module N 
  Cores 1-2 are on processor module N 
  Cores 11-12 are on processor module 1
  Cores 21-22 are on processor module 2
  MCores  1-32 are on processor module N
  MCores 33-64 are on processor module 2

where N is the default processor module, and N=0 is the main board.

If a parameter is not used by a given port type, it will be ignored.
To specify complex data, negate the number of bits per I and Q data elements.
Example: for 16 bit complex tuner output, set bits = -16.

The function returns the DMA channel assigned, or 0 for no DMA, -1 for error.
This channel number is then used by other functions such as PIC_DMAFUNC,
PIC_SETKEY and PIC_GETKEY.

Tuner Banks need a call to setkey() on KEY_PKTLEN, KEY_DFREQ, and KEY_CHNS before 
the call to IOPORT to allow proper mapping.  The number of channels in each tuner 
bank depends on the processor module and the FTTM=mode setting.  See the help on 
the FTTM flag.  The FRAME size is the number of consecutive bytes from each channel 
to write into the DMA buffer.  The frames are written for channels 1 through N and 
then repeated.  To individually set a parameter for one of the channels in a tuner 
bank, use setkey() on KEY_CHAN before the call to setkey() on the item.