Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cfe/cfe_console.c
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
cn_drvinit(void *unused) | cn_drvinit(void *unused) | ||||
{ | { | ||||
struct tty *tp; | struct tty *tp; | ||||
if (cfe_consdev.cn_pri != CN_DEAD && | if (cfe_consdev.cn_pri != CN_DEAD && | ||||
cfe_consdev.cn_name[0] != '\0') { | cfe_consdev.cn_name[0] != '\0') { | ||||
tp = tty_alloc(&cfe_ttydevsw, NULL); | tp = tty_alloc(&cfe_ttydevsw, NULL); | ||||
callout_init_mtx(&cfe_timer, tty_getlock(tp), 0); | callout_init_mtx(&cfe_timer, ttydisc_getlock(tp), 0); | ||||
tty_makedev(tp, NULL, "cfecons"); | tty_makedev(tp, NULL, "cfecons"); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
cfe_tty_open(struct tty *tp) | cfe_tty_open(struct tty *tp) | ||||
{ | { | ||||
ttydisc_assert_locked(tp); | |||||
polltime = hz / CFECONS_POLL_HZ; | polltime = hz / CFECONS_POLL_HZ; | ||||
if (polltime < 1) | if (polltime < 1) | ||||
polltime = 1; | polltime = 1; | ||||
callout_reset(&cfe_timer, polltime, cfe_timeout, tp); | callout_reset(&cfe_timer, polltime, cfe_timeout, tp); | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
cfe_tty_close(struct tty *tp) | cfe_tty_close(struct tty *tp) | ||||
{ | { | ||||
ttydisc_assert_locked(tp); | |||||
callout_stop(&cfe_timer); | callout_stop(&cfe_timer); | ||||
} | } | ||||
static void | static void | ||||
cfe_tty_outwakeup(struct tty *tp) | cfe_tty_outwakeup(struct tty *tp) | ||||
{ | { | ||||
int len, written, rc; | int len, written, rc; | ||||
u_char buf[CFEBURSTLEN]; | u_char buf[CFEBURSTLEN]; | ||||
Show All 16 Lines | |||||
static void | static void | ||||
cfe_timeout(void *v) | cfe_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 = cfe_cngetc(NULL)) != -1) | while ((c = cfe_cngetc(NULL)) != -1) | ||||
ttydisc_rint(tp, c, 0); | ttydisc_rint(tp, c, 0); | ||||
ttydisc_rint_done(tp); | ttydisc_rint_done(tp); | ||||
callout_reset(&cfe_timer, polltime, cfe_timeout, tp); | callout_reset(&cfe_timer, polltime, cfe_timeout, tp); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |