文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>lab1:kern/console.c: serial_init

lab1:kern/console.c: serial_init

时间:2009-02-27  来源:朝花夕拾

//03F8-03FF ---- serial port (8250,8251,16450,16550,16550A,etc.)// same as 02E8,02F8 and 03E8
void serial_init (void) {
// Turn off the FIFO
outb(COM1+COM_FCR, 0); => outb(0x03FA,0)

// Set speed; requires DLAB latch(锁存器)
//Line Control Register, set Divisor latch access bit
outb(COM1+COM_LCR, COM_LCR_DLAB); => outb(0x03FB,0x80)
//Divisor Latch Low (DLAB=1)
outb(COM1+COM_DLL, (uint8_t)(115200/9600)); => outb(0x03F8,12)
//Divisor Latch High (DLAB=1)
outb(COM1+COM_DLM, 0); => outb(0x03F9,0)

 // 8 data bits, 1 stop bit, parity off; turn off DLAB latch
outb(COM1+COM_LCR, COM_LCR_WLEN8 & ~COM_LCR_DLAB); => outb(0x03FB,0x03)

// set Modem Control Register: No modem controls
outb(COM1+COM_MCR, 0); => outb(0x03FC,0)

// set Interrupt Enable Register: Enable receiver data interrupt
outb(COM1+COM_IER, COM_IER_RDI); => outb(0x03F9,0x01)

// Clear any preexisting overrun indications and interrupts
// Serial port doesn't exist if COM_LSR returns 0xFF
serial_exists = (inb(COM1+COM_LSR) != 0xFF); => inb(0x03FD)
// ??
(void) inb(COM1+COM_IIR); => inb(0x03FA)
(void) inb(COM1+COM_RX); => inb(0x03F8)
}
相关阅读 更多 +
排行榜 更多 +
爱是小事最新版

爱是小事最新版

休闲益智 下载
悬案2刹那惊颤游戏

悬案2刹那惊颤游戏

冒险解谜 下载
几何飞行内购修改版

几何飞行内购修改版

飞行射击 下载