/** * Initialize Board * * @param none * @return none * * @brief Initialize Board */ static void Board_Init() { /* init nand */ NandFlash_Init(); /* init nor */ NORFLASHInit(); /* init eeprom */ EEPROM_24c02_Init(); /* init option */ optionSaveStruct=EEPROM_ReadStruct(); ipConfig=optionSaveStruct.ipConfig; /* init lcd */ //TFT_Init(); }
/*********************************************************************//** * @brief c_entry: Main ADC program body * @param[in] None * @return None **********************************************************************/ void c_entry(void) { uint32_t i; volatile uint16_t *ip; uint32_t NorFlashAdr; /* Initialize debug via UART0 * – 115200bps * – 8 data bit * – No parity * – 1 stop bit * – No flow control */ debug_frmwrk_init(); // print welcome screen print_menu(); _DBG_("Init NOR Flash..."); NORFLASHInit(); _DBG_("Read NOR Flash ID..."); if ( NORFLASHCheckID() == FALSE ) { _DBG_("Error in reading NOR Flash ID, testing terminated!"); while ( 1 ); /* Fatal error */ } _DBG_("Erase entire NOR Flash..."); NORFLASHErase(); /* Chip erase */ /* Write to flash with pattern 0xAA55 and 0xA55A */ NorFlashAdr = NOR_FLASH_BASE; _DBG_("Write a block of 2K data to NOR Flash..."); for ( i = 0; i < NORFLASH_RW_PAGE_SIZE/2; i++ ) { NORFLASHWriteWord( NorFlashAdr, 0xAA55 ); NorFlashAdr++; NORFLASHWriteWord( NorFlashAdr, 0xA55A ); NorFlashAdr++; } /* Verify */ _DBG_("Verify data..."); NorFlashAdr = NOR_FLASH_BASE; for ( i = 0; i < NORFLASH_RW_PAGE_SIZE/2; i+=2 ) { ip = GET_ADDR(i); if ( (*ip & 0xFFFF) != 0xAA55 ) { _DBG_("Verifying fail, testing terminated!"); while ( 1 ); /* Fatal error */ } ip = GET_ADDR(i+1); if ( (*ip & 0xFFFF) != 0xA55A ) { _DBG_("Verifying fail, testing terminated!"); while ( 1 ); /* Fatal error */ } } // terminated _DBG_("Verifying complete! Testing terminated!"); while (1); }