/**************************************************************************** **************************************************************************** Erase/Program DB1100 flash : INPUT : OUTPUT : RETURN error code ****************************************************************************/ static BDI_InitTypeT initListDB1100[] = { {BDI_INIT_MIPS_WGPR, 8007, 0xA0001000}, //Define a workspace for fast dump/verify {BDI_INIT_MIPS_WM32, 0xB1900060, 0x00000021}, //CPU_PLL Configuration {BDI_INIT_MIPS_DELAY, 0, 100 }, {BDI_INIT_MIPS_WM32, 0xB1900038, 0x00000001}, //Set to Little Endian {BDI_INIT_MIPS_WCP0, 16, 0x00000003}, {BDI_INIT_MIPS_WM32, 0xB4001000, 0x00000003}, //RCS0 Configuration {BDI_INIT_MIPS_WM32, 0xB4001004, 0x040181D7}, //RCS0 Timing {BDI_INIT_MIPS_WM32, 0xB4001008, 0x11E03F80}, //RCS0 Address {BDI_INIT_MIPS_WM32, 0xB4001010, 0x00000080}, //RCS1 Configuration {BDI_INIT_MIPS_WM32, 0xB4001014, 0x22080A20}, //RCS1 Timing {BDI_INIT_MIPS_WM32, 0xB4001018, 0x10C03F00}, //RCS1 Address {BDI_INIT_MIPS_WM32, 0xB4001030, 0x00000002}, //RCS3 Configuration {BDI_INIT_MIPS_WM32, 0xB4001034, 0x280E3E07}, //RCS3 Timing {BDI_INIT_MIPS_WM32, 0xB4001038, 0x10000000}, //RCS3 Address {BDI_INIT_MIPS_WM32, 0xB4000000, 0x005522AA}, //CS0 mode configuration {BDI_INIT_MIPS_WM32, 0xB4000004, 0x005522AA}, //CS1 mode configuration {BDI_INIT_MIPS_WM32, 0xB4000008, 0x00000000}, //CS2 mode configuration {BDI_INIT_MIPS_WM32, 0xB400000C, 0x001003F8}, //CS0 address, 32MB at 0x00000000 {BDI_INIT_MIPS_WM32, 0xB4000010, 0x001023F8}, //CS1 address, 32MB at 0x02000000 {BDI_INIT_MIPS_WM32, 0xB4000014, 0x00000000}, //CS2 address, {BDI_INIT_MIPS_WM32, 0xB4000018, 0x64000C24}, //Program refresh (disabled) {BDI_INIT_MIPS_WM32, 0xB400001C, 0x00000000}, //Precharge all banks {BDI_INIT_MIPS_WM32, 0xB4000020, 0x00000000}, //Issue two auto refreshes {BDI_INIT_MIPS_WM32, 0xB4000020, 0x00000000}, //Issue two auto refreshes {BDI_INIT_MIPS_WM32, 0xB4000018, 0x66000C24}, //Enable refresh {BDI_INIT_MIPS_WM32, 0xB4000024, 0x00000033}, //CS0 set mode {BDI_INIT_MIPS_WM32, 0xB4000028, 0x00000033}, //CS1 set mode {BDI_INIT_MIPS_WM32, 0xB400002C, 0x00000000}, //CS2 set mode }; static int ProgramDB1100(void) { int result; DWORD errorAddr; /* setup flash type */ result = BDI_FlashSetType(BDI_FLASH_MIRRORX16, 0x800000, 0, 32, 0xA0001000); /* reset and configure tagret */ result = BDI_TargetStartup(100, // 100ms reset time (0L << 16) | (1L << 8) | 0, // little endian, Au1000, 16MHz JTAG sizeof initListDB1100 / sizeof initListDB1100[0], initListDB1100); /* erase flash */ printf("erasing ... "); result = BDI_FlashEraseSector(0xBFC80000); result = BDI_FlashEraseSector(0xBFCA0000); result = BDI_FlashEraseSector(0xBFCC0000); result = BDI_FlashEraseSector(0xBFCE0000); printf("passed\n"); /* program from a binary file */ printf("programming..."); // result = BDI_FlashWriteBinary("e:/temp/dump512k.bin", 0xBFC80000, &errorAddr); result = BDI_FlashWriteFile("e:/temp/dump512k.s19", &errorAddr); printf("passed\n"); /* verify */ printf("verifing... "); // result = BDI_VerifyBinary("e:/temp/dump512k.bin", 0xBFC80000, &errorAddr); result = BDI_VerifyFile("e:/temp/dump512k.s19", &errorAddr); printf("passed\n"); return result; } /* ProgramDB1100 */