
PCI CD and PCI CDa
Document Number: 008-00965-06 EDT Public Revision: I December 2004
Template: edt.dot
Page 12
Input and Output
The PCI CD/CDa device driver can perform two kinds of DMA transfers: continuous and
noncontinuous.
To perform continuous transfers, use ring buffers. The ring buffers are a set of buffers that applications
can access continuously, reading and writing as required. When the last buffer in the set has been
accessed, the application then cycles back to the first buffer. See
edt_configure_ring_buffers for a complete description of the ring buffer parameters that can
be configured. See the sample programs simple_getdata.c and simple_putdata.c
distributed with the driver for examples of using the ring buffers.
For noncontinuous transfers, the driver uses DMA system calls read and write. Each read and
write system call performs a single, noncontinuous DMA transfer.
Note: For portability, use the library calls edt_reg_read, edt_reg_write, edt_reg_or, or
edt_reg_and to read or write the hardware registers rather than ioctls.
Elements of EDT Interface Applications
Applications for performing continuous transfers typically include the following elements:
#include "edtinc.h"
main()
{
EdtDev *edt_p = edt_open("pcd", 0) ;
char *buf_ptr; int outfd = open("outfile", 1) ;
/* Configure a ring buffer with four 1MB buffers */
edt_configure_ring_buffers(edt_p, 1024*1024, 4, EDT_READ, NULL) ;
/* start 4 buffers */
edt_start_buffers(edt_p, 4) ;
/* This loop will capture data indefinitely, but the write()
* (or whatever processing on the data) must be able to keep up.
*/
while ((buf_ptr = edt_wait_for_buffers(edt_p, 1)) != NULL)
{
write(outfd, buf_ptr, 1024*1024) ;
edt_start_buffers(edt_p, 1) ;
}
edt_close(edt_p) ;
}
Applications for performing noncontinuous transfers typically include the following elements. This
example opens a specific DMA channel with edt_open_channel, assuming that a multi-channel
Xilinx firmware file has been loaded:
#include "edtinc.h"
main()
{
Kommentare zu diesen Handbüchern