xref: /original-bsd/sys/luna68k/dev/bmc.c (revision a043e977)
1 /*
2  * Copyright (c) 1992 OMRON Corporation.
3  * Copyright (c) 1992 The Regents of the University of California.
4  * All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * OMRON Corporation.
8  *
9  * %sccs.include.redist.c%
10  *
11  *	@(#)bmc.c	7.6 (Berkeley) 02/04/93
12  */
13 
14 #define	BMC_NOCONSOLE
15 
16 #define	BMC_CNPORT	1
17 
18 #include "bmc.h"
19 #if NBMC > 0
20 
21 #include <sys/param.h>
22 #include <sys/systm.h>
23 #include <sys/ioctl.h>
24 #include <sys/proc.h>
25 #include <sys/tty.h>
26 #include <sys/conf.h>
27 #include <sys/file.h>
28 #include <sys/uio.h>
29 #include <sys/kernel.h>
30 #include <sys/syslog.h>
31 #include <luna68k/dev/device.h>
32 #include <luna68k/dev/sioreg.h>
33 #include <luna68k/dev/siovar.h>
34 
35 extern	struct sio_portc *sio_port_assign();
36 
37 int     bmcprobe();
38 int     bmcopen();
39 void    bmcstart();
40 int     bmcparam();
41 int     bmcintr();
42 
43 struct	driver bmcdriver = {
44 	bmcprobe, "bmc",
45 };
46 
47 struct	bmc_softc {
48 	struct sio_portc *sc_pc;
49 	int	sc_mask;
50 };
51 
52 struct	bmc_softc bmc_softc[NBMC];
53 
54 struct	tty bmc_tty[NBMC];
55 
56 int	bmc_config_done = 0;
57 int	bmcconsole = -1;
58 int	bmcdefaultrate = B9600;				/* speed of console line is fixed */
59 int	bmcmajor = 13;
60 
61 #define	bmcunit(x)		minor(x)
62 
63 extern	struct tty *constty;
64 
65 /*
66  *  key-code decoding
67  */
68 
69 struct bmc_keymap {
70 	int	km_type;
71 	int	km_code[2];
72 };
73 
74 #define KC_CHAR		0x000000FF
75 #define KC_TYPE		0x0000FF00
76 #define	KC_CODE		0x00000000
77 #define	KC_SHIFT	0x00000100
78 #define	KC_IGNORE	0x0000FF00
79 
80 #define KS_SHIFT	0
81 #define KS_CTRL		1
82 #define KS_META		2
83 
84 struct bmc_keymap bmc_keymap[] = {
85 	KC_IGNORE,	0,		0,		/*   0 [0x00]	      */
86 	KC_IGNORE,	0,		0,		/*   1 [0x01]	      */
87 	KC_IGNORE,	0,		0,		/*   2 [0x02]	      */
88 	KC_IGNORE,	0,		0,		/*   3 [0x03]	      */
89 	KC_IGNORE,	0,		0,		/*   4 [0x04]	      */
90 	KC_IGNORE,	0,		0,		/*   5 [0x05]	      */
91 	KC_IGNORE,	0,		0,		/*   6 [0x06]	      */
92 	KC_IGNORE,	0,		0,		/*   7 [0x07]	      */
93 	KC_IGNORE,	0,		0,		/*   8 [0x08]	      */
94 	KC_CODE,	0x09,		0x09,		/*   9 [0x09]	TAB   */
95 	KC_SHIFT,	KS_CTRL,	KS_CTRL,	/*  10 [0x0A]	CTRL  */
96 	KC_IGNORE,	0,		0,		/*  11 [0x0B]	      */
97 	KC_SHIFT,	KS_SHIFT,	KS_SHIFT,	/*  12 [0x0C]	SHIFT */
98 	KC_SHIFT,	KS_SHIFT,	KS_SHIFT,	/*  13 [0x0D]	SHIFT */
99 	KC_IGNORE,	0,		0,		/*  14 [0x0E]	      */
100 	KC_SHIFT,	KS_META,	KS_META,	/*  15 [0x0F]	META  */
101 	KC_CODE,	0x1B,		0x1B,		/*  16 [0x10]	ESC   */
102 	KC_CODE,	0x08,		0x08,		/*  17 [0x11]	BS    */
103 	KC_CODE,	0x0D,		0x0D,		/*  18 [0x12]	CR    */
104 	KC_IGNORE,	0,		0,		/*  19 [0x13]	      */
105 	KC_CODE,	0x20,		0x20,		/*  20 [0x14]	SP    */
106 	KC_CODE,	0x7F,		0x7F,		/*  21 [0x15]	DEL   */
107 	KC_IGNORE,	0,		0,		/*  22 [0x16]	      */
108 	KC_IGNORE,	0,		0,		/*  23 [0x17]	      */
109 	KC_IGNORE,	0,		0,		/*  24 [0x18]	      */
110 	KC_IGNORE,	0,		0,		/*  25 [0x19]	      */
111 	KC_IGNORE,	0,		0,		/*  26 [0x1A]	      */
112 	KC_IGNORE,	0,		0,		/*  27 [0x1B]	      */
113 	KC_IGNORE,	0,		0,		/*  28 [0x1C]	      */
114 	KC_IGNORE,	0,		0,		/*  29 [0x1D]	      */
115 	KC_IGNORE,	0,		0,		/*  30 [0x1E]	      */
116 	KC_IGNORE,	0,		0,		/*  31 [0x1F]	      */
117 	KC_IGNORE,	0,		0,		/*  32 [0x20]	      */
118 	KC_IGNORE,	0,		0,		/*  33 [0x21]	      */
119 	KC_CODE,	0x31,		0x21,		/*  34 [0x22]	 1    */
120 	KC_CODE,	0x32,		0x22,		/*  35 [0x23]	 2    */
121 	KC_CODE,	0x33,		0x23,		/*  36 [0x24]	 3    */
122 	KC_CODE,	0x34,		0x24,		/*  37 [0x25]	 4    */
123 	KC_CODE,	0x35,		0x25,		/*  38 [0x26]	 5    */
124 	KC_CODE,	0x36,		0x26,		/*  39 [0x27]	 6    */
125 	KC_CODE,	0x37,		0x27,		/*  40 [0x28]	 7    */
126 	KC_CODE,	0x38,		0x28,		/*  41 [0x29]	 8    */
127 	KC_CODE,	0x39,		0x29,		/*  42 [0x2A]	 9    */
128 	KC_CODE,	0x30,		0x30,		/*  43 [0x2B]	 0    */
129 	KC_CODE,	0x2D,		0x3D,		/*  44 [0x2C]	 -    */
130 	KC_CODE,	0x5E,		0x7E,		/*  45 [0x2D]	 ^    */
131 	KC_CODE,	0x5C,		0x7C,		/*  46 [0x2E]	 \    */
132 	KC_IGNORE,	0,		0,		/*  47 [0x2F]	      */
133 	KC_IGNORE,	0,		0,		/*  48 [0x30]	      */
134 	KC_IGNORE,	0,		0,		/*  49 [0x31]	      */
135 	KC_CODE,	0x71,		0x51,		/*  50 [0x32]	 q    */
136 	KC_CODE,	0x77,		0x57,		/*  51 [0x33]	 w    */
137 	KC_CODE,	0x65,		0x45,		/*  52 [0x34]	 e    */
138 	KC_CODE,	0x72,		0x52,		/*  53 [0x35]	 r    */
139 	KC_CODE,	0x74,		0x54,		/*  54 [0x36]	 t    */
140 	KC_CODE,	0x79,		0x59,		/*  55 [0x37]	 y    */
141 	KC_CODE,	0x75,		0x55,		/*  56 [0x38]	 u    */
142 	KC_CODE,	0x69,		0x49,		/*  57 [0x39]	 i    */
143 	KC_CODE,	0x6F,		0x4F,		/*  58 [0x3A]	 o    */
144 	KC_CODE,	0x70,		0x50,		/*  59 [0x3B]	 p    */
145 	KC_CODE,	0x40,		0x60,		/*  60 [0x3C]	 @    */
146 	KC_CODE,	0x5B,		0x7B,		/*  61 [0x3D]	 [    */
147 	KC_IGNORE,	0,		0,		/*  62 [0x3E]	      */
148 	KC_IGNORE,	0,		0,		/*  63 [0x3F]	      */
149 	KC_IGNORE,	0,		0,		/*  64 [0x40]	      */
150 	KC_IGNORE,	0,		0,		/*  65 [0x41]	      */
151 	KC_CODE,	0x61,		0x41,		/*  66 [0x42]	 a    */
152 	KC_CODE,	0x73,		0x53,		/*  67 [0x43]	 s    */
153 	KC_CODE,	0x64,		0x44,		/*  68 [0x44]	 d    */
154 	KC_CODE,	0x66,		0x46,		/*  69 [0x45]	 f    */
155 	KC_CODE,	0x67,		0x47,		/*  70 [0x46]	 g    */
156 	KC_CODE,	0x68,		0x48,		/*  71 [0x47]	 h    */
157 	KC_CODE,	0x6A,		0x4A,		/*  72 [0x48]	 j    */
158 	KC_CODE,	0x6B,		0x4B,		/*  73 [0x49]	 k    */
159 	KC_CODE,	0x6C,		0x4C,		/*  74 [0x4A]	 l    */
160 	KC_CODE,	0x3B,		0x2B,		/*  75 [0x4B]	 ;    */
161 	KC_CODE,	0x3A,		0x2A,		/*  76 [0x4C]	 :    */
162 	KC_CODE,	0x5D,		0x7D,		/*  77 [0x4D]	 ]    */
163 	KC_IGNORE,	0,		0,		/*  78 [0x4E]	      */
164 	KC_IGNORE,	0,		0,		/*  79 [0x4F]	      */
165 	KC_IGNORE,	0,		0,		/*  80 [0x50]	      */
166 	KC_IGNORE,	0,		0,		/*  81 [0x51]	      */
167 	KC_CODE,	0x7A,		0x5A,		/*  82 [0x52]	 z    */
168 	KC_CODE,	0x78,		0x58,		/*  83 [0x53]	 x    */
169 	KC_CODE,	0x63,		0x43,		/*  84 [0x54]	 c    */
170 	KC_CODE,	0x76,		0x56,		/*  85 [0x55]	 v    */
171 	KC_CODE,	0x62,		0x42,		/*  86 [0x56]	 b    */
172 	KC_CODE,	0x6E,		0x4E,		/*  87 [0x57]	 n    */
173 	KC_CODE,	0x6D,		0x4D,		/*  88 [0x58]	 m    */
174 	KC_CODE,	0x2C,		0x3C,		/*  89 [0x59]	 ,    */
175 	KC_CODE,	0x2E,		0x3E,		/*  90 [0x5A]	 .    */
176 	KC_CODE,	0x2F,		0x3F,		/*  91 [0x5B]	 /    */
177 	KC_CODE,	0x5F,		0x5F,		/*  92 [0x5C]	 _    */
178 	KC_IGNORE,	0,		0,		/*  93 [0x5D]	      */
179 	KC_IGNORE,	0,		0,		/*  94 [0x5E]	      */
180 	KC_IGNORE,	0,		0,		/*  95 [0x5F]	      */
181 	KC_IGNORE,	0,		0,		/*  96 [0x60]	      */
182 	KC_IGNORE,	0,		0,		/*  97 [0x61]	      */
183 	KC_IGNORE,	0,		0,		/*  98 [0x62]	      */
184 	KC_IGNORE,	0,		0,		/*  99 [0x63]	      */
185 	KC_IGNORE,	0,		0,		/* 100 [0x64]	      */
186 	KC_IGNORE,	0,		0,		/* 101 [0x65]	      */
187 	KC_IGNORE,	0,		0,		/* 102 [0x66]	      */
188 	KC_IGNORE,	0,		0,		/* 103 [0x67]	      */
189 	KC_IGNORE,	0,		0,		/* 104 [0x68]	      */
190 	KC_IGNORE,	0,		0,		/* 105 [0x69]	      */
191 	KC_IGNORE,	0,		0,		/* 106 [0x6A]	      */
192 	KC_IGNORE,	0,		0,		/* 107 [0x6B]	      */
193 	KC_IGNORE,	0,		0,		/* 108 [0x6C]	      */
194 	KC_IGNORE,	0,		0,		/* 109 [0x6D]	      */
195 	KC_IGNORE,	0,		0,		/* 110 [0x6E]	      */
196 	KC_IGNORE,	0,		0,		/* 111 [0x6F]	      */
197 	KC_IGNORE,	0,		0,		/* 112 [0x70]	      */
198 	KC_IGNORE,	0,		0,		/* 113 [0x71]	      */
199 	KC_IGNORE,	0,		0,		/* 114 [0x72]	      */
200 	KC_IGNORE,	0,		0,		/* 115 [0x73]	      */
201 	KC_IGNORE,	0,		0,		/* 116 [0x74]	      */
202 	KC_IGNORE,	0,		0,		/* 117 [0x75]	      */
203 	KC_IGNORE,	0,		0,		/* 118 [0x76]	      */
204 	KC_IGNORE,	0,		0,		/* 119 [0x77]	      */
205 	KC_IGNORE,	0,		0,		/* 120 [0x78]	      */
206 	KC_IGNORE,	0,		0,		/* 121 [0x79]	      */
207 	KC_IGNORE,	0,		0,		/* 122 [0x7A]	      */
208 	KC_IGNORE,	0,		0,		/* 123 [0x7B]	      */
209 	KC_IGNORE,	0,		0,		/* 124 [0x7C]	      */
210 	KC_IGNORE,	0,		0,		/* 125 [0x7D]	      */
211 	KC_IGNORE,	0,		0,		/* 126 [0x7E]	      */
212 	KC_IGNORE,	0,		0,		/* 127 [0x7F]	      */
213 };
214 
215 int	shift_flag = 0;
216 int	ctrl_flag  = 0;
217 int	meta_flag  = 0;
218 
219 bmc_decode(code)
220 	register u_char code;
221 {
222 	register unsigned int c, updown;
223 
224 	if (code & 0x80)
225 		updown = 1;
226 	else
227 		updown = 0;
228 
229 	code &= 0x7F;
230 
231 	c = bmc_keymap[code].km_type;
232 
233 	switch(c) {
234 
235 	case KC_CODE:
236 		if (updown)
237 			c = KC_IGNORE;
238 		break;
239 
240 	case KC_SHIFT:
241 		switch(bmc_keymap[code].km_code[0]) {
242 		case KS_SHIFT:
243 			shift_flag = 1 - updown;
244 			break;
245 
246 		case KS_CTRL:
247 			ctrl_flag  = 1 - updown;
248 			break;
249 
250 		case KS_META:
251 			meta_flag  = 1 - updown;
252 			break;
253 		}
254 		break;
255 
256 	default:
257 		break;
258 	}
259 
260 	c |= bmc_keymap[code].km_code[shift_flag];
261 
262 	if (bmc_keymap[code].km_type == KC_CODE) {
263 		if (meta_flag)
264 			c |= 0x0080;
265 		if (ctrl_flag)
266 			c &= 0xFF1F;
267 	}
268 
269 	return(c);
270 }
271 
272 
273 /*
274  *  probe routine
275  */
276 
277 bmcprobe(hd)
278 	register struct hp_device *hd;
279 {
280 }
281 
282 bmcinit(port)
283 	register int port;
284 {
285 	register struct bmc_softc *sc = &bmc_softc[0];
286 
287 	/*
288 	 * if BMC is already configured, should be skipped.
289          */
290 	if (bmc_config_done)
291 		return(0);
292 
293 	/*
294 	 * Check out bitmap Interface board
295 	 */
296 
297 	/* port checking (for keyboard) */
298 	if (port != 1)
299 		return(0);
300 
301 	/* locate the major number */
302 	for (bmcmajor = 0; bmcmajor < nchrdev; bmcmajor++)
303 		if (cdevsw[bmcmajor].d_open == bmcopen)
304 			break;
305 
306 	sc->sc_pc = sio_port_assign(port, bmcmajor, 0, bmcintr);
307 
308 	printf("bmc%d: port %d, address 0x%x\n", sc->sc_pc->pc_unit, port, sc->sc_pc->pc_addr);
309 
310 	bmdinit();
311 
312 	bmc_config_done = 1;
313 	return(1);
314 }
315 
316 
317 /*
318  *  entry routines
319  */
320 
321 /* ARGSUSED */
322 #ifdef __STDC__
323 bmcopen(dev_t dev, int flag, int mode, struct proc *p)
324 #else
325 bmcopen(dev, flag, mode, p)
326 	dev_t dev;
327 	int flag, mode;
328 	struct proc *p;
329 #endif
330 {
331 	register struct tty *tp;
332 	register int unit;
333 	int error = 0;
334 
335 	unit = bmcunit(dev);
336 	if (unit >= NBMC)
337 		return (ENXIO);
338 	tp = &bmc_tty[unit];
339 	tp->t_oproc = bmcstart;
340 	tp->t_param = bmcparam;
341 	tp->t_dev = dev;
342 	if ((tp->t_state & TS_ISOPEN) == 0) {
343 		tp->t_state |= TS_WOPEN;
344 		ttychars(tp);
345 		if (tp->t_ispeed == 0) {
346 			tp->t_iflag = TTYDEF_IFLAG;
347 			tp->t_oflag = TTYDEF_OFLAG;
348 			tp->t_cflag = TTYDEF_CFLAG;
349 /*			tp->t_cflag = (CREAD | CS8 | HUPCL);	*/
350 			tp->t_lflag = TTYDEF_LFLAG;
351 			tp->t_ispeed = tp->t_ospeed = bmcdefaultrate;
352 		}
353 		bmcparam(tp, &tp->t_termios);
354 		ttsetwater(tp);
355 	} else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0)
356 		return (EBUSY);
357 	tp->t_state |= TS_CARR_ON;
358 	(void) spltty();
359 	while ((flag&O_NONBLOCK) == 0 && (tp->t_cflag&CLOCAL) == 0 &&
360 	       (tp->t_state & TS_CARR_ON) == 0) {
361 		tp->t_state |= TS_WOPEN;
362 		if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
363 		    ttopen, 0))
364 			break;
365 	}
366 	(void) spl0();
367 	if (error == 0)
368 		error = (*linesw[tp->t_line].l_open)(dev, tp);
369 
370 	return (error);
371 }
372 
373 /*ARGSUSED*/
374 bmcclose(dev, flag, mode, p)
375 	dev_t dev;
376 	int flag, mode;
377 	struct proc *p;
378 {
379 	register struct tty *tp;
380 	register int unit;
381 
382 	unit = bmcunit(dev);
383 	tp = &bmc_tty[unit];
384 	(*linesw[tp->t_line].l_close)(tp, flag);
385 	ttyclose(tp);
386 	return (0);
387 }
388 
389 bmcread(dev, uio, flag)
390 	dev_t dev;
391 	struct uio *uio;
392 {
393 	register struct tty *tp = &bmc_tty[bmcunit(dev)];
394 
395 	return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
396 }
397 
398 bmcwrite(dev, uio, flag)
399 	dev_t dev;
400 	struct uio *uio;
401 {
402 	register int unit = bmcunit(dev);
403 	register struct tty *tp = &bmc_tty[unit];
404 
405 	if ((unit == bmcconsole) && constty &&
406 	    (constty->t_state&(TS_CARR_ON|TS_ISOPEN))==(TS_CARR_ON|TS_ISOPEN))
407 		tp = constty;
408 
409 	return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
410 }
411 
412 /*
413  * Stop output on a line.
414  */
415 /*ARGSUSED*/
416 bmcstop(tp, flag)
417 	register struct tty *tp;
418 {
419 	register int s;
420 
421 	s = spltty();
422 	if (tp->t_state & TS_BUSY) {
423 		if ((tp->t_state&TS_TTSTOP)==0)
424 			tp->t_state |= TS_FLUSH;
425 	}
426 	splx(s);
427 }
428 
429 bmcioctl(dev, cmd, data, flag, p)
430 	dev_t dev;
431 	int cmd;
432 	caddr_t data;
433 	int flag;
434 	struct proc *p;
435 {
436 	register struct tty *tp;
437 	register int unit = bmcunit(dev);
438 	register int error;
439 
440 	tp = &bmc_tty[unit];
441 	error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
442 	if (error >= 0)
443 		return (error);
444 	error = ttioctl(tp, cmd, data, flag);
445 	if (error >= 0)
446 		return (error);
447 
448 	switch (cmd) {
449 	default:
450 		return (ENOTTY);
451 	}
452 	return (0);
453 }
454 
455 /*
456  *
457  */
458 void
459 bmcstart(tp)
460 	register struct tty *tp;
461 {
462 	int unit = bmcunit(tp->t_dev);
463 	register struct bmc_softc *sc = &bmc_softc[unit];
464 	register int cc, s;
465 	int hiwat = 0;
466 
467 	s = spltty();
468 	if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) {
469 		splx(s);
470 		return;
471 	}
472 	tp->t_state |= TS_BUSY;
473 	cc = tp->t_outq.c_cc;
474 	if (cc <= tp->t_lowat) {
475 		if (tp->t_state & TS_ASLEEP) {
476 			tp->t_state &= ~TS_ASLEEP;
477 			wakeup((caddr_t)&tp->t_outq);
478 		}
479 		selwakeup(&tp->t_wsel);
480 	}
481 	/*
482 	 * Limit the amount of output we do in one burst
483 	 * to prevent hogging the CPU.
484 	 */
485 	while (--cc >= 0) {
486 		register int c;
487 
488 		c = getc(&tp->t_outq);
489 		/*
490 		 * iteputchar() may take a long time and we don't want to
491 		 * block all interrupts for long periods of time.  Since
492 		 * there is no need to stay at high priority while outputing
493 		 * the character (since we don't have to worry about
494 		 * interrupts), we don't.  We just need to make sure that
495 		 * we don't reenter iteputchar, which is guarenteed by the
496 		 * earlier setting of TS_BUSY.
497 		 */
498 		splx(s);
499 		bmdputc(c & sc->sc_mask);
500 		spltty();
501 	}
502 	tp->t_state &= ~TS_BUSY;
503 	splx(s);
504 }
505 
506 bmcparam(tp, t)
507 	register struct tty *tp;
508 	register struct termios *t;
509 {
510 	int unit = bmcunit(tp->t_dev);
511 	register struct bmc_softc *sc = &bmc_softc[unit];
512 	register int cflag = t->c_cflag;
513 
514         /* and copy to tty */
515         tp->t_ispeed = t->c_ispeed;
516         tp->t_ospeed = t->c_ospeed;
517         tp->t_cflag = cflag;
518 
519 	/*
520 	 * change line speed
521 	 */
522 
523 	switch (cflag&CSIZE) {
524 	case CS5:
525 		sc->sc_mask = 0x1F ; break;
526 	case CS6:
527 		sc->sc_mask = 0x3F ; break;
528 	case CS7:
529 		sc->sc_mask = 0x7F ; break;
530 	case CS8:
531 		sc->sc_mask = 0xFF ; break;
532 	}
533 
534 	/*
535 	 * parity
536 	 */
537 
538 	/*
539 	 * stop bit
540 	 */
541 
542 	return (0);
543 }
544 
545 
546 /*
547  *  interrupt handling
548  */
549 
550 bmcintr(unit)
551 	register int unit;
552 {
553 	register struct siodevice *sio = bmc_softc[unit].sc_pc->pc_addr;
554 	register struct tty *tp;
555 	register u_char code;
556 	register int c;
557 	int s, rr;
558 
559 	tp = &bmc_tty[unit];
560 	rr = siogetreg(sio);
561 
562 	if (rr & RR_RXRDY) {
563 		code = sio->sio_data;
564 		c = bmc_decode(code);
565 		if (c & KC_TYPE)			/* skip special codes */
566 			return;
567 		code = (c & KC_CHAR);
568 		if ((tp->t_state & TS_ISOPEN) != 0)
569 			(*linesw[tp->t_line].l_rint)(code, tp);
570 	}
571 
572 	if (rr & RR_TXRDY) {
573 		sio->sio_cmd = WR0_RSTPEND;
574 	}
575 }
576 
577 /*
578  * Following are all routines needed for SIO to act as console
579  */
580 #include "../luna68k/cons.h"
581 
582 bmccnprobe(cp)
583 	register struct consdev *cp;
584 {
585 #ifdef BMC_NOCONSOLE
586 	cp->cn_pri = CN_DEAD;
587 	return;
588 #else
589 	/* check DIP-SW setup */
590 	/* check bitmap interface board */
591 
592 	/* locate the major number */
593 	for (bmcmajor = 0; bmcmajor < nchrdev; bmcmajor++)
594 		if (cdevsw[bmcmajor].d_open == bmcopen)
595 			break;
596 
597 	/* initialize required fields */
598 	cp->cn_dev = makedev(bmcmajor, 0);
599 	cp->cn_tp  = &bmc_tty[0];
600 	cp->cn_pri = CN_INTERNAL;
601 
602 	bmc_config_done = 1;
603 #endif
604 }
605 
606 bmccninit(cp)
607 	struct consdev *cp;
608 {
609 	int unit = bmcunit(cp->cn_dev);
610 	register struct bmc_softc *sc = &bmc_softc[0];
611 
612 	sioinit((struct siodevice *) SIO_HARDADDR, bmcdefaultrate);
613 	bmdinit();
614 
615 	/* port assign */
616 	sc->sc_pc = sio_port_assign(BMC_CNPORT, bmcmajor, 0, bmcintr);
617 
618 	bmcconsole = unit;
619 }
620 
621 bmccngetc(dev)
622 	dev_t dev;
623 {
624 	struct bmc_softc *sc = &bmc_softc[bmcunit(dev)];
625 	struct sio_portc *pc = sc->sc_pc;
626 	register int c;
627 	register u_char code;
628 
629 	do {
630 		code = sio_imgetc(pc->pc_addr);
631 	} while ((c = bmc_decode(code)) & KC_TYPE);
632 
633 	return(c);
634 }
635 
636 bmccnputc(dev, c)
637 	dev_t dev;
638 	int c;
639 {
640 	struct bmc_softc *sc = &bmc_softc[bmcunit(dev)];
641 	struct sio_portc *pc = sc->sc_pc;
642 
643 	bmdputc(c);
644 }
645 #endif
646