Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/gxemul/cons/gxemul_cons.c
Show First 20 Lines • Show All 275 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
gxemul_cons_ttyinit(void *unused) | gxemul_cons_ttyinit(void *unused) | ||||
{ | { | ||||
struct tty *tp; | struct tty *tp; | ||||
tp = tty_alloc(&gxemul_cons_ttydevsw, NULL); | tp = tty_alloc(&gxemul_cons_ttydevsw, NULL); | ||||
tty_init_console(tp, 0); | tty_init_console(tp, 0); | ||||
tty_makedev(tp, NULL, "%s", "ttyu0"); | tty_makedev(tp, NULL, "%s", "ttyu0"); | ||||
callout_init(&gxemul_cons_callout, 1); | callout_init_mtx(&gxemul_cons_callout, ttydisc_getlock(tp), 0); | ||||
ttydisc_lock(tp); | |||||
callout_reset(&gxemul_cons_callout, gxemul_cons_polltime, | callout_reset(&gxemul_cons_callout, gxemul_cons_polltime, | ||||
gxemul_cons_timeout, tp); | gxemul_cons_timeout, tp); | ||||
ttydisc_unlock(tp); | |||||
} | } | ||||
SYSINIT(gxemul_cons_ttyinit, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, | SYSINIT(gxemul_cons_ttyinit, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE, | ||||
gxemul_cons_ttyinit, NULL); | gxemul_cons_ttyinit, NULL); | ||||
static void | static void | ||||
gxemul_cons_outwakeup(struct tty *tp) | gxemul_cons_outwakeup(struct tty *tp) | ||||
{ | { | ||||
int len; | int len; | ||||
Show All 15 Lines | |||||
static void | static void | ||||
gxemul_cons_timeout(void *v) | gxemul_cons_timeout(void *v) | ||||
{ | { | ||||
struct tty *tp; | struct tty *tp; | ||||
int c; | int c; | ||||
tp = v; | tp = v; | ||||
tty_lock(tp); | ttydisc_lock(tp); | ||||
GC_LOCK(); | GC_LOCK(); | ||||
while (gxemul_cons_readable()) { | while (gxemul_cons_readable()) { | ||||
c = gxemul_cons_read(); | c = gxemul_cons_read(); | ||||
GC_UNLOCK(); | GC_UNLOCK(); | ||||
#ifdef KDB | #ifdef KDB | ||||
kdb_alt_break(c, &gxemul_cons_alt_break_state); | kdb_alt_break(c, &gxemul_cons_alt_break_state); | ||||
#endif | #endif | ||||
ttydisc_rint(tp, c, 0); | ttydisc_rint(tp, c, 0); | ||||
GC_LOCK(); | GC_LOCK(); | ||||
} | } | ||||
GC_UNLOCK(); | GC_UNLOCK(); | ||||
ttydisc_rint_done(tp); | ttydisc_rint_done(tp); | ||||
tty_unlock(tp); | |||||
callout_reset(&gxemul_cons_callout, gxemul_cons_polltime, | callout_reset(&gxemul_cons_callout, gxemul_cons_polltime, | ||||
gxemul_cons_timeout, tp); | gxemul_cons_timeout, tp); | ||||
ttydisc_unlock(tp); | |||||
} | } |