/* * Exit emulator */ static void do_exit_machine (void) { graphics_leave (); inputdevice_close (); #ifdef SCSIEMU scsidev_exit (); #endif DISK_free (); audio_close (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CD32 akiko_free (); #endif gui_exit (); #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); hardfile_cleanup (); rtarea_cleanup (); #endif #ifdef SAVESTATE savestate_free (); #endif memory_cleanup (); cfgfile_addcfgparam (0); }
void do_leave_program (void) { graphics_leave (); inputdevice_close (); #ifdef SCSIEMU scsidev_exit (); #endif DISK_free (); close_sound (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif /* #ifdef CD32 akiko_free (); #endif */ if (! no_gui) gui_exit (); #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); #endif #ifdef SAVESTATE savestate_free (); #endif memory_cleanup (); cfgfile_addcfgparam (0); }
void do_leave_program (void) { sampler_free (); graphics_leave (); inputdevice_close (); DISK_free (); close_sound (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CDTV cdtv_free (); #endif #ifdef A2091 a2091_free (); a3000scsi_free (); #endif #ifdef NCR ncr710_free(); ncr_free(); #endif #ifdef NCR9X ncr9x_free(); #endif #ifdef CD32 akiko_free (); cd32_fmv_free(); #endif if (! no_gui) gui_exit (); #ifdef USE_SDL SDL_Quit (); #endif #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); #endif #ifdef BSDSOCKET bsdlib_reset (); #endif gayle_free (); device_func_reset (); #ifdef WITH_LUA uae_lua_free (); #endif savestate_free (); memory_cleanup (); free_shm (); cfgfile_addcfgparam (0); machdep_free (); }
void do_leave_program (void) { #ifdef SAMPLER sampler_free (); #endif graphics_leave (); inputdevice_close (); DISK_free (); close_sound (); dump_counts (); #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CDTV cdtv_free (); #endif #ifdef A2091 a2091_free (); #endif #ifdef NCR ncr_free (); #endif #ifdef CD32 akiko_free (); #endif if (! no_gui) gui_exit (); #ifdef USE_SDL SDL_Quit (); #endif #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef FILESYS filesys_cleanup (); #endif #ifdef BSDSOCKET bsdlib_reset (); #endif #ifdef SCSIEMU #ifdef GAYLE gayle_free (); #endif device_func_reset (); #endif savestate_free (); memory_cleanup (); #ifdef NATMEM_OFFSET free_shm (); #endif cfgfile_addcfgparam (0); machdep_free (); }
void do_leave_program (void) { graphics_leave (); close_joystick (); close_sound (); dump_counts (); zfile_exit (); #ifdef USE_SDL SDL_Quit (); #endif memory_cleanup (); }
int main() { init(); // Main Game running loop // while (1){ // //printf("%d \n", *(world_calc+1)); // display_world(); // } conway_test(); memory_cleanup(); }
void do_leave_program (void) { #ifdef USE_SDL if(current_screenshot != NULL) SDL_FreeSurface(current_screenshot); #endif graphics_leave (); close_joystick (); close_sound (); zfile_exit (); #ifdef USE_SDL SDL_Quit (); #endif memory_cleanup (); }
void do_leave_program (void) { graphics_leave (); inputdevice_close (); close_sound (); dump_counts (); serial_exit (); zfile_exit (); if (! no_gui) gui_exit (); #ifdef USE_SDL SDL_Quit (); #endif expansion_cleanup (); memory_cleanup (); }
void reset_all_systems (void) { init_eventtab (); // thinkp memory_cleanup (); memory_init (); // thinkp memory_reset (); #ifdef BSDSOCKET bsdlib_reset (); #endif #ifdef FILESYS filesys_reset (); filesys_start_threads (); hardfile_reset (); #endif #ifdef SCSIEMU scsidev_reset (); scsidev_start_threads (); #endif }
void do_leave_program (void) { sampler_free (); graphics_leave (); inputdevice_close (); DISK_free (); close_sound (); dump_counts (); #ifdef PARALLEL_PORT parallel_exit(); #endif #ifdef SERIAL_PORT serial_exit (); #endif #ifdef CDTV cdtv_free(); cdtvcr_free(); #endif #ifdef A2091 a2091_free (); gvp_free (); a3000scsi_free (); #endif soft_scsi_free(); #ifdef NCR ncr_free(); #endif #ifdef NCR9X ncr9x_free(); #endif #ifdef CD32 akiko_free (); cd32_fmv_free(); #endif if (! no_gui) gui_exit (); #ifdef USE_SDL SDL_Quit (); #endif #ifdef AUTOCONFIG expansion_cleanup (); #endif #ifdef WITH_PCI pci_free(); #endif #ifdef WITH_X86 x86_bridge_free(); #endif #ifdef FILESYS filesys_cleanup (); #endif #ifdef BSDSOCKET bsdlib_reset (); #endif gayle_free (); idecontroller_free(); device_func_reset (); #ifdef WITH_LUA uae_lua_free (); #endif #ifdef WITH_PPC uae_ppc_free(); #endif #ifdef WITH_TOCCATA sndboard_free(); #endif gfxboard_free(); #ifdef SAVESTATE savestate_free (); #endif memory_cleanup (); free_shm (); cfgfile_addcfgparam (0); machdep_free (); #ifdef DRIVESOUND driveclick_free(); #endif ethernet_enumerate_free(); }
/** * Bootloader main entry */ int main(void) { uint8_t boot_region = 0; /* Real boot region at this time */ #ifdef DBG_USE_USART uint8_t load_region = 0; /* Real region to put loaded data */ #endif struct regions_info info; void *app_addr = NULL; uint32_t app_size = 0; enum trigger_modes trigger; bool app_valid = false; wdt_disable(WDT); sysclk_init(); board_init(); /* First turn on the led to indicate the bootloader run. */ ioport_set_pin_dir(DBG_LED_PIN, IOPORT_DIR_OUTPUT); ioport_set_pin_level(DBG_LED_PIN, DBG_LED_PIN_ON_LEVEL); dbg_init(); dbg_print("\r\n\n----------------------\r\n"); dbg_print("%s Bootloader\r\n", BOARD_NAME); dbg_print("Boot region: %x, size %dK\r\n", BOOT0_START, BOOT_SIZE / 1024); dbg_print("App region: %x, size %dK\r\n", APP0_START, (int)APP_SIZE / 1024); dbg_print(" - Code %dK + Info %dK\r\n", (int)APP_CODE_SIZE, (int)INFO_SIZE); dbg_print("----------------------\r\n"); /* bootloader initialize */ dbg_print("bl: init ...\r\n"); trigger_init(); memory_init(); media_init(file_list, MEDIA_FILE_LIST_LEN); dbg_print("bl: init done\r\n"); boot_region = _app_boot_get(); dbg_print("bl: current boot region %d\r\n", (int)boot_region); #ifdef MEM_LOCK_BOOT_REGION dbg_print("bl: lock boot region ...\r\n"); memory_lock((void *)BOOT0_START, (void *)BOOT0_END); dbg_print("bl: lock boot region done\r\n"); #endif /* load regions information * Single flash: from last page * Dual flash (remap) : from last page of last physical flash * Dual flash (mirror): from last page of boot flash */ dbg_print("bl: read regions info ...\r\n"); region_info_read((void *)INFO_ADDR(true), &info); /* Read for boot */ app_addr = (void *)(APP_START(boot_region)); app_valid = region_check_valid(app_addr, info.length[boot_region], info.signature[boot_region]); dbg_print("bl: read regions info done\r\n"); dbg_print("bl: trigger flag %s\r\n", trigger_modes_str[info.trigger]); dbg_print("bl: region\t%8d\t%8d\r\n", 0, 1); dbg_print("bl: size\t%8d\t%8d\r\n", (int)info.length[0], (int)info.length[1]); dbg_print("bl: sign\t%8x\t%8x\r\n", (unsigned)info.signature[0], (unsigned)info.signature[1]); dbg_print("bl: boot\t %c\t %c\r\n", boot_region ? ' ' : 'Y', boot_region ? 'Y' : ' '); dbg_print("bl: App @ %d, %x - data %x ...\r\n", (int)boot_region, (unsigned)app_addr, (unsigned)*(uint32_t *)app_addr); dbg_print("bl: App valid: %c\r\n", app_valid ? 'Y' : 'N'); #ifdef DBG_USE_INFO_EDIT /* InfoEdit */ _app_info_edit(&info); #endif /* bootloader trigger check */ dbg_print("bl: trigger ...\r\n"); trigger = trigger_poll(&info); dbg_print("bl: trigger mode %s\r\n", trigger_modes_str[trigger]); if (TRIGGER_BOOT == trigger) { goto main_run_app_check; } /* Now any other trigger load file to update application directly */ #ifdef DBG_USE_LED _app_led_blink(100, 1); #endif /* Update media file information */ if (info.boot_file_name[0]) { dbg_print("bl: boot file assigned, set it\r\n"); media_set_file_name(info.boot_file_name); } main_load_app: /* load new firmware */ #ifdef DBG_USE_USART load_region = boot_region; dbg_print("bl: download @ %d ...\r\n", load_region); #endif app_size = _app_load(&info, true); if (app_size == 0) { _app_led_error(); dbg_print("bl: download fail, retry\r\n"); goto main_load_app; } else { dbg_print("bl: download done, size %d\r\n", (int)app_size); } main_run_app_check: /* Is application valid */ dbg_print("bl: check app @ %d is valid\r\n", (int)info.boot_region); app_valid = region_check_valid(app_addr, info.length[info.boot_region], info.signature[info.boot_region]); if (!app_valid) { dbg_print("bl: application is not valid\r\n"); _app_led_error(); dbg_print("bl: reload firmware\r\n"); goto main_load_app; } dbg_print("bl: application is valid, run\r\n"); /* Turn off the led before jump to the app. */ _app_led_off(DBG_LED_PIN); /* cleanup */ dbg_print("bl: cleanup ...\r\n"); media_cleanup(); trigger_cleanup(); memory_cleanup(); dbg_print("bl: cleanup done\r\n"); /* load application */ dbg_print("bl: load application ...\r\n\n"); #ifdef DBG_USE_USART delay_ms(50); /* Wait USART lines idle */ dbg_cleanup(); delay_ms(50); #endif /* run application */ _app_exec(app_addr); return (int)app_addr; }