ssc.c revision 1.1
1/*- 2 * Copyright (c) 2000 Doug Rabson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD$ 27 */ 28#include <sys/param.h> 29#include <sys/conf.h> 30#include <sys/kernel.h> 31#include <sys/lock.h> 32#include <sys/proc.h> 33#include <sys/systm.h> 34#include <sys/tty.h> 35#include <sys/device.h> 36 37#include <machine/md_var.h> 38#include <machine/ssc.h> 39 40#include <dev/cons.h> 41 42 43#define SSC_GETCHAR 21 44#define SSC_PUTCHAR 31 45 46#define SSC_POLL_HZ 50 47 48void sscconsattach(struct device *, struct device *, void *); 49 50static void ssccnprobe(struct consdev *); 51static void ssccninit(struct consdev *); 52static void ssccnputc(dev_t, int); 53static int ssccngetc(dev_t); 54 55struct consdev constab[] = { 56 { ssccnprobe, ssccninit, ssccngetc, ssccnputc, nullcnpollc, 57 NULL, NULL, NULL, NODEV, CN_NORMAL }, 58 { NULL } 59}; 60 61 62u_int64_t 63ssc(u_int64_t in0, u_int64_t in1, u_int64_t in2, u_int64_t in3, int which) 64{ 65 register u_int64_t ret0 __asm("r8"); 66 67 __asm __volatile("mov r15=%1\n\t" 68 "break 0x80001" 69 : "=r"(ret0) 70 : "r"(which), "r"(in0), "r"(in1), "r"(in2), "r"(in3)); 71 return ret0; 72} 73 74void sscconsattach(struct device *parent, struct device *self, void *aux) 75{ 76} 77 78static void 79ssccnprobe(struct consdev *cp) 80{ 81 cp->cn_pri = CN_INTERNAL; 82} 83 84static void 85ssccninit(struct consdev *cp) 86{ 87} 88 89/* void */ 90/* ssccnattach(void *arg) */ 91/* { */ 92/* static struct consdev ssccons = { */ 93/* ssccnprobe, ssccninit, ssccngetc, ssccnputc, nullcnpollc, */ 94/* NULL, NULL, NULL, NODEV, CN_NORMAL */ 95/* }; */ 96 97/* cn_tab = &ssccons; */ 98/* } */ 99 100static void 101ssccnputc(dev_t dev, int c) 102{ 103 ssc(c, 0, 0, 0, SSC_PUTCHAR); 104} 105 106static int 107ssccngetc(dev_t dev) 108{ 109 int c; 110 do { 111 c = ssc(0, 0, 0, 0, SSC_GETCHAR); 112 } while (c == 0); 113 114 return c; 115} 116 117/* XXX: integrate the rest of the ssc.c stuff from FreeBSD to plug into wsdisplay */ 118 119