1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 1990,1991,1997-1998 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_BPP_IO_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_BPP_IO_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * I/O header file for the bidirectional parallel port 34*7c478bd9Sstevel@tonic-gate * driver (bpp) for the Zebra SBus card. 35*7c478bd9Sstevel@tonic-gate */ 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #include <sys/ioccom.h> 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 40*7c478bd9Sstevel@tonic-gate extern "C" { 41*7c478bd9Sstevel@tonic-gate #endif 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate /* #defines (not struct elements) below */ 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate /* 46*7c478bd9Sstevel@tonic-gate * Minor device number encoding (should not be here): 47*7c478bd9Sstevel@tonic-gate */ 48*7c478bd9Sstevel@tonic-gate #define BPP_UNIT(dev) getminor(*dev) 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* 51*7c478bd9Sstevel@tonic-gate * ioctl defines for cmd argument 52*7c478bd9Sstevel@tonic-gate */ 53*7c478bd9Sstevel@tonic-gate /* set contents of transfer parms structure */ 54*7c478bd9Sstevel@tonic-gate #define BPPIOC_SETPARMS _IOW('b', 1, struct bpp_transfer_parms) 55*7c478bd9Sstevel@tonic-gate /* read contents of transfer parms structure */ 56*7c478bd9Sstevel@tonic-gate #define BPPIOC_GETPARMS _IOR('b', 2, struct bpp_transfer_parms) 57*7c478bd9Sstevel@tonic-gate /* set contents of output pins structure */ 58*7c478bd9Sstevel@tonic-gate #define BPPIOC_SETOUTPINS _IOW('b', 3, struct bpp_pins) 59*7c478bd9Sstevel@tonic-gate /* read contents of output pins structure */ 60*7c478bd9Sstevel@tonic-gate #define BPPIOC_GETOUTPINS _IOR('b', 4, struct bpp_pins) 61*7c478bd9Sstevel@tonic-gate /* read contents of snapshot error status structure */ 62*7c478bd9Sstevel@tonic-gate #define BPPIOC_GETERR _IOR('b', 5, struct bpp_error_status) 63*7c478bd9Sstevel@tonic-gate /* pretend to attempt a data transfer */ 64*7c478bd9Sstevel@tonic-gate #define BPPIOC_TESTIO _IO('b', 6) 65*7c478bd9Sstevel@tonic-gate /* ioctl values 7-12 are test-only and are reserved */ 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* Structure definitions and locals #defines below */ 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate #define MAX_TIMEOUT 1800000 /* maximum read/write timeout */ 71*7c478bd9Sstevel@tonic-gate /* 30 minutes */ 72*7c478bd9Sstevel@tonic-gate /* 73*7c478bd9Sstevel@tonic-gate * #defines and enum variables, and general comments for the 74*7c478bd9Sstevel@tonic-gate * bpp_transfer_parms structure. 75*7c478bd9Sstevel@tonic-gate */ 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* Values for read_handshake and write_handshake fields */ 78*7c478bd9Sstevel@tonic-gate enum handshake_t { 79*7c478bd9Sstevel@tonic-gate BPP_NO_HS = 1, /* no handshake pins */ 80*7c478bd9Sstevel@tonic-gate BPP_ACK_HS = 2, /* handshake controlled by ACK line */ 81*7c478bd9Sstevel@tonic-gate BPP_BUSY_HS = 3, /* handshake controlled by BSY line */ 82*7c478bd9Sstevel@tonic-gate BPP_ACK_BUSY_HS = 4, /* handshake controlled by ACK and BSY lines */ 83*7c478bd9Sstevel@tonic-gate /* read_handshake only! */ 84*7c478bd9Sstevel@tonic-gate BPP_XSCAN_HS = 5, /* xerox scanner mode, read_handshake only! */ 85*7c478bd9Sstevel@tonic-gate BPP_HSCAN_HS = 6, /* HP scanjet scanner mode */ 86*7c478bd9Sstevel@tonic-gate /* read_handshake only! */ 87*7c478bd9Sstevel@tonic-gate BPP_CLEAR_MEM = 7, /* write 0's to memory, read_handshake only! */ 88*7c478bd9Sstevel@tonic-gate BPP_SET_MEM = 8, /* write 1's to memory, read_handshake only! */ 89*7c478bd9Sstevel@tonic-gate /* The following handshakes are RESERVED. Do not use. */ 90*7c478bd9Sstevel@tonic-gate BPP_VPRINT_HS = 9, /* valid only in read/write mode */ 91*7c478bd9Sstevel@tonic-gate BPP_VPLOT_HS = 10 /* valid only in read/write mode */ 92*7c478bd9Sstevel@tonic-gate }; 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate /* 95*7c478bd9Sstevel@tonic-gate * The read_setup_time field indicates 96*7c478bd9Sstevel@tonic-gate * dstrb- to bsy+ in BPP_HS_NOHS or BPP_HS_ACKHS 97*7c478bd9Sstevel@tonic-gate * dstrb- to ack+ in BPP_HS_ACKHS or BPP_HS_ACKBUSYHS 98*7c478bd9Sstevel@tonic-gate * ack- to dstrb+ in BPP_HS_XSCANHS 99*7c478bd9Sstevel@tonic-gate * 100*7c478bd9Sstevel@tonic-gate * The read_strobe_width field indicates 101*7c478bd9Sstevel@tonic-gate * ack+ to ack- in BPP_HS_ACKHS or BPP_HS_ACKBUSYHS 102*7c478bd9Sstevel@tonic-gate * dstrb+ to dstrb- in BPP_HS_XSCANHS 103*7c478bd9Sstevel@tonic-gate */ 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate /* Values allowed for write_handshake field */ 106*7c478bd9Sstevel@tonic-gate /* 107*7c478bd9Sstevel@tonic-gate * these are duplicates of the definitions above 108*7c478bd9Sstevel@tonic-gate * BPP_HS_NOHS 109*7c478bd9Sstevel@tonic-gate * BPP_HS_ACKHS 110*7c478bd9Sstevel@tonic-gate * BPP_HS_BUSYHS 111*7c478bd9Sstevel@tonic-gate */ 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate /* 114*7c478bd9Sstevel@tonic-gate * The write_setup_time field indicates 115*7c478bd9Sstevel@tonic-gate * data valid to dstrb+ in all handshakes 116*7c478bd9Sstevel@tonic-gate * 117*7c478bd9Sstevel@tonic-gate * The write_strobe_width field indicates 118*7c478bd9Sstevel@tonic-gate * dstrb+ to dstrb- in non-reserved handshakes 119*7c478bd9Sstevel@tonic-gate * minimum dstrb+ to dstrb- in BPP_HS_VPRINTHS or BPP_HS_VPLOTHS 120*7c478bd9Sstevel@tonic-gate */ 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate /* 124*7c478bd9Sstevel@tonic-gate * This structure is used to configure the hardware handshake and 125*7c478bd9Sstevel@tonic-gate * timing modes. 126*7c478bd9Sstevel@tonic-gate */ 127*7c478bd9Sstevel@tonic-gate struct bpp_transfer_parms { 128*7c478bd9Sstevel@tonic-gate enum handshake_t 129*7c478bd9Sstevel@tonic-gate read_handshake; /* parallel port read handshake mode */ 130*7c478bd9Sstevel@tonic-gate int read_setup_time; /* DSS register - in nanoseconds */ 131*7c478bd9Sstevel@tonic-gate int read_strobe_width; /* DSW register - in nanoseconds */ 132*7c478bd9Sstevel@tonic-gate int read_timeout; /* wait this many microseconds */ 133*7c478bd9Sstevel@tonic-gate /* before aborting a transfer */ 134*7c478bd9Sstevel@tonic-gate enum handshake_t 135*7c478bd9Sstevel@tonic-gate write_handshake; /* parallel port write handshake mode */ 136*7c478bd9Sstevel@tonic-gate int write_setup_time; /* DSS register - in nanoseconds */ 137*7c478bd9Sstevel@tonic-gate int write_strobe_width; /* DSW register - in nanoseconds */ 138*7c478bd9Sstevel@tonic-gate int write_timeout; /* wait this many microseconds */ 139*7c478bd9Sstevel@tonic-gate /* before aborting a transfer */ 140*7c478bd9Sstevel@tonic-gate }; 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate struct bpp_pins { 143*7c478bd9Sstevel@tonic-gate uchar_t output_reg_pins; /* pins in P_OR register */ 144*7c478bd9Sstevel@tonic-gate uchar_t input_reg_pins; /* pins in P_IR register */ 145*7c478bd9Sstevel@tonic-gate }; 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate /* 149*7c478bd9Sstevel@tonic-gate * #defines and general comments for 150*7c478bd9Sstevel@tonic-gate * the bpp_pins structure. 151*7c478bd9Sstevel@tonic-gate */ 152*7c478bd9Sstevel@tonic-gate /* Values for output_reg_pins field */ 153*7c478bd9Sstevel@tonic-gate #define BPP_SLCTIN_PIN 0x01 /* Select in pin */ 154*7c478bd9Sstevel@tonic-gate #define BPP_AFX_PIN 0x02 /* Auto feed pin */ 155*7c478bd9Sstevel@tonic-gate #define BPP_INIT_PIN 0x04 /* Initialize pin */ 156*7c478bd9Sstevel@tonic-gate #define BPP_V1_PIN 0x08 /* reserved pin 1 */ 157*7c478bd9Sstevel@tonic-gate #define BPP_V2_PIN 0x10 /* reserved pin 2 */ 158*7c478bd9Sstevel@tonic-gate #define BPP_V3_PIN 0x20 /* reserved pin 3 */ 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate #define BPP_ALL_OUT_PINS (BPP_SLCTIN_PIN | BPP_AFX_PIN | BPP_INIT_PIN |\ 161*7c478bd9Sstevel@tonic-gate BPP_V1_PIN | BPP_V2_PIN | BPP_V3_PIN) 162*7c478bd9Sstevel@tonic-gate 163*7c478bd9Sstevel@tonic-gate /* Values for input_reg_pins field */ 164*7c478bd9Sstevel@tonic-gate #define BPP_ERR_PIN 0x01 /* Error pin */ 165*7c478bd9Sstevel@tonic-gate #define BPP_SLCT_PIN 0x02 /* Select pin */ 166*7c478bd9Sstevel@tonic-gate #define BPP_PE_PIN 0x04 /* Paper empty pin */ 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate #define BPP_ALL_IN_PINS (BPP_ERR_PIN | BPP_SLCT_PIN | BPP_PE_PIN) 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate struct bpp_error_status { 171*7c478bd9Sstevel@tonic-gate char timeout_occurred; /* 1 if a timeout occurred */ 172*7c478bd9Sstevel@tonic-gate char bus_error; /* 1 if an SBus bus error */ 173*7c478bd9Sstevel@tonic-gate uchar_t pin_status; /* status of pins which could */ 174*7c478bd9Sstevel@tonic-gate /* cause an error */ 175*7c478bd9Sstevel@tonic-gate }; 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate /* 178*7c478bd9Sstevel@tonic-gate * #defines for the bpp_error_status structure 179*7c478bd9Sstevel@tonic-gate */ 180*7c478bd9Sstevel@tonic-gate /* Values for pin_status field */ 181*7c478bd9Sstevel@tonic-gate #define BPP_ERR_ERR 0x01 /* Error pin active */ 182*7c478bd9Sstevel@tonic-gate #define BPP_SLCT_ERR 0x02 /* Select pin active */ 183*7c478bd9Sstevel@tonic-gate #define BPP_PE_ERR 0x04 /* Paper empty pin active */ 184*7c478bd9Sstevel@tonic-gate #define BPP_SLCTIN_ERR 0x10 /* Select in pin active */ 185*7c478bd9Sstevel@tonic-gate #define BPP_BUSY_ERR 0x40 /* Busy pin active */ 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 188*7c478bd9Sstevel@tonic-gate } 189*7c478bd9Sstevel@tonic-gate #endif 190*7c478bd9Sstevel@tonic-gate 191*7c478bd9Sstevel@tonic-gate #endif /* !_SYS_BPP_IO_H */ 192