/* Copyright 1984 by the Massachusetts Institute of Technology */

/* System definition */

#include	<types.h>
#include	<sys.h>


#define	NULL	0

/* definitions of packet sizes */
#define	MX_PKT	3000		/* Size of largest packet */
#define	MX_SH	4		/* software header (MPW) */
#define	MX_HH	14		/* hardware header (10 Mb EtherNet) */
#define	MX_ST	0		/* software trailer */
#define	MX_HT	6		/* hardware trailer (chaos) */

/*
 * System initialization routines
 */

ext void log_init(), opcon_register();
ext word log_cmd;
ext void time_init(), io_init(), bus_int();
ext void initgw();
ext void INNET(), CHNET(), ARP(), RIP(), EGP();
ext void TIMING();
ext void OPCON(), STAT();
ext void restart_init();
ext void tcp_Init(), SUPDUP();
ext void KEEP_ALIVE();

struct inittbl	INITTBL[] = {
			/* system initialization */
	log_init, 0,		/* logging */
	time_init, 0,		/* timers */
	io_init, 0,		/* devices */
	OPCON, 0,		/* command interpreter */
	STAT, 0,		/* status */
	opcon_register, (word)(&log_cmd), /* init logging commands */

	initgw, 0,	/* gateway initialization */
		
			/* protocol initialization */
	INNET, 0,		/* internet */
/*	CHNET, 0,		/* chaos net */
	ARP, 0,			/* address resolution protocol */
/*	EGP, 0,			/* exterior gateway protocol */
/*	RIP, 0,	    		/* routing information protocol */

	tcp_Init, 0,		/* TCP */
	SUPDUP, 0,		/* SUPDUP server */
	KEEP_ALIVE, 2,		/* DEQNA keep alive */
/*	TIMING, 0,		/* print timing info */
	restart_init, 0, /* Sets up restart parameter block */
	0, 0
};


/*
 * Device definitions
 */

ext void viiii(), viioi(), viiin(), viiot(), vii_up();
ext void dmaii(), dmaoi(), dmain(), dmaot(), dma_up();
ext void qna_in_up(), qna_out_up(), qna_out(), qna_in(), qna_int();
ext void con_rup(), con_tup(), con_out(), con_rint(), con_tint();
ext void sd_tup(), sd_write();

dct viidct[2] = {
    DCTMAC(viiii, vii_up, viiin, 0x20001a80, 0x2b0, &viidct[1]),
    DCTMAC(viioi, vii_up, viiot, 0x20001a88, 0x2b4, &viidct[0]),
};

dct dmadct[2] = {
    DCTMAC(dmaii, dma_up, dmain, 0x20001dc0, 0x260, &dmadct[1]),
    DCTMAC(dmaoi, dma_up, dmaot, 0x20001dc8, 0x264, &dmadct[0]),
};

dct qnadct[2] = {
    DCTMAC(qna_int, qna_in_up, qna_in, 0x20001920, 0x3f8, &qnadct[1]),
    DCTMAC(qna_int, qna_out_up, qna_out, 0x20001920, 0x3fc, &qnadct[0]),
};

dct condct[2] = {
    DCTMAC(con_rint, con_rup, NULL, 0, 0xf8, &condct[1]),
    DCTMAC(con_tint, con_tup, con_out, 0, 0xfc, &condct[0]),
};

dct sddct[1] = {
    DCTMAC(NULL, sd_tup, sd_write, 0, 0, &sddct[0]),
};

dct *DCTVT[] =	{	&dmadct[0],
			&dmadct[1],
			&viidct[0],
			&viidct[1],
			&qnadct[0],
			&qnadct[1],
			&condct[0],
			&condct[1],
			&sddct[0],
			NULL
		};

dct *log_dev = &condct[1];

/*
 * Global Variables defined per configuration
 *
 *	These should really be set from the net structure at runtime.
 */

word	pktsiz = MX_PKT + MX_SH + MX_HH + MX_ST + MX_HT;
word	hdrsiz = MX_SH + MX_HH;
word	tlrsiz = MX_ST + MX_HT;
word	bufsiz = sizeof(iorb) + MX_PKT + MX_SH + MX_HH + MX_ST + MX_HT;
word	pktoff = sizeof(iorb) + MX_SH + MX_HH;
