diff -u --recursive --new-file linux-2.0.30-clean/.config linux/.config --- linux-2.0.30-clean/.config Thu Jan 1 01:00:00 1970 +++ linux/.config Sun Jun 22 21:38:32 1997 @@ -0,0 +1,180 @@ +# +# Automatically generated make config: don't edit +# + +# +# Code maturity level options +# +# CONFIG_EXPERIMENTAL is not set + +# +# Loadable module support +# +CONFIG_MODULES=y +CONFIG_MODVERSIONS=y +CONFIG_KERNELD=y + +# +# General setup +# +CONFIG_MATH_EMULATION=y +CONFIG_NET=y +# CONFIG_MAX_16M is not set +# CONFIG_PCI is not set +CONFIG_SYSVIPC=y +CONFIG_BINFMT_AOUT=m +CONFIG_BINFMT_ELF=y +CONFIG_KERNEL_ELF=y +CONFIG_M386=y +# CONFIG_M486 is not set +# CONFIG_M586 is not set +# CONFIG_M686 is not set + +# +# Floppy, IDE, and other block devices +# +CONFIG_BLK_DEV_FD=m +CONFIG_BLK_DEV_IDE=y + +# +# Please see Documentation/ide.txt for help/info on IDE drives +# +# CONFIG_BLK_DEV_HD_IDE is not set +# CONFIG_BLK_DEV_IDECD is not set +# CONFIG_BLK_DEV_IDETAPE is not set +# CONFIG_BLK_DEV_IDE_PCMCIA is not set +# CONFIG_BLK_DEV_CMD640 is not set +# CONFIG_IDE_CHIPSETS is not set + +# +# Additional Block Devices +# +CONFIG_BLK_DEV_LOOP=m +# CONFIG_BLK_DEV_MD is not set +# CONFIG_BLK_DEV_RAM is not set +# CONFIG_BLK_DEV_XD is not set +# CONFIG_BLK_DEV_HD is not set + +# +# Networking options +# +# CONFIG_FIREWALL is not set +# CONFIG_NET_ALIAS is not set +CONFIG_INET=y +# CONFIG_IP_FORWARD is not set +# CONFIG_IP_MULTICAST is not set +# CONFIG_SYN_COOKIES is not set +# CONFIG_IP_ACCT is not set +# CONFIG_IP_ROUTER is not set +# CONFIG_NET_IPIP is not set + +# +# (it is safe to leave these untouched) +# +# CONFIG_INET_PCTCP is not set +# CONFIG_INET_RARP is not set +# CONFIG_NO_PATH_MTU_DISCOVERY is not set +CONFIG_IP_NOSR=y +# CONFIG_SKB_LARGE is not set + +# +# +# +# CONFIG_IPX is not set +# CONFIG_ATALK is not set +# CONFIG_AX25 is not set +# CONFIG_NETLINK is not set + +# +# SCSI support +# +# CONFIG_SCSI is not set + +# +# Network device support +# +CONFIG_NETDEVICES=y +CONFIG_DUMMY=m +# CONFIG_EQUALIZER is not set +CONFIG_PLIP=m +CONFIG_PPP=m + +# +# CCP compressors for PPP are only built as modules. +# +# CONFIG_SLIP is not set +# CONFIG_NET_RADIO is not set +CONFIG_NET_ETHERNET=y +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_LANCE is not set +# CONFIG_NET_VENDOR_SMC is not set +# CONFIG_NET_ISA is not set +# CONFIG_NET_EISA is not set +CONFIG_NET_POCKET=y +# CONFIG_ATP is not set +# CONFIG_DE600 is not set +CONFIG_DE620=m +# CONFIG_TR is not set +# CONFIG_FDDI is not set +# CONFIG_ARCNET is not set + +# +# ISDN subsystem +# +# CONFIG_ISDN is not set + +# +# CD-ROM drivers (not for SCSI or IDE/ATAPI drives) +# +# CONFIG_CD_NO_IDESCSI is not set + +# +# Filesystems +# +# CONFIG_QUOTA is not set +# CONFIG_LOCK_MANDATORY is not set +CONFIG_MINIX_FS=m +# CONFIG_EXT_FS is not set +CONFIG_EXT2_FS=y +# CONFIG_XIA_FS is not set +CONFIG_FAT_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=m +CONFIG_UMSDOS_FS=m +CONFIG_PROC_FS=y +CONFIG_NFS_FS=m +# CONFIG_SMB_FS is not set +# CONFIG_ISO9660_FS is not set +# CONFIG_HPFS_FS is not set +# CONFIG_SYSV_FS is not set +# CONFIG_UFS_FS is not set + +# +# Character devices +# +CONFIG_SERIAL=m +# CONFIG_DIGI is not set +# CONFIG_CYCLADES is not set +# CONFIG_STALDRV is not set +# CONFIG_RISCOM8 is not set +CONFIG_PRINTER=m +# CONFIG_MOUSE is not set +# CONFIG_UMISC is not set +# CONFIG_QIC02_TAPE is not set +# CONFIG_FTAPE is not set +# CONFIG_APM is not set +# CONFIG_WATCHDOG is not set +# CONFIG_RTC is not set +CONFIG_NCR3125=y +CONFIG_NCR_PEN=m +CONFIG_NCR_POWER_OFF=y + +# +# Sound +# +# CONFIG_SOUND is not set + +# +# Kernel hacking +# +# CONFIG_PROFILE is not set diff -u --recursive --new-file linux-2.0.30-clean/Documentation/ncr3125.txt linux/Documentation/ncr3125.txt --- linux-2.0.30-clean/Documentation/ncr3125.txt Thu Jan 1 01:00:00 1970 +++ linux/Documentation/ncr3125.txt Sun Jun 22 21:20:16 1997 @@ -0,0 +1,78 @@ + NCR3125 SUPPORT + + Marc Meis (100334.1426@compuserve.com) + +NCR3125 support comprises pen support and powering off the NCR3125 when halted +(shutdown). The NCR3125 suspend mode normally works with linux. I never tried +the suspend to disk. + +Compilation of NCR3125 support into the kernel must be enabled under the +"NCR3125 Support" kernel configuration option. + +The code for powering off the NCR3125 was obtained from the sysoff DOS programm +provided with the computer. The code to access the pen is derived from a sample +code anonymously delivered over the internet. + +Make the pen device with: + + mknod -m 666 /dev/ncrpen 10 8 + chown root:sys /dev/ncrpen + +If the pen driver has been compiled as a module, include the following +in /etc/conf.modules: + + alias char-major-10-8 ncrpen + +NCR3125 pen support is included in gpm since version 1.05. Call gpm with: + + gpm -t ncr + +The pen is an absolute pointing device providing absolute screen coordinates +and, as regards hardware, is to be considered as a busmouse. No initialisation +is required, it is sufficient to open the device and read data therefrom, +always from the start of the device file buffer (Logitech busmouse alike). + +Data provided by the pen driver is: +(this should be clear from the read_pen function in ncrpen.c) + +data[0]: char: bitwise: 0 0 0 0 ' 1 0 left_button right_button + (left_button means the pen is firmly pressed against LCD) + (right_button means the button on the pen is pressed) +data[1]: signed char: x displacement +data[2]: signed char: y displacement + (the displacements are calculated by the pen driver based upon its + successive positions) +data[3]: unsigned char: x high byte +data[4]: unsigned char: x low byte +data[5]: unsigned char: y high byte +data[6]: unsigned char: y low byte + +Absolute position (0,0) is in the lower left corner of the screen. + +At least data[0] to data[2] (3 bytes) must be read. The remaining 4 bytes +are optional. + +Gpm-1.05 uses the absolute position data provided (last 4 bytes). + +Here is a small perl program to check output of the driver: + +#!/usr/bin/perl + +open(PEN,'/dev/ncrpen'); +print "open error: $!\n"; + +if ($pen_status eq 'error') { + print STDOUT "Can't open pen device: $pen_error\n"; + die; + } + +do { + if (sysread(PEN,$data,7,0) > 0) { + ($buttons,$dx,$dy,$xhi,$xlo,$yhi,$ylo) + = unpack("C1 c1 c1 C1 C1 C1 C1",$data); + $x = ($xhi << 8) + $xlo; + $y = ($yhi << 8) + $ylo; + print "pen data: $buttons $dx $dy $x $y\n" } + } +until (0); + diff -u --recursive --new-file linux-2.0.30-clean/drivers/char/Config.in linux/drivers/char/Config.in --- linux-2.0.30-clean/drivers/char/Config.in Wed May 7 21:00:46 1997 +++ linux/drivers/char/Config.in Sun Jun 22 13:31:11 1997 @@ -68,4 +68,11 @@ tristate ' Berkshire Products PC Watchdog' CONFIG_PCWATCHDOG fi bool 'Enhanced Real Time Clock Support' CONFIG_RTC + +bool 'NCR3125 Support' CONFIG_NCR3125 +if [ "$CONFIG_NCR3125" != "n" ]; then + tristate ' Pen support' CONFIG_NCR_PEN + bool ' Power off on shutdown' CONFIG_NCR_POWER_OFF +fi + endmenu diff -u --recursive --new-file linux-2.0.30-clean/drivers/char/Makefile linux/drivers/char/Makefile --- linux-2.0.30-clean/drivers/char/Makefile Wed May 7 20:59:55 1997 +++ linux/drivers/char/Makefile Thu May 8 16:31:04 1997 @@ -98,6 +98,16 @@ endif endif +ifeq ($(CONFIG_NCR_PEN),y) +M = y +L_OBJS += ncrpen.o +else + ifeq ($(CONFIG_NCR_PEN),m) + M_OBJS += ncrpen.o + MM = m + endif +endif + ifeq ($(CONFIG_PRINTER),y) L_OBJS += lp.o else diff -u --recursive --new-file linux-2.0.30-clean/drivers/char/mem.c linux/drivers/char/mem.c --- linux-2.0.30-clean/drivers/char/mem.c Wed May 7 21:00:10 1997 +++ linux/drivers/char/mem.c Thu May 8 16:33:47 1997 @@ -395,6 +395,7 @@ #endif #if defined (CONFIG_BUSMOUSE) || defined(CONFIG_UMISC) || \ defined (CONFIG_PSMOUSE) || defined (CONFIG_MS_BUSMOUSE) || \ + defined (CONFIG_NCR_PEN) || \ defined (CONFIG_ATIXL_BUSMOUSE) || defined(CONFIG_SOFT_WATCHDOG) || \ defined (CONFIG_PCWATCHDOG) || \ defined (CONFIG_APM) || defined (CONFIG_RTC) || defined (CONFIG_SUN_MOUSE) diff -u --recursive --new-file linux-2.0.30-clean/drivers/char/misc.c linux/drivers/char/misc.c --- linux-2.0.30-clean/drivers/char/misc.c Wed May 7 21:00:24 1997 +++ linux/drivers/char/misc.c Thu May 8 22:08:05 1997 @@ -64,6 +64,7 @@ extern int bus_mouse_init(void); extern int psaux_init(void); extern int ms_bus_mouse_init(void); +extern int ncr_pen_init(void); extern int atixl_busmouse_init(void); extern int sun_mouse_init(void); extern void watchdog_init(void); @@ -198,6 +199,9 @@ #endif /* PROC_FS */ #ifdef CONFIG_BUSMOUSE bus_mouse_init(); +#endif +#ifdef CONFIG_NCR_PEN + ncr_pen_init(); #endif #if defined CONFIG_PSMOUSE psaux_init(); diff -u --recursive --new-file linux-2.0.30-clean/drivers/char/ncrpen.c linux/drivers/char/ncrpen.c --- linux-2.0.30-clean/drivers/char/ncrpen.c Thu Jan 1 01:00:00 1970 +++ linux/drivers/char/ncrpen.c Sun Jun 22 21:04:12 1997 @@ -0,0 +1,431 @@ +/* + * NCR3125 pen driver for Linux 2.0.30 + * by Marc Meis (100334.1426@compuserve.com) + * 22 june 1997 + * + * derived from Linux 1.2.13 and 2.0.30 Logitech bus (busmouse.c) mouse driver + * thanks to Kevin Burtch for gathering information + * + * see Documentation/ncr3125.txt for documentation + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +static struct ncr_digitizer_data digitizer; +static struct ncr_pen_status pen; + +static int pen_irq = NCR_IRQ; + +static unsigned char pen_stream = NCR_STREAM103; + +void ncr_pen_setup(char *str, int *ints) +{ + if (ints[0] > 0) + switch(ints[0]) { + case 10: + pen_stream = NCR_STREAM10; + break; + case 24: + pen_stream = NCR_STREAM24; + break; + case 40: + pen_stream = NCR_STREAM40; + break; + case 51: + pen_stream = NCR_STREAM51; + break; + case 68: + pen_stream = NCR_STREAM68; + break; + case 103: + pen_stream = NCR_STREAM103; + break; + case 205: + pen_stream = NCR_STREAM205; + break; + default: + pen_stream = NCR_STREAM103; + } +} + +static int ncr_wait(unsigned char semaphore) +{ + int i; + unsigned char byte; + + for (i = 0; + i < NCR_TIMEOUT && (!((byte = inb(NCR_STATUS_REG)) & semaphore)); + i++ ); + return(byte & semaphore); +} + +static int ncr_issue_command(unsigned char command) +{ + int w; + + w = ncr_wait(NCR_COMMAND_READY); + outb(command,NCR_COMMAND_REG); + return(w); +} + +static void ncr_poll_digitizer_data(char dummy) +{ + ncr_issue_command(NCR_REQUEST); + ncr_wait(NCR_DATA_READY); + + digitizer.status_byte = inb(NCR_DATA_REG); + digitizer.x_word = (inb(NCR_DATA_REG) & 0x0ff) << 8; + digitizer.x_word += inb(NCR_DATA_REG) & 0x0ff; + digitizer.y_word = NCR_NCRMAXY; + digitizer.y_word -= (inb(NCR_DATA_REG) & 0x0ff) << 8; + digitizer.y_word -= inb(NCR_DATA_REG) & 0x0ff; + digitizer.buttons_byte = inb(NCR_DATA_REG); +} + +static int ncr_poll_pen_position(char dummy) +{ + ncr_poll_digitizer_data(0); + + if ((digitizer.status_byte & NCR_NCRREADY) == 0 || + (digitizer.status_byte & NCR_NCRTAB) == 0) + return(0); + + /* if there has been a previous position, set dx, dy */ + + if (pen.previous) { + pen.dx += digitizer.x_word - pen.x; + pen.dy += digitizer.y_word - pen.y; + } + + pen.x = digitizer.x_word; + pen.y = digitizer.y_word; + pen.previous = 1; + + /* pen.buttons: + * bit 0: 0: pen close to or against digitizer surface (LCD) + * 1: pen firmly against digitizer surface (LCD) + * bit 1: 0: pen button not pressed + * 1: pen button pressed */ + + pen.buttons = digitizer.buttons_byte & 0x03; + return(1); + } + +static void pen_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + int x_word, y_word; + + /* following DOS and PenOS experience, it seems safe just to wait + * for data to be ready without using a timeout loop */ + + do { } while (!(inb(NCR_STATUS_REG) & NCR_DATA_READY)); + + /* check if there is data */ + + if (!(inb(NCR_DATA_REG) & NCR_NCRREADY)) return; + + /* it seems ok to get the pen position now */ + + x_word = (inb(NCR_DATA_REG) & 0x0ff) << 8; + x_word += inb(NCR_DATA_REG) & 0x0ff; + y_word = NCR_NCRMAXY; + y_word -= (inb(NCR_DATA_REG) & 0x0ff) << 8; + y_word -= inb(NCR_DATA_REG) & 0x0ff; + + pen.buttons = inb(NCR_DATA_REG) & 0x03; + + /* if there has been a previous position, set dx, dy */ + + if (pen.previous) { + pen.dx += x_word - pen.x; + pen.dy += y_word - pen.y; + } + + pen.x = x_word; + pen.y = y_word; + + if (pen.fasyncptr) + kill_fasync(pen.fasyncptr, SIGIO); + + pen.previous = 1; + pen.ready = 1; + wake_up_interruptible(&pen.wait); +} + +/* + * fasync support +*/ + +static int fasync_pen(struct inode *inode, struct file *filp, int on) +{ + int retval; + + retval = fasync_helper(inode, filp, on, &pen.fasyncptr); + if (retval < 0) + return retval; + return 0; +} + +/* + * close access to the mouse +*/ + +static void close_pen(struct inode * inode, struct file * file) +{ + fasync_pen(inode, file, 0); + if (--pen.active) + return; + + /* stop stream, reset digitizer and put to sleep */ + + ncr_issue_command(NCR_STREAMSTOP); + ncr_issue_command(NCR_RESET); + ncr_issue_command(NCR_SLEEP); + free_irq(pen_irq, NULL); + MOD_DEC_USE_COUNT; +} + +/* + * open access to the mouse + */ + +static int open_pen(struct inode * inode, struct file * file) +{ + if (!pen.present) + return -EINVAL; + + if (pen.active++) + return 0; + + pen.ready = 0; + + /* to check if a previous position is available to calculate dx, dy */ + + pen.previous = 0; + pen.dx = 0; + pen.dy = 0; + + /* wake up pen and try to get an inital absolute pen position + * to get dx, dy next time */ + + ncr_issue_command(NCR_RESET); + ncr_poll_pen_position(0); + + if (request_irq(pen_irq, pen_interrupt, 0, "ncrpen", NULL)) { + pen.active--; + return -EBUSY; + } + + MOD_INC_USE_COUNT; + + ncr_issue_command(NCR_RESET); + ncr_issue_command(pen_stream); + + return 0; +} + +/* + * writes are not allowed + */ + +static int write_pen(struct inode * inode, struct file * file, const char * buffer, int count) +{ + return -EINVAL; +} + +/* + * read mouse data + */ + +static int read_pen(struct inode * inode, struct file * file, char * buffer, int count) +{ + int r, pen_count; + int x, y, dx, dy; + unsigned char buttons; + + if (count < 3) + return -EINVAL; + + if ((r = verify_area(VERIFY_WRITE, buffer, count))) + return r; + + if (!pen.ready) + return -EAGAIN; + + /* + * Obtain the current mouse parameters and limit as appropriate for + * the return data format. Interrupts are only disabled while + * obtaining the parameters, NOT during the puts_fs_byte() calls, + * so paging in put_fs_byte() does not effect mouse tracking. + */ + + disable_irq(pen_irq); + + x = pen.x; + y = pen.y; + + dx = pen.dx < -127 ? -127 : pen.dx > 127 ? 127 : pen.dx; + dy = pen.dy < -127 ? -127 : pen.dy > 127 ? 127 : pen.dy; + + pen.dx -= dx; + pen.dy -= dy; + + /* pen.buttons: + * bit 0: 0: pen close to or against digitizer surface (LCD) + * 1: pen firmly against digitizer surface (LCD) + * bit 1: 0: pen button not pressed + * 1: pen button pressed */ + + buttons = pen.buttons | 0x08; + + pen.ready = 0; + enable_irq(pen_irq); + + /* first 3 bytes: buttons, dx, dy + * (compatibility with relative pointing devices) */ + + pen_count = 3; + + put_fs_byte(buttons, buffer); + put_fs_byte((char)dx, buffer + 1); + put_fs_byte((char)dy, buffer + 2); + + /* optional next 4 bytes: + * xhibyte, xlowbyte, yhibyte, ylowbyte + * + * put_fs_byte has been used to make sure of byte order */ + + if (count >= 7) { + pen_count = 7; + put_fs_byte((char)(x >> 8), buffer + 3); + put_fs_byte((char)(x & 0xff), buffer + 4); + put_fs_byte((char)(y >> 8), buffer + 5); + put_fs_byte((char)(y & 0xff), buffer + 6); + } + + for (r = pen_count; r < count; r++) + put_fs_byte(0x00, buffer + r); + return r; +} + +/* + * select for mouse input, must disable the mouse interrupt while checking + * mouse.ready/select_wait() to avoid race condition (though in reality + * such a condition is not fatal to the proper operation of the mouse since + * multiple interrupts generally occur). + */ + +static int pen_select(struct inode *inode, struct file *file, int sel_type, select_table * wait) +{ + if (sel_type == SEL_IN) { + if (pen.ready) + return 1; + select_wait(&pen.wait, wait); + } + return 0; +} + +struct file_operations ncr_pen_fops = { + NULL, /* pen_seek */ + read_pen, + write_pen, + NULL, /* pen_readdir */ + pen_select, /* pen_select */ + NULL, /* pen_ioctl */ + NULL, /* pen_mmap */ + open_pen, + close_pen, + NULL, + fasync_pen, +}; + +static struct miscdevice ncr_pen = { + NCR_PEN, "ncrpen", &ncr_pen_fops +}; + + +int ncr_pen_init(void) +{ + int pen_stream_type; + + if (check_region(NCR_PEN_BASE, NCR_PEN_EXTENT)) { + pen.present = 0; + return -EIO; + } + + if (ncr_issue_command(NCR_RESET) == 0) { + pen.present = 0; + printk("NCR3125 pen not detected or not ready!\n"); + return -EIO; + } + + /* as pen seems to exist, put it to sleep (power savings?) */ + + ncr_issue_command(NCR_SLEEP); + + request_region(NCR_PEN_BASE, NCR_PEN_EXTENT, "ncrpen"); + + pen.present = 1; + pen.ready = 0; + pen.active = 0; + + pen.wait = NULL; + + switch(pen_stream) { + case NCR_STREAM10: + pen_stream_type = 10; + break; + case NCR_STREAM24: + pen_stream_type = 24; + break; + case NCR_STREAM40: + pen_stream_type = 40; + break; + case NCR_STREAM51: + pen_stream_type = 51; + break; + case NCR_STREAM68: + pen_stream_type = 68; + break; + case NCR_STREAM103: + pen_stream_type = 103; + break; + case NCR_STREAM205: + pen_stream_type = 205; + break; + } + printk("NCR3125 pen detected and installed using stream%d.\n", + pen_stream_type); + misc_register(&ncr_pen); + return 0; +} + +#ifdef MODULE + +int init_module(void) +{ + return ncr_pen_init(); +} + +void cleanup_module(void) +{ + misc_deregister(&ncr_pen); + release_region(NCR_PEN_BASE, NCR_PEN_EXTENT); +} +#endif + diff -u --recursive --new-file linux-2.0.30-clean/include/linux/busmouse.h linux/include/linux/busmouse.h --- linux-2.0.30-clean/include/linux/busmouse.h Thu Dec 14 07:16:53 1995 +++ linux/include/linux/busmouse.h Thu May 8 20:48:24 1997 @@ -30,6 +30,7 @@ #define MOUSE_IRQ 5 #define LOGITECH_BUSMOUSE 0 /* Minor device # for Logitech */ #define MICROSOFT_BUSMOUSE 2 /* Minor device # for Microsoft */ +#define NCR_PEN 8 /* Minor device # for NCR3125 pen */ /*--------- LOGITECH BUSMOUSE ITEMS -------------*/ @@ -101,4 +102,100 @@ /* Function Prototypes */ #endif + +/*--------- NCR3125 PEN ITEMS -------------*/ + +/* ports used */ + +#define NCR_PEN_BASE 0x160 +#define NCR_PEN_EXTENT 0x2 + +/* register port addresses */ + +#define NCR_COMMAND_REG 0x161 +#define NCR_STATUS_REG 0x161 +#define NCR_DATA_REG 0x160 + +/* IRQ */ + +#define NCR_IRQ 10 + +/* commands */ + +#define NCR_REQUEST 0x40 +#define NCR_RESET 0x52 +#define NCR_DIAGNOSTIC 0x63 +#define NCR_ECHOBACK 0x65 +#define NCR_VERSION 0x6A +#define NCR_SLEEP 0x73 +#define NCR_WAKE 0x77 +#define NCR_STREAM205 0x31 +#define NCR_STREAM103 0x32 +#define NCR_STREAM68 0x33 +#define NCR_STREAM51 0x34 +#define NCR_STREAM40 0x35 +#define NCR_STREAM24 0x36 +#define NCR_STREAM10 0x37 +#define NCR_STREAMSTOP 0x38 + +/* NCR_STATUS_REG bits */ + +#define NCR_STREAM_BIT2 0x80 +#define NCR_STREAM_BIT1 0x40 +#define NCR_LOW_SCAN 0x20 +#define NCR_SLEEP_MODE 0x10 +#define NCR_STREAM_BIT0 0x08 +#define NCR_COMMAND_READY 0x02 +#define NCR_DATA_READY 0x01 + +/* consecutive data bytes to be read from NCR_DATA_REG: + * byte 0: status byte + * 1: x high byte + * 2: x low byte + * 3: y high byte + * 4: y low byte + * 5: z and button */ + +/* status byte (byte 5) bits + * (bit values found out by experimentation) */ + +#define NCR_NCRTAB 0x80 /* no idea what this bit is good for ! */ +#define NCR_NCRREADY 0x40 /* 0: no pen around, no position data */ + /* 1: position data available */ + +/* z and button (byte 5) bits */ + +#define NCR_NCRBUTTON 0x02 /* 0: pen button not pressed */ + /* 1: pen button pressed */ + +#define NCR_NCRPENZ 0x01 /* 0: pen close to or against digitizer */ + /* 1: pen firmly against digitzer */ + +/* general stuff */ + +#define NCR_TIMEOUT 10000 /* seems to be ok */ + +#define NCR_NCRMAXX 2010 +#define NCR_NCRMAXY 1510 + +struct ncr_digitizer_data { + unsigned char status_byte; + int x_word; + int y_word; + unsigned char buttons_byte; +}; + +struct ncr_pen_status { + int x; + int y; + int buttons; + int dx; + int dy; + unsigned char previous; + unsigned char present; + unsigned char active; + unsigned char ready; + struct wait_queue *wait; + struct fasync_struct *fasyncptr; +}; diff -u --recursive --new-file linux-2.0.30-clean/include/linux/miscdevice.h linux/include/linux/miscdevice.h --- linux-2.0.30-clean/include/linux/miscdevice.h Sun May 19 14:55:19 1996 +++ linux/include/linux/miscdevice.h Thu May 8 16:38:57 1997 @@ -8,6 +8,7 @@ #define AMIGAMOUSE_MINOR 4 #define ATARIMOUSE_MINOR 5 #define SUN_MOUSE_MINOR 6 +#define NCR_PEN_MINOR 8 #define MISC_DYNAMIC_MINOR 255 extern int misc_init(void); diff -u --recursive --new-file linux-2.0.30-clean/init/main.c linux/init/main.c --- linux-2.0.30-clean/init/main.c Wed May 7 21:00:36 1997 +++ linux/init/main.c Thu May 8 17:03:05 1997 @@ -73,6 +73,7 @@ extern void buff_setup(char *str, int *ints); extern void panic_setup(char *str, int *ints); extern void bmouse_setup(char *str, int *ints); +extern void ncr_pen_setup(char *str, int *ints); extern void msmouse_setup(char *str, int *ints); extern void lp_setup(char *str, int *ints); extern void eth_setup(char *str, int *ints); @@ -293,6 +294,9 @@ #endif #ifdef CONFIG_BUSMOUSE { "bmouse=", bmouse_setup }, +#endif +#ifdef CONFIG_NCR_PEN + { "ncrpen=", ncr_pen_setup }, #endif #ifdef CONFIG_MS_BUSMOUSE { "msmouse=", msmouse_setup }, diff -u --recursive --new-file linux-2.0.30-clean/kernel/sys.c linux/kernel/sys.c --- linux-2.0.30-clean/kernel/sys.c Wed May 7 21:00:52 1997 +++ linux/kernel/sys.c Sun Jun 22 20:17:34 1997 @@ -29,6 +29,45 @@ #include /* + * NCR3125 power off + */ + +#define NCR_POWER_OFF_DELAY \ + "jmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\tjmp 1f\n" \ + "1:\t" + +#define NCR_POWER_OFF() __asm__ __volatile__( \ + "cli\n\t" \ + "mov $0xFFFB,%dx\n\t" \ + "inb %dx,%al\n\t" \ + "orb $0xFF,%dl\n\t" \ + "inb %dx,%al\n\t" \ + "andb $0xFD,%dl\n\t" \ + "inb %dx,%al\n\t" \ + "andb $0xF9,%dl\n\t" \ + "inb %dx,%al\n\t" \ + "movb $0xFE,%al\n\t" \ + "outb %al,$0x24\n\t" \ + NCR_POWER_OFF_DELAY \ + "inb $0x25,%al\n\t" \ + NCR_POWER_OFF_DELAY \ + "andb $0xF7,%al\n\t" \ + "push %ax\n\t" \ + "movb $0xFE,%al\n\t" \ + "outb %al,$0x24\n\t" \ + NCR_POWER_OFF_DELAY \ + "pop %ax\n\t" \ + "outb %al,$0x25\n\t" \ + "mov $0x24,%dx\n\t" \ + "movb $0xFA,%al\n\t" \ + "outb %al,%dx\n\t") + +/* * this indicates whether you can reboot with ctrl-alt-del: the default is yes */ int C_A_D = 1; @@ -197,6 +236,9 @@ sys_kill(-1, SIGKILL); #if defined(CONFIG_APM) && defined(CONFIG_APM_POWER_OFF) apm_set_power_state(APM_STATE_OFF); +#endif +#ifdef CONFIG_NCR_POWER_OFF + NCR_POWER_OFF(); #endif do_exit(0); } else