Update to new console api.

This commit is contained in:
Poul-Henning Kamp 2006-05-26 18:25:34 +00:00
parent af8d1678e1
commit 05c3592e13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158964
3 changed files with 22 additions and 57 deletions

View File

@ -73,13 +73,13 @@ static int ofw_tty_param(struct tty *, struct termios *);
static void ofw_tty_stop(struct tty *, int);
static void ofw_timeout(void *);
static cn_probe_t ofw_cons_probe;
static cn_init_t ofw_cons_init;
static cn_getc_t ofw_cons_getc;
static cn_checkc_t ofw_cons_checkc;
static cn_putc_t ofw_cons_putc;
static cn_probe_t ofw_cnprobe;
static cn_init_t ofw_cninit;
static cn_term_t ofw_cnterm;
static cn_getc_t ofw_cngetc;
static cn_putc_t ofw_cnputc;
CONS_DRIVER(ofw, ofw_cons_probe, ofw_cons_init, NULL, ofw_cons_getc,
CONSOLE_DRIVER(ofw)
ofw_cons_checkc, ofw_cons_putc, NULL);
static void
@ -260,7 +260,7 @@ ofw_cons_probe(struct consdev *cp)
}
static void
ofw_cons_init(struct consdev *cp)
ofw_cninit(struct consdev *cp)
{
/* XXX: This is the alias, but that should be good enough */
@ -268,30 +268,13 @@ ofw_cons_init(struct consdev *cp)
cp->cn_tp = ofw_tp;
}
static int
ofw_cons_getc(struct consdev *cp)
static void
ofw_cneterm(struct consdev *cp)
{
unsigned char ch;
int l;
ch = '\0';
while ((l = OF_read(stdin, &ch, 1)) != 1) {
if (l != -2 && l != 0) {
return (-1);
}
}
#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER)
if (kdb_alt_break(ch, &alt_break_state))
kdb_enter("Break sequence on console");
#endif
return (ch);
}
static int
ofw_cons_checkc(struct consdev *cp)
ofw_cngetc(struct consdev *cp)
{
unsigned char ch;
@ -307,7 +290,7 @@ ofw_cons_checkc(struct consdev *cp)
}
static void
ofw_cons_putc(struct consdev *cp, int c)
ofw_cnputc(struct consdev *cp, int c)
{
char cbuf;

View File

@ -129,7 +129,6 @@ static cn_probe_t zs_cnprobe;
static cn_init_t zs_cninit;
static cn_term_t zs_cnterm;
static cn_getc_t zs_cngetc;
static cn_checkc_t zs_cncheckc;
static cn_putc_t zs_cnputc;
static int zstty_cngetc(struct zstty_softc *sc);
@ -155,8 +154,7 @@ static struct cdevsw zstty_cdevsw = {
static struct zstty_softc *zstty_cons;
CONS_DRIVER(zs, zs_cnprobe, zs_cninit, zs_cnterm, zs_cngetc, zs_cncheckc,
zs_cnputc, NULL);
CONSOLE_DRIVER(zs);
int
zs_probe(device_t dev)
@ -833,16 +831,6 @@ zs_cngetc(struct consdev *cn)
{
struct zstty_softc *sc = zstty_cons;
if (sc == NULL)
return (-1);
return (zstty_cngetc(sc));
}
static int
zs_cncheckc(struct consdev *cn)
{
struct zstty_softc *sc = zstty_cons;
if (sc == NULL)
return (-1);
return (zstty_cncheckc(sc));

View File

@ -87,14 +87,19 @@ ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, int which)
}
static void
ssccnprobe(struct consdev *cp)
ssc_cnprobe(struct consdev *cp)
{
sprintf(cp->cn_name, "ssccons");
cp->cn_pri = CN_INTERNAL;
}
static void
ssccninit(struct consdev *cp)
ssc_cninit(struct consdev *cp)
{
}
static void
ssc_cnterm(struct consdev *cp)
{
}
@ -108,24 +113,13 @@ ssccnattach(void *arg)
SYSINIT(ssccnattach, SI_SUB_DRIVERS, SI_ORDER_ANY, ssccnattach, 0);
static void
ssccnputc(struct consdev *cp, int c)
ssc_cnputc(struct consdev *cp, int c)
{
ssc(c, 0, 0, 0, SSC_PUTCHAR);
}
static int
ssccngetc(struct consdev *cp)
{
int c;
do {
c = ssc(0, 0, 0, 0, SSC_GETCHAR);
} while (c == 0);
return c;
}
static int
ssccncheckc(struct consdev *cp)
ssc_cngetc(struct consdev *cp)
{
int c;
c = ssc(0, 0, 0, 0, SSC_GETCHAR);
@ -243,4 +237,4 @@ ssctimeout(void *v)
ssctimeouthandle = timeout(ssctimeout, tp, polltime);
}
CONS_DRIVER(ssc, ssccnprobe, ssccninit, NULL, ssccngetc, ssccncheckc, ssccnputc, NULL);
CONSOLE_DRIVER(ssc);