static switch_status_t channel_on_routing(switch_core_session_t *session) { switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; const char *app, *arg; channel = switch_core_session_get_channel(session); assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); do_reset(tech_pvt); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && (app = switch_channel_get_variable(channel, "loopback_app"))) { switch_caller_extension_t *extension = NULL; arg = switch_channel_get_variable(channel, "loopback_app_arg"); extension = switch_caller_extension_new(session, app, app); switch_caller_extension_add_application(session, extension, "pre_answer", NULL); switch_caller_extension_add_application(session, extension, app, arg); switch_channel_set_caller_extension(channel, extension); switch_channel_set_state(channel, CS_EXECUTE); return SWITCH_STATUS_FALSE; } return SWITCH_STATUS_SUCCESS; }
/* * pseudo signature: * * int API_reset(void) */ static int API_reset(va_list ap) { do_reset(NULL, 0, 0, NULL); /* NOT REACHED */ return 0; }
static void compl_do_reset(struct usb_ep *ep, struct usb_request *req) { struct f_rockusb *f_rkusb = get_rkusb(); rkusb_set_reboot_flag(f_rkusb->reboot_flag); do_reset(NULL, 0, 0, NULL); }
int ee_do_command( u8 *Tx, int Tx_len, u8 *Rx, int Rx_len, int Send_skip ){ /* Execute this command string, including giving reset and setting to idle after command if Rx_len is set, we read out data from EEPROM */ int i; E_DEBUG("Command, Tx_len %d, Rx_len %d\n", Tx_len, Rx_len ); if(do_reset()){ /* Failed! */ return(-EIO); } if(Send_skip) /* Always send SKIP_ROM first to tell chip we are sending a command, except when we read out rom data for chip */ write_byte(SKIP_ROM); /* Always have Tx data */ for(i=0;i<Tx_len;i++){ write_byte(Tx[i]); } if(Rx_len){ for(i=0;i<Rx_len;i++){ Rx[i]=read_byte(); } } set_idle(); E_DEBUG("Command done\n"); return(0); }
int fun_handler_cam2_back(void) { printf("Soft reset !!!!! \n"); set_to_peripheral_boot_mode(); do_reset(NULL, 0, 0, NULL); return 1; }
static ERL_NIF_TERM evaluate_command(esqlite_command *cmd, esqlite_connection *conn) { switch(cmd->type) { case cmd_open: return do_open(cmd->env, conn, cmd->arg); case cmd_exec: return do_exec(cmd->env, conn, cmd->arg); case cmd_changes: return do_changes(cmd->env, conn, cmd->arg); case cmd_prepare: return do_prepare(cmd->env, conn, cmd->arg); case cmd_step: return do_step(cmd->env, conn->db, cmd->stmt); case cmd_reset: return do_reset(cmd->env, conn->db, cmd->stmt); case cmd_bind: return do_bind(cmd->env, conn->db, cmd->stmt, cmd->arg); case cmd_column_names: return do_column_names(cmd->env, cmd->stmt); case cmd_close: return do_close(cmd->env, conn, cmd->arg); case cmd_insert: return do_insert(cmd->env, conn, cmd->arg); default: return make_error_tuple(cmd->env, "invalid_command"); } }
/** * Set the boot bank to the alternate bank */ void cpld_set_altbank(u8 banksel) { struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE); u8 reg11; reg11 = in_8(&cpld_data->flhcsr); switch (banksel) { case 1: out_8(&cpld_data->flhcsr, (reg11 & CPLD_BANKSEL_MASK) | CPLD_BANKSEL_EN | CPLD_SELECT_BANK1); break; case 2: out_8(&cpld_data->flhcsr, (reg11 & CPLD_BANKSEL_MASK) | CPLD_BANKSEL_EN | CPLD_SELECT_BANK2); break; case 3: out_8(&cpld_data->flhcsr, (reg11 & CPLD_BANKSEL_MASK) | CPLD_BANKSEL_EN | CPLD_SELECT_BANK3); break; case 4: out_8(&cpld_data->flhcsr, (reg11 & CPLD_BANKSEL_MASK) | CPLD_BANKSEL_EN | CPLD_SELECT_BANK4); break; default: printf("Invalid value! [1-4]\n"); return; } udelay(100); do_reset(NULL, 0, 0, NULL); }
void hts_engine_impl::reset() { if(input->lbegin()!=input->lend()) do_reset(); output=0; input=0; rate=1.0; }
void kernel_reset() { if(current_task->uid) return; kernel_shutdown(); kprintf("Rebooting system...\n"); do_reset(); }
void do_resetdialog() { changeFullScreen(0); save_undo(); if (okcancel("Are you sure you want to reset?\nAny unsaved changes will be lost.")) { resetfilename(); do_reset(); } }
int do_tftpd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { const int press_times = 1; int i = 0; asus_gpio_init(); if (DETECT()) /* Reset button */ { printf(" \n## Enter Rescue Mode ##\n"); printf(" \n3: System Boot system code via TFTP.\n"); setenv("autostart", "no"); /* Wait forever for an image */ if (NetLoop(TFTPD) < 0) return 1; } else if (DETECT_WPS()) /* WPS button */ { /* Make sure WPS button is pressed at least press_times * 0.01s. */ while (DETECT_WPS() && i++ < press_times) { udelay(10000); } if (i >= press_times) { while (DETECT_WPS()) { udelay(90000); i++; if (i & 1) LEDON(); else LEDOFF(); } LEDOFF(); asus_gpio_uninit(); reset_to_default(); do_reset (NULL, 0, 0, NULL); } } else { if(check_trx(argc, argv)) { printf(" \nEnter Recuse Mode for trx error\n"); printf(" \n3: System Boot system code via TFTP.\n"); if (NetLoop(TFTPD) < 0) return 1; } printf(" \n3: System Boot system code via Flash.\n"); do_bootm(cmdtp, 0, argc, argv); } return 0; }
static switch_status_t channel_on_reset(switch_core_session_t *session) { private_t *tech_pvt = (private_t *) switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); do_reset(tech_pvt); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RESET\n", switch_channel_get_name(switch_core_session_get_channel(session))); return SWITCH_STATUS_SUCCESS; }
static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req) { req->complete = NULL; fastboot_shutdown(); printf("Booting kernel..\n"); //do_bootm(NULL, 0, 2, bootm_args); /* This only happens if image is somehow faulty so we start over */ do_reset(NULL, 0, 0, NULL); }
// FIXME: if rules_reset fails, exit static int MAIL(void) { const response* resp; msg2("MAIL ", arg.s); do_reset(); if ((resp = parse_addr_arg()) == 0) { if ((resp = handle_sender(&addr, ¶ms)) == 0) resp = &resp_accepted_sender; if (number_ok(resp)) { saw_mail = 1; } } return respond(resp); }
void dr_inter::try_loading( const char* rFile, const char* aFile ) { // full reset do_reset(); if ( base_object.full_read( rFile, aFile ) ) { rFileName = rFile; aFileName = aFile; fLoaded = true; // just indicate that file has been loaded } else fLoaded = false; // just indicate thate file has been loaded }
int board_late_init(void) { pci_dev_t bdf; ulong bootcount; /* * Check if the PEX switch is detected (somtimes its not available * on the PCIe bus). In this case, try to recover by issuing a * soft-reset or even a power-cycle, depending on the bootcounter * value. */ bdf = pci_find_device(PCI_VENDOR_ID_PLX, 0x8619, 0); if (bdf == -1) { u8 i2c_buf[8]; int ret; /* PEX switch not found! */ bootcount = bootcount_load(); printf("Failed to find PLX PEX-switch (bootcount=%ld)\n", bootcount); if (bootcount > PEX_SWITCH_NOT_FOUNT_LIMIT) { printf("Issuing power-switch via uC!\n"); printf("Issuing power-switch via uC!\n"); i2c_set_bus_num(STM_I2C_BUS); i2c_buf[0] = STM_I2C_ADDR << 1; i2c_buf[1] = 0xc5; /* cmd */ i2c_buf[2] = 0x01; /* enable */ /* Delay before reboot */ i2c_buf[3] = REBOOT_DELAY & 0x00ff; i2c_buf[4] = (REBOOT_DELAY & 0xff00) >> 8; /* Delay before shutdown */ i2c_buf[5] = 0x00; i2c_buf[6] = 0x00; i2c_buf[7] = crc8(0x72, &i2c_buf[0], 7); ret = i2c_write(STM_I2C_ADDR, 0, 0, &i2c_buf[1], 7); if (ret) { printf("I2C write error (ret=%d)\n", ret); printf("Issuing soft-reset...\n"); /* default handling: SOFT reset */ do_reset(NULL, 0, 0, NULL); } /* Wait for power-cycle to occur... */ printf("Waiting for power-cycle via uC...\n"); while (1) ; } else {
static int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { bootm_headers_t images; if (bootz_start(cmdtp, flag, argc, argv, &images)) return 1; /* * We have reached the point of no return: we are going to * overwrite all exception vector code, so we cannot easily * recover from any failures any more... */ disable_interrupts(); #ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ eth_halt(); #endif #if defined(CONFIG_CMD_USB) /* * turn off USB to prevent the host controller from writing to the * SDRAM while Linux is booting. This could happen (at least for OHCI * controller), because the HCCA (Host Controller Communication Area) * lies within the SDRAM and the host controller writes continously to * this area (as busmaster!). The HccaFrameNumber is for example * updated every 1 ms within the HCCA structure in SDRAM! For more * details see the OpenHCI specification. */ usb_stop(); #endif #ifdef CONFIG_SBOOT bootm_sboot(); #endif #ifdef CONFIG_SILENT_CONSOLE fixup_silent_linux(); #endif arch_preboot_os(); do_bootm_linux(0, argc, argv, &images); #ifdef DEBUG puts("\n## Control returned to monitor - resetting...\n"); #endif do_reset(cmdtp, flag, argc, argv); return 1; }
static void erase_environment(void) { struct spi_flash *flash; printf("Erasing environment..\n"); flash = spi_flash_probe(0, 0, 1000000, SPI_MODE_3); if (!flash) { printf("Erasing flash failed\n"); return; } spi_flash_erase(flash, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE); spi_flash_free(flash); do_reset(NULL, 0, 0, NULL); }
void do_redo() { if (!gRedoStack.empty()) { do_cancel(); File * state = new MemoryFile(); do_savebinary(state); gUndoStack.push_back(state); do_reset(); state = gRedoStack.back(); state->seek(0); do_loadbinary(state); gRedoStack.pop_back(); delete state; } }
/* * Dump crash to file (typically FAT file on SD/MMC). */ static int do_checkcrash(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { int rc = 0; #if defined(ENG_VERSION) Elf32_Ehdr *elfhdr_addr; char *crash_env_val; crash_env_val = getenv("crash_dump"); if ((crash_env_val != NULL) && strcmp(crash_env_val, "yes") == 0) { rc = -1; elfhdr_addr = get_elfhdr_addr(); if (elfhdr_addr != NULL) rc = check_elfhdr(elfhdr_addr); if (rc == 0) { printf("crash dump elf header found." " Dumping to card...\n"); rc = crashdump(elfhdr_addr); if (rc != 0) printf("checkcrash: " "error writing dump from %x to %s\n", (u32) elfhdr_addr, crash_filename); } else { printf("crash dump elf header not found. Will try to create one" " Dumping to card...\n"); rc = dump_regions_from_environment(); } } stop_mpcore_wdt(); /* * For some reason we can't reboot into the linux kernel when coming * from there using kexec. On the other hand, we can't reset through the * PRCMU when we are here because of a watchdog reset. * For now let's * 1) Reset through PRCMU when coming from kexec * 2) Continue booting when coming from a watchdog reset */ if (!reboot_at_crash()) setenv("bootdelay", "-1"); else #endif if (restarted()) do_reset(); return rc; }
void cli_simple_loop(void) { static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, }; int len; int flag; int rc = 1; for (;;) { if (rc >= 0) { /* Saw enough of a valid command to * restart the timeout. */ bootretry_reset_cmd_timeout(); } len = cli_readline(CONFIG_SYS_PROMPT); flag = 0; /* assume no special flags for now */ if (len > 0) strcpy(lastcommand, console_buffer); else if (len == 0) flag |= CMD_FLAG_REPEAT; #ifdef CONFIG_BOOT_RETRY_TIME else if (len == -2) { /* -2 means timed out, retry autoboot */ puts("\nTimed out waiting for command\n"); # ifdef CONFIG_RESET_TO_RETRY /* Reinit board to run initialization code again */ do_reset(NULL, 0, 0, NULL); # else return; /* retry autoboot */ # endif } #endif if (len == -1) puts("<INTERRUPT>\n"); else rc = run_command_repeatable(lastcommand, flag); if (rc <= 0) { /* invalid command or not repeatable, forget it */ lastcommand[0] = 0; } } }
void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[], bootm_headers_t *images) { /* First parameter is mapped to $r5 for kernel boot args */ void (*theKernel) (char *); char *commandline = getenv ("bootargs"); ulong ep = 0; /* find kernel entry point */ if (images->legacy_hdr_valid) { ep = image_get_ep (images->legacy_hdr_os); #if defined(CONFIG_FIT) } else if (images->fit_uname_os) { int ret = fit_image_get_entry (images->fit_hdr_os, images->fit_noffset_os, &ep); if (ret) { puts ("Can't get entry point property!\n"); goto error; } #endif } else { puts ("Could not find kernel entry point!\n"); goto error; } theKernel = (void (*)(char *))ep; show_boot_progress (15); #ifdef DEBUG printf ("## Transferring control to Linux (at address %08lx) ...\n", (ulong) theKernel); #endif if (!images->autostart) return ; theKernel (commandline); /* does not return */ return; error: if (images->autostart) do_reset (cmdtp, flag, argc, argv); return; }
static int DATA(void) { const response* resp; if (!saw_mail) return respond(&resp_no_mail); if (!saw_rcpt) return respond(&resp_no_rcpt); if (!response_ok(resp = handle_data_start())) return respond(resp); if (!respond(&resp_data_ok)) return 0; if (!copy_body()) { do_reset(); return 0; } if ((resp = handle_message_end()) == 0) resp = &resp_accepted_message; return respond(resp); }
static void EFIAPI efi_reset_system(enum efi_reset_type reset_type, efi_status_t reset_status, unsigned long data_size, void *reset_data) { EFI_ENTRY("%d %lx %lx %p", reset_type, reset_status, data_size, reset_data); switch (reset_type) { case EFI_RESET_COLD: case EFI_RESET_WARM: do_reset(NULL, 0, 0, NULL); break; case EFI_RESET_SHUTDOWN: /* We don't have anything to map this to */ break; } EFI_EXIT(EFI_SUCCESS); }
/** *** Analyse the processor(s) specified. This is not actually used at *** present, but I may have to put it in again at a later stage. *** Currently it is just a copy of driver_Reset(). **/ static void driver_Analyse(NetworkDCB *device, DriverRequest *request) { RmHardwareFacility *hardware; int i; int state; RmProcessor Processor; hardware = device->HardwareFacility; request->FnRc = do_reset(device); if (request->FnRc eq Err_Null) for (i = 0; i < hardware->NumberProcessors; i++) { Processor = hardware->Processors[i]; if ((Processor eq (RmProcessor) device->RootProcessor) || (Processor eq (RmProcessor) device->ControlProc)) continue; state = RmGetProcessorState(Processor); state |= RmS_Reset; (void) RmSetProcessorState(Processor, state); } }
void show_boot_progress (int status) { int i,j; if(status > 0) { last_boot_progress = status; } else { /* * If a specific failure code is given, flash this code * else just use the last success code we've seen */ if(status < -1) last_boot_progress = -status; /* * Flash this code 5 times */ for(j=0; j<5; j++) { /* * Houston, we have a problem. * Blink the last OK status which indicates where things failed. */ status_led_set(STATUS_LED_RED, STATUS_LED_ON); flash_code(last_boot_progress, 5, 3); /* * Delay 5 seconds between repetitions, * with the fault LED blinking */ for(i=0; i<5; i++) { status_led_set(STATUS_LED_RED, STATUS_LED_OFF); udelay(500000); status_led_set(STATUS_LED_RED, STATUS_LED_ON); udelay(500000); } } /* * Reset the board to retry initialization. */ do_reset (NULL, 0, 0, NULL); } }
static ERL_NIF_TERM evaluate_command(esqlite_command *cmd, esqlite_connection *conn) { esqlite_statement *stmt = NULL; if(cmd->stmt) { if(!enif_get_resource(cmd->env, cmd->stmt, esqlite_statement_type, (void **) &stmt)) { return make_error_tuple(cmd->env, "invalid_statement"); } } switch(cmd->type) { case cmd_open: return do_open(cmd->env, conn, cmd->arg); case cmd_update_hook_set: return do_set_update_hook(cmd->env, conn, cmd->arg); case cmd_exec: return do_exec(cmd->env, conn, cmd->arg); case cmd_changes: return do_changes(cmd->env, conn, cmd->arg); case cmd_prepare: return do_prepare(cmd->env, conn, cmd->arg); case cmd_multi_step: return do_multi_step(cmd->env, conn->db, stmt->statement, cmd->arg); case cmd_reset: return do_reset(cmd->env, conn->db, stmt->statement); case cmd_bind: return do_bind(cmd->env, conn->db, stmt->statement, cmd->arg); case cmd_column_names: return do_column_names(cmd->env, stmt->statement); case cmd_column_types: return do_column_types(cmd->env, stmt->statement); case cmd_close: return do_close(cmd->env, conn, cmd->arg); case cmd_insert: return do_insert(cmd->env, conn, cmd->arg); case cmd_get_autocommit: return do_get_autocommit(cmd->env, conn); default: return make_error_tuple(cmd->env, "invalid_command"); } }
static void notify_parent(void) { pid_t ppid; union sigval signal_value; memset(&signal_value, 0, sizeof(signal_value)); ppid = getppid(); if (ppid == 1) { /* Our parent died unexpectedly. Triggering * self-fence. */ cl_log(LOG_WARNING, "Our parent is dead."); do_reset(); } switch (pcmk_healthy) { case pcmk_health_pending: case pcmk_health_shutdown: case pcmk_health_transient: DBGLOG(LOG_INFO, "Not notifying parent: state transient (%d)", pcmk_healthy); break; case pcmk_health_unknown: case pcmk_health_unclean: case pcmk_health_noquorum: DBGLOG(LOG_WARNING, "Notifying parent: UNHEALTHY (%d)", pcmk_healthy); sigqueue(ppid, SIG_PCMK_UNHEALTHY, signal_value); break; case pcmk_health_online: DBGLOG(LOG_INFO, "Notifying parent: healthy"); sigqueue(ppid, SIG_LIVENESS, signal_value); break; default: DBGLOG(LOG_WARNING, "Notifying parent: UNHEALTHY %d", pcmk_healthy); sigqueue(ppid, SIG_PCMK_UNHEALTHY, signal_value); break; } }
static int do_boot_mode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { const struct boot_mode *p; int reset_requested = 1; if (argc < 2) return CMD_RET_USAGE; p = search_modes(argv[1]); if (!p) return CMD_RET_USAGE; if (argc == 3) { if (strcmp(argv[2], "noreset")) return CMD_RET_USAGE; reset_requested = 0; } boot_mode_apply(p->cfg_val); if (reset_requested && p->cfg_val) do_reset(NULL, 0, 0, NULL); return 0; }
void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], bootm_headers_t *images) { ulong ep = 0; /* find kernel entry point */ if (images->legacy_hdr_valid) { ep = image_get_ep (images->legacy_hdr_os); #if defined(CONFIG_FIT) } else if (images->fit_uname_os) { int ret = fit_image_get_entry (images->fit_hdr_os, images->fit_noffset_os, &ep); if (ret) { puts ("Can't get entry point property!\n"); goto error; } #endif } else { puts ("Could not find kernel entry point!\n"); goto error; } void (*kernel)(void) = (void (*)(void))ep; if (!images->autostart) return ; /* For now we assume the Microtronix linux ... which only * needs to be called ;-) */ kernel (); /* does not return */ return; error: if (images->autostart) do_reset (cmdtp, flag, argc, argv); return; }