/* flush_console_out(): * Call this function to wait for the console UART to flush all outgoing * characters. Note that this function has a timeout in the loop. */ void flush_console_out(void) { int timeout = 0; if (remoteputchar) return; while(timeout++ < 50000) { if (target_console_empty()) { monDelay(10); break; } } }
//-------------------------------------------------------------------------- // sed135x_on // // This function turns on the SED1355 or SED1356 LCD and/or CRT // void sed135x_on() { sed135x_off(); // Turn on the LCD and/or CRT // The SED1356 supports seperate LCD and CRT timing registers // that have already been setup. We just blank the side we // aren't using and enable the other. if (sed_disp_mode_crt) { // 1 = CRT Mode // Blank the LCD and CRT SED1356_REG_LCD_DISP_MODE_and_MISC |= H2SED(SED1356_LCD_DISP_BLANK); SED1356_REG_CRT_DISP_MODE |= H2SED(SED1356_CRT_DISP_BLANK); // turn the LCD backlight off lcd_bkl(0); // Set the SED1356 to CRT Mode SED1356_REG_DISP_MODE = H2SED(SED1356_DISP_SWIV_NORM | SED1356_DISP_MODE_CRT); // Turn on the CRT SED1356_REG_CRT_DISP_MODE &= ~H2SED(SED1356_CRT_DISP_BLANK); } // if CRT mode else { // 0 = LCD Mode // Blank the LCD and CRT SED1356_REG_LCD_DISP_MODE_and_MISC |= H2SED(SED1356_LCD_DISP_BLANK); SED1356_REG_CRT_DISP_MODE |= H2SED(SED1356_CRT_DISP_BLANK); // Set the SED1356 to LCD Mode SED1356_REG_DISP_MODE = H2SED(SED1356_DISP_SWIV_NORM | SED1356_DISP_MODE_LCD); // Turn on the LCD SED1356_REG_LCD_DISP_MODE_and_MISC &= ~H2SED(SED1356_LCD_DISP_BLANK); lcd_bkl(0xff); // turn the LCD backlight on/full brightness } // else LCD Mode monDelay(10); // wait for Power-up sequence to complete }
int Sleep(int argc,char *argv[]) { int opt, calibrate, count, multiplier; multiplier = 1000; calibrate = 0; while ((opt=getopt(argc,argv,"clmv:")) != -1) { switch(opt) { case 'c': calibrate = 2; break; case 'l': calibrate = 1; break; case 'm': multiplier = 1; break; case 'v': shell_sprintf(optarg,"%d",LoopsPerMillisecond*1000); return(CMD_SUCCESS); default: return(CMD_PARAM_ERROR); } } /* If no args, just print the current LPS value and return... */ if (argc == 1) { #if INCLUDE_HWTMR printf("Hardware-based timer, LPS not applicable\n"); #else printf("Current LPS = %ld\n",LoopsPerMillisecond * 1000); #endif return(CMD_SUCCESS); } /* For calibration, take in the count on the command line, then use * it to put out 5 dots dot at the rate of the loop to allow the user * to adjust it to be about 1 second. */ if (calibrate) { #if INCLUDE_HWTMR printf("Hardware-based timer, doesn't calibrate\n"); #else long lps; if (argc != optind+1) return(CMD_PARAM_ERROR); printf("Current LPS: %ld\n",LoopsPerMillisecond * 1000); lps = strtol(argv[optind],0,0); LoopsPerMillisecond = lps/1000; printf("New LPS: %ld%s\n",LoopsPerMillisecond * 1000, lps % 1000 ? " (truncated by 1000)" : ""); if (calibrate == 2) { count = 10; while(count-- > 0) { monDelay(1000); putstr(".\007"); } putchar('\n'); } #endif return(CMD_SUCCESS); } if (argc == optind) count = 1; else count = strtol(argv[optind],(char **)0,0); monDelay(count * multiplier); return(CMD_SUCCESS); }