/* $Id: hps.onb.h,v 2.3 91/10/11 10:12:41 steve Exp $ */
/*****************************************************************/
/* 						hps.onb.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.									*/
/****************************************************************/
/*																*/
/* HPS On-board code header file								*/
/*																*/
/* This file defines data structures and constants required by	*/
/* code * that executes on-board the HPS controller, and uses	*/
/* the standard * VRTX operating system and network interfaces	*/
/*																*/
/* Precede with:												*/
/*	#include "hps.types.h"										*/
/*	#include "hps.iocb.h"										*/
/*																*/
/*****************************************************************/


/* Host Response Handler's input queue: */
#define RESP_QID	0x0005


/* Initial Memory Partitions: */
#define MEM_512	0x0001	/* 512-byte blocks, for general use	*/
#define MEM_64		0x0002	/* 64-byte blocks, for IOCBs			*/
#define MEM_32		0x0003	/* 32-byte blocks					*/
#define MEM_16		0x0004	/* 16-byte blocks, for network headers	*/
#define MEM_16K	0x0005	/* 16K-byte blocks, for circular output */


/* Partition Sizes: */
#define MAIN_SIZ	0x4000	/* 32 512-byte blocks				*/
#define HEAD_SIZ	0x0200	/* 32 16-byte blocks				*/


/* VRTX-returned error codes: */
#define RET_OK		0x00	/* No Error					*/

#define ER_TID		0x01	/* Task ID Error				*/
#define ER_TCB		0x02	/* No TCBs Available			*/
#define ER_MEM		0x03	/* No Memory Blocks Available		*/
#define ER_NMB		0x04	/* Not a Memory Block			*/
#define ER_MIU		0x05	/* Mailbox Already in Use		*/
#define ER_ZMW		0x06	/* Zero Message				*/
#define ER_BUF		0x07	/* Buffer Full					*/
#define ER_WTC		0x08	/* Previous v_waitc() in Progress	*/

#define ER_TMO		0x0A	/* Timeout					*/
#define ER_NMP		0x0B	/* No Message Present			*/
#define ER_QID		0x0C	/* Queue ID Error				*/
#define ER_QFL		0x0D	/* Queue Full					*/
#define ER_PID		0x0E	/* Partition ID Error			*/

#define ER_NCP		0x10	/* No Character Present			*/


/* VRTX Extension Error Codes: */
#define ER_BTO		0x11	/* Bus Grant Timeout on DMA		*/
#define ER_XTO		0x12	/* XACK Timeout on DMA			*/


/*
 *	Semaphore for v_wait()/v_signal().
 */
typedef struct
{
	bit16	s_busy;
	bit16	s_res;
	bit32	s_mbox;
} SEM;


/*****************************************************************/
/* Message Control Block.  Post a pointer to one of these		*/
/* to the Request Completion Handler's queue (RESP_QID) to		*/
/* pass a message to the host.							*/		
/*****************************************************************/

typedef struct
{
	short	code;	/* Identifies message type (below)	*/
	union
	{
		long  ret_msg;	/* Info for msg field of P. Block	*/
		short port;	/* Channel number				*/
		short station;	/* Network station address		*/
	} m_un;
	IOCBHDR  *iocb;	/* Points to on-board copy of IOCB	*/
	long		mail;	/* Mail for IOCB completion		*/
	long		qid;		/* Requestor's queue ID			*/
	long	    *mbox;	/* Requestor's mailbox addr.		*/
	long		msg;		/* Message for requestor			*/
} MCB;




/*****************************************************************/
/* System Buffer Header									*/
/*													*/
/* These headers can be used to create arbitrary lists of data	*/
/* structures, data blocks, etc.  In particular, these 		*/
/* structures link together the components of Network Queue		*/
/* Elements. Data bytes follow the header structure 			*/
/* contiguously.										*/
/*****************************************************************/

typedef struct sbh
{
	struct sbh    *nxte;		/* Link to next queue element */
	struct sbh    *next;		/* Link field to next header	*/
	short		length;		/* Number of bytes of data	*/
} SBH;

/*
 * MODIFICATION HISTORY:
 *
 * $Log:	hps.onb.h,v $
 * Revision 1.1.2.1  92/06/24  13:53:26  marker
 * Branch RISCOS_5_01_2_FIXES off of trunk.
 * 
 * Revision 2.3  91/10/11  10:12:41  steve
 * Made semaphore structure always aligned.
 * ENHANCEMENT
 * 
 * Revision 2.2  91/01/10  20:42:44  dave
 * Update header.
 * COSMETIC
 * 
 */
