Chinaunix首页 | 论坛 | 博客
  • 博客访问: 581208
  • 博文数量: 137
  • 博客积分: 4040
  • 博客等级: 上校
  • 技术积分: 1584
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-08 13:05
文章分类

全部博文(137)

文章存档

2011年(10)

2010年(23)

2009年(104)

分类: LINUX

2009-08-12 00:24:54

/*
 * linux/kernel/rs_io.s
 *
 * (C) 1991 Linus Torvalds
 */

/*
 *    rs_io.s
 *
 * This module implements the rs232 io interrupts.
 */

.text
.globl _rs1_interrupt,_rs2_interrupt

size    = 1024/*缓冲区(缓冲队列的长度)与/include/linux/tty.h line 14 #define TTY_BUF_SIZE 1024 相同 must be a power of two ! And MUST be the same                /* must be power of two !
                     and must match the value
                     in tty_io. */

/* these are the offsets into the read/write buffer structures */
rs_addr = 0 #串行端口号字段偏移(端口号是0x3f8 或0x2f8)。
head = 4 #缓冲区中头指针字段偏移
tail = 8 #缓冲区中尾指针字段偏移
proc_list = 12 #等待该缓冲的进程字段偏移
buf = 16 #缓冲区字段偏移

startup    = 256 #当写队列里还剩256 个字符空间(WAKEUP_CHARS)时,我们就可以写        /* chars left in write queue when we restart it */

/*
 * These are the actual interrupt routines. They look where
 * the interrupt is coming from, and take appropriate action.
 */
.align 2
_rs1_interrupt:#串行端口1 中断处理程序入口点。
    pushl $_table_list+8 #tty 表中对应串口1 的读写缓冲指针的地址入栈,linux-0.11\kernel\chr_drv\tty_io.c line 99
    jmp rs_int
.align 2
_rs2_interrupt:#串行端口2 中断处理程序入口点
    pushl $_table_list+16 #tty 表中对应串口2 的读写缓冲指针的地址入栈,linux-0.11\kernel\chr_drv\tty_io.c line 99
rs_int:
    pushl %edx
    pushl %ecx
    pushl %ebx
    pushl %eax
    push %es
    push %ds        /* as this is an interrupt, we cannot */
    pushl $0x10        /* know that bs is ok. Load it */
    pop %ds
    pushl $0x10
    pop %es
    movl 24(%esp),%edx
    movl (%edx),%edx
    movl rs_addr(%edx),%edx
    addl $2,%edx        /* interrupt ident. reg */
rep_int:
    xorl %eax,%eax
    inb %dx,%al
    testb $1,%al
    jne end
    cmpb $6,%al        /* this shouldn

阅读(674) | 评论(0) | 转发(0) |
0

上一篇:console.c

下一篇:serial.c

给主人留下些什么吧!~~