📄 parallel.c
字号:
/* * $Id: parallel.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 "parport.h"#include "download.h"#include "format.h"static voidPP_writechar( char c ){ OEMParallelPortSendByte( c );}static charPP_read( unsigned char *buff, int len ){ int i; for (i = 0; i < len; i++) { buff[i] = (unsigned char)OEMParallelPortGetByte(); if (buff[i] < 0) Throw E_READTIMEOUT; } return 1;}/* * PP_download - download .bin image via parallel port * returns: 0 for ok, -1 for download error, -2 for download timeout */intPP_download( struct imginfo *img ){ int i; struct fntable fn = { PP_writechar, PP_read }; EdbgOutputDebugString( "Ready to download image via parallel\n" ); /* first try MSCEPB protocol. */ PP_Protocol = PP_PROTOCOL_EPP; for (i = 0; i < 4; i++) { /* try all supported protocols (MSCEPB, EPP) in cycle */ switch (PP_Protocol) { case PP_PROTOCOL_MSCEPB: PP_Protocol = PP_PROTOCOL_EPP; break; case PP_PROTOCOL_EPP: default: PP_Protocol = PP_PROTOCOL_MSCEPB; } EdbgOutputDebugString( "." ); NoPPFS = FALSE; Try { download( &fn, img, PP_Protocol == PP_PROTOCOL_EPP ); } 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 + -