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