akaros/kern/arch/x86/console.h
<<
>>
Prefs
   1/* Copyright (c) 2012 The Regents of the University of California
   2 * Barret Rhoden <brho@cs.berkeley.edu>
   3 * See LICENSE for details.
   4 *
   5 * x86 Console (keyboard/serial/monitor) interfaces */
   6
   7#pragma once
   8
   9#include <ros/common.h>
  10#include <sys/queue.h>
  11
  12/* Types of console devices */
  13#define CONS_KB_DEV             1
  14#define CONS_SER_DEV            2
  15
  16struct cons_dev;
  17/* Interrupt-driven console input devices */
  18struct cons_dev {
  19        SLIST_ENTRY(cons_dev)           next;
  20        int                             type;   /* e.g., CONS_KB_DEV */
  21        int                             val;    /* e.g., COM1 */
  22        int                             irq;    /* desired irq */
  23        char                            *model; /* descriptive string */
  24        int (*getc)(struct cons_dev *, uint8_t *);
  25};
  26SLIST_HEAD(cons_dev_slist, cons_dev);
  27extern struct cons_dev_slist cdev_list;
  28
  29void cons_init(void);
  30/* Returns 0 on success, with the char in *data */
  31int cons_get_char(struct cons_dev *cdev, uint8_t *data);
  32/* Returns any available character, or 0 for none (legacy helper) */
  33int cons_get_any_char(void);
  34/* Writes c to the monitor and to all CONS_SER_DEV console devices */
  35void cons_putc(int c);
  36
  37/* TODO: remove us (and serial IO) */
  38void serial_send_byte(uint8_t b);
  39int serial_read_byte();
  40