文章详情

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

lab1:kern/console.c: cons_getc,cons_putc

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

// return the next input character from the console, or 0 if none waitingint
cons_getc(void)
{
  int c;

  // poll for any pending input characters,
  // so that this function works even when interrupts are disabled
  // (e.g., when called from the kernel monitor).
  serial_intr(); // 输入又可能来自串口或者键盘, xxx_intr设置终端响应函数
  kbd_intr(); // 调用cons_intr(int (*proc)(void)),proc为各自的接口处理函数
  // 将输入保存到cons.buf内

  // grab the next character from the input buffer.
  if (cons.rpos != cons.wpos) { // buffer内有输入;使用数组作为循环buffer
  c = cons.buf[cons.rpos++];
  if (cons.rpos == CONSBUFSIZE) // 循环buffer
  cons.rpos = 0;
  return c;
  }
  return 0;

}

// output a character to the console
void
cons_putc(int c)
{
  lpt_putc(c); // 输出到parallel printer port,打印机
  cga_putc(c); // 输出到Color Graphics Adapter,显示器
}

相关阅读 更多 +
排行榜 更多 +
爱是小事最新版

爱是小事最新版

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

悬案2刹那惊颤游戏

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

几何飞行内购修改版

飞行射击 下载