/* $Id: plip.c,v 1.3.6.2 1997/04/16 15:07:56 phil Exp $ */
/* PLIP: A parallel port "network" driver for Linux. */
/* This driver is for parallel port with 5-bit cable (LapLink (R) cable). */
/*
* Authors: Donald Becker <becker@scyld.com>
* Tommy Thorn <thorn@daimi.aau.dk>
* Tanabe Hiroyasu <hiro@sanpo.t.u-tokyo.ac.jp>
* Alan Cox <gw4pts@gw4pts.ampr.org>
* Peter Bauer <100136.3530@compuserve.com>
* Niibe Yutaka <gniibe@mri.co.jp>
* Nimrod Zimerman <zimerman@mailandnews.com>
*
* Enhancements:
* Modularization and ifreq/ifmap support by Alan Cox.
* Rewritten by Niibe Yutaka.
* parport-sharing awareness code by Philip Blundell.
* SMP locking by Niibe Yutaka.
* Support for parallel ports with no IRQ (poll mode),
* Modifications to use the parallel port API
* by Nimrod Zimerman.
*
* Fixes:
* Niibe Yutaka
* - Module initialization.
* - MTU fix.
* - Make sure other end is OK, before sending a packet.
* - Fix immediate timer problem.
*
* Al Viro
* - Changed {enable,disable}_irq handling to make it work
* with new ("stack") semantics.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
/*
* Original version and the name 'PLIP' from Donald Becker <becker@scyld.com>
* inspired by Russ Nelson's parallel port packet driver.
*
* NOTE:
* Tanabe Hiroyasu had changed the protocol, and it was in Linux v1.0.
* Because of the necessity to communicate to DOS machines with the
* Crynwr packet driver, Peter Bauer changed the protocol again
* back to original protocol.
*
* This version follows original PLIP protocol.
* So, this PLIP can't communicate the PLIP of Linux v1.0.
*/
/*
* To use with DOS box, please do (Turn on ARP switch):
* # ifconfig plip[0-2] arp
*/
static const char version[] = "NET3 PLIP version 2.4-parport gniibe@mri.co.jp\n";
/*
Sources:
Ideas and protocols came from Russ Nelson's <nelson@crynwr.com>
"parallel.asm" parallel port packet driver.
The "Crynwr" parallel port standard specifies the following protocol:
Trigger by sending nibble '0x8' (this causes interrupt on other end)
count-low octet
count-high octet
... data octets
checksum octet
Each octet is sent as <wait for rx. '0x1?'> <send 0x10+(octet&0x0F)>
<wait for rx. '0x0?'> <send 0x00+((octet>>4)&0x0F)>
The packet is encapsulated as if it were ethernet.
The cable used is a de facto standard parallel null cable -- sold as
a "LapLink" cable by various places. You'll need a 12-conductor cable to
make one yourself. The wiring is:
SLCTIN 17 - 17
GROUND 25 - 25
D0->ERROR 2 - 15 15 - 2
D1->SLCT 3 - 13 13 - 3
D2->PAPOUT 4 - 12 12 - 4
D3->ACK 5 - 10 10 - 5
D4->BUSY 6 - 11 11 - 6
Do not connect the other pins. They are
D5,D6,D7 are 7,8,9
STROBE is 1, FEED is 14, INIT is 16
extra grounds are 18,19,20,21,22,23,24
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/string.h>
#include <linux/if_ether.h>
#include <linux/in.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/inetdevice.h>
#include <linux/skbuff.h>
#include <linux/if_plip.h>
#include <linux/workqueue.h>
#include <linux/spinlock.h>
#include