/*~**********************************************************************
Title........ config.c
Date......... Tue Jul  6 10:52:33  1999
Author....... J.M.Tarrant
Description.. Configuration data specifying the hardware attached to
............. the system
***********************************************************************~*/
/****	Include Files */

	#include	"hardware.h"
	#include	"peripherals.h"

	#include	"interface.h"
	#include	"palettes.h"
	#include	"config.h"
	#include	"fpga.h"
	#include	"config.sp"

/****	Security */
const	LONG	SecStart=0;
const	LONG	SecEnd=0;

/****	Interrupts */

void (*Int1msLst[])()={0,0,0,0,0,0,0,0,0,0,0,0,EOF_FUNCTIONS};
void (*Int10msLst[])()={0,0,0,0,0,0,0,0,0,EOF_FUNCTIONS};
void (*Int250msLst[])()={0,0,0,0,0,0,0,0,0,EOF_FUNCTIONS};
void (*IntDuartLst[])()={0,0,0,0,EOF_FUNCTIONS};

/****	Inputs */

const	INPUTCFG	InputCfg[]=
	{
	{4},								/* Debounce sample time */
	};

/****	Multiplexed Inputs */

INPUTMAP	MxiInputMap[2];

const	WORD	MxiStrobeLst[]={OP63,OP61,-1};

/****	Outputs */

const	OUTPUT	VOPList[]={EOF_OUTPUTS};

const	OUTPUTCFG	OutputCfg[]=
	{
	{VOPList}
	};


/****	Sound */
const	SOUNDCFG	SoundCfg[]=
	{
	{80,80},
	{0,0}
	};
/****	Serial Communications - 68340 Serial module configuration and buffers */


BYTE	SerialModTxABuffer[1<<4]={0};
BYTE	SerialModRxABuffer[1<<4]={0};
BYTE	SerialModTxBBuffer[1<<5]={0};
BYTE	SerialModRxBBuffer[1<<4]={0};

const	WORD	SerialModTxAMask=sizeof(SerialModTxABuffer)-1;
const	WORD	SerialModRxAMask=sizeof(SerialModRxABuffer)-1;
const	WORD	SerialModTxBMask=sizeof(SerialModTxBBuffer)-1;
const	WORD	SerialModRxBMask=sizeof(SerialModRxBBuffer)-1;
const SERIALCFG SerialModuleCfg[] =
	{
	0x0086,0x41,0x04,0x33,0x00,0x00,
	BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE,	// Channel A
	BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE	// Channel B
	};
/****	Serial Communications - DUART0 configuration and buffers */
//static BYTE	Duart0TxABuffer[1<<3]={0};
//static BYTE	Duart0RxABuffer[1<<3]={0};
//static BYTE	Duart0TxBBuffer[1<<3]={0};
//static BYTE	Duart0RxBBuffer[1<<3]={0};
//const	DUARTCFG	DUART0Cfg[]=
//	{
//		{
//		DUART0BASE,
//		Duart0ISR,
//		Duart0TxABuffer,
//		Duart0RxABuffer,
//		Duart0TxBBuffer,
//		Duart0RxBBuffer,
//		sizeof(Duart0TxABuffer)-1,
//		sizeof(Duart0RxABuffer)-1,
//		sizeof(Duart0TxBBuffer)-1,
//		sizeof(Duart0RxBBuffer)-1,
//		BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE,	// Channel A
//		BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE	// Channel B
//		},
//	{0,0}
//	};

/****	Serial Communications - DUART1 configuration and buffers*/
//static BYTE	Duart1TxABuffer[1<<3]={0};
//static BYTE	Duart1RxABuffer[1<<3]={0};
//static BYTE	Duart1TxBBuffer[1<<3]={0};
//static BYTE	Duart1RxBBuffer[1<<3]={0};
//const	DUARTCFG	DUART1Cfg[]=
//	{
//		{
//		DUART1BASE,
//		Duart1ISR,
//		Duart1TxABuffer,
//		Duart1RxABuffer,
//		Duart1TxBBuffer,
//		Duart1RxBBuffer,
//		sizeof(Duart1TxABuffer)-1,
//		sizeof(Duart1RxABuffer)-1,
//		sizeof(Duart1TxBBuffer)-1,
//		sizeof(Duart1RxBBuffer)-1,
//		BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE,	// Channel A
//		BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE	// Channel B
//		},
//	{0,0}
//	};
/****	Serial Communications - DUART2 configuration and buffers*/
//static BYTE	Duart2TxABuffer[1<<3]={0};
//static BYTE	Duart2RxABuffer[1<<3]={0};
//static BYTE	Duart2TxBBuffer[1<<3]={0};
//static BYTE	Duart2RxBBuffer[1<<3]={0};
//const	DUARTCFG	DUART2Cfg[]=
//	{
//		{
//		DUART2BASE,
//		Duart2ISR,
//		Duart2TxABuffer,
//		Duart2RxABuffer,
//		Duart2TxBBuffer,
//		Duart2RxBBuffer,
//		sizeof(Duart2TxABuffer)-1,
//		sizeof(Duart2RxABuffer)-1,
//		sizeof(Duart2TxBBuffer)-1,
//		sizeof(Duart2RxBBuffer)-1,
//		BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE,	// Channel A
//		BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE	// Channel B
//		},
//	{0,0}
//	};

/****	Serial Communications - Calypso 16 UART configuration and buffers */
BYTE	UARTTxBuffer[1<<8]={0};
BYTE	UARTRxBuffer[1<<8]={0};
const	WORD	UARTTxMask=sizeof(UARTTxBuffer)-1;
const	WORD	UARTRxMask=sizeof(UARTRxBuffer)-1;
const	UARTCFG	UARTCfg[]=
	{
		BAUD9600,BAUD9600,BITS8,STOP1,PARITYNONE,TXNONE,RXNONE
	};




/****	Multiplexed Lamps */

const	LAMPSCFG	LampsCfg=
	{
	8,							/* Default flash time */
	80							/* Default brightness */
	};


/****	PIC */
const	PICCFG	PICCfg[]=
	{
	{&I2CPICDevice,0xd6}	/* I2CDevice  I2CAddress PIC=d6*/
	};
/****	Timers */

TIMER*	TimerLst[8];
const	WORD	NofTimers=(sizeof(TimerLst)/sizeof(TimerLst[0]));

TIMER*	FTimerLst[8];
const	WORD	NofFTimers=(sizeof(FTimerLst)/sizeof(FTimerLst[0]));

/*****	 Stepper definitions */
STEPPERVARS reel1_ram =
	{
	0,0,		/*****	STEP POSITION/DISTANCE					*****/
	0,			/*****	DIRECTION								*****/
	0,0,		/*****	PATTERN TABLE/INDEX						*****/
	0,			/*****	VECTOR TABLE							*****/
	0,0,0,		/*****	DELAY TABLE INDEX TIMER					*****/
	0,0,		/*****	PIX MASK/OPTO COUNT						*****/
	0,0,		/*****	SPIN/ENABLE FLAGS						*****/
	0,0			/*****	POS CORRECTION/TAB MISSED				*****/
	};
STEPPERZVARS reel1_ram2;
const REEL_ADDR reel1_addr =
	{
	REEL1_OPS,
	REEL1_IP
	};

 /*****	REEL 2 ADDRESS												*****/
STEPPERVARS reel2_ram =
	{
		0,0,		/*****	STEP POSITION/DISTANCE					*****/
		0,			/*****	DIRECTION								*****/
		0,0,		/*****	PATTERN TABLE/INDEX						*****/
		0,			/*****	VECTOR TABLE							*****/
		0,0,0,		/*****	DELAY TABLE INDEX TIMER					*****/
		0,0,		/*****	PIX MASK/OPTO COUNT						*****/
		0,0,		/*****	SPIN/ENABLE FLAGS						*****/
		0,0			/*****	POS CORRECTION/TAB MISSED				*****/
	};
