亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 8250.c

?? IXP425 平臺下嵌入式LINUX的串口的驅動程序
?? C
?? 第 1 頁 / 共 4 頁
字號:
/* *  linux/drivers/char/serial_8250.c * *  Driver for 8250/16550-type serial ports * *  Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. * *  Copyright (C) 2001 Russell King. * * 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. * *  $Id: 8250.c,v 1.14.2.8 2002/10/24 14:31:31 rmk Exp $ * * A note about mapbase / membase * *  mapbase is the physical address of the IO port.  Currently, we don't *  support this very well, and it may well be dropped from this driver *  in future.  As such, mapbase should be NULL. * *  membase is an 'ioremapped' cookie.  This is compatible with the old *  serial.c driver, and is currently the preferred form. */#include <linux/config.h>#include <linux/module.h>#include <linux/errno.h>#include <linux/sched.h>#include <linux/tty.h>#include <linux/tty_flip.h>#include <linux/major.h>#include <linux/ptrace.h>#include <linux/ioport.h>#include <linux/init.h>#include <linux/serial.h>#include <linux/console.h>#include <linux/sysrq.h>#include <linux/serial_reg.h>#include <linux/serialP.h>#include <linux/delay.h>#include <linux/serial_core.h>#include <linux/kmod.h>#include <asm/system.h>#include <asm/io.h>#include <asm/irq.h>#include <asm/uaccess.h>#include <asm/bitops.h>#include "8250.h"/* * This converts from our new CONFIG_ symbols to the symbols * that asm/serial.h expects.  You _NEED_ to comment out the * linux/config.h include contained inside asm/serial.h for * this to work. */#undef CONFIG_SERIAL_MANY_PORTS#undef CONFIG_SERIAL_DETECT_IRQ#undef CONFIG_SERIAL_MULTIPORT#undef CONFIG_HUB6#ifdef CONFIG_SERIAL_8250_MANY_PORTS#define CONFIG_SERIAL_MANY_PORTS 1#endif#ifdef CONFIG_SERIAL_8250_DETECT_IRQ#define CONFIG_SERIAL_DETECT_IRQ 1#endif#ifdef CONFIG_SERIAL_8250_MULTIPORT#define CONFIG_SERIAL_MULTIPORT 1#endif#ifdef CONFIG_SERIAL_8250_HUB6#define CONFIG_HUB6 1#endif#include <asm/serial.h>static struct old_serial_port old_serial_port[] = {	SERIAL_PORT_DFNS /* defined in asm/serial.h */};#define UART_NR	ARRAY_SIZE(old_serial_port)static struct tty_driver normal, callout;static struct tty_struct *serial8250_table[UART_NR];static struct termios *serial8250_termios[UART_NR], *serial8250_termios_locked[UART_NR];#ifdef CONFIG_SERIAL_8250_CONSOLEstatic struct console serial8250_console;static unsigned int lsr_break_flag;#endifstatic struct uart_info *IRQ_ports[NR_IRQS];#if defined(CONFIG_SERIAL_RSA) && defined(MODULE)#define PORT_RSA_MAX 4static int probe_rsa[PORT_RSA_MAX];static int force_rsa[PORT_RSA_MAX];MODULE_PARM(probe_rsa, "1-" __MODULE_STRING(PORT_RSA_MAX) "i");MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");MODULE_PARM(force_rsa, "1-" __MODULE_STRING(PORT_RSA_MAX) "i");MODULE_PARM_DESC(force_rsa, "Force I/O ports for RSA");#endif /* CONFIG_SERIAL_RSA  */#define port_acr	unused[0]	/* 8bit */#define port_ier	unused[1]	/* 8bit */#define port_rev	unused[2]	/* 8bit */#define port_lcr	unused[3]	/* 8bit *//* * Here we define the default xmit fifo size used for each type of UART. */static const struct serial_uart_config uart_config[PORT_MAX_8250+1] = {	{ "unknown",	1,	0 },	{ "8250",	1,	0 },	{ "16450",	1,	0 },	{ "16550",	1,	0 },	{ "16550A",	16,	UART_CLEAR_FIFO | UART_USE_FIFO },	{ "Cirrus",	1, 	0 },	{ "ST16650",	1,	UART_CLEAR_FIFO | UART_STARTECH },	{ "ST16650V2",	32,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },	{ "TI16750",	64,	UART_CLEAR_FIFO | UART_USE_FIFO },	{ "Startech",	1,	0 },	{ "16C950/954",	128,	UART_CLEAR_FIFO | UART_USE_FIFO },	{ "ST16654",	64,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },	{ "XR16850",	128,	UART_CLEAR_FIFO | UART_USE_FIFO | UART_STARTECH },	{ "RSA",	2048,	UART_CLEAR_FIFO | UART_USE_FIFO }};static _INLINE_ unsigned int serial_in(struct uart_port *port, int offset){	offset <<= port->regshift;	switch (port->iotype) {#ifdef CONFIG_SERIAL_8250_HUB6	case SERIAL_IO_HUB6:		outb(port->hub6 - 1 + offset, port->iobase);		return inb(port->iobase + 1);#endif	case SERIAL_IO_MEM:		return readb((unsigned long)port->membase + offset);	default:		return inb(port->iobase + offset);	}}static _INLINE_ voidserial_out(struct uart_port *port, int offset, int value){	offset <<= port->regshift;	switch (port->iotype) {#ifdef CONFIG_SERIAL_8250_HUB6	case SERIAL_IO_HUB6:		outb(port->hub6 - 1 + offset, port->iobase);		outb(value, port->iobase + 1);		break;#endif	case SERIAL_IO_MEM:		writeb(value, (unsigned long)port->membase + offset);		break;	default:		outb(value, port->iobase + offset);	}}/* * We used to support using pause I/O for certain machines.  We * haven't supported this for a while, but just in case it's badly * needed for certain old 386 machines, I've left these #define's * in.... */#define serial_inp(port, offset)		serial_in(port, offset)#define serial_outp(port, offset, value)	serial_out(port, offset, value)/* * For the 16C950 */static void serial_icr_write(struct uart_port *port, int offset, int  value){	serial_out(port, UART_SCR, offset);	serial_out(port, UART_ICR, value);}static unsigned int serial_icr_read(struct uart_port *port, int offset){	unsigned int value;	serial_icr_write(port, UART_ACR, port->port_acr | UART_ACR_ICRRD);	serial_out(port, UART_SCR, offset);	value = serial_in(port, UART_ICR);	serial_icr_write(port, UART_ACR, port->port_acr);	return value;}#ifdef CONFIG_SERIAL_RSA/* Attempts to turn on the RSA FIFO.  Returns zero on failure */static int enable_rsa(struct uart_port *port){	unsigned char mode;	int result;	unsigned long flags;	save_flags(flags); cli();	mode = serial_inp(port, UART_RSA_MSR);	result = mode & UART_RSA_MSR_FIFO;	if (!result) {		serial_outp(port, UART_RSA_MSR, mode | UART_RSA_MSR_FIFO);		mode = serial_inp(port, UART_RSA_MSR);		result = mode & UART_RSA_MSR_FIFO;	}	restore_flags(flags);	return result;}/* Attempts to turn off the RSA FIFO.  Returns zero on failure */static int disable_rsa(struct uart_port *port){	unsigned char mode;	int result;	unsigned long flags;	save_flags(flags); cli();	mode = serial_inp(port, UART_RSA_MSR);	result = !(mode & UART_RSA_MSR_FIFO);	if (!result) {		serial_outp(port, UART_RSA_MSR, mode & ~UART_RSA_MSR_FIFO);		mode = serial_inp(port, UART_RSA_MSR);		result = !(mode & UART_RSA_MSR_FIFO);	}	restore_flags(flags);	return result;}#endif /* CONFIG_SERIAL_RSA *//* * This is a quickie test to see how big the FIFO is. * It doesn't work at all the time, more's the pity. */static int size_fifo(struct uart_port *port){	unsigned char old_fcr, old_mcr, old_dll, old_dlm;	int count;	old_fcr = serial_inp(port, UART_FCR);	old_mcr = serial_inp(port, UART_MCR);	serial_outp(port, UART_FCR, UART_FCR_ENABLE_FIFO |		    UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);	serial_outp(port, UART_MCR, UART_MCR_LOOP);	serial_outp(port, UART_LCR, UART_LCR_DLAB);	old_dll = serial_inp(port, UART_DLL);	old_dlm = serial_inp(port, UART_DLM);	serial_outp(port, UART_DLL, 0x01);	serial_outp(port, UART_DLM, 0x00);	serial_outp(port, UART_LCR, 0x03);	for (count = 0; count < 256; count++)		serial_outp(port, UART_TX, count);	mdelay(20);	for (count = 0; (serial_inp(port, UART_LSR) & UART_LSR_DR) &&	     (count < 256); count++)		serial_inp(port, UART_RX);	serial_outp(port, UART_FCR, old_fcr);	serial_outp(port, UART_MCR, old_mcr);	serial_outp(port, UART_LCR, UART_LCR_DLAB);	serial_outp(port, UART_DLL, old_dll);	serial_outp(port, UART_DLM, old_dlm);	return count;}/* * This is a helper routine to autodetect StarTech/Exar/Oxsemi UART's. * When this function is called we know it is at least a StarTech * 16650 V2, but it might be one of several StarTech UARTs, or one of * its clones.  (We treat the broken original StarTech 16650 V1 as a * 16550, and why not?  Startech doesn't seem to even acknowledge its * existence.) *  * What evil have men's minds wrought... */static voidautoconfig_startech_uarts(struct uart_port *port){	unsigned char scratch, scratch2, scratch3, scratch4;	/*	 * First we check to see if it's an Oxford Semiconductor UART.	 *	 * If we have to do this here because some non-National	 * Semiconductor clone chips lock up if you try writing to the	 * LSR register (which serial_icr_read does)	 */	if (port->type == PORT_16550A) {		/*		 * EFR [4] must be set else this test fails		 *		 * This shouldn't be necessary, but Mike Hudson		 * (Exoray@isys.ca) claims that it's needed for 952		 * dual UART's (which are not recommended for new designs).		 */		port->port_acr = 0;		serial_out(port, UART_LCR, 0xBF);		serial_out(port, UART_EFR, 0x10);		serial_out(port, UART_LCR, 0x00);		/* Check for Oxford Semiconductor 16C950 */		scratch = serial_icr_read(port, UART_ID1);		scratch2 = serial_icr_read(port, UART_ID2);		scratch3 = serial_icr_read(port, UART_ID3);				if (scratch == 0x16 && scratch2 == 0xC9 &&		    (scratch3 == 0x50 || scratch3 == 0x52 ||		     scratch3 == 0x54)) {			port->type = PORT_16C950;			port->port_rev = serial_icr_read(port, UART_REV) |				(scratch3 << 8);			return;		}	}		/*	 * We check for a XR16C850 by setting DLL and DLM to 0, and then	 * reading back DLL and DLM.  The chip type depends on the DLM	 * value read back:	 *  0x10 - XR16C850 and the DLL contains the chip revision.	 *  0x12 - XR16C2850.	 *  0x14 - XR16C854.	 */	/* Save the DLL and DLM */	serial_outp(port, UART_LCR, UART_LCR_DLAB);	scratch3 = serial_inp(port, UART_DLL);	scratch4 = serial_inp(port, UART_DLM);	serial_outp(port, UART_DLL, 0);	serial_outp(port, UART_DLM, 0);	scratch2 = serial_inp(port, UART_DLL);	scratch = serial_inp(port, UART_DLM);	serial_outp(port, UART_LCR, 0);	if (scratch == 0x10 || scratch == 0x12 || scratch == 0x14) {		if (scratch == 0x10)			port->port_rev = scratch2;		port->type = PORT_16850;		return;	}	/* Restore the DLL and DLM */	serial_outp(port, UART_LCR, UART_LCR_DLAB);	serial_outp(port, UART_DLL, scratch3);	serial_outp(port, UART_DLM, scratch4);	serial_outp(port, UART_LCR, 0);	/*	 * We distinguish between the '654 and the '650 by counting	 * how many bytes are in the FIFO.  I'm using this for now,	 * since that's the technique that was sent to me in the	 * serial driver update, but I'm not convinced this works.	 * I've had problems doing this in the past.  -TYT	 */	if (size_fifo(port) == 64)		port->type = PORT_16654;	else		port->type = PORT_16650V2;}/* * This routine is called by rs_init() to initialize a specific serial * port.  It determines what type of UART chip this serial port is * using: 8250, 16450, 16550, 16550A.  The important question is * whether or not this UART is a 16550A or not, since this will * determine whether or not we can use its FIFO features or not. */static void autoconfig(struct uart_port *port, unsigned int probeflags){	unsigned char status1, status2, scratch, scratch2, scratch3;	unsigned char save_lcr, save_mcr;	unsigned long flags;#ifdef SERIAL_DEBUG_AUTOCONF	printk("Testing ttyS%d (0x%04x, 0x%08lx)...\n",		port->line, port->iobase, port->membase);#endif	if (!port->iobase && !port->membase)		return;	save_flags(flags); cli();	if (!(port->flags & ASYNC_BUGGY_UART)) {		/*		 * Do a simple existence test first; if we fail this,		 * there's no point trying anything else.		 * 		 * 0x80 is used as a nonsense port to prevent against		 * false positives due to ISA bus float.  The		 * assumption is that 0x80 is a non-existent port;		 * which should be safe since include/asm/io.h also		 * makes this assumption.		 */		scratch = serial_inp(port, UART_IER);		serial_outp(port, UART_IER, 0);#ifdef __i386__		outb(0xff, 0x080);#endif		scratch2 = serial_inp(port, UART_IER);		serial_outp(port, UART_IER, 0x0F);#ifdef __i386__		outb(0, 0x080);#endif		scratch3 = serial_inp(port, UART_IER);		serial_outp(port, UART_IER, scratch);		if (scratch2 || scratch3 != 0x0F) {#ifdef SERIAL_DEBUG_AUTOCONF			printk("serial: ttyS%d: simple autoconfig failed "			       "(%02x, %02x)\n", port->line, 			       scratch2, scratch3);#endif			restore_flags(flags);			return;		/* We failed; there's nothing here */		}	}	save_mcr = serial_in(port, UART_MCR);	save_lcr = serial_in(port, UART_LCR);	/* 	 * Check to see if a UART is really there.  Certain broken	 * internal modems based on the Rockwell chipset fail this	 * test, because they apparently don't implement the loopback	 * test mode.  So this test is skipped on the COM 1 through	 * COM 4 ports.  This *should* be safe, since no board	 * manufacturer would be stupid enough to design a board	 * that conflicts with COM 1-4 --- we hope!	 */	if (!(port->flags & ASYNC_SKIP_TEST)) {		serial_outp(port, UART_MCR, UART_MCR_LOOP | 0x0A);		status1 = serial_inp(port, UART_MSR) & 0xF0;		serial_outp(port, UART_MCR, save_mcr);		if (status1 != 0x90) {#ifdef SERIAL_DEBUG_AUTOCONF			printk("serial: ttyS%d: no UART loopback failed\n",			       port->line);#endif			restore_flags(flags);			return;		}	}	serial_outp(port, UART_LCR, 0xBF); /* set up for StarTech test */	serial_outp(port, UART_EFR, 0);	/* EFR is the same as FCR */	serial_outp(port, UART_LCR, 0);	serial_outp(port, UART_FCR, UART_FCR_ENABLE_FIFO);	scratch = serial_in(port, UART_IIR) >> 6;	switch (scratch) {		case 0:			port->type = PORT_16450;			break;		case 1:			port->type = PORT_UNKNOWN;			break;		case 2:			port->type = PORT_16550;			break;		case 3:			port->type = PORT_16550A;			break;	}	if (port->type == PORT_16550A) {		/* Check for Startech UART's */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲午夜免费电影| 国产精品美女久久久久久久久| 国内久久精品视频| 偷拍日韩校园综合在线| 亚洲精品免费在线| 国产精品福利一区| 亚洲欧洲韩国日本视频| 国产精品成人一区二区艾草| 亚洲欧洲av色图| 亚洲精品中文字幕乱码三区| 亚洲免费观看在线观看| 亚洲综合激情另类小说区| 亚洲一级片在线观看| 亚洲电影第三页| 日韩av二区在线播放| 麻豆精品在线视频| 国产一区二区伦理| av一二三不卡影片| 欧美在线小视频| 欧美一区二区视频免费观看| 久久婷婷成人综合色| 国产精品婷婷午夜在线观看| 亚洲图片激情小说| 亚洲va天堂va国产va久| 激情偷乱视频一区二区三区| 国产v综合v亚洲欧| 欧美日韩在线播放三区四区| 欧美二区三区91| 国产日韩欧美麻豆| 亚洲精品国产无套在线观| 天天色 色综合| 国产成人av在线影院| 欧美午夜影院一区| 2019国产精品| 亚洲一区二区在线免费看| 美国三级日本三级久久99| 99热精品一区二区| 欧美人与z0zoxxxx视频| 久久久亚洲高清| 亚洲国产成人av网| 国产成人av影院| 91精品久久久久久蜜臀| 国产三级三级三级精品8ⅰ区| 亚洲美女免费在线| 国产精品中文字幕日韩精品| 欧美日韩卡一卡二| 国产精品毛片无遮挡高清| 日本伊人精品一区二区三区观看方式| 国产成人免费在线| 日韩精品一区在线观看| 怡红院av一区二区三区| 91麻豆蜜桃一区二区三区| 日韩欧美黄色影院| 一级精品视频在线观看宜春院| 国内国产精品久久| 91精品欧美久久久久久动漫| 日韩一区中文字幕| 国产一区二区福利视频| 欧美少妇性性性| 亚洲伦在线观看| 国产激情91久久精品导航 | 日韩视频永久免费| 国产精品对白交换视频 | av一区二区三区| 久久这里都是精品| 久久99蜜桃精品| 5858s免费视频成人| 一区二区三区在线观看视频| 成人在线一区二区三区| 亚洲精品在线一区二区| 美女www一区二区| 欧美一二三四区在线| 香蕉影视欧美成人| 欧美日韩亚洲综合在线| 亚洲一区二区综合| 91久久精品一区二区三| 亚洲免费在线播放| 91国产免费看| 亚洲一二三四在线| 欧美无砖砖区免费| 亚洲国产一二三| 欧美久久婷婷综合色| 天堂成人国产精品一区| 欧美电影在哪看比较好| 蜜桃av一区二区在线观看| 亚洲欧洲精品天堂一级| 成人激情视频网站| 综合久久综合久久| 在线免费不卡电影| 天天影视色香欲综合网老头| 欧美日韩国产一区二区三区地区| 亚洲一区二区精品视频| 欧美日韩视频不卡| 久久99精品国产麻豆婷婷洗澡| 精品毛片乱码1区2区3区| 国产乱子伦视频一区二区三区 | 日韩一卡二卡三卡四卡| 免费看日韩a级影片| 久久综合av免费| 成人av网站在线| 亚洲成人黄色影院| 久久久噜噜噜久噜久久综合| 高清在线观看日韩| 一区二区在线看| 日韩一区二区麻豆国产| 不卡视频在线观看| 五月婷婷激情综合网| 久久一夜天堂av一区二区三区| 99麻豆久久久国产精品免费 | 亚洲精品一区二区三区蜜桃下载| 国产传媒一区在线| 一区二区高清在线| 精品99一区二区| 在线观看不卡一区| 国产精品一区二区在线播放 | 国产精品二区一区二区aⅴ污介绍| 99久久精品国产一区| 日韩主播视频在线| 亚洲欧洲av在线| 精品裸体舞一区二区三区| 欧美一区二区在线不卡| 国产一区二区不卡在线| 亚洲综合色成人| 国产精品久久午夜| 26uuu成人网一区二区三区| 在线观看免费成人| 风流少妇一区二区| 精品一区二区免费看| 一片黄亚洲嫩模| 国产精品国产自产拍高清av| 精品久久久久99| 91精品午夜视频| 欧洲亚洲精品在线| 91麻豆国产自产在线观看| 国产精品一区三区| 九九在线精品视频| 三级影片在线观看欧美日韩一区二区| 国产午夜精品理论片a级大结局| 欧美视频自拍偷拍| 91色视频在线| 波多野结衣中文一区| 国产精品综合久久| 久久99久久99| 久久99精品国产.久久久久| 亚洲.国产.中文慕字在线| 亚洲天堂2014| 亚洲欧美国产高清| 亚洲日本一区二区三区| 亚洲视频免费在线观看| 国产精品电影一区二区| 欧美国产禁国产网站cc| 久久久精品天堂| 国产亚洲一二三区| 日本一区二区三区免费乱视频| 精品三级在线看| 久久久久久久精| 国产精品视频观看| 中文字幕中文字幕中文字幕亚洲无线| 国产人成一区二区三区影院| 久久这里只有精品首页| 国产欧美一区二区三区沐欲| 国产三级一区二区| 亚洲欧洲精品成人久久奇米网| 中文字幕在线不卡一区二区三区| 中文字幕亚洲欧美在线不卡| 亚洲欧洲性图库| 亚洲综合一区二区精品导航| 天天色天天爱天天射综合| 日本人妖一区二区| 国产激情一区二区三区四区| 国产高清视频一区| 91免费视频网| 51精品久久久久久久蜜臀| 欧美tickling网站挠脚心| 国产日韩精品一区二区浪潮av| 中文字幕在线免费不卡| 亚洲成人av免费| 久久成人免费网| 成人性视频网站| 欧美性色aⅴ视频一区日韩精品| 555夜色666亚洲国产免| 中文字幕亚洲区| 日韩电影一区二区三区| 国内成人精品2018免费看| 成av人片一区二区| 欧美日韩一区二区在线观看| 欧美mv日韩mv国产网站app| 欧美极品另类videosde| 亚洲国产精品天堂| 国产乱码精品一品二品| 91九色最新地址| 久久蜜桃av一区二区天堂| 亚洲人精品午夜| 精品一区二区影视| 色综合天天做天天爱| 亚洲精品在线免费观看视频| 亚洲精品成人a在线观看| 国产在线一区观看| 欧美日韩不卡在线| 中文字幕一区二区三区四区|