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_INTERNAL	- Internal Application algorithm (1-8)
  IOPT_CORE     - FPGA Core algorithm (1-8, 11-18, 21-28)

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_FRAME, 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.

Cores  1-8  are on the main board FPGA. 
Cores 11-18 are on processor module 1.
Cores 21-28 are on processor module 2.