⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug-sa1110.c

📁 PXA250上的XBOOT
💻 C
字号:
/*  * $Id: debug-sa1110.c,v 1.1 2002/12/05 22:20:38 telka 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 "board.h"#if CPU == SA1110#include <_windows.h>#include <nkintr.h>#include <sa11x0/gpio.h>#include <sa11x0/uart.h>#include <sa11x0/hssp.h>#include "debug.h"#define	NONE	0#define	UART2	2#define	UART3	3/* select debug port */#if (WID != EP202)#define	DEBUG_PORT	UART3#else /* WID == EP202 */#define	DEBUG_PORT	UART2#endif/* Pointer to UART registers */#if DEBUG_PORT == UART2#	define	UART_pointer	UART2_pointer#elif DEBUG_PORT == UART3#	define	UART_pointer	UART3_pointer#endif/* wait for transmit all data in tx FIFO through debug serial port */voidOEMFlushDebugSerial( void ){#if (DEBUG_PORT != NONE)	while (UTSR1 & 0x1) ;#endif /* (DEBUG_PORT != NONE) */}#if (DEBUG_PORT != NONE)static uint32_t save_gpdr;#endif /* (DEBUG_PORT != NONE) */voidOEMInitDebugSerial( void ){#if (DEBUG_PORT == UART2)	HSCR0 = 0x00000000;			/* enable UART engine */	UTCR4 = 0x00000000;			/* functions as normal UART */#endif /* (DEBUG_PORT == UART2) */#if (DEBUG_PORT != NONE)	UTSR0 = 0xFF;	UTCR0 = 0x08;	UTCR3 = 0x00;	UTCR1 = 0x00;	UTCR2 = 0x01;				/* 0x17: 9600, 0x0b: 19200, 0x05: 38400, 0x03: 57600,						   0x01: 115200 baud */	save_gpdr = GPDR;#if (DEBUG_PORT == UART3)#if (WID == EI370)	GPDR |= GPIO_BCR_MASK | GPIO_BCR2_MASK;	GPSR = GPIO_BCR2_MASK;	GPCR = GPIO_BCR_MASK;#elif (WID == EP002)	GPDR |= GPIO_BCR_MASK;	GPSR = GPIO_BCR_MASK;#endif#endif /* (DEBUG_PORT == UART3) */#if (DEBUG_PORT == UART2) && (WID == EP202)	GPDR |= GPIO_BCS_MASK | GPIO_ISD_MASK;	GPSR = GPIO_ISD_MASK;	GPCR = GPIO_BCS_MASK;#endif	UTCR3 = 0x03;#endif /* (DEBUG_PORT != NONE) */}voidOEMDeinitDebugSerial( void ){#if (DEBUG_PORT != NONE)	UTCR3 = 0x00;	GPDR = save_gpdr;#endif /* (DEBUG_PORT != NONE) */}voidOEMWriteDebugByte( BYTE ch ){#if (DEBUG_PORT != NONE)	while (!(UTSR1 & 0x04)) ;	UTDR = ch;#endif /* (DEBUG_PORT != NONE) */}intOEMReadDebugByte( void ){#if (DEBUG_PORT != NONE)	int data;	if (!(UTSR1 & 0x2))		return OEM_DEBUG_READ_NODATA;	data = UTDR;	if (data & 0x700)		return OEM_DEBUG_COM_ERROR;	return data;#else /* (DEBUG_PORT != NONE) */	return OEM_DEBUG_READ_NODATA;#endif /* (DEBUG_PORT != NONE) */}#endif /* CPU == SA1110 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -