#ifndef __VIP_H
#define __VIP_H


#include "types.h"

/****** VIP Registers ******/
u16* const VIP_REGS = (u16*)0x0005F800;

/****** VIP Register Mnemonics ******/
#define	INTPND	0x00
#define	INTENB	0x01

/* Register for interrupt control */
#define	INTCLR	0x02
#define		TIMEERR		0x8000
#define		XPEND		0x4000
#define		SBHIT		0x2000
#define		FRAMESTART	0x0010
#define		GAMESTART	0x0008
#define		RFBEND		0x0004
#define		LFBEND		0x0002
#define		SCANERR		0x0001

/* Indicatory control register flag */
#define	DPSTTS	0x10
#define	DPCTRL	0x11
#define		LOCK		0x0400			// VPU Select CTA
#define		LOCKOFF		(~LOCK)
#define		SYNCE		0x0200			// L,R_SYNC to VPU
#define		SYNCEOFF	(~SYNCE)
#define		RE		0x0100			// Memory Refresh Cycle On
#define		REOFF		(~RE)
#define		DISP		0x0002			// Display On
#define		DISPOFF		(~DISP)
#define		DPRST		0x0001			// Reset VPU Counter and Wait for FCLK
#define		DPRSTOFF	(~DPRST)
#define		FCLK		0x0080
#define		SCANRDY		0x0040

#define	BRTA	0x12
#define	BRTB	0x13
#define	BRTC	0x14
#define	REST	0x15

#define	FRMCYC	0x17
#define	CTA		0x18

/*** Register for drawing control ***/
#define	XPSTTS	0x20
#define	XPCTRL	0x21
#define		XPEN		0x0002			// Start of drawing
#define		XPENOFF		(~XPEN)
#define		XPRST		0x0001			// Forcing idling
#define		XPRSTOFF	(~XPRST)
#define		SBOUT		0x8000			// In FrameBuffer drawing included
#define		OVERTIME	0x0010			// Processing
#define		XPBSYI		0x0000			// Idling
#define		XPBSY0		0x0004			// In the midst of FrameBuffer0 picture editing
#define		XPBSY1		0x0008			// In the midst of FrameBuffer1 picture editing
#define		XPBSYR		0x000C			// In the midst of drawing processing reset

#define	VER	0x22

#define	SPT0	0x24
#define	SPT1	0x25
#define	SPT2	0x26
#define	SPT3	0x27

#define	GPLT0	0x30
#define	GPLT1	0x31
#define	GPLT2	0x32
#define	GPLT3	0x33

#define	JPLT0	0x34
#define	JPLT1	0x35
#define	JPLT2	0x36
#define	JPLT3	0x37

#define	BKCOL	0x38


#endif
