📄 serial.c
字号:
/* * $Id: serial.c,v 1.3 2003/09/24 12:13:35 jfabo Exp $ * * Copyright (C) 2001, 2002 ETC s.r.o. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * Written by Marcel Telka <marcel@telka.sk>, 2001, 2002. * */#include <_windows.h>#include <nkintr.h>#include "except.h"#include "download.h"#include "format.h"static voidSerial_writechar( char c ){ OEMWriteDebugByte( c );}static charSerial_read( unsigned char *buff, int len ){ int i; int Timeout = 0x100000; for (i = 0; i < len; i++) { Timeout = 0x100000; while (Timeout--) { if ((buff[i] = (unsigned char)(OEMReadDebugByte())) < 0) continue; else break; } if (!Timeout) Throw E_READTIMEOUT; } return 1;}intSerial_download( struct imginfo *img ){ int i; struct fntable fn = { Serial_writechar, Serial_read }; EdbgOutputDebugString( "Ready to download image via serial\n" ); for (i = 0; i < 2; i++) { EdbgOutputDebugString( "." ); Try { download( &fn, img, 1 ); } Catch_anonymous { continue; } return 0; } EdbgOutputDebugString( "\nFail to synchonize with the host\n" ); return -2;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -