Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bvm/bvm_console.c
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
cn_drvinit(void *unused) | cn_drvinit(void *unused) | ||||
{ | { | ||||
struct tty *tp; | struct tty *tp; | ||||
if (bvm_consdev.cn_pri != CN_DEAD) { | if (bvm_consdev.cn_pri != CN_DEAD) { | ||||
tp = tty_alloc(&bvm_ttydevsw, NULL); | tp = tty_alloc(&bvm_ttydevsw, NULL); | ||||
callout_init_mtx(&bvm_timer, tty_getlock(tp), 0); | callout_init_mtx(&bvm_timer, ttydisc_getlock(tp), 0); | ||||
tty_makedev(tp, NULL, "bvmcons"); | tty_makedev(tp, NULL, "bvmcons"); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
bvm_tty_open(struct tty *tp) | bvm_tty_open(struct tty *tp) | ||||
{ | { | ||||
ttydisc_assert_locked(tp); | |||||
polltime = hz / BVMCONS_POLL_HZ; | polltime = hz / BVMCONS_POLL_HZ; | ||||
if (polltime < 1) | if (polltime < 1) | ||||
polltime = 1; | polltime = 1; | ||||
callout_reset(&bvm_timer, polltime, bvm_timeout, tp); | callout_reset(&bvm_timer, polltime, bvm_timeout, tp); | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
bvm_tty_close(struct tty *tp) | bvm_tty_close(struct tty *tp) | ||||
{ | { | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
callout_stop(&bvm_timer); | callout_stop(&bvm_timer); | ||||
} | } | ||||
static void | static void | ||||
bvm_tty_outwakeup(struct tty *tp) | bvm_tty_outwakeup(struct tty *tp) | ||||
{ | { | ||||
int len, written; | int len, written; | ||||
u_char buf[BVMBURSTLEN]; | u_char buf[BVMBURSTLEN]; | ||||
Show All 12 Lines | |||||
static void | static void | ||||
bvm_timeout(void *v) | bvm_timeout(void *v) | ||||
{ | { | ||||
struct tty *tp; | struct tty *tp; | ||||
int c; | int c; | ||||
tp = (struct tty *)v; | tp = (struct tty *)v; | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
while ((c = bvm_cngetc(NULL)) != -1) | while ((c = bvm_cngetc(NULL)) != -1) | ||||
ttydisc_rint(tp, c, 0); | ttydisc_rint(tp, c, 0); | ||||
ttydisc_rint_done(tp); | ttydisc_rint_done(tp); | ||||
callout_reset(&bvm_timer, polltime, bvm_timeout, tp); | callout_reset(&bvm_timer, polltime, bvm_timeout, tp); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |