LINUX HOME | ||
![]() |
||
LinuxThe [cd]/linux directory contains three directories. One for 2.4 kernel specific samples and drivers, one for 2.6 specific samples and drivers, and one for samples that will work in both 2.4 and 2.6 kernels. Linux 2.4The "/linux/2.4/Register IO Driver" directory contains an ISA (and PC/104) compatible driver eliminating the need to be logged in as root. This driver is optional, but can add flexibility to your system. This driver was written by a third party and is open source. Please refer to the directory contents (readme etc) for more information. Many customers may prefer to use the "PCI Register IO Driver", described below, even with ISA and PC/104 devices. The "/linux/2.4/PCI Register IO Driver" directory is a modified version of the previous driver. We expanded the capabilities of the "Register IO Driver" to include support for I/O addresses in the 0x400--0xFFFF range, and removed some of the more onerous installation issues. This driver is fully compatible with any I/O address based card, be it PCI, ISA etc. Linux 2.6The "/linux/2.6/iogen" directory contains an ISA (and PC/104) compatible driver eliminating the need to be logged in as root. This driver will support any number of cards. This driver also adds IRQ support. In addition there are several card specific samples provided with the driver. Most of these samples are ports of the DOS samples for these cards. Full source is provided. The "/linux/2.6/apci" directory contains a PCI compatible driver eliminating the need to be logged in as root. The driver supports interrupts on an arbitrary number of cards, and includes many card specific samples. Full source is provided. Converting DOS Samples for LinuxOur DOS C samples are not hard to convert for Linux. The samples for five of our cards are already converted, at right; these can also be used as conversion samples. For the remaining cards, the following conversion guidelines are provided. To gain I/O port access without inserting a kernel module, use the function ioperm(). This function also requires the program to be run in the super user or root mode and must be compiled with the -O option for example: g++ -O sample0.c The functions outportb() and inportb() have to be changed to outb() and inb() and the arguments reversed: Remove the <dos.h> and <conio.h> include statements. They provide DOS-specific screen formatting functions, such as windows(), textcolor(), and textbackground(). These funtions can simply be omitted when using the Linux terminal. The function cprintf() needs to be changed to printf().
The function clrscr() needs be changed to system("clear"). The function gotoxy(X Y) needs to be changed to system("tput cup X Y"). Since dos.h is not in linux, kbhit() and getch() are not supported, we've included a library called kbinp.h with functions that mimic them. getch() can be used as before, but kbhit() must be transformed as such: while(!kbhit()); may be changed to: while(kbhit()==0);
|