unsigned short	TFTRAM[384000]	__attribute__((at(0x64000000)));

char	SSDconfig [] = 
			{	/*Size of the thumb wo this	*/				81,
				/*Software Reset						*/				0x01, 0,
				/*Set PLL NM								*/				0xE2, 3, 0x23, 0x02, 0x04,																//Software reset
				/*Set PLL										*/				0xE0, 1, 0x01,																						//Enable PLL
				/*Set PLL										*/				0xE0, 1, 0x03,																						//Use PLL
				/*Software, Reset						*/				0x01, 0,																									//Software reset
				/*Set Lshift Freq						*/				0xE6, 3, 0x01, 0x70, 0xA2,																//Pixel clock setup: 800x480x25Hz = 9.6MHz (0x0170A2)
				/*Set Pixel Data Interface	*/				0xF0, 1, 0x03,																						//MCU interface setup: 0x03 (16bit, RGB 565 format)	(PHYSICAL BUS WIDE)
				/*Set LCD Mode							*/				0xB0, 7, 0x00, 0x20, 0x03, 0x1F, 0x01, 0xDF, 0x00, 				//LCD mode setup
				/*Set Hori Period		35-	*/						0xB4,	8, 0x03, 0x52, 0x00, 0x33, 0x30, 0x00, 0x00, 0x00, 	//Horisontal Periodical Setup
				/*Set	Vert Period		45----	*/				0xB6,	7, 0x02, 0x12, 0x00, 0x32, 0x03, 0x00, 0x1E, 				//Vertical Periodical Setup
				/*Set Pwm Configuration			*/				0xBE, 6, 0x0A, 0x80, 0x01, 0x00, 0x00, 0x00,							//Backlight PWM setup:
				/*Set Display On						*/				0x29, 0,																									//Switch the display on
				/*Set GPIO configuration		*/				0xB8, 2, 0x0F, 0x01,																			//GPIO setup: All GPIO output, GPIO[0] normal IO
				/*Set GPIO value						*/				0xBA, 1, 0x0F,																						//All GPIO turn on
				/*Set Column Address				*/				0x2A, 4, 0x00, 0x00, 0x03, 0x20,
				/*Set Page Address					*/				0x2B, 4, 0x00, 0x00, 0x01, 0xE0
				};

unsigned long		HSYNCperiod			= 1056;
unsigned long		HSYNCpulsewidth	= 1;
unsigned long		HSYNCbackporch	= 45;
unsigned long		HSYNCfrontporch = 210;


unsigned long		VSYNCperiod			= 635;
unsigned long		VSYNCpulsewidth	= 1;
unsigned long		VSYNCbackporch	= 22;
unsigned long		VSYNCfrontporch	= 132;

unsigned long		SSDFxtal				= 10;			//XTAL to the SSD1963 = 10 000 kHz
unsigned long		SSD_VCOFreq			= 360;		//SSD internal PLL freq = 360MHz
unsigned long		SSD_PLLFreq			= 120;
unsigned long		HRES						= 800;					//Horisontal Resolution					[pixel]
unsigned long		VRES						= 480;					//Vertical Resolution					[pixel]
unsigned long		RefreshRate			= 25;						//Display Refresh rate					[Hz]
unsigned long		PixelFreq				= 40;


#define		ClockFreq		50000000;

//-------------------------------------------------------------------------------------------------------------------------
#define	CS_Low			GPIOB->BSRRH		=	0x8000;					//Selected
#define	CS_High			GPIOB->BSRRL		=	0x8000;					//Deselected
#define	RS_Low			GPIOB->BSRRH		=	0x4000;					//Command
#define	RS_High			GPIOB->BSRRL		=	0x4000;					//Data
#define	WR_Low			GPIOB->BSRRH		=	0x2000;
#define	WR_High			GPIOB->BSRRL		=	0x2000;
#define	RD_Low			GPIOB->BSRRH		=	0x1000;
#define	RD_High			GPIOB->BSRRL		=	0x1000;
#define	RST_Low			GPIOB->BSRRH		=	0x8000;					//Hold in Reset
#define	RST_High		GPIOB->BSRRL		=	0x8000;					//Relased

typedef struct
{
  __IO uint16_t LCD_REG;
  __IO uint16_t LCD_RAM;
}LCD_TypeDef;

#define	LCD_REG       (*((volatile unsigned short *) 0x6C000000)) // RS = 0	Command
#define LCD_RAM       (*((volatile unsigned short *) 0x6C000002)) // RS = 1	Data
				

