linux内核态串口读写程序,linux 0.11 内核学习 -- rs_io.s,串口汇编代码
/*
* ?該文件實現rs232 串行通信中斷處理
*/
/*
* ?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/* must be power of two !
and must match the value
in tty_io.c!!! */
/* these are the offsets into the read/write buffer structures */
/* 讀寫緩沖結構中的偏移量tty_queue */
rs_addr = 0
head = 4
tail = 8
proc_list = 12
buf = 16
/* 當寫隊列里還剩256 個字符空間(WAKEUP_CHARS)時,我們就可以寫 */
startup= 256/* 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
/* 串行端口1 中斷處理程序入口點 */
_rs1_interrupt:
// tty 表中對應串口1 的讀寫緩沖指針的地址入棧
pushl $_table_list+8// table_list定義在文件tty_io.c文件中
jmp rs_int
/* 串行端口2 中斷處理程序入口點 */
.align 2
_rs2_interrupt:
pushl $_table_list+16// 同上
rs_int:
pushl %edx
pushl %ecx
pushl %ebx
pushl %eax
push %es
push %ds/* as this is an interrupt, we cannot */
/* 讓ds、es 指向內核數據段 */
pushl $0x10/* know that bs is ok. Load it */
pop %ds
pushl $0x10
pop %es
movl 24(%esp),%edx// 將緩沖隊列指針地址存入edx 寄存器
movl (%edx),%edx// 取讀隊列指針(地址)
總結
以上是生活随笔為你收集整理的linux内核态串口读写程序,linux 0.11 内核学习 -- rs_io.s,串口汇编代码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: oracle适配器接口,Oracle
- 下一篇: linux gcc 静态编译,GCC 程