static void plug_devices(void) { /* Port ranges 0x0 -> 0xF */ port_map[0x0] = init_control(); port_map[0x1] = init_flash(); port_map[0x2] = init_sha256(); port_map[0x3] = init_usb(); port_map[0x4] = init_lcd(); port_map[0x5] = init_intrpt(); port_map[0x6] = init_watchdog(); port_map[0x7] = init_gpt(); port_map[0x8] = init_rtc(); port_map[0x9] = init_protected(); port_map[0xA] = init_keypad(); port_map[0xB] = init_backlight(); port_map[0xC] = init_cxxx(); port_map[0xD] = init_dxxx(); port_map[0xE] = init_exxx(); port_map[0xF] = init_fxxx(); reset_proc_count = 0; /* Populate reset callbacks */ add_reset_proc(lcd_reset); add_reset_proc(keypad_reset); add_reset_proc(gpt_reset); add_reset_proc(rtc_reset); add_reset_proc(watchdog_reset); add_reset_proc(cpu_reset); gui_console_printf("[CEmu] Initialized APB...\n"); }
int __init omap_toto_mtd_init(void) { int status; if (status = init_flash()) { printk(KERN_ERR "OMAP Toto Flash: unable to init map for toto flash\n"); } return status; }
/** * @brief * init opendir test * */ void init_readdirTest(){ if(nandInit()) return; init_flash(); initializeRamStructs(); handleNoFs(); init_fsbuf(fs_buffer); }
/** * @brief * tear down open test * */ void tearDown_openTest(){ init_flash(); init_file_entries(); init_vnodes(); init_transactions(); nandTerminate(); init_fsbuf(fs_buffer); initializeRamStructs(); }
/** * @brief * init open test * */ void init_openTest(){ if(nandInit()) return; // PRINT("\nstart init_openTest()"); init_flash(); init_file_entries(); init_vnodes(); init_transactions(); initializeRamStructs(); handleNoFs(); init_fsbuf(fs_buffer); // PRINT("\nfinished init_openTest()"); // bool_t pendingVOTs; // /* boot sequencing layer */ // VERIFY(!sequencingBooting(fs_ptr, sizeof(filesystem_t), &pendingVOTs, checkpointWriter)); }
static rtems_task gui_task(rtems_task_argument argument) { init_fb_mtk(sysconfig_get_autostart_mode() == SC_AUTOSTART_FILE); sysconfig_set_mtk_language(); sysconfig_set_mtk_wallpaper(); init_input(); input_add_callback(mtk_input); init_shortcuts(); init_osc(); init_messagebox(); init_performance(); init_renderer(); init_cp(); init_keyboard(); init_ir(); init_audio(); init_midi(); init_oscsettings(); init_dmxspy(); init_dmxdesk(); init_dmx(); init_videoin(); init_rsswall(); init_patcheditor(); init_monitor(); init_firstpatch(); init_filemanager(); #ifdef WITH_PDF init_pdfreader(); #endif init_sysettings(); init_about(); init_flash(); init_shutdown(); cp_autostart(); if(sysconfig_is_rescue()) messagebox("Rescue mode", "You have booted in rescue mode.\n" "Your system will function as usual, using back-up software.\n" "From there, you can update the main software or perform\nother actions to fix the problem.\n"); /* FIXME: work around "black screen" bug in MTK */ mtk_cmd(1, "screen.refresh()"); input_eventloop(); }
int main(int argc, char *argv[]) { int ret = 0; struct SceIoStat stat; SceCtrlData ctl; u32 key; memset(&stat, 0, sizeof(stat)); pspDebugScreenInit(); psp_fw_version = sceKernelDevkitVersion(); #ifdef CONFIG_620 if(psp_fw_version == FW_620) { goto version_OK; } #endif #ifdef CONFIG_635 if(psp_fw_version == FW_635) { goto version_OK; } #endif #ifdef CONFIG_639 if(psp_fw_version == FW_639) { goto version_OK; } #endif #if defined(CONFIG_660) || defined(CONFIG_661) if((psp_fw_version == FW_660) || (psp_fw_version == FW_661)) { goto version_OK; } #endif printf("Sorry. This program doesn't support your FW(0x%08X).\n", (uint)psp_fw_version); goto exit; version_OK: psp_model = kuKernelGetModel(); scePowerSetClockFrequency(333, 333, 166); init_flash(); usage(); printf("Press X to launch CFW.\n"); printf("Press Triangle to uninstall CFW.\n"); printf("Hold L to reinstall CFW.\n"); printf("Press R to exit.\n"); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; while (0 == (key & (PSP_CTRL_CROSS | PSP_CTRL_RTRIGGER | PSP_CTRL_TRIANGLE))) { sceKernelDelayThread(50000); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; } if (key & PSP_CTRL_RTRIGGER) { printf("Exiting...\n"); cleanup_exit(); sceKernelDelayThread(100000); sceKernelExitGame(); } switch(psp_model) { case PSP_GO: printf("PSP GO BRITE Detected ....\n"); break; case PSP_9000: printf("PSP BRITE 3000(09g) Detected ....\n"); break; case PSP_7000: printf("PSP BRITE 3000(07g) Detected ....\n"); break; case PSP_4000: printf("PSP BRITE 3000(04g) Detected ....\n"); break; case PSP_3000: printf("PSP BRITE 3000 Detected ....\n"); break; case PSP_2000: printf("PSP SLIM 2000 Detected ....\n"); break; case PSP_1000: printf("PSP FAT 1000 Detected ....\n"); break; case PSP_11000: printf("PSP STREET E1000 Detected ....\n"); break; default: printf("Unknown PSP model 0%dg\n", psp_model+1); break; } sceCtrlReadBufferPositive(&ctl, 1); if (ctl.Buttons & PSP_CTRL_LTRIGGER) { disable_smart = 1; } if (key & PSP_CTRL_CROSS) { ret = install_cfw(); if (ret == 0) { printf(" Completed.\nPress X to start CFW.\n"); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; while (0 == (key & PSP_CTRL_CROSS)) { sceKernelDelayThread(50000); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; } printf("Now reboot to " VERSION_STR " :)\n"); start_reboot(1); } } else if (key & PSP_CTRL_TRIANGLE) { ret = uninstall_cfw(); printf("Now reboot to OFW :)\n"); sceKernelDelayThread(1000000); start_reboot(0); } exit: printf("Press X to exit.\n"); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; while (0 == (key & PSP_CTRL_CROSS)) { sceKernelDelayThread(50000); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; } cleanup_exit(); sceKernelExitGame(); return 0; }
//int main(void) { ////main function int main (void) { u32 waitForCard = 0; // set up avr32 hardware and peripherals init_avr32(); print_dbg("\r\n SRAM size: 0x"); print_dbg_hex(smc_get_cs_size(1)); cpu_irq_disable(); /// test the SRAM sram_test(); cpu_irq_enable(); //memory manager init_mem(); print_dbg("\r\n init_mem"); // wait for sdcard print_dbg("\r\n SD check... "); while (!sd_mmc_spi_mem_check()) { waitForCard++; } print_dbg("\r\nfound SD card. "); // intialize the FAT filesystem print_dbg("\r\n init fat"); fat_init(); // setup control logic print_dbg("\r\n init ctl"); init_ctl(); /* // initialize the application */ /* app_init(); */ /* print_dbg("\r\n init app"); */ // initialize flash: firstrun = init_flash(); print_dbg("r\n init flash, firstrun: "); print_dbg_ulong(firstrun); screen_startup(); // find and load dsp from sdcard files_search_dsp(); print_dbg("\r\n starting event loop.\r\n"); // dont do startup startup = 0; while(1) { check_events(); } }
void main(void) { byte test; byte manuf_id; word device_id; byte far *str; word test2,i; dword sec_size=0; long count=0; printf("Beginning test.....\n\n"); /* First, poke around the memory map to see what kind of flash is installed in the socket...assume a DL800B */ /* The purpose of init_flash is to perform any system memory mapping required, and to set up pointers to those region(s). init_flash() also selects the proper sector organization table defined in flash.c Note: init_flash() will need to be provided by users of the flash.c routines */ if(!init_flash(AM29DL800B)) { exit(1); } /* Verify the manufacturer code is indeed 0x01 for AMD */ manuf_id = flash_get_manuf_code(0); switch(manuf_id) { case AMDPART: printf("AMD Flash found in socket...\n"); break; default: printf("Non AMD part found in socket...exiting.\n"); exit(1); break; } /* Poll the device id so that the proper sector layout table is used for the device in the socket */ printf("Polling part for Device ID..."); /* Retrieve the device ID for this AMD flash part. All device id's are stored in flash.h */ device_id = flash_get_device_id(0); switch(device_id) { case ID_AM29DL800T: printf("found an Am29DL800T\n"); if(!init_flash(AM29DL800T)) exit(1); break; case ID_AM29DL800B: printf("found an Am29DL800B\n"); if(!init_flash(AM29DL800B)) exit(1); break; case ID_AM29LV800T: printf("found an Am29LV800T\n"); if(!init_flash(AM29LV800T)) exit(1); break; case ID_AM29LV800B: printf("found an Am29LV800B\n"); if(!init_flash(AM29LV800B)) exit(1); break; case ID_AM29LV160B: printf( "found an Am29LV160B\n"); if(!init_flash(AM29LV160B)) exit(1); break; case ID_AM29LV400B: printf( "found an Am29LV400B\n"); if(!init_flash(AM29LV400B)) exit(1); break; default: printf("error reading Device ID...exiting.\n"); exit(1); break; } randomize(); /* flash_get_status uses DQ7, DQ5, and DQ2 polling to get the status of the flash. All status codes are defined in flash.h Also note that for the DL parts, status is bank dependent */ printf("Checking current flash status...flash is "); test = flash_get_status(0); switch(test) { case STATUS_READY: printf("[Ready]\n");break; case STATUS_BUSY: printf("[Busy]\n");break; case STATUS_ERSUSP: printf("[Erase Suspended]\n");break; case STATUS_TIMEOUT: printf("[Timed Out]\n");break; default: printf("Error!\n"); exit(1);break; } printf("Performing API tests...\n\n"); /* flash_sector_erase_int() is the function which erases a single sector. It is different from flash_sector_erase() in that it 'interrupts' execution of the program until the erase is completed. For erasing a sector without pausing use flash_sector_erase(). */ flash_reset(); /* Quick safe check */ printf("Erasing sector 8..."); flash_sector_erase_int(8); printf("done.\n"); printf("Verifying erase..."); flash_get_sector_size(8, &sec_size); /* Get # of byte */ /* A simple test which reads every word from the flash, and checks to see if every word contains the data 0xFFFF, which indicates an erased word. */ for (count=0 ; count < (sec_size/2); count++) { if(count%2048 == 0) printf("."); /*print out some dots to show the program hasn't frozen */ if (flash_read_word(8,count) != 0xFFFF) { printf("erase not completed sucessfully!\n"); exit(1); } } printf("erase successful.\n"); /* flash_write_word() takes word data and programs it to the flash at the indicated offset. Note that this data must be *word aligned*, or else programming errors can result. It is also good to check the word for 0xFFFF data before programming. */ printf("Writing a single word [0xABCD]\n"); flash_write_word(8,0,0xABCD); /* flash_read_word() returns a single word of data at the specified sector/offset . Must also be word aligned */ printf("After write(0xABCD): %4x\n", flash_read_word(8,0)); str = (byte far *) calloc(0x7FFF, sizeof(byte)); /* Randomize the string with random ASCII characters */ for(i=0; i<0x7FFF; i++) { str[i] = (byte) (41 + (rand() % 26)); } printf("Erasing sector 9..."); flash_sector_erase_int(9); printf("done.\n"); /* flash_write_string() is a function to program bulk data from a C buffer. It is a bit faster than looping techniques using flash_write_word() because function overhead is eliminated. */ printf("Writing 32 kbyte string..."); flash_write_string(9,0,str,0x7FFE); printf("done.\n\n"); printf("Testing erase suspend\n"); printf("Beginning erase...\n"); /* This is an example of flash_sector_erase(). Note that the program will simply issue the command, and execution will continue while the flash is erasing. */ flash_sector_erase(10); /* flash_erase_suspend will suspend an erase in progress. The application can then do any reading of data from that sector, or another sector. */ printf("Suspending erase..."); flash_erase_suspend(10); printf("done.\n"); /* The current flash status should now be STATUS_ERSUSP */ printf("Checking current flash status...flash is "); test = flash_get_status(10); switch(test) { case STATUS_READY: printf("[Ready]\n");break; case STATUS_BUSY: printf("[Busy]\n");break; case STATUS_ERSUSP: printf("[Erase Suspended]\n");break; case STATUS_TIMEOUT: printf("[Timed Out]\n");break; default: printf("Error!\n"); exit(1);break; } /* Now we can resume the erase previously suspended */ printf("Resuming erase after status check.."); flash_erase_resume(10); printf("done.\n"); /* Now for a test of unlock bypass mode */ /* Unlock bypass allows for faster programming of flash data in that the number of required bus cycles is cut in half. The most benefit can be realized when programming large amounts of data using flash_write_string_ub() */ printf("Entering unlock bypass mode...\n"); flash_sector_erase_int(11); flash_ub(11); /* Enter unlock bypass mode */ printf("Programming a string in unlock bypass mode.."); flash_write_string_ub(11,0,str,0x7FFE); printf("done.\n"); printf("Exiting unlock bypass mode..\n"); flash_reset_ub(); flash_reset(); /* Last thing is a quick loop through all the sectors to check for sector protection. */ printf("\nVerifying sector protection...\n"); flash_get_numsectors(&test2); printf("This device contains %3i sectors: \n", test2); for(i=0; i < test2; i++) { test = flash_sector_protect_verify(i); flash_get_sector_size(i, &size); printf("Verify sector #%2i, size [%-5li]: ", i, size); if (test == 0x01) printf("sector is protected[%2i].\n", test); else printf("sector is not protected[%2i].\n", test); flash_reset(); } printf("Test drive done!\n"); free(str); exit(0); }
/** * @brief * tear down opendir test * */ void tearDown_readdirTest(){ init_flash(); nandTerminate(); initializeRamStructs(); }
/** * @brief Post-initialization of SDF agent engine (fthread safe) * * Order of initialization (change accordingly): <br> * * 1. init_flash <br> * 2. init_action_home <br> * 3. home_flash_start <br> * 3. async_puts_start <br> * 4. spawn home node fthreads <br> * 5. init_containers <br> * * @return status, SDF_TRUE on success */ SDF_boolean_t agent_engine_post_init(struct sdf_agent_state * state ) { SDF_boolean_t success = SDF_TRUE; /* * Enable the Replication only if my node is part of * N+1, 2way, simple replication */ #ifdef SIMPLE_REPLICATION int grp_type; grp_type = SDFMyGroupGroupTypeFromConfig(); if( (grp_type == SDF_REPLICATION_V1_2_WAY) || (grp_type == SDF_REPLICATION_V1_N_PLUS_1)) { plat_log_msg(20851, LOG_CAT,PLAT_LOG_LEVEL_TRACE," Replication StateMachine Turned ON\n"); state->config.always_replicate = 1; } #endif /* * Initialize the flash subsystem. */ if (success) { success = init_flash(state ); plat_log_msg(20852, LOG_CAT, success ? LOG_LEV : PLAT_LOG_LEVEL_DEBUG, "init_flash = %u", success); } /* * Initialize the action and home protocol threads. */ if (success) { success = init_action_home(state); plat_log_msg(20853, LOG_CAT, success ? LOG_LEV : PLAT_LOG_LEVEL_DEBUG, "init_action_home = %u", success); } if ((!SDFNew_Mode) || SDFEnable_Replication) { /* we don't use any of this stuff in streamlined SDF mode */ /* * Initialize the home flash threads. */ if (success) { success = home_flash_start( state->FlashInitState.pfs ); /* * FIXME: home_flash_start returns 0 as success */ success = ( 0 == success ) ? SDF_TRUE : SDF_FALSE; plat_log_msg(20854, LOG_CAT, success ? LOG_LEV : PLAT_LOG_LEVEL_DEBUG, "home_flash_start = %u", success); } /* * Initialize the replication subsystem. */ // XXX: drew 2008-08-29 conditional until replication is re-fixed if (success && state->config.always_replicate) { success = sdf_replicator_adapter_start(state->ReplicationInitState.adapter); success = ( 0 == success ) ? SDF_TRUE : SDF_FALSE; plat_log_msg(20855, LOG_CAT, success ? LOG_LEV : PLAT_LOG_LEVEL_DEBUG, "sdf_replicator_adapter_start = %u", success); if (success) { struct sdf_replicator *replicator = NULL; replicator = sdf_replicator_adapter_get_replicator(state->ReplicationInitState.adapter); /* Request liveness callbacks from the messaging system */ msg_livecall(1, 1, live_back, replicator); } } } /* * Initialize the async put threads. */ if (success) { success = async_start( state->AsyncPutsInitState.paps ); /* * FIXME: async_puts_start returns 0 as success */ success = success ? SDF_TRUE : SDF_FALSE; plat_log_msg(20856, LOG_CAT, success ? LOG_LEV : PLAT_LOG_LEVEL_DEBUG, "async_puts_start = %u", success); } /* * Initialize the CMC. */ if (success) { // schedule_container_thread(state); success = init_containers(state); plat_log_msg(20857, LOG_CAT, success ? LOG_LEV : PLAT_LOG_LEVEL_DEBUG, "init_containers = %u", success); } /* Declare ourselves alive */ //msg_map_alive(); return (success); }