#include <reg52.h>

#include "Upgrade.h"
#include "PalmChip.h"

void main(void)
{
	// Initialize static values
	Led_Blink(NORMAL_LIGHT);

	Run_22Mhz();		// 22.2Mhz
	CheckSdram();	// Check upgrade mode stored in sdram

	// to avoid warning
	Run_46Mhz();		// 22.2Mhz
#ifndef OPTIONS_PAGE
	BootIndication(0);
#endif
}

#ifdef OPTIONS_PAGE
void SetBootingFlags(UCHAR iFlags)
{
	DCHAR i;
	CCHAR cBooting[] = "Booting ...";

	XBYTE[Sdram_pDataCache+SDRAM_CHECK_POS] = iFlags;
	sdram_write(SDRAM_CHECK_HI, SDRAM_CHECK_LO, SRAM_DMA_HALF_DWORD);
	write_control_byte(0x80);		// first line
	for (i = 0; i < 10; i ++)
	{
		write_data_byte(cBooting[i]);
	}
	BootIndication(0);
	BootIndication(1);
	SwitchPage(OPTIONS_PAGE);
}
#endif