STEPPERZVARS reel2_ram2;
const REEL_ADDR reel2_addr =
	{
	REEL2_OPS,
	REEL2_IP
	};

/*****	REEL 3 ADDRESS												*****/
STEPPERVARS reel3_ram =
	{
		0,0,		/*****	STEP POSITION/DISTANCE					*****/
		0,			/*****	DIRECTION								*****/
		0,0,		/*****	PATTERN TABLE/INDEX						*****/
		0,			/*****	VECTOR TABLE							*****/
		0,0,0,		/*****	DELAY TABLE INDEX TIMER					*****/
		0,0,		/*****	PIX MASK/OPTO COUNT						*****/
		0,0,		/*****	SPIN/ENABLE FLAGS						*****/
		0,0			/*****	POS CORRECTION/TAB MISSED				*****/
	};
STEPPERZVARS reel3_ram2;
const REEL_ADDR reel3_addr =
	{
	REEL3_OPS,
	REEL3_IP
	};

/*****	REEL 4 ADDRESS												*****/
STEPPERVARS reel4_ram =
	{
		0,0,		/*****	STEP POSITION/DISTANCE					*****/
		0,			/*****	DIRECTION								*****/
		0,0,		/*****	PATTERN TABLE/INDEX						*****/
		0,			/*****	VECTOR TABLE							*****/
		0,0,0,		/*****	DELAY TABLE INDEX TIMER					*****/
		0,0,		/*****	PIX MASK/OPTO COUNT						*****/
		0,0,		/*****	SPIN/ENABLE FLAGS						*****/
		0,0			/*****	POS CORRECTION/TAB MISSED				*****/
	};
STEPPERZVARS reel4_ram2;
const REEL_ADDR reel4_addr =
	{
	REEL4_OPS,
	REEL4_IP
	};
const STEPPER reel1 =
	{
	&reel1_addr,
	&RM161680,
	&reel1_ram,
	&reel1_ram2,
	0
	};
const STEPPER reel2 =
	{
	&reel2_addr,
	&RM161680,
	&reel2_ram,
	&reel2_ram2,
	0
	};
const STEPPER reel3 =
	{
	&reel3_addr,
	&RM161680,
	&reel3_ram,
	&reel3_ram2,
	0
	};
const STEPPER reel4 =
	{
	&reel4_addr,
	&RM161680,
	&reel4_ram,
	&reel4_ram2,
	0
	};

 /*****	REEL LIST													*****/
const	STEPPER* const	stepperlist[]=
	{
		&reel1,
		&reel2,
		&reel3,
		&reel4,
		EOF_STEPPERS
	};
const	STEPCFG	StepperCfg=
	{
	stepperlist,
	5,						/* No. of steps to wake up steppers */
	50,						/* delay between steps */
	50						/* opto delay */
	};

//	LED digit list
const	DIGIT	LEDDigitLst[]=
	{
	LED0,
	LED1,
	LED2,
	LED3,
	LED4,
	LED5,
	LED6,
	LED7,
	LED8,
	LED9,
	LED10,
	LED11,
	LED12,
	LED13,
	LED14,
	LED15,
	EOF_DIGITS
	};

/****	Video*/
const	CREMSONCFG	CremsonCfg[]=
	{
	{Cremson800x600,(const RGB*) palette},
//	{Cremson640x480,palette},
//	{Cremson1024x768,palette},
	0
	};


const	CALYPSOCFG	CalypsoCfg[]=
	{
	{Calypso800x600,palette},
//	{Calypso640x480,palette},
//	{Calypso1024x768,palette},
	0
	};

/****	CDRom */
const CDROMCFG CDRomCfg=
	{
	1500,// 1500Initialise time out
	};
const	WORD	IMask1ms=5;
const	WORD	IMask10ms=3;
const	WORD	IMask250ms=2;
/*************************************************************************/