ppb_1284.h revision 42475
166200Simp/*-
252506Simp * Copyright (c) 1997 Nicolas Souchu
352506Simp * All rights reserved.
452506Simp *
552506Simp * Redistribution and use in source and binary forms, with or without
652506Simp * modification, are permitted provided that the following conditions
752506Simp * are met:
852506Simp * 1. Redistributions of source code must retain the above copyright
952506Simp *    notice, this list of conditions and the following disclaimer.
1052506Simp * 2. Redistributions in binary form must reproduce the above copyright
1152506Simp *    notice, this list of conditions and the following disclaimer in the
1252506Simp *    documentation and/or other materials provided with the distribution.
1352506Simp *
1452506Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1552506Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1652506Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1752506Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1852506Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1952506Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2052506Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2152506Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2252506Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2352506Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2452506Simp * SUCH DAMAGE.
2552506Simp *
2652506Simp *	$Id: ppb_1284.h,v 1.3 1998/09/13 18:26:26 nsouch Exp $
2752506Simp *
2852506Simp */
2952506Simp#ifndef __1284_H
3052506Simp#define __1284_H
3152506Simp
3252506Simp/*
3352506Simp * IEEE1284 signals
3452506Simp */
3552506Simp
3652506Simp/* host driven signals */
3774636Simp
3852506Simp#define nHostClk	STROBE
3952506Simp#define Write		STROBE
4052506Simp
4152506Simp#define nHostBusy	AUTOFEED
4252506Simp#define nHostAck	AUTOFEED
4352506Simp#define DStrb		AUTOFEED
4452506Simp
4552506Simp#define nReveseRequest	nINIT
4652506Simp
4752506Simp#define nActive1284	SELECTIN
4852506Simp#define AStrb		SELECTIN
4952506Simp
5054250Simp/* peripheral driven signals */
5152506Simp
5252506Simp#define nDataAvail	nFAULT
5352506Simp#define nPeriphRequest	nFAULT
5452506Simp
5552506Simp#define Xflag		SELECT
5652506Simp
5752506Simp#define AckDataReq	PERROR
5852506Simp#define nAckReverse	PERROR
5952506Simp
6052506Simp#define nPtrBusy	nBUSY
6152506Simp#define nPeriphAck	nBUSY
6252506Simp#define Wait		nBUSY
6352506Simp
6454250Simp#define PtrClk		nACK
6554250Simp#define PeriphClk	nACK
6652506Simp#define Intr		nACK
6752506Simp
6852506Simp/* request mode values */
6952506Simp#define NIBBLE_1284_NORMAL	0x0
7052506Simp#define NIBBLE_1284_REQUEST_ID	0x4
7152506Simp#define BYTE_1284_NORMAL	0x1
7252506Simp#define BYTE_1284_REQUEST_ID	0x5
7352506Simp#define ECP_1284_NORMAL		0x10
7452506Simp#define ECP_1284_REQUEST_ID	0x14
7552506Simp#define ECP_1284_RLE		0x30
7652506Simp#define ECP_1284_RLE_REQUEST_ID	0x34
7752506Simp#define EPP_1284_NORMAL		0x40
7852506Simp#define EXT_LINK_1284_NORMAL	0x80
7952506Simp
8052506Simp/* ieee1284 mode options */
8152506Simp#define PPB_REQUEST_ID		0x1
8252506Simp#define PPB_USE_RLE		0x2
8352506Simp#define PPB_EXTENSIBILITY_LINK	0x4
8452506Simp
8552506Simp/* ieee1284 errors */
8652506Simp#define PPB_NO_ERROR		0
8752506Simp#define PPB_MODE_UNSUPPORTED	1	/* mode not supported by peripheral */
8852506Simp#define PPB_NOT_IEEE1284	2	/* not an IEEE1284 compliant periph. */
8952506Simp#define PPB_TIMEOUT		3	/* timeout */
9052506Simp#define PPB_INVALID_MODE	4	/* current mode is incorrect */
9152506Simp
9252506Simp/* ieee1284 host side states */
9352506Simp#define PPB_ERROR			0
9452506Simp#define PPB_FORWARD_IDLE		1
9552506Simp#define PPB_NEGOCIATION			2
9652506Simp#define PPB_SETUP			3
9752506Simp#define PPB_ECP_FORWARD_IDLE		4
9852506Simp#define PPB_FWD_TO_REVERSE		5
9952506Simp#define PPB_REVERSE_IDLE		6
10052506Simp#define PPB_REVERSE_TRANSFER		7
10152506Simp#define PPB_REVERSE_TO_FWD		8
10252506Simp#define PPB_EPP_IDLE			9
10352506Simp#define PPB_TERMINATION			10
10452506Simp
10552506Simp/* peripheral side states */
10652506Simp#define PPB_PERIPHERAL_NEGOCIATION	11
10767187Simp#define PPB_PERIPHERAL_IDLE		12
10867187Simp#define PPB_PERIPHERAL_TRANSFER		13
10967187Simp#define PPB_PERIPHERAL_TERMINATION	14
11067187Simp
11167187Simpextern int nibble_1284_inbyte(struct ppb_device *, char *);
11267187Simpextern int byte_1284_inbyte(struct ppb_device *, char *);
11360938Sjakeextern int spp_1284_read(struct ppb_device *, int, char *, int, int *);
11452506Simp
11552506Simpextern int ppb_1284_negociate(struct ppb_device *, int, int);
11652506Simpextern int ppb_1284_terminate(struct ppb_device *);
11752506Simpextern int ppb_1284_read_id(struct ppb_device *, int, char *, int, int *);
11852506Simpextern int ppb_1284_read(struct ppb_device *, int, char *, int, int *);
11952506Simp
12052506Simpextern int ppb_peripheral_terminate(struct ppb_device *, int);
12152506Simpextern int ppb_peripheral_negociate(struct ppb_device *, int, int);
12252506Simpextern int byte_peripheral_write(struct ppb_device *, char *, int, int *);
12355720Simp
12455720Simp#endif
12560938Sjake