PXA250上的XBOOT

源代码在线查看: parallel.c

软件大小: 110 K
上传用户: pipinooad
关键词: XBOOT PXA 250
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* 				 * $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 , 2001, 2002.				 *				 */								#include 				#include 								#include "except.h"				#include "parport.h"				#include "download.h"				#include "format.h"								static void				PP_writechar( char c )				{					OEMParallelPortSendByte( c );				}								static char				PP_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				 */				int				PP_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;				}							

相关资源