Article View: cam.lists.esix
Article #1Re: 4.0.3 lp driver w/ streams
From: Marc Boucher
Date: Sat, 06 Jun 1992 04:12
Date: Sat, 06 Jun 1992 04:12
455 lines
11670 bytes
11670 bytes
In cam.lists.esix, Burt Janz <bhj%decvax.UUCP@zk3.dec.com> writes:
>Lately, I've been printing a lot of GIF->PS conversions, and the polling
>driver (pp) just can't seem to hack it. It's fine for text and for mostly
>other PS files (like dvips or tpscript output), but seems to choke (give up)
>on GIF->PS conversions. No, I don't know why.
>I can't use the standard 4.0.3 driver either... I'd like to print these files
>before the next decade :-)
>Where can I UUCP the streams-based lp driver from? I'll be willing to put
>it up on bhjat for access as well.
>If you can get it to me via e-mail, contact me via e-mail.
>Thanks!
>\burt
>--
>Burt Janz
>Complete Computing Solutions of New England, Inc
>31 Syracuse Road (603) 880-0482
>Nashua, NH 03060 (603) 889-6154 fax/modem
>..{decvax,everex,sparky}!bhjat!bhj
>Gnu tools, ESIX V3 and V4 patches, and various other sources by anonymous uucp:
> uucp bhjat!/usr5/ls-lR.Z
>Systems or L.sys should contain something like:
> bhjat Any,1 ACU 19200 16038896154 "" \r gin:--gin: nuucp word: nuucp
Here's my current version...
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 06/06/1992 04:06 UTC by marc@altitude
# Source directory /var/home/marc/tmp/plp
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 293 -rw-r--r-- Makefile
# 27 -rw-r--r-- Master
# 39 -rw-r--r-- Node
# 1237 -rw-r--r-- Space.c
# 78 -rw-r--r-- System
# 4210 -rw-r--r-- plp.c
# 179 -rw-r--r-- plp.h
#
# ============= Makefile ==============
if test -f 'Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping Makefile (File already exists)'
else
echo 'x - extracting Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
X
IDINSTALL=/etc/conf/bin/idinstall
X
CFLAGS=-D_KERNEL -DINKERNEL -O
X
plp.o: /usr/include/sys/plp.h
X
/usr/include/sys/plp.h: plp.h
X install -m 444 plp.h /usr/include/sys/plp.h
X
clean:
X rm -f plp.o
X
install: plp.o
X -$(IDINSTALL) -d plp
X rm -f Driver.o; ln -s plp.o Driver.o
X $(IDINSTALL) -ka plp
SHAR_EOF
chmod 0644 Makefile ||
echo 'restore of Makefile failed'
Wc_c="`wc -c < 'Makefile'`"
test 293 -eq "$Wc_c" ||
echo 'Makefile: original size 293, current size' "$Wc_c"
fi
# ============= Master ==============
if test -f 'Master' -a X"$1" != X"-c"; then
echo 'x - skipping Master (File already exists)'
else
echo 'x - extracting Master (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Master' &&
plp I iHcSf plp 0 0 1 3 -1
SHAR_EOF
chmod 0644 Master ||
echo 'restore of Master failed'
Wc_c="`wc -c < 'Master'`"
test 27 -eq "$Wc_c" ||
echo 'Master: original size 27, current size' "$Wc_c"
fi
# ============= Node ==============
if test -f 'Node' -a X"$1" != X"-c"; then
echo 'x - skipping Node (File already exists)'
else
echo 'x - extracting Node (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Node' &&
plp plp0 c 0
plp plp1 c 1
plp plp2 c 2
SHAR_EOF
chmod 0644 Node ||
echo 'restore of Node failed'
Wc_c="`wc -c < 'Node'`"
test 39 -eq "$Wc_c" ||
echo 'Node: original size 39, current size' "$Wc_c"
fi
# ============= Space.c ==============
if test -f 'Space.c' -a X"$1" != X"-c"; then
echo 'x - skipping Space.c (File already exists)'
else
echo 'x - extracting Space.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Space.c' &&
X
#include "config.h"
#include "sys/param.h"
#include "sys/types.h"
#include "sys/signal.h"
#include "sys/dma.h"
#include "sys/errno.h"
#include "sys/file.h"
#include "sys/termio.h"
#include "sys/stream.h"
#include "sys/stropts.h"
#include "sys/plp.h"
#include "sys/ddi.h"
X
int NUMPLP=PLP_UNITS;
int plpdebug=0;
X
#define PLP_DEFSTROBE 30
#define PLP_DEFWAIT 200
#define PLP_DEFSHORTDELAY 10 /* ticks */
#define PLP_DEFLONGDELAY HZ/2 /* ticks */
X
struct plpcfg plpcfg[PLP_UNITS] = {
X PLP_0_SIOA+0, /* data register port address */
X PLP_0_SIOA+1, /* status register port address */
X PLP_0_SIOA+2, /* control register port address */
X PLP_DEFSTROBE,
X PLP_DEFWAIT,
X PLP_DEFSHORTDELAY,
X PLP_DEFLONGDELAY,
X 0
#ifdef PLP_1
X ,
X PLP_1_SIOA+0, /* data register port address */
X PLP_1_SIOA+1, /* status register port address */
X PLP_1_SIOA+2, /* control register port address */
X PLP_DEFSTROBE,
X PLP_DEFWAIT,
X PLP_DEFSHORTDELAY,
X PLP_DEFLONGDELAY,
X 0
#endif /* PLP_1 */
#ifdef PLP_2
X ,
X PLP_2_SIOA+0, /* data register port address */
X PLP_2_SIOA+1, /* status register port address */
X PLP_2_SIOA+2, /* control register port address */
X PLP_DEFSTROBE,
X PLP_DEFWAIT,
X PLP_DEFSHORTDELAY,
X PLP_DEFLONGDELAY,
X 0
#endif /* PLP_2 */
};
SHAR_EOF
chmod 0644 Space.c ||
echo 'restore of Space.c failed'
Wc_c="`wc -c < 'Space.c'`"
test 1237 -eq "$Wc_c" ||
echo 'Space.c: original size 1237, current size' "$Wc_c"
fi
# ============= System ==============
if test -f 'System' -a X"$1" != X"-c"; then
echo 'x - skipping System (File already exists)'
else
echo 'x - extracting System (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'System' &&
plp Y 1 0 0 0 3bc 3be 0 0
plp Y 1 0 0 0 378 37f 0 0
plp Y 1 0 0 0 278 27f 0 0
SHAR_EOF
chmod 0644 System ||
echo 'restore of System failed'
Wc_c="`wc -c < 'System'`"
test 78 -eq "$Wc_c" ||
echo 'System: original size 78, current size' "$Wc_c"
fi
# ============= plp.c ==============
if test -f 'plp.c' -a X"$1" != X"-c"; then
echo 'x - skipping plp.c (File already exists)'
else
echo 'x - extracting plp.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'plp.c' &&
/* Streams-based polling parallel port driver
X
X Copyright (c)1991 Marc Boucher (marc@CAM.ORG)
X All Rights Reserved.
X
X THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
X WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
X MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X
X Derived from:
X
X Fast printer driver Copyright(c) 1989 Michael Grenier
*/
X
#include <sys/param.h>
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/stream.h>
#include <sys/stropts.h>
#include <sys/cred.h>
#include <sys/plp.h>
X
#include <sys/ddi.h>
X
static struct module_info minfo = { 0x49ba, "plp", 0, INFPSZ, 150, 50 };
X
static int plpopen(), plpclose(), plpwput(), plpwsrv();
X
static struct qinit rinit = {
X NULL, NULL, plpopen, plpclose, NULL, &minfo, NULL
};
static struct qinit winit = {
X plpwput, plpwsrv, NULL, NULL, NULL, &minfo, NULL
};
X
struct streamtab plpinfo = { &rinit, &winit, NULL, NULL };
X
int plpdevflag=0;
X
extern struct plpcfg plpcfg[];
extern int NUMPLP;
extern int plpdebug;
X
/* Status port defines */
X
#define NOT_BUSY (1 << 7)
#define NOT_ACK (1 << 6)
#define END_OF_PAPER (1 << 5)
#define SELECT (1 << 4)
#define NOT_ERROR (1 << 3)
X
/* Control port defines */
X
#define IRQ_ENABLE (1 << 4)
#define SELECT_IN (1 << 3)
#define NOT_INIT (1 << 2)
#define AUTO_LF (1 << 1)
#define STROBE 1
X
X
int
plpinit()
{
X int unit;
X
X for (unit = 0; unit < NUMPLP; unit++)
X {
X int st;
X
X outb(plpcfg[unit].control, SELECT_IN | NOT_INIT);
X
X st=(~inb(plpcfg[unit].status))&0xff;
X
X if(st) printf("plp: Unit %d configured at address 0x%x - Initial status is 0x%x\n", unit, plpcfg[unit].data, st);
X else plpcfg[unit].data=0;
X }
X return 0;
}
X
static int
plpopen(q, dev, flag, sflag, credp)
register queue_t *q;
dev_t *dev;
cred_t *credp;
{
X int unit;
X struct plpcfg *pr;
X
X if (sflag) return(EINVAL);
X if (q->q_ptr) return(EBUSY);
X
X unit = getminor(*dev);
X
X if ( unit >= NUMPLP ) return(ENXIO);
X
X pr=&plpcfg[unit];
X
X if (pr->data==0) return(ENXIO);
X
X if ( ! (inb(pr->status) & NOT_ERROR) ) {
X printf("plp: Error detected on unit %d\n", unit);
X return(EIO);
X }
X
X q->q_ptr=WR(q)->q_ptr=pr;
X pr->curdelay=pr->shortdelay;
X return 0;
}
X
static int
plpclose(q)
register queue_t *q;
{
X q->q_ptr=WR(q)->q_ptr=NULL;
X return 0;
}
X
static int
plpwsrv(q)
struct queue *q;
{
X register mblk_t *mp;
X struct plpcfg *plp;
X
X plp=(struct plpcfg *)q->q_ptr;
X
X while((mp=getq(q)) != NULL) do {
X mblk_t *bp;
X
X while(mp->b_rptr < mp->b_wptr) {
X int strobe_cnt;
X
X for ( strobe_cnt = plp->wait
X ; strobe_cnt && !(inb(plp->status) & NOT_BUSY)
X ; strobe_cnt--);
X
X if ( ! (inb(plp->status) & NOT_BUSY) ) {
X int prevdel;
X
X if( (prevdel=plp->curdelay) == plp->shortdelay) {
X /* prevent the STREAMS scheduler from
X calling our service routine */
X noenable(q);
X
X /* longer pause for subsequent waits */
X plp->curdelay=plp->longdelay;
X }
X
X /* re-queue the unprocessed message */
X putbq(q, mp);
X
X /* have ourselves called again after prevdel
X ticks, hoping that the port became NOT_BUSY */
X if(plpdebug)
X printf("plp: timeout(%d)\n", prevdel);
X timeout(plpwsrv, q, prevdel);
X
X return 0;
X }
X
X if(plp->curdelay==plp->longdelay) {
X enableok(q);
X plp->curdelay=plp->shortdelay;
X }
X
X outb( plp->data, *mp->b_rptr++ );
X
X outb( plp->control, SELECT_IN | NOT_INIT | STROBE);
X
X for ( strobe_cnt = plp->strobe
X ; strobe_cnt
X ; strobe_cnt--);
X
X outb( plp->control, SELECT_IN | NOT_INIT);
X }
X bp=unlinkb(mp);
X freeb(mp);
X mp=bp;
X
X } while(mp);
X
X return 0;
}
X
static int
plpwput(q, mp)
struct queue *q;
mblk_t *mp;
{
X switch (mp->b_datap->db_type)
X {
X case M_DATA:
X putq(q, mp); /* queue it for our service procedure */
X break;
X
X case M_IOCTL: /* nak all ioctl's */
X mp->b_datap->db_type=M_IOCNAK;
X ((struct iocblk *)mp->b_rptr)->ioc_error = EINVAL;
X qreply(q, mp);
X break;
X
X case M_FLUSH:
X if(*mp->b_rptr&FLUSHW) {
X flushq(q, FLUSHALL);
X *mp->b_rptr&=~FLUSHW;
X }
X if(*mp->b_rptr&FLUSHR) {
X flushq(RD(q), FLUSHALL);
X qreply(q, mp);
X } else freemsg(mp);
X
X default: /* silently discard messages of unknown type */
X freemsg(mp);
X break;
X }
X return 0;
}
SHAR_EOF
chmod 0644 plp.c ||
echo 'restore of plp.c failed'
Wc_c="`wc -c < 'plp.c'`"
test 4210 -eq "$Wc_c" ||
echo 'plp.c: original size 4210, current size' "$Wc_c"
fi
# ============= plp.h ==============
if test -f 'plp.h' -a X"$1" != X"-c"; then
echo 'x - skipping plp.h (File already exists)'
else
echo 'x - extracting plp.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'plp.h' &&
X
#ifndef SYS_PLP_H
#define SYS_PLP_H
X
struct plpcfg {
X unsigned short data, status, control;
X int strobe, wait, shortdelay, longdelay, curdelay;
};
X
#endif /* SYS_PLP_H */
X
SHAR_EOF
chmod 0644 plp.h ||
echo 'restore of plp.h failed'
Wc_c="`wc -c < 'plp.h'`"
test 179 -eq "$Wc_c" ||
echo 'plp.h: original size 179, current size' "$Wc_c"
fi
exit 0
--
^@-------~~--**----/ --- - Marc Boucher
marc@CAM.ORG \----? ":
/-----_-- - ----_|| +1 514 466 8932 - &-
Technical Details
Message-ID:
<1992Jun6.041235.13658@CAM.ORG>Path:
arc1-ca.pugleaf.net!wupost!uunet!bonnie.concordia.ca!clyde.concordia.ca!altitude!marcReferences:
<199206010311.AA06370@bulldog.CS.YALE.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wupost!uunet!bonnie.concordia.ca!clyde.concordia.ca!altitude!marc From: marc@CAM.ORG (Marc Boucher) Newsgroups: cam.lists.esix,comp.unix.sysv386,alt.sources Subject: Re: 4.0.3 lp driver w/ streams Message-ID: <1992Jun6.041235.13658@CAM.ORG> Date: 6 Jun 92 04:12:35 GMT References: <199206010311.AA06370@bulldog.CS.YALE.EDU> Organization: Altitude, St-Lambert QC CANADA Lines: 455