#include "p_apps.h"

#include <reg52.h>

void RunUpgrade()
{
	// We can only use "data" var in this function, "xdata" will cause failure
	DCHAR i, iIndexLo;
	PXCHAR_D pCur;

	// switch to upgrade 
	EA = 0;		// disable all interrupts

	pCur = (PXCHAR)SRAM_START;
	iIndexLo = PAGE128_SDRAM_LO;
	for (i = 0; i < 16; i ++)
	{
		SdramRead(PAGE128_SDRAM_HI, iIndexLo, SRAM_DMA_HALF_DWORD);
		p_memcpy_x2x(pCur, (PXCHAR)Sdram_pDataCache, 0);
		iIndexLo ++;
		pCur += 256;
    }
	SwitchPage(128);
}
