ppb_1284.h revision 296373
1314125Sdelphij/*- 2238405Sjkim * Copyright (c) 1997 Nicolas Souchu 3238405Sjkim * All rights reserved. 4238405Sjkim * 5238405Sjkim * Redistribution and use in source and binary forms, with or without 6238405Sjkim * modification, are permitted provided that the following conditions 7238405Sjkim * are met: 8238405Sjkim * 1. Redistributions of source code must retain the above copyright 9238405Sjkim * notice, this list of conditions and the following disclaimer. 10238405Sjkim * 2. Redistributions in binary form must reproduce the above copyright 11238405Sjkim * notice, this list of conditions and the following disclaimer in the 12238405Sjkim * documentation and/or other materials provided with the distribution. 13238405Sjkim * 14238405Sjkim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15238405Sjkim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16238405Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17238405Sjkim * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18238405Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19238405Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20238405Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21238405Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22238405Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23238405Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24238405Sjkim * SUCH DAMAGE. 25238405Sjkim * 26238405Sjkim * $FreeBSD: releng/10.3/sys/dev/ppbus/ppb_1284.h 55957 2000-01-14 08:03:15Z nsouch $ 27238405Sjkim * 28238405Sjkim */ 29238405Sjkim#ifndef __1284_H 30238405Sjkim#define __1284_H 31238405Sjkim 32238405Sjkim/* 33238405Sjkim * IEEE1284 signals 34238405Sjkim */ 35238405Sjkim 36238405Sjkim/* host driven signals */ 37238405Sjkim 38238405Sjkim#define nHostClk STROBE 39238405Sjkim#define Write STROBE 40238405Sjkim 41276861Sjkim#define nHostBusy AUTOFEED 42276861Sjkim#define nHostAck AUTOFEED 43238405Sjkim#define DStrb AUTOFEED 44238405Sjkim 45238405Sjkim#define nReveseRequest nINIT 46238405Sjkim 47238405Sjkim#define nActive1284 SELECTIN 48238405Sjkim#define AStrb SELECTIN 49314125Sdelphij 50238405Sjkim/* peripheral driven signals */ 51238405Sjkim 52238405Sjkim#define nDataAvail nFAULT 53276861Sjkim#define nPeriphRequest nFAULT 54276861Sjkim 55276861Sjkim#define Xflag SELECT 56238405Sjkim 57314125Sdelphij#define AckDataReq PERROR 58314125Sdelphij#define nAckReverse PERROR 59314125Sdelphij 60314125Sdelphij#define nPtrBusy nBUSY 61238405Sjkim#define nPeriphAck nBUSY 62314125Sdelphij#define Wait nBUSY 63314125Sdelphij 64314125Sdelphij#define PtrClk nACK 65276861Sjkim#define PeriphClk nACK 66238405Sjkim#define Intr nACK 67238405Sjkim 68238405Sjkim/* request mode values */ 69238405Sjkim#define NIBBLE_1284_NORMAL 0x0 70238405Sjkim#define NIBBLE_1284_REQUEST_ID 0x4 71238405Sjkim#define BYTE_1284_NORMAL 0x1 72238405Sjkim#define BYTE_1284_REQUEST_ID 0x5 73238405Sjkim#define ECP_1284_NORMAL 0x10 74238405Sjkim#define ECP_1284_REQUEST_ID 0x14 75238405Sjkim#define ECP_1284_RLE 0x30 76238405Sjkim#define ECP_1284_RLE_REQUEST_ID 0x34 77238405Sjkim#define EPP_1284_NORMAL 0x40 78238405Sjkim#define EXT_LINK_1284_NORMAL 0x80 79238405Sjkim 80238405Sjkim/* ieee1284 mode options */ 81238405Sjkim#define PPB_REQUEST_ID 0x1 82238405Sjkim#define PPB_USE_RLE 0x2 83238405Sjkim#define PPB_EXTENSIBILITY_LINK 0x4 84238405Sjkim 85238405Sjkim/* ieee1284 errors */ 86238405Sjkim#define PPB_NO_ERROR 0 87238405Sjkim#define PPB_MODE_UNSUPPORTED 1 /* mode not supported by peripheral */ 88238405Sjkim#define PPB_NOT_IEEE1284 2 /* not an IEEE1284 compliant periph. */ 89238405Sjkim#define PPB_TIMEOUT 3 /* timeout */ 90238405Sjkim#define PPB_INVALID_MODE 4 /* current mode is incorrect */ 91238405Sjkim 92238405Sjkim/* ieee1284 host side states */ 93238405Sjkim#define PPB_ERROR 0 94238405Sjkim#define PPB_FORWARD_IDLE 1 95238405Sjkim#define PPB_NEGOCIATION 2 96238405Sjkim#define PPB_SETUP 3 97238405Sjkim#define PPB_ECP_FORWARD_IDLE 4 98238405Sjkim#define PPB_FWD_TO_REVERSE 5 99238405Sjkim#define PPB_REVERSE_IDLE 6 100238405Sjkim#define PPB_REVERSE_TRANSFER 7 101238405Sjkim#define PPB_REVERSE_TO_FWD 8 102238405Sjkim#define PPB_EPP_IDLE 9 103238405Sjkim#define PPB_TERMINATION 10 104238405Sjkim 105238405Sjkim/* peripheral side states */ 106238405Sjkim#define PPB_PERIPHERAL_NEGOCIATION 11 107238405Sjkim#define PPB_PERIPHERAL_IDLE 12 108238405Sjkim#define PPB_PERIPHERAL_TRANSFER 13 109238405Sjkim#define PPB_PERIPHERAL_TERMINATION 14 110238405Sjkim 111238405Sjkimextern int nibble_1284_inbyte(device_t, char *); 112238405Sjkimextern int byte_1284_inbyte(device_t, char *); 113238405Sjkimextern int spp_1284_read(device_t, int, char *, int, int *); 114238405Sjkim 115238405Sjkimextern int ppb_1284_negociate(device_t, int, int); 116238405Sjkimextern int ppb_1284_terminate(device_t); 117238405Sjkimextern int ppb_1284_read_id(device_t, int, char *, int, int *); 118238405Sjkimextern int ppb_1284_read(device_t, int, char *, int, int *); 119238405Sjkimextern int ppb_1284_get_state(device_t bus); 120238405Sjkimextern int ppb_1284_set_state(device_t bus, int state); 121238405Sjkim 122238405Sjkimextern int ppb_peripheral_terminate(device_t, int); 123238405Sjkimextern int ppb_peripheral_negociate(device_t, int, int); 124238405Sjkimextern int byte_peripheral_write(device_t, char *, int, int *); 125238405Sjkim 126238405Sjkim#endif 127238405Sjkim