1 /* $NetBSD: zs.c,v 1.5 2001/07/08 21:04:50 thorpej Exp $ */ 2 3 /*- 4 * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Gordon W. Ross and Wayne Knowles 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 /* 40 * Zilog Z8530 Dual UART driver (machine-dependent part) 41 * 42 * Runs two serial lines per chip using slave drivers. 43 * Plain tty/async lines use the zs_async slave. 44 */ 45 46 #include "opt_ddb.h" 47 48 #include <sys/param.h> 49 #include <sys/systm.h> 50 #include <sys/conf.h> 51 #include <sys/device.h> 52 #include <sys/file.h> 53 #include <sys/ioctl.h> 54 #include <sys/kernel.h> 55 #include <sys/proc.h> 56 #include <sys/tty.h> 57 #include <sys/time.h> 58 #include <sys/syslog.h> 59 60 #include <machine/cpu.h> 61 #include <machine/intr.h> 62 #include <machine/autoconf.h> 63 #include <machine/z8530var.h> 64 65 #include <dev/cons.h> 66 #include <dev/ic/z8530reg.h> 67 68 #include <sgimips/hpc/hpcvar.h> 69 #include <sgimips/hpc/hpcreg.h> 70 71 #include <dev/arcbios/arcbios.h> 72 #include <dev/arcbios/arcbiosvar.h> 73 74 /* 75 * Some warts needed by z8530tty.c - 76 * The default parity REALLY needs to be the same as the PROM uses, 77 * or you can not see messages done with printf during boot-up... 78 */ 79 int zs_def_cflag = (CREAD | CS8 | HUPCL); 80 int zs_major = 35; 81 82 #define PCLK 3672000 /* PCLK pin input clock rate */ 83 84 #ifndef ZS_DEFSPEED 85 #define ZS_DEFSPEED 9600 86 #endif 87 88 /* 89 * Define interrupt levels. 90 */ 91 #define ZSHARD_PRI 64 92 93 /* SGI shouldn't need ZS_DELAY() as recovery time is done in hardware? */ 94 #define ZS_DELAY() delay(3) 95 96 /* The layout of this is hardware-dependent (padding, order). */ 97 struct zschan { 98 u_char pad1[3]; 99 volatile u_char zc_csr; /* ctrl,status, and indirect access */ 100 u_char pad2[3]; 101 volatile u_char zc_data; /* data */ 102 }; 103 104 struct zsdevice { 105 struct zschan zs_chan_b; 106 struct zschan zs_chan_a; 107 }; 108 109 /* Return the byte offset of element within a structure */ 110 #define OFFSET(struct_def, el) ((size_t)&((struct_def *)0)->el) 111 112 #define ZS_CHAN_A OFFSET(struct zsdevice, zs_chan_a) 113 #define ZS_CHAN_B OFFSET(struct zsdevice, zs_chan_b) 114 #define ZS_REG_CSR 0 115 #define ZS_REG_DATA 1 116 static int zs_chan_offset[] = {ZS_CHAN_A, ZS_CHAN_B}; 117 118 static void zscnprobe __P((struct consdev *)); 119 static void zscninit __P((struct consdev *)); 120 static int zscngetc __P((dev_t)); 121 static void zscnputc __P((dev_t, int)); 122 static void zscnpollc __P((dev_t, int)); 123 124 static int cons_port; 125 126 struct consdev zs_cn = { 127 zscnprobe, 128 zscninit, 129 zscngetc, 130 zscnputc, 131 zscnpollc 132 }; 133 134 /* Flags from cninit() */ 135 static int zs_consunit = -1; 136 static int zs_conschan = -1; 137 138 /* Default speed for all channels */ 139 static int zs_defspeed = ZS_DEFSPEED; 140 static volatile int zssoftpending; 141 142 static u_char zs_init_reg[16] = { 143 0, /* 0: CMD (reset, etc.) */ 144 0, /* 1: No interrupts yet. */ 145 ZSHARD_PRI, /* 2: IVECT */ 146 ZSWR3_RX_8 | ZSWR3_RX_ENABLE, 147 ZSWR4_CLK_X16 | ZSWR4_ONESB, 148 ZSWR5_TX_8 | ZSWR5_TX_ENABLE, 149 0, /* 6: TXSYNC/SYNCLO */ 150 0, /* 7: RXSYNC/SYNCHI */ 151 0, /* 8: alias for data port */ 152 ZSWR9_MASTER_IE, 153 0, /*10: Misc. TX/RX control bits */ 154 ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD | ZSWR11_TRXC_OUT_ENA, 155 BPS_TO_TCONST(PCLK/16, ZS_DEFSPEED), /*12: BAUDLO (default=9600) */ 156 0, /*13: BAUDHI (default=9600) */ 157 ZSWR14_BAUD_ENA, 158 ZSWR15_BREAK_IE, 159 }; 160 161 162 /**************************************************************** 163 * Autoconfig 164 ****************************************************************/ 165 166 /* Definition of the driver for autoconfig. */ 167 static int zs_hpc_match __P((struct device *, struct cfdata *, void *)); 168 static void zs_hpc_attach __P((struct device *, struct device *, void *)); 169 static int zs_print __P((void *, const char *name)); 170 171 struct cfattach zsc_hpc_ca = { 172 sizeof(struct zsc_softc), zs_hpc_match, zs_hpc_attach 173 }; 174 175 extern struct cfdriver zsc_cd; 176 177 static int zshard __P((void *)); 178 void zssoft __P((void *)); 179 static int zs_get_speed __P((struct zs_chanstate *)); 180 struct zschan *zs_get_chan_addr (int zs_unit, int channel); 181 int zs_getc __P((void *)); 182 void zs_putc __P((void *, int)); 183 184 /* 185 * Is the zs chip present? 186 */ 187 static int 188 zs_hpc_match(parent, cf, aux) 189 struct device *parent; 190 struct cfdata *cf; 191 void *aux; 192 { 193 return 1; 194 } 195 196 /* 197 * Attach a found zs. 198 * 199 * Match slave number to zs unit number, so that misconfiguration will 200 * not set up the keyboard as ttya, etc. 201 */ 202 static void 203 zs_hpc_attach(parent, self, aux) 204 struct device *parent; 205 struct device *self; 206 void *aux; 207 { 208 struct zsc_softc *zsc = (void *) self; 209 struct hpc_attach_args *haa = aux; 210 struct zsc_attach_args zsc_args; 211 struct zs_chanstate *cs; 212 struct zs_channel *ch; 213 int zs_unit, channel, err, s; 214 char *promconsdev; 215 216 promconsdev = ARCBIOS->GetEnvironmentVariable("ConsoleOut"); 217 218 zsc->zsc_bustag = haa->ha_iot; 219 if ((err = bus_space_subregion(haa->ha_iot, haa->ha_ioh, 220 HPC_PBUS_CH6_DEVREGS + 0x30, 0x10, 221 &zsc->zsc_base)) != 0) { 222 printf(": unable to map 85c30 registers, error = %d\n", err); 223 return; 224 } 225 226 zs_unit = zsc->zsc_dev.dv_unit; 227 printf("\n"); 228 229 /* 230 * Initialize software state for each channel. 231 * 232 * Done in reverse order of channels since the first serial port 233 * is actually attached to the *second* channel, and vice versa. 234 * Doing it this way should force a 'zstty*' to attach zstty0 to 235 * channel 1 and zstty1 to channel 0. They couldn't have wired 236 * it up in a more sensible fashion, could they? 237 */ 238 for (channel = 1; channel >= 0; channel--) { 239 zsc_args.channel = channel; 240 ch = &zsc->zsc_cs_store[channel]; 241 cs = zsc->zsc_cs[channel] = (struct zs_chanstate *)ch; 242 243 cs->cs_reg_csr = NULL; 244 cs->cs_reg_data = NULL; 245 cs->cs_channel = channel; 246 cs->cs_private = NULL; 247 cs->cs_ops = &zsops_null; 248 cs->cs_brg_clk = PCLK / 16; 249 250 if (bus_space_subregion(zsc->zsc_bustag, zsc->zsc_base, 251 zs_chan_offset[channel], 252 sizeof(struct zschan), 253 &ch->cs_regs) != 0) { 254 printf(": cannot map regs\n"); 255 return; 256 } 257 ch->cs_bustag = zsc->zsc_bustag; 258 259 memcpy(cs->cs_creg, zs_init_reg, 16); 260 memcpy(cs->cs_preg, zs_init_reg, 16); 261 262 zsc_args.hwflags = 0; 263 zsc_args.consdev = NULL; 264 265 if (zs_consunit == -1 && zs_conschan == -1) { 266 /* 267 * If this channel is being used by the PROM console, 268 * pass the generic zs driver a 'no reset' flag so the 269 * channel gets left in the appropriate state after 270 * attach. 271 * 272 * Note: the channel mappings are swapped. 273 */ 274 if (promconsdev != NULL && 275 strlen(promconsdev) == 9 && 276 strncmp(promconsdev, "serial", 6) == 0 && 277 (promconsdev[7] == '0' || promconsdev[7] == '1')) { 278 if (promconsdev[7] == '1' && channel == 0) 279 zsc_args.hwflags |= ZS_HWFLAG_NORESET; 280 else if (promconsdev[7] == '0' && channel == 1) 281 zsc_args.hwflags |= ZS_HWFLAG_NORESET; 282 } 283 } 284 285 /* If console, don't stomp speed, let zstty know */ 286 if (zs_unit == zs_consunit && channel == zs_conschan) { 287 zsc_args.consdev = &zs_cn; 288 zsc_args.hwflags = ZS_HWFLAG_CONSOLE; 289 290 cs->cs_defspeed = zs_get_speed(cs); 291 } else 292 cs->cs_defspeed = zs_defspeed; 293 294 cs->cs_defcflag = zs_def_cflag; 295 296 /* Make these correspond to cs_defcflag (-crtscts) */ 297 cs->cs_rr0_dcd = ZSRR0_DCD; 298 cs->cs_rr0_cts = 0; 299 cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS; 300 cs->cs_wr5_rts = 0; 301 302 /* 303 * Clear the master interrupt enable. 304 * The INTENA is common to both channels, 305 * so just do it on the A channel. 306 */ 307 if (channel == 0) { 308 zs_write_reg(cs, 9, 0); 309 } 310 /* 311 * Look for a child driver for this channel. 312 * The child attach will setup the hardware. 313 */ 314 if (!config_found(self, (void *)&zsc_args, zs_print)) { 315 /* No sub-driver. Just reset it. */ 316 u_char reset = (channel == 0) ? 317 ZSWR9_A_RESET : ZSWR9_B_RESET; 318 319 s = splhigh(); 320 zs_write_reg(cs, 9, reset); 321 splx(s); 322 } 323 } 324 325 326 zsc->sc_si = softintr_establish(IPL_SOFTSERIAL, zssoft, zsc); 327 cpu_intr_establish(29, IPL_TTY, zshard, NULL); 328 329 /* 330 * Set the master interrupt enable and interrupt vector. 331 * (common to both channels, do it on A) 332 */ 333 cs = zsc->zsc_cs[0]; 334 s = splhigh(); 335 /* interrupt vector */ 336 zs_write_reg(cs, 2, zs_init_reg[2]); 337 /* master interrupt control (enable) */ 338 zs_write_reg(cs, 9, zs_init_reg[9]); 339 splx(s); 340 } 341 342 static int 343 zs_print(aux, name) 344 void *aux; 345 const char *name; 346 { 347 struct zsc_attach_args *args = aux; 348 349 if (name != NULL) 350 printf("%s: ", name); 351 352 if (args->channel != -1) 353 printf(" channel %d", args->channel); 354 355 return UNCONF; 356 } 357 358 /* 359 * Our ZS chips all share a common, autovectored interrupt, 360 * so we have to look at all of them on each interrupt. 361 */ 362 static int 363 zshard(arg) 364 void *arg; 365 { 366 register struct zsc_softc *zsc; 367 register int unit, rval, softreq; 368 369 rval = 0; 370 for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) { 371 zsc = zsc_cd.cd_devs[unit]; 372 if (zsc == NULL) 373 continue; 374 rval |= zsc_intr_hard(zsc); 375 softreq = zsc->zsc_cs[0]->cs_softreq; 376 softreq |= zsc->zsc_cs[1]->cs_softreq; 377 if (softreq && (zssoftpending == 0)) { 378 zssoftpending = 1; 379 softintr_schedule(zsc->sc_si); 380 } 381 } 382 return rval; 383 } 384 385 /* 386 * Similar scheme as for zshard (look at all of them) 387 */ 388 void 389 zssoft(arg) 390 void *arg; 391 { 392 register struct zsc_softc *zsc; 393 register int s, unit; 394 395 /* This is not the only ISR on this IPL. */ 396 if (zssoftpending == 0) 397 return; 398 399 /* 400 * The soft intr. bit will be set by zshard only if 401 * the variable zssoftpending is zero. The order of 402 * these next two statements prevents our clearing 403 * the soft intr bit just after zshard has set it. 404 */ 405 /*isr_soft_clear(ZSSOFT_PRI);*/ 406 zssoftpending = 0; 407 408 /* Make sure we call the tty layer at spltty. */ 409 s = spltty(); 410 for (unit = 0; unit < zsc_cd.cd_ndevs; unit++) { 411 zsc = zsc_cd.cd_devs[unit]; 412 if (zsc == NULL) 413 continue; 414 (void) zsc_intr_soft(zsc); 415 } 416 splx(s); 417 return; 418 } 419 420 421 /* 422 * Compute the current baud rate given a ZS channel. 423 */ 424 static int 425 zs_get_speed(cs) 426 struct zs_chanstate *cs; 427 { 428 int tconst; 429 430 tconst = zs_read_reg(cs, 12); 431 tconst |= zs_read_reg(cs, 13) << 8; 432 return (TCONST_TO_BPS(cs->cs_brg_clk, tconst)); 433 } 434 435 /* 436 * MD functions for setting the baud rate and control modes. 437 */ 438 int 439 zs_set_speed(cs, bps) 440 struct zs_chanstate *cs; 441 int bps; /* bits per second */ 442 { 443 int tconst, real_bps; 444 445 #if 0 446 while (!(zs_read_csr(cs) & ZSRR0_TX_READY)) 447 {/*nop*/} 448 #endif 449 /* Wait for transmit buffer to empty */ 450 if (bps == 0) { 451 return (0); 452 } 453 454 #ifdef DIAGNOSTIC 455 if (cs->cs_brg_clk == 0) 456 panic("zs_set_speed"); 457 #endif 458 459 tconst = BPS_TO_TCONST(cs->cs_brg_clk, bps); 460 if (tconst < 0) 461 return (EINVAL); 462 463 /* Convert back to make sure we can do it. */ 464 real_bps = TCONST_TO_BPS(cs->cs_brg_clk, tconst); 465 466 /* XXX - Allow some tolerance here? */ 467 #if 0 468 if (real_bps != bps) 469 return (EINVAL); 470 #endif 471 472 cs->cs_preg[12] = tconst; 473 cs->cs_preg[13] = tconst >> 8; 474 475 /* Caller will stuff the pending registers. */ 476 return (0); 477 } 478 479 int 480 zs_set_modes(cs, cflag) 481 struct zs_chanstate *cs; 482 int cflag; /* bits per second */ 483 { 484 int s; 485 486 /* 487 * Output hardware flow control on the chip is horrendous: 488 * if carrier detect drops, the receiver is disabled, and if 489 * CTS drops, the transmitter is stoped IN MID CHARACTER! 490 * Therefore, NEVER set the HFC bit, and instead use the 491 * status interrupt to detect CTS changes. 492 */ 493 s = splzs(); 494 cs->cs_rr0_pps = 0; 495 if ((cflag & (CLOCAL | MDMBUF)) != 0) { 496 cs->cs_rr0_dcd = 0; 497 if ((cflag & MDMBUF) == 0) 498 cs->cs_rr0_pps = ZSRR0_DCD; 499 } else 500 cs->cs_rr0_dcd = ZSRR0_DCD; 501 if ((cflag & CRTSCTS) != 0) { 502 cs->cs_wr5_dtr = ZSWR5_DTR; 503 cs->cs_wr5_rts = ZSWR5_RTS; 504 cs->cs_rr0_cts = ZSRR0_CTS; 505 } else if ((cflag & MDMBUF) != 0) { 506 cs->cs_wr5_dtr = 0; 507 cs->cs_wr5_rts = ZSWR5_DTR; 508 cs->cs_rr0_cts = ZSRR0_DCD; 509 } else { 510 cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS; 511 cs->cs_wr5_rts = 0; 512 cs->cs_rr0_cts = 0; 513 } 514 splx(s); 515 516 /* Caller will stuff the pending registers. */ 517 return (0); 518 } 519 520 521 /* 522 * Read or write the chip with suitable delays. 523 */ 524 525 u_char 526 zs_read_reg(cs, reg) 527 struct zs_chanstate *cs; 528 u_char reg; 529 { 530 u_char val; 531 struct zs_channel *zsc = (struct zs_channel *)cs; 532 533 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR, reg); 534 ZS_DELAY(); 535 val = bus_space_read_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR); 536 ZS_DELAY(); 537 return val; 538 } 539 540 void 541 zs_write_reg(cs, reg, val) 542 struct zs_chanstate *cs; 543 u_char reg, val; 544 { 545 struct zs_channel *zsc = (struct zs_channel *)cs; 546 547 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR, reg); 548 ZS_DELAY(); 549 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR, val); 550 ZS_DELAY(); 551 } 552 553 u_char zs_read_csr(cs) 554 struct zs_chanstate *cs; 555 { 556 struct zs_channel *zsc = (struct zs_channel *)cs; 557 register u_char val; 558 559 val = bus_space_read_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR); 560 ZS_DELAY(); 561 return val; 562 } 563 564 void zs_write_csr(cs, val) 565 struct zs_chanstate *cs; 566 u_char val; 567 { 568 struct zs_channel *zsc = (struct zs_channel *)cs; 569 570 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_CSR, val); 571 ZS_DELAY(); 572 } 573 574 u_char zs_read_data(cs) 575 struct zs_chanstate *cs; 576 { 577 struct zs_channel *zsc = (struct zs_channel *)cs; 578 register u_char val; 579 580 val = bus_space_read_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_DATA); 581 ZS_DELAY(); 582 return val; 583 } 584 585 void zs_write_data(cs, val) 586 struct zs_chanstate *cs; 587 u_char val; 588 { 589 struct zs_channel *zsc = (struct zs_channel *)cs; 590 591 bus_space_write_1(zsc->cs_bustag, zsc->cs_regs, ZS_REG_DATA, val); 592 ZS_DELAY(); 593 } 594 595 void 596 zs_abort(cs) 597 struct zs_chanstate *cs; 598 { 599 #if defined(KGDB) 600 zskgdb(cs); 601 #elif defined(DDB) 602 Debugger(); 603 #endif 604 } 605 606 607 /*********************************************************/ 608 /* Polled character I/O functions for console and KGDB */ 609 /*********************************************************/ 610 611 struct zschan * 612 zs_get_chan_addr(zs_unit, channel) 613 int zs_unit, channel; 614 { 615 static int dumped_addr = 0; 616 struct zsdevice *addr; 617 struct zschan *zc; 618 619 addr = (struct zsdevice *) MIPS_PHYS_TO_KSEG1(0x1fbd9830); 620 621 if (channel == 0) { 622 zc = &addr->zs_chan_b; 623 } else { 624 zc = &addr->zs_chan_a; 625 } 626 627 if (dumped_addr == 0) { 628 dumped_addr++; 629 printf("zs channel %d had address %p\n", channel, zc); 630 } 631 632 return (zc); 633 } 634 635 int 636 zs_getc(arg) 637 void *arg; 638 { 639 register volatile struct zschan *zc = arg; 640 register int s, c, rr0; 641 642 s = splzs(); 643 /* Wait for a character to arrive. */ 644 do { 645 rr0 = zc->zc_csr; 646 ZS_DELAY(); 647 } while ((rr0 & ZSRR0_RX_READY) == 0); 648 649 c = zc->zc_data; 650 ZS_DELAY(); 651 splx(s); 652 653 return (c); 654 } 655 656 /* 657 * Polled output char. 658 */ 659 void 660 zs_putc(arg, c) 661 void *arg; 662 int c; 663 { 664 register volatile struct zschan *zc = arg; 665 register int s, rr0; 666 667 s = splzs(); 668 /* Wait for transmitter to become ready. */ 669 do { 670 rr0 = zc->zc_csr; 671 ZS_DELAY(); 672 } while ((rr0 & ZSRR0_TX_READY) == 0); 673 674 zc->zc_data = c; 675 wbflush(); 676 ZS_DELAY(); 677 splx(s); 678 } 679 680 /***************************************************************/ 681 void 682 zscnprobe(cn) 683 struct consdev *cn; 684 { 685 } 686 687 void 688 zscninit(cn) 689 struct consdev *cn; 690 { 691 char* consdev; 692 693 if ((consdev = ARCBIOS->GetEnvironmentVariable("ConsoleOut")) == NULL) 694 panic("zscninit without valid ARCS ConsoleOut setting!\n"); 695 696 if (strlen(consdev) != 9 || 697 strncmp(consdev, "serial", 6) != 0) 698 panic("zscninit with ARCS console not set to serial!\n"); 699 700 cons_port = consdev[7] - '0'; 701 702 cn->cn_dev = makedev(zs_major, cons_port); 703 cn->cn_pri = CN_REMOTE; 704 705 /* Mark this unit as the console */ 706 zs_consunit = 0; 707 708 /* SGI hardware wires serial port 1 to channel B, port 2 to A */ 709 if (cons_port == 0) 710 zs_conschan = 1; 711 else 712 zs_conschan = 0; 713 } 714 715 int 716 zscngetc(dev) 717 dev_t dev; 718 { 719 struct zschan *zs; 720 721 zs = zs_get_chan_addr(0, cons_port); 722 return zs_getc(zs); 723 } 724 725 void 726 zscnputc(dev, c) 727 dev_t dev; 728 int c; 729 { 730 struct zschan *zs; 731 732 zs = zs_get_chan_addr(0, cons_port); 733 zs_putc(zs, c); 734 } 735 736 void 737 zscnpollc(dev, on) 738 dev_t dev; 739 int on; 740 { 741 } 742