/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& * Function: emu_Flash_Init * Inputs: none * Outputs: PASS=0 (notice 0=ok here) * Description: Creates & initializes the flash RAM array. * *&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ u16 emu_Flash_Init(void) { int i; nand_dbg_print(NAND_DBG_TRACE, "%s, Line %d, Function: %s\n", __FILE__, __LINE__, __func__); flash_memory[0] = vmalloc(GLOB_LLD_PAGE_SIZE * GLOB_LLD_BLOCKS * GLOB_LLD_PAGES * sizeof(u8)); if (!flash_memory[0]) { printk(KERN_ERR "Fail to allocate memory " "for nand emulator!\n"); return ERR; } memset((char *)(flash_memory[0]), 0xFF, GLOB_LLD_PAGE_SIZE * GLOB_LLD_BLOCKS * GLOB_LLD_PAGES * sizeof(u8)); for (i = 1; i < GLOB_LLD_BLOCKS * GLOB_LLD_PAGES; i++) flash_memory[i] = flash_memory[i - 1] + GLOB_LLD_PAGE_SIZE; emu_load_file_to_mem(); /* Load nand emu file to mem */ return PASS; }
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& * Function: emu_Flash_Init * Inputs: none * Outputs: PASS=0 (notice 0=ok here) * Description: Creates & initializes the flash RAM array. * *&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ uint16 emu_Flash_Init() { int i; #if FLASH_EMU_STATIC_MALLOC GLOB_flash_memory[0] = (unsigned char *)GLOB_MALLOC(GLOB_LLD_PAGE_SIZE * GLOB_LLD_BLOCKS*GLOB_LLD_PAGES * sizeof(unsigned char)); memset((char *)(GLOB_flash_memory[0]), 0xFF, GLOB_LLD_PAGE_SIZE * GLOB_LLD_BLOCKS*GLOB_LLD_PAGES * sizeof(unsigned char)); #else GLOB_flash_memory[0] = NULL; #endif for(i=1;i<GLOB_LLD_BLOCKS*GLOB_LLD_PAGES;i++) { #if FLASH_EMU_STATIC_MALLOC GLOB_flash_memory[i] = GLOB_flash_memory[i-1] + GLOB_LLD_PAGE_SIZE; #else GLOB_flash_memory[i] = NULL; #endif } #if EMU_BAD_BLOCK emu_init_bad_block_info(); #endif #if FLASH_EMU_STATIC_MALLOC emu_load_file_to_mem(); #endif return PASS; }