/* $Id: hps.iocb.h,v 2.2 91/01/10 20:42:14 dave Exp $ */
/****************************************************************/
/*						hps.iocb.h								*/
/****************************************************************/
/*																*/
/*                 Confidential Information                     */
/*      Limited Distribution to Authorized Persons Only         */
/*     Created 1986 and Protected as an Unpublished Work        */
/*          Under the U.S. Copyright Act of 1976.               */
/*         Copyright (c) 1986, Systech Corporation          	*/
/*                  All Rights Reserved                         */
/*																*/
/*	THIS SOFTWARE IS LICENSED BY AND IS THE	CONFIDENTIAL AND 	*/
/*	PROPRIETARY PROPERTY OF SYSTECH COMPUTER CORPORATION AND 	*/
/*	MAY NOT, WITHOUT THE PRIOR WRITTEN CONSENT OF SYSTECH 		*/
/*	COMPUTER CORPORATION, BE REPRODUCED, USED OR DISCLOSED 		*/
/*	EXCEPT IN ACCORDANCE WITH A SYSTECH COMPUTER CORPORATION 	*/
/*	SOFTWARE LICENSE AGREEMENT.									*/
/****************************************************************/
/*																*/
/* Precede with:												*/
/*	#include "hps.types.h"										*/
/*																*/
/* IOCB header format											*/
/*																*/
/* This is the header that the on-board HPS firmware recognizes.*/
/* The firmware allows host or application specific extensions	*/
/* to this IOCB header.  The "len" field gives the total length	*/
/* of the IOCB, in bytes.										*/
/*																*/
/****************************************************************/

#ifdef HPS_ALIGN
	typedef struct iocb_hdr
	{
		bit16		len;		/* Total IOCB length (header + extensions)	*/
		bit16		maj_dev;	/* On-board application ID					*/
		bit16		min_dev;	/* Application-specific parameter			*/
		bit16		int_enab;	/* == 1 to interrupt on IOCB comnpletion	*/
		HPS_LONG	return_msg;	/* Completion info to give host when finished*/
		bit16		data_len;	/* Length of data, in bytes					*/
		bit16		res;
		HPS_LONG	data;		/* Pointer to data							*/
		bit16		data_dir;	/* Direction of data transfer (1 = to HPS)	*/
		bit16		mode;		/* Data in DPRAM, or bus memory (DMA)		*/
		HPS_LONG	mail;		/* Storage for completion status			*/
			/* These fields are reserved for the host:						*/
		struct      iocb_hdr *next;	/* Points to next IOCB on queue			*/
		int			(*finished)();	/* Pointer to completion handler		*/
	} IOCBHDR;
#else
	typedef struct iocb_hdr
	{
		bit16		len;		/* Total IOCB length (header + extensions)	*/
		bit16		maj_dev;	/* On-board application ID					*/
		bit16		min_dev;	/* Application-specific parameter			*/
		bit16		int_enab;	/* == 1 to interrupt on IOCB comnpletion	*/
		HPS_LONG	return_msg;	/* Completion info to give host when finished*/
		bit16		data_len;	/* Length of data, in bytes					*/
		HPS_LONG	data;		/* Pointer to data							*/
		bit16		data_dir;	/* Direction of data transfer (1 = to HPS)	*/
		bit16		mode;		/* Data in DPRAM, or bus memory (DMA)		*/
		HPS_LONG	mail;		/* Storage for completion status			*/
			/* These fields are reserved for the host:						*/
		struct      iocb_hdr *next;	/* Points to next IOCB on queue			*/
		int			(*finished)();	/* Pointer to completion handler		*/
	} IOCBHDR;
#endif

/* Codes for int_enab:	*/
#define ENABLED		1
#define DISABLED	0

/* Codes for data_dir:	*/
#define TO_HPS		1		/* (WRITE)	*/
#define FROM_HPS	0		/* (READ)	*/

/* Codes for mode:		*/
#define DPRAM_IOCB		1
#define DPRAM_DATA		2


/* IOCB Error codes (placed in mailbox after IOCB completion):		*/

#define E_NODEV		0x01	/* No such major device						*/
#define E_NOFUNC	0x02	/* No such minor device						*/
#define E_NOCOMMAND	0x03	/* Command not recognized by device			*/
#define E_REMOTE	0x04	/* Remote station did not respond			*/
#define E_NOCONFIRM	0x05	/* Failed to receive a CONFIRM packet		*/
#define E_OVERFLOW	0x06	/* Remote sent more data than was requested	*/
#define E_NOSTATION	0x07	/* Could find no station with given address	*/
#define E_XACKTO	0x08	/* XACK Timeout during DMA					*/
#define E_BUSTO		0x09	/* Bus Grant Timeout during DMA				*/
#define E_BUSY		0x0A	/* Minor device busy						*/
#define E_NOMEM		0x0B	/* No on-board memory available				*/
#define E_CLOSED	0x0C	/* Minor device already closed				*/
#define E_OFFLINE	0x0D 	/* No response from network					*/
#define E_NORESP	0x0E 	/* No response from remote station			*/
#define E_BADRESP	0x0F 	/* Bad response (NAK) from remote station	*/
#define E_FULL		0x10 	/* Output buffer full						*/
#define E_NETBUSY   0x11 	/* Network busy								*/
#define E_CONNECT	0x12 	/* No clusters connected for download		*/
#define E_CHKSUM	0x13 	/* Checksum error during cluster download	*/

#define E_PANIC		0xFF	/* Panic condition on controller			*/

#define R_ERR_NO	0x100	/* Error code from a remote station			*/

/*
 * MODIFICATION HISTORY:
 *
 * $Log:	hps.iocb.h,v $
 * Revision 1.1.2.1  92/06/24  13:53:23  marker
 * Branch RISCOS_5_01_2_FIXES off of trunk.
 * 
 * Revision 2.2  91/01/10  20:42:14  dave
 * Update header.
 * COSMETIC
 * 
 */
