#include "../h/param.h"
#include "../h/buf.h"
#include "../h/map.h"
#include "../h/vm.h"

#include "../s32dev/mbvar.h"

#define C (caddr_t)


extern struct mb_driver rfdriver;
extern rfintr();
int	 (*rfint0[])() = { rfintr, 0 } ;
extern struct mb_driver rfdriver;
extern rfintr();
int	 (*rfint1[])() = { rfintr, 0 } ;
extern struct mb_driver isdriver;
extern isintr();
int	 (*isint0[])() = { isintr, 0 } ;
extern struct mb_driver isdriver;
extern isintr();
int	 (*isint1[])() = { isintr, 0 } ;
extern struct mb_driver isdriver;
extern isintr();
int	 (*isint2[])() = { isintr, 0 } ;
extern struct mb_driver isdriver;
extern isintr();
int	 (*isint3[])() = { isintr, 0 } ;
extern struct mb_driver modriver;
extern mointr();
int	 (*moint0[])() = { mointr, 0 } ;
extern struct mb_driver exdriver;
extern exIntr();
int	 (*exint0[])() = { exIntr, 0 } ;
extern struct mb_driver ecdriver;
extern ecIntr();
int	 (*ecint0[])() = { ecIntr, 0 } ;
extern struct mb_driver scdriver;
extern scintr();
int	 (*scint0[])() = { scintr, 0 } ;
extern struct mb_driver skydriver;
extern skyintr();
int	 (*skyint0[])() = { skyintr, 0 } ;
extern struct mb_driver octdriver;
extern octintr();
int	 (*octint0[])() = { octintr, 0 } ;
extern struct mb_driver octdriver;
extern octintr();
int	 (*octint1[])() = { octintr, 0 } ;
extern struct mb_driver smoctdriver;
extern smoctintr();
int	 (*smoctint0[])() = { smoctintr, 0 } ;
extern struct mb_driver smoctdriver;
extern smoctintr();
int	 (*smoctint1[])() = { smoctintr, 0 } ;
extern struct mb_driver smoctdriver;
extern smoctintr();
int	 (*smoctint2[])() = { smoctintr, 0 } ;
extern struct mb_driver smoctdriver;
extern smoctintr();
int	 (*smoctint3[])() = { smoctintr, 0 } ;
extern struct mb_driver kgdriver;
extern kgclock();
int	 (*kgint0[])() = { kgclock, 0 } ;

struct mb_ctlr mbcinit[] = {
	/* driver,    ctlr, alive,    intr,     addr */
	{ &rfdriver,	 0,     0,  rfint0, C 0x00ac },
	{ &rfdriver,	 1,     0,  rfint1, C 0x00aa },
	{ &isdriver,	 0,     0,  isint0, C 0x00f0 },
	{ &isdriver,	 1,     0,  isint1, C 0x00f8 },
	{ &isdriver,	 2,     0,  isint2, C 0x00e0 },
	{ &isdriver,	 3,     0,  isint3, C 0x00e8 },
	0
};

struct mb_device mbdinit[] = {
	/* driver,    unit, ctlr, slave,    intr,     addr, dk, flags */
	{ &rfdriver,	 0,    0,     0,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 1,    0,     1,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 2,    0,     2,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 3,    0,     3,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 4,    0,     4,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 5,    0,     5,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 6,    0,     6,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 7,    0,     7,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 0,    0,     0,       0, C 0x0000,  0, 0x0 },
	{ &rfdriver,	 1,    0,     1,       0, C 0x0000,  0, 0x0 },
	{ &rfdriver,	 2,    0,     2,       0, C 0x0000,  0, 0x0 },
	{ &rfdriver,	 3,    0,     3,       0, C 0x0000,  0, 0x0 },
	{ &rfdriver,	 4,    0,     4,       0, C 0x0000,  0, 0x0 },
	{ &rfdriver,	 8,    1,     0,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 9,    1,     1,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	10,    1,     2,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	11,    1,     3,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	12,    1,     4,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	13,    1,     5,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	14,    1,     6,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	15,    1,     7,       0, C 0x0000,  1, 0x0 },
	{ &rfdriver,	 4,    1,     0,       0, C 0x0000,  0, 0x0 },
	{ &rfdriver,	 5,    1,     1,       0, C 0x0000,  0, 0x0 },
	{ &isdriver,	 0,    0,     0,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 1,    0,     1,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 2,    0,     2,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 3,    0,     3,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 0,    0,     0,       0, C 0x0000,  0, 0x0 },
	{ &isdriver,	 4,    1,     0,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 5,    1,     1,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 6,    1,     2,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 7,    1,     3,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 8,    2,     0,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	 9,    2,     1,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	10,    2,     2,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	11,    2,     3,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	12,    3,     0,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	13,    3,     1,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	14,    3,     2,       0, C 0x0000,  1, 0x0 },
	{ &isdriver,	15,    3,     3,       0, C 0x0000,  1, 0x0 },
	{ &modriver,	 0,   -1,    -1,  moint0, C 0x0800,  0, 0x0 },
	{ &exdriver,	 0,   -1,    -1,  exint0, C 0x0200,  0, 0x0 },
	{ &ecdriver,	 0,   -1,    -1,  ecint0, C 0x380000,  0, 0x0 },
	{ &scdriver,	 0,   -1,    -1,  scint0, C 0x0000,  0, 0x0 },
	{ &skydriver,	 0,   -1,    -1, skyint0, C 0x1282,  0, 0x0 },
	{ &octdriver,	 0,   -1,    -1, octint0, C 0x01a0,  0, 0x0 },
	{ &octdriver,	 1,   -1,    -1, octint1, C 0x01c0,  0, 0x0 },
	{ &smoctdriver,	 0,   -1,    -1, smoctint0, C 0x0240,  0, 0x0 },
	{ &smoctdriver,	 1,   -1,    -1, smoctint1, C 0x0242,  0, 0x0 },
	{ &smoctdriver,	 2,   -1,    -1, smoctint2, C 0x0244,  0, 0x0 },
	{ &smoctdriver,	 3,   -1,    -1, smoctint3, C 0x0246,  0, 0x0 },
	{ &kgdriver,	 0,   -1,    -1,  kgint0, C 0x0000,  0, 0x0 },
	0
};
