/* * Note: this debug setup only works if the target platform has two serial ports * available so that the other one (currently only port 1) can be used for debug * messages. */ static int zm_dprintf(char *fmt, ...) { int cur_console; va_list args; va_start(args, fmt); #ifdef REDBOOT cur_console = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); CYGACC_CALL_IF_SET_CONSOLE_COMM(1); #endif diag_vprintf(fmt, args); #ifdef REDBOOT CYGACC_CALL_IF_SET_CONSOLE_COMM(cur_console); #endif }
externC void err_printf( char *fmt, ... ) { va_list ap; va_start(ap, fmt); diag_vprintf( fmt, ap ); va_end(ap); // If we are not in redboot_exec() just return as usual. If we are // inside a call to redboot_exec(), longjump out to terminate the command. if( redboot_exec_call ) { diag_printf("err_printf: aborting command\n"); hal_longjmp(error_jmpbuf, 1); } }
static bool _verify_action(int timeout, char *fmt, va_list ap) { char ans[8]; int ret; #ifdef CYGFUN_REDBOOT_BOOT_SCRIPT // Don't ask if we're executing a script if (script && *script) return 1; #endif diag_vprintf(fmt, ap); diag_printf(" - continue (y/n)? "); if ((ret = _rb_gets(ans, sizeof(ans), timeout)) > 0) { return ((ans[0] == 'y') || (ans[0] == 'Y')); } else { if (ret == _GETS_TIMEOUT) { diag_printf(" ** Timed out!\n"); } return 0; // Timed out or ^C } }