USB driver code:
The USB port looks just like a serial port to the application software. In Windows, the VCP drivers from FTDI for the 245 chip must be installed, and the port will get a COMx designation. In Linux, the drivers are already included in the 2.6 kernel, and the device is controlled through /dev/TTYUSBx.
PCI driver code:
The PCI port is currently only accessible under Linux. The driver I wrote is horribly inefficient, but it works. All the driver code is written in C. To compile the driver code, you must be running a Version 2.6 Kernel that has been compiled with the source tree installed. I am running Fedora Core 5, which required installing the kernel-source rpm and recompiling the kernel. To compile the driver module, run make from the driver source directory. The load and unload script in the same directory will load and unload the module, and also deal with linking the driver module to the appropriate /dev file. load and unload must both be run as root, but the /dev file is given wide open permissions in order to allow a regular user to run the application.
Tools for writing Windows PCI drivers are available, but beyond my budget.
The entire driver code is in pci_arb.c The functions are called at various times by the kernel pci_arb_init() pci_arb_exit() are called when the module is loaded and unloaded. These functions register all the other functions with the kernel. After the module is loaded, an associated /dev/ file is created (in the "load" script) which application code will use to access the device. arb_llseek(), arb_read(),arb_write(), arb_ioctl(), arb_open(), and arb_release() are called when application code calls corresponding functions on the /dev/ file.
probe() and remove() are called from the pci controller and are used to initialize the device and manage the memory space that is used to communicate with the device.
The application has three different versions. A Windows and a Linux application that commuunicate with the card over USB, and a Linux application that communicates over PCI. There is a common file called sa_portable.c that contains the main program, and three different files that handle communication: linux_arb_pci.c, linux_arb_usb.c, and windows_arb_usb.c. os_arb_interface.h contains the function prototypes for the three communication files. The different applications are created by the choice of communication file linked in.
To built the Linux applications, run make from the application_code directory. sas is the USB executable which must be run as root, and sap is the PCI executable which can be run as a normal user.
I did not include a project for a Windows build. Just create a regular console application project and add sa_portable.c and windows_arb_usb.c.
To generate the A image at at the top of the page, load the file sample.waveform. The file format for the waveform is a character specifying the radix of all the numbers in the file -x for hexadecimal, anything else for decimal- followed by a number specifying the length of the waveform, followed by the values for the samples.