xref: /netbsd-src/sys/dev/mvme/lptvar.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: lptvar.h,v 1.5 2008/04/28 20:23:54 martin Exp $	*/
208bde987Sscw 
308bde987Sscw /*-
408bde987Sscw  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
508bde987Sscw  * All rights reserved.
608bde987Sscw  *
708bde987Sscw  * This code is derived from software contributed to The NetBSD Foundation
808bde987Sscw  * by Steve C. Woodford.
908bde987Sscw  *
1008bde987Sscw  * Redistribution and use in source and binary forms, with or without
1108bde987Sscw  * modification, are permitted provided that the following conditions
1208bde987Sscw  * are met:
1308bde987Sscw  * 1. Redistributions of source code must retain the above copyright
1408bde987Sscw  *    notice, this list of conditions and the following disclaimer.
1508bde987Sscw  * 2. Redistributions in binary form must reproduce the above copyright
1608bde987Sscw  *    notice, this list of conditions and the following disclaimer in the
1708bde987Sscw  *    documentation and/or other materials provided with the distribution.
1808bde987Sscw  *
1908bde987Sscw  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2008bde987Sscw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2108bde987Sscw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2208bde987Sscw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2308bde987Sscw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2408bde987Sscw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2508bde987Sscw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2608bde987Sscw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2708bde987Sscw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2808bde987Sscw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2908bde987Sscw  * POSSIBILITY OF SUCH DAMAGE.
3008bde987Sscw  */
3108bde987Sscw 
3208bde987Sscw /*
3308bde987Sscw  * Common front-end for mvme68k/mvme88k parallel printer ports
3408bde987Sscw  */
3508bde987Sscw 
3608bde987Sscw #ifndef __mvme_lptvar_h
3708bde987Sscw #define __mvme_lptvar_h
3808bde987Sscw 
3908bde987Sscw #include <sys/callout.h>
4008bde987Sscw 
4108bde987Sscw struct lpt_funcs;
4208bde987Sscw 
4308bde987Sscw 
4408bde987Sscw struct lpt_softc {
458ecf8999Scube 	device_t		sc_dev;
4608bde987Sscw 	struct callout		sc_wakeup_ch;
4708bde987Sscw 	struct lpt_funcs	*sc_funcs;
4808bde987Sscw 	void			*sc_arg;
4908bde987Sscw 	size_t			sc_count;
5008bde987Sscw 	struct buf		*sc_inbuf;
5108bde987Sscw 	u_char			*sc_cp;
5208bde987Sscw 	int			sc_spinmax;
5308bde987Sscw 	u_char			sc_state;
5408bde987Sscw #define	LPT_OPEN	0x01	/* device is open */
5508bde987Sscw #define	LPT_OBUSY	0x02	/* printer is busy doing output */
5608bde987Sscw #define	LPT_INIT	0x04	/* waiting to initialize for open */
5708bde987Sscw 	u_char			sc_flags;
5808bde987Sscw #define	LPT_FAST_STROBE	0x10	/* Select 1.6uS strobe pulse */
5908bde987Sscw #define	LPT_AUTOLF	0x20	/* automatic LF on CR */
6008bde987Sscw #define	LPT_NOPRIME	0x40	/* don't prime on open */
6108bde987Sscw #define	LPT_NOINTR	0x80	/* do not use interrupt */
6208bde987Sscw 
6308bde987Sscw 	/* Back-end specific stuff */
6408bde987Sscw 	bus_space_tag_t		sc_bust;
6508bde987Sscw 	bus_space_handle_t	sc_bush;
6608bde987Sscw 	int			sc_ipl;
6708bde987Sscw 	u_char			sc_icr;
6808bde987Sscw 	u_char			sc_laststatus;
6908bde987Sscw 	struct evcnt		sc_evcnt;
7008bde987Sscw };
7108bde987Sscw 
7208bde987Sscw 
7308bde987Sscw struct lpt_funcs {
7418db93c7Sperry 	void	(*lf_open)(struct lpt_softc *, int);
7518db93c7Sperry 	void	(*lf_close)(struct lpt_softc *);
7618db93c7Sperry 	void	(*lf_iprime)(struct lpt_softc *);
7718db93c7Sperry 	void	(*lf_speed)(struct lpt_softc *, int);
7818db93c7Sperry 	int	(*lf_notrdy)(struct lpt_softc *, int);
7918db93c7Sperry 	void	(*lf_wrdata)(struct lpt_softc *, u_char);
8008bde987Sscw };
8108bde987Sscw 
8208bde987Sscw #define	LPT_STROBE_FAST	0
8308bde987Sscw #define LPT_STROBE_SLOW	1
8408bde987Sscw 
8518db93c7Sperry extern	void	lpt_attach_subr(struct lpt_softc *);
8618db93c7Sperry extern	int	lpt_intr(struct lpt_softc *);
8708bde987Sscw 
8808bde987Sscw #endif	/* __mvme_lptvar_h */
89