这篇教程C++ tstc函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tstc函数的典型用法代码示例。如果您正苦于以下问题:C++ tstc函数的具体用法?C++ tstc怎么用?C++ tstc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tstc函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: awaitkeystatic char awaitkey(unsigned long delay, int* error_p){ int i; if (delay == -1) { while (1) { if (tstc()) /* we got a key press */ return getc(); } } else { for (i = 0; i < delay; i++) { if (tstc()) /* we got a key press */ return getc(); udelay (10*1000); } } if (error_p) *error_p = -1; return 0;}
开发者ID:tsingui,项目名称:bootloader,代码行数:25,
示例2: Receive_Byte/* * @return :1 -- OK 0 -- Error */static int Receive_Byte (u8 *c, ulong timeout){#if 1#define DELAY 20 unsigned long counter = 0; while (!tstc () && (counter < timeout * 1000 / DELAY)) { udelay (DELAY); counter++; } if (tstc ()) { *c = getc (); return 1; } return 0;#else unsigned long counter = 0; int data = 0; do { data = getc (); counter++; }while ((data < 0) && (counter < timeout)); if (counter < timeout) { *c = (u8)data; //printf(" %.2X", *c); return 1; } return 0;#endif}
开发者ID:webom2008,项目名称:bf512.project,代码行数:37,
示例3: CYGACC_COMM_IF_GETC_TIMEOUTint CYGACC_COMM_IF_GETC_TIMEOUT (char chan,char *c) {#define DELAY 20 unsigned long counter=0; while (!tstc() && (counter < xyzModem_CHAR_TIMEOUT*1000/DELAY)) { udelay(DELAY); counter++; } if (tstc()) { *c=getc(); return 1; } return 0;}
开发者ID:A1DEVS,项目名称:lenovo_a1_07_uboot,代码行数:13,
示例4: hello_worldint hello_world (int argc, char *argv[]){ int i; /* Print the ABI version */ app_startup(argv); printf ("Example expects ABI version %d/n", XF_VERSION); printf ("Actual U-Boot ABI version %d/n", (int)get_version()); printf ("Hello World/n"); printf ("argc = %d/n", argc); for (i=0; i<=argc; ++i) { printf ("argv[%d] = /"%s/"/n", i, argv[i] ? argv[i] : "<NULL>"); } volatile unsigned long *GPIO_DATAIN_BOOTKEY = 0x48310038; volatile unsigned long *GPIO_OE_SYSLED4 = 0x49058034; volatile unsigned long *GPIO_DATAOUT_SYSLED4 = 0x4905803C; *GPIO_OE_SYSLED4 &= 0xffffffef; while(!tstc()) { if((*GPIO_DATAIN_BOOTKEY & 0x00000080) == 0) { printf ("Button NOT pushed: LED OFF/n"); *GPIO_DATAOUT_SYSLED4 |= 0x00000010; } else { printf ("Button pushed: LED ON/n"); *GPIO_DATAOUT_SYSLED4 &= 0xffffffef; } } printf ("Hit any key to exit ... "); while (!tstc()) ; /* consume input */ (void) getc(); printf ("/n/n"); return (0);}
开发者ID:CasperHeller,项目名称:MPS_Exercise3,代码行数:49,
示例5: board_late_initint board_late_init(void){ /* enable 3V3 for LAN controller */ if (raise_ab8500_gpio26() >= 0) { /* Turn on FSMC device */ writel(0x1, 0x8000f000); writel(0x1, 0x8000f008); /* setup FSMC for LAN controler */ writel(0x305b, 0x80000000); /* run at the highest possible speed */ writel(0x01010210, 0x80000004); } else printf("error: can't raise GPIO26/n"); /* enable 3v6 for GBF chip */ if ((raise_ab8500_gpio16() < 0)) printf("error: cant' raise GPIO16/n"); /* empty UART RX FIFO */ while (tstc()) (void) getc(); return 0;}
开发者ID:dreamsxin,项目名称:BananaPi-Android-4.2.2-Liab,代码行数:26,
示例6: WaitForYesPressed/*! /return 1 if yes is pressed otherwise 1 */int WaitForYesPressed( const char* szWhat, const char* szWhere ){ int iRes = 0; /** * From autoscript we shouldn't expect user's confirmations. * Assume yes is the correct answer here to avoid halting the script. */ if (RunningAutoScript) return 1; printf( "%s(y/n)", szWhat ); while( 1 ) { if( tstc() ) { char c = getc(); putc( c ); if( 'y' == c ) { iRes = 1; break; } else { eprintf( "/n%s aborted/n", szWhere ); break; } } } /* while( true ) */ printf( "/n" ); return iRes;}
开发者ID:digidotcom,项目名称:yocto-uboot,代码行数:34,
示例7: check_uart_inputint check_uart_input(void){ int c = 0; if(uboot_spare_head.boot_data.work_mode != WORK_MODE_BOOT) { return 0; } if(tstc()) { c = getc(); printf("0x%x/n", c); } else { puts("no key input/n"); } if(c == '2') { return -1; } else if(c == '3') { sunxi_key_init(); do_key_test(NULL, 0, 1, NULL); } else if(c == 's') //shell mode { gd->force_shell = 1; gd->debug_mode = 1; } return 0;}
开发者ID:Ronchou,项目名称:OrangePI-Kernel,代码行数:33,
示例8: read_optstatic int read_opt(void){ /* wait for key to be pressed */ while (!tstc()) ; return getc();}
开发者ID:digidotcom,项目名称:yocto-uboot,代码行数:7,
示例9: getcint getc(void){ unsigned char ch; uint64_t start; /* * For 100us we read the characters from the serial driver * into a kfifo. This helps us not to lose characters * in small hardware fifos. */ start = get_time_ns(); while (1) { if (tstc()) { kfifo_putc(console_input_buffer, getc_raw()); start = get_time_ns(); } if (is_timeout(start, 100 * USECOND) && kfifo_len(console_input_buffer)) break; } kfifo_getc(console_input_buffer, &ch); return ch;}
开发者ID:cwyy,项目名称:barebox,代码行数:25,
示例10: do_vboot_twostopstatic intdo_vboot_twostop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]){ uint32_t selection; int ro_firmware; bootstage_mark_name(BOOTSTAGE_VBOOT_TWOSTOP, "do_vboot_twostop"); /* * Empty keyboard buffer before boot. In case EC did not clear its * buffer between power cycles, this prevents vboot of current power * cycle being affected by keystrokes of previous power cycle. */ while (tstc()) getc(); if (cros_init()) { VBDEBUG("fail to init cros library/n"); goto on_error; } /* * TODO: We should clear screen later if we load graphics optionally. * In normal mode, we don't need to load graphics driver and clear * screen. */ display_clear(); /* * A processor reset jumps to the reset entry point (which is the * read-only firmware), otherwise we have entered U-Boot from a * software jump. * * Note: If a read-only firmware is loaded to memory not because of a * processor reset, this instance of read-only firmware should go to the * readwrite firmware code path. */ ro_firmware = is_processor_reset(); VBDEBUG("Starting %s firmware/n", ro_firmware ? "read-only" : "read-write"); if (ro_firmware) selection = twostop_boot(0); else selection = twostop_readwrite_main_firmware(); VBDEBUG("selection of main firmware: %s/n", str_selection(selection)); if (selection == TWOSTOP_SELECT_COMMAND_LINE) return 0; if (selection == TWOSTOP_SELECT_POWER_OFF) power_off(); assert(selection == TWOSTOP_SELECT_ERROR);on_error: cold_reboot(); return 0;}
开发者ID:ArthySundaram,项目名称:u-boot-chromebook,代码行数:60,
示例11: hello_worldint hello_world (int argc, char * const argv[]){ int i; /* Print the ABI version */ app_startup(argv); printf ("Example expects ABI version %d/n", XF_VERSION); printf ("Actual U-Boot ABI version %d/n", (int)get_version()); printf ("Hello World/n"); printf ("argc = %d/n", argc); for (i=0; i<=argc; ++i) { printf ("argv[%d] = /"%s/"/n", i, argv[i] ? argv[i] : "<NULL>"); } printf ("Hit any key to exit ... "); while (!tstc()) ; /* consume input */ (void) getc(); printf ("/n/n"); return (0);}
开发者ID:AeroGirl,项目名称:u-boot-kern3.2,代码行数:28,
示例12: video_scrollvoid video_scroll(int rows){ unsigned short clear = ((unsigned short)current_attr) | (' '<<8); unsigned short* addr16 = &((unsigned short *)VIDEO_BASE)[(VIDEO_ROWS-rows)*VIDEO_COLS]; int i; char *s; s = getenv("vga_askscroll"); video_scrolls += rows; if (video_scrolls >= video_numrows) { if (s && strcmp(s, "yes")) { while (-1 == tstc()); } video_scrolls = 0; } memcpy(VIDEO_BASE, VIDEO_BASE+rows*(VIDEO_COLS*2), (VIDEO_ROWS-rows)*(VIDEO_COLS*2)); for (i = 0 ; i < rows * VIDEO_COLS ; i++) addr16[i] = clear; cursor_row-=rows; cursor_col=0;}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:27,
示例13: ctrlc/* test if ctrl-c was pressed */int ctrlc (void){ poller_call(); if (tstc() && getc() == 3) return 1; return 0;}
开发者ID:dgarnier,项目名称:barebox,代码行数:9,
示例14: comm_if_getc_toutint comm_if_getc_tout(char *c){ unsigned long counter=0; #define DELAY 20 while(!tstc() && (counter < xyzModem_CHAR_TIMEOUT*1000/DELAY)){ udelay(DELAY); counter++; } if(tstc()){ *c=getc(); return 1; } return 0;}
开发者ID:AdityaL05,项目名称:uboot,代码行数:17,
示例15: CYGACC_COMM_IF_GETC_TIMEOUTstatic intCYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c){ ulong now = get_timer(0); while (!tstc ()) { if (get_timer(now) > xyzModem_CHAR_TIMEOUT) break; } if (tstc ()) { *c = getc (); return 1; } return 0;}
开发者ID:Philippe12,项目名称:u-boot-sunxi,代码行数:17,
示例16: abortbootstatic __inline__ int abortboot(int bootdelay){ int abort = 0;#ifdef CONFIG_SILENT_CONSOLE if(gd->flags & GD_FLG_SILENT){ /* Restore serial console */ console_assign(stdout, "serial"); console_assign(stderr, "serial"); }#endif if((bootdelay > 0) && (getenv("silent") == NULL)){#ifdef CONFIG_MENUPROMPT printf(CONFIG_MENUPROMPT, bootdelay);#else printf("Hit any key to stop autoboot: %d ", bootdelay);#endif while((bootdelay > 0) && (!abort)){ int i; --bootdelay; /* delay 100 * 10ms */ for(i = 0; !abort && i < 100; ++i){ /* we got a key press */ if(tstc()){ /* don't auto boot */ abort = 1; /* no more delay */ bootdelay = 0; /* consume input */ (void) getc(); break; } udelay(10000); } printf("/b/b%d ", bootdelay); } printf("/n/n"); }#ifdef CONFIG_SILENT_CONSOLE if(abort){ /* permanently enable normal console output */ gd->flags &= ~(GD_FLG_SILENT); } else if(gd->flags & GD_FLG_SILENT){ /* Restore silent console */ console_assign(stdout, "nulldev"); console_assign(stderr, "nulldev"); }#endif return(abort);}
开发者ID:codywon,项目名称:cody,代码行数:58,
示例17: bootretry_tstc_timeoutint bootretry_tstc_timeout(void){ while (!tstc()) { /* while no incoming data */ if (retry_time >= 0 && get_ticks() > endtime) return -ETIMEDOUT; WATCHDOG_RESET(); } return 0;}
开发者ID:0xFelix,项目名称:u-boot-edminiv2,代码行数:10,
示例18: API_tstc/* * pseudo signature: * * int API_tstc(int *c) */static int API_tstc(va_list ap){ int *t; if ((t = (int *)va_arg(ap, u_int32_t)) == NULL) return API_EINVAL; *t = tstc(); return 0;}
开发者ID:105678256,项目名称:u-boot-2010.09,代码行数:15,
示例19: ctrlcint ctrlc (void){ if (tstc()) { switch (getc ()) { case 0x03: /* ^C - Control C */ return 1; default: break; } } return 0;}
开发者ID:AeroGirl,项目名称:u-boot-kern3.2,代码行数:12,
示例20: do_printenvvoid do_printenv (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]){ uchar *env, *nxt; int i;#if defined(CFG_FLASH_ENV_ADDR) uchar *environment = env_init();#else env_init();#endif /* CFG_FLASH_ENV_ADDR */ if (argc == 1) { /* Print all env variables */ uchar *start = environment; for (env=environment; *env; env=nxt+1) { for (nxt=env; *nxt; ++nxt) ; puts (env); putc ('/n'); if (tstc()) { getc (); printf ("/n ** Abort/n"); return; } } printf("/nEnvironment size: %d bytes/n", env-start); return; } for (i=1; i<argc; ++i) { /* print single env variables */ char *name = argv[i]; char *val = NULL; for (env=environment; *env; env=nxt+1) { for (nxt=env; *nxt; ++nxt) ; val=envmatch(name, env); if (val) { puts (name); putc ('='); puts (val); putc ('/n'); break; } } if (!val) printf ("## Error: /"%s/" not defined/n", name); }}
开发者ID:GWARDAR,项目名称:OpenPLi-1,代码行数:52,
示例21: passwd_abortstatic int passwd_abort(uint64_t etime){ const char *sha_env_str = getenv("bootstopkeysha256"); u8 sha_env[SHA256_SUM_LEN]; u8 sha[SHA256_SUM_LEN]; char presskey[MAX_DELAY_STOP_STR]; const char *algo_name = "sha256"; u_int presskey_len = 0; int abort = 0; int size; int ret; if (sha_env_str == NULL) sha_env_str = CONFIG_AUTOBOOT_STOP_STR_SHA256; /* * Generate the binary value from the environment hash value * so that we can compare this value with the computed hash * from the user input */ ret = hash_parse_string(algo_name, sha_env_str, sha_env); if (ret) { printf("Hash %s not supported!/n", algo_name); return 0; } /* * We don't know how long the stop-string is, so we need to * generate the sha256 hash upon each input character and * compare the value with the one saved in the environment */ do { if (tstc()) { /* Check for input string overflow */ if (presskey_len >= MAX_DELAY_STOP_STR) return 0; presskey[presskey_len++] = getc(); /* Calculate sha256 upon each new char */ hash_block(algo_name, (const void *)presskey, presskey_len, sha, &size); /* And check if sha matches saved value in env */ if (slow_equals(sha, sha_env, SHA256_SUM_LEN)) abort = 1; } } while (!abort && get_ticks() <= etime); return abort;}
开发者ID:13xiaobang,项目名称:mini2440-uboot_2016.01,代码行数:51,
示例22: wait_for_ch_timeoutint wait_for_ch_timeout(int rel_timeout, uint64_t abs_timeout){ uint64_t etime = abs_timeout; if (rel_timeout) etime = endtick(rel_timeout); while (!tstc()) { /* while no incoming data */ if ((retry_time >= 0) && etime && (get_ticks() > etime)) return (-2); /* timed out */ WATCHDOG_RESET(); } return 0;}
开发者ID:gomi1992,项目名称:tiny210v2-uboot,代码行数:14,
示例23: misc_init_rint misc_init_r(void){ char *str; int mach_type; str = getenv("mach_type"); if (str != NULL) { mach_type = simple_strtoul(str, NULL, 10); printf("Overwriting MACH_TYPE with %d!!!/n", mach_type); gd->bd->bi_arch_number = mach_type; }#if defined(CONFIG_KM_MGCOGE3UN) char *wait_for_ne; wait_for_ne = getenv("waitforne"); if (wait_for_ne != NULL) { if (strcmp(wait_for_ne, "true") == 0) { int cnt = 0; int abort = 0; puts("NE go: "); while (startup_allowed() == 0) { if (tstc()) { (void) getc(); /* consume input */ abort = 1; break; } udelay(200000); cnt++; if (cnt == 5) puts("wait/b/b/b/b"); if (cnt == 10) { cnt = 0; puts(" /b/b/b/b"); } } if (abort == 1) printf("/nAbort waiting for ne/n"); else puts("OK/n"); } }#endif initialize_unit_leds(); set_km_env();#if defined(CONFIG_BOOTCOUNT_LIMIT) set_bootcount_addr();#endif return 0;}
开发者ID:Analias,项目名称:SNOWLeo-SDR-1,代码行数:49,
示例24: ctrlcint ctrlc(void){ if (!ctrlc_disabled && gd->have_console) { if (tstc()) { switch (getc()) { case 0x03: /* ^C - Control C */ ctrlc_was_pressed = 1; return 1; default: break; } } } return 0;}
开发者ID:aosp,项目名称:uboot,代码行数:15,
示例25: last_stage_initint last_stage_init(void){ int i;#if CONFIG_NETPHONE_VERSION == 2 /* assert peripheral reset */ ((volatile immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat &= ~_BW(12); for (i = 0; i < 10; i++) udelay(1000); ((volatile immap_t *)CONFIG_SYS_IMMR)->im_ioport.iop_pcdat |= _BW(12);#endif reset_phys(); /* check in order to enable the local console */ left_to_poll = PHONE_CONSOLE_POLL_HZ; i = CONFIG_SYS_HZ * 2; while (i > 0) { if (tstc()) { getc(); break; } do_poll(); if (drv_phone_use_me()) { status_led_set(0, STATUS_LED_ON); while (!drv_phone_is_idle()) { do_poll(); udelay(1000000 / CONFIG_SYS_HZ); } console_assign(stdin, "phone"); console_assign(stdout, "phone"); console_assign(stderr, "phone"); setenv("bootdelay", "-1"); break; } udelay(1000000 / CONFIG_SYS_HZ); i--; left_to_poll--; } left_to_poll = PHONE_CONSOLE_POLL_HZ; return 0;}
开发者ID:12thmantec,项目名称:u-boot-novena-spl,代码行数:47,
示例26: hello_worldint hello_world (int argc, char *argv[]){ app_startup(argv); printf ("Toggle SYSLED_4 using BOOT_KEY/n"); // Initialize pointers volatile unsigned long* GPIO_DATAIN_BOOTKEY = 0x48310038; volatile unsigned long* GPIO_OE_SYSLED4 = 0x49058034; volatile unsigned long* GPIO_DATAOUT_SYSLED4 = 0x4905803c; // Setup output for SYSLED4 *GPIO_OE_SYSLED4 &= 0xffffffef; // Continues loop checking BOOT_KEY and updating SYSLED: printf ("Hit any key to exit ... /n/n"); long bootKeyLast = 0; while(!tstc()) { if (*GPIO_DATAIN_BOOTKEY != bootKeyLast) { if (*GPIO_DATAIN_BOOTKEY & 128) printf ("%s", "SysLED4 is on!/n"); else printf ("%s", "SysLED4 is off!/n"); bootKeyLast = *GPIO_DATAIN_BOOTKEY; } if (*GPIO_DATAIN_BOOTKEY & 128) { *GPIO_DATAOUT_SYSLED4 &= 0xffffffef; } else { *GPIO_DATAOUT_SYSLED4 |= 16; } } // consume input (void) getc(); printf ("/n/n"); return (0);}
开发者ID:mikrj,项目名称:MPS_Exercises,代码行数:46,
示例27: while/** * getline - consume a line of input and handle some escape sequences */static char *getline(void){ static char buffer[100]; char c; size_t i; i = 0; while (1) { buffer[i] = '/0'; while (!tstc()) continue; c = getc(); /* Convert to uppercase */ if (c >= 'a' && c <= 'z') c -= ('a' - 'A'); switch (c) { case '/r': /* Enter/Return key */ case '/n': puts("/n"); return buffer; case 0x03: /* ^C - break */ return NULL; case 0x5F: case 0x08: /* ^H - backspace */ case 0x7F: /* DEL - backspace */ if (i) { puts("/b /b"); i--; } break; default: /* Ignore control characters */ if (c < 0x20) break; /* Queue up all other characters */ buffer[i++] = c; printf("%c", c); break; } }}
开发者ID:AvalueAES,项目名称:rev-sa01,代码行数:49,
示例28: do_load_serialstatic int do_load_serial(struct command *cmdtp, int argc, char *argv[]){ ulong offset = 0; ulong addr; int i; const char *env_echo; int rcode = 0; if (((env_echo = getenv("loads_echo")) != NULL) && (*env_echo == '1')) { do_echo = 1; } else { do_echo = 0; } if (argc == 2) { offset = simple_strtoul(argv[1], NULL, 16); } printf ("## Ready for S-Record download .../n"); addr = load_serial(offset); /* * Gather any trailing characters (for instance, the ^D which * is sent by 'cu' after sending a file), and give the * box some time (100 * 1 ms) */ for (i=0; i<100; ++i) { if (tstc()) { (void) getc(); } udelay(1000); } if (addr == ~0) { printf("## S-Record download aborted/n"); rcode = 1; } else { printf("## Start Addr = 0x%08lX/n", addr); } return rcode;}
开发者ID:cpdesign,项目名称:barebox,代码行数:43,
示例29: misc_init_rint misc_init_r(void){#if defined(CONFIG_KM_MGCOGE3UN) char *wait_for_ne; u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE); wait_for_ne = env_get("waitforne"); if ((wait_for_ne != NULL) && (dip_switch == 0)) { if (strcmp(wait_for_ne, "true") == 0) { int cnt = 0; int abort = 0; puts("NE go: "); while (startup_allowed() == 0) { if (tstc()) { (void) getc(); /* consume input */ abort = 1; break; } udelay(200000); cnt++; if (cnt == 5) puts("wait/b/b/b/b"); if (cnt == 10) { cnt = 0; puts(" /b/b/b/b"); } } if (abort == 1) printf("/nAbort waiting for ne/n"); else puts("OK/n"); } }#endif ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN); initialize_unit_leds(); set_km_env(); set_bootcount_addr(); return 0;}
开发者ID:CogSystems,项目名称:u-boot,代码行数:42,
示例30: console_countdownint console_countdown(int timeout_s, unsigned flags, char *out_key){ uint64_t start, second; int countdown, ret = -EINTR; int key = 0; start = get_time_ns(); second = start; countdown = timeout_s; if (!(flags & CONSOLE_COUNTDOWN_SILENT)) printf("%2d", countdown--); do { if (tstc()) { key = getchar(); if (flags & CONSOLE_COUNTDOWN_ANYKEY) goto out; if (flags & CONSOLE_COUNTDOWN_RETURN && key == '/n') goto out; if (flags & CONSOLE_COUNTDOWN_CTRLC && key == 3) goto out; key = 0; } if (!(flags & CONSOLE_COUNTDOWN_SILENT) && is_timeout(second, SECOND)) { printf("/b/b%2d", countdown--); second += SECOND; } } while (!is_timeout(start, timeout_s * SECOND)); ret = 0; out: if (!(flags & CONSOLE_COUNTDOWN_SILENT)) printf("/n"); if (key && out_key) *out_key = key; return ret;}
开发者ID:cherojeong,项目名称:barebox,代码行数:42,
注:本文中的tstc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tstring函数代码示例 C++ tstate_definition函数代码示例 |