next up previous
Next: Using the Device Driver Up: Linux Device Drivers for Previous: The Physical Interface

Subsections

Compiling and Installing the Driver

Unpacking the distribution and typing make should generate an object file called krpc.o. (Other files are also created while krpc.o is being built; these files can be ignored). A Linux kernel v2.2 or higher is required.

The parapin parallel port pin control library, which is required by the krpc module, is included in the RPC driver distribution. It can be used separately for other applications or drivers that use the PC parallel port as a generic digital I/O interface. For more details, see the Parapin home page.

After the module has been compiled, it can be installed much as any other Linux kernel module; e.g. insmod krpc.o. Note that it depends on the parport and parport_pc modules; these might have to be installed manually before you install krpc. For example:

   insmod parport
   insmod parport_pc io=0x378 irq=7
   insmod krpc


Configuring the Parallel Port for Interrupts

If your RPC interface is capable of generating interrupts, special care must be taken to ensure that those interrupts are delivered all the way up to the RPC application. First, make sure the parallel port hardware is configured to generate interrupts. On modern motherboards with integrated parallel ports, this is selected from the BIOS setup screen. Older systems may use a DIP switch or jumper on the motherboard or the expansion board that drives the parallel port.

Next, the Linux kernel itself must be configured to handle parallel port interrupts. Unlike most other hardware devices, the kernel does not detect or claim the parallel port's interrupts by default. It is possible to manually enable kernel IRQ handling for the parallel port by writing the interrupt number into the special file /proc/parport/$n$/irq, where $n$ is the parallel port number. For example, the following command tells the kernel that parport0 is using IRQ 7:

        echo 7 > /proc/parport/0/irq
If parallel port support is being provided to the kernel through modules, it is also possible to configure the IRQ number as an argument to the parport_pc module when it is loaded. For example:
        insmod parport
        insmod parport_pc io=0x378 irq=7
Note that both the io and irq arguments are required, even if the parallel port is using the default I/O base address of 0x378.

The actual interrupt number used by the kernel (7 in the examples above) must, of course, match the interrupt line being used by the hardware. The IRQ used by the parallel port hardware is usually configured in the BIOS setup screen on modern motherboards that have built-in parallel ports. Older motherboards or stand-alone ISA cards usually have jumpers or DIP switches for configuring the interrupt number. The typical assignment of interrupts to parallel ports is as follows:

Port Interrupt
LPT1 7
LPT2 5

These are reasonable defaults if the actual hardware configuration is not known.

When the krpc module is inserted, it will report its status in the kernel log that appears on the console and/or in the system log files. Make sure these messages indicate the module is using interrupts. If the driver reports that it is in ``polling mode'', the Linux kernel is not properly configured as described above. Note that the Linux kernel must be configured to use interrupts before the krpc module is inserted.

Use the irq_debug module option (desribed below) to make sure that interrupts are actually being delivered. At least one ``interrupt received'' message should appear in the system log each time a packet is received (if your RPC interface generates RXR interrupts) or transmitted (if your RPC interface generates TXA interrupts).


Module Options

The krpc module takes a number of options that can be set by specifying arguments with insmod; for example:

        insmod krpc.o lpt=1 krpc_debug_level=10

The legal module parameters are:


next up previous
Next: Using the Device Driver Up: Linux Device Drivers for Previous: The Physical Interface
Jeremy Elson 2000-07-11