Module Name:    src
Committed By:   uwe
Date:           Sun Jul 19 23:44:36 UTC 2020

Added Files:
        src/sys/arch/evbsh3/conf: NEXTVOD files.nextvod mk.nextvod std.nextvod
        src/sys/arch/evbsh3/nextvod: clock_machdep.c nextvod.c stasc.c

Log Message:
Add placeholders/boilerplate for NextVoD.

STMicroelectronics support needs to be written for both the CPU and
devices.  This config and related files is absolute bare bones to get
a scaffolding kernel to compile to actually work on that support.
Don't hold your breath.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbsh3/conf/NEXTVOD \
    src/sys/arch/evbsh3/conf/files.nextvod \
    src/sys/arch/evbsh3/conf/mk.nextvod src/sys/arch/evbsh3/conf/std.nextvod
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbsh3/nextvod/clock_machdep.c \
    src/sys/arch/evbsh3/nextvod/nextvod.c src/sys/arch/evbsh3/nextvod/stasc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/sys/arch/evbsh3/conf/NEXTVOD
diff -u /dev/null src/sys/arch/evbsh3/conf/NEXTVOD:1.1
--- /dev/null	Sun Jul 19 23:44:36 2020
+++ src/sys/arch/evbsh3/conf/NEXTVOD	Sun Jul 19 23:44:36 2020
@@ -0,0 +1,178 @@
+# $NetBSD: NEXTVOD,v 1.1 2020/07/19 23:44:36 uwe Exp $
+
+# This config and related files are placeholders/boilerplate for work
+# in progress.  Not expected to compile.
+
+include "arch/evbsh3/conf/std.nextvod"
+
+options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+#ident 		"NEXTVOD-$Revision: 1.1 $"
+
+maxusers	32		# estimated number of users
+
+
+# Standard system options
+options 	INSECURE	# disable kernel security levels
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+options 	NTP		# NTP phase/frequency locked loop
+options 	KTRACE		# system call tracing via ktrace(1)
+
+options 	SYSVMSG		# System V message queues
+options 	SYSVSEM		# System V semaphores
+options 	SYSVSHM		# System V shared memory
+
+#options 	MODULAR		# new style module(7) framework
+#options 	MODULAR_DEFAULT_AUTOLOAD
+
+options 	USERCONF	# userconf(4) support
+#options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
+#options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+
+# Diagnostic/debugging support options
+#options 	DIAGNOSTIC	# cheap kernel consistency checks
+#options 	DEBUG		# expensive debugging checks/support
+options 	DDB		# in-kernel debugger
+#options 	DDB_ONPANIC=0	# don't go into ddb on panic.
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
+#options 	DDB_COMMANDONENTER="bt"
+
+
+# File systems
+#file-system 	FFS		# UFS
+file-system 	MFS		# memory file system
+file-system 	NFS		# Network File System client
+file-system 	KERNFS		# /kern
+file-system 	PROCFS		# /proc
+file-system	PTYFS		# /dev/pts/N support
+
+# File system options
+#options 	WAPBL		# File system journaling support
+#options 	UFS_ACL		# UFS Access Control Lists
+options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+options 	NFS_BOOT_DHCP	# Support DHCP NFS root
+
+
+# Networking options
+#options 	GATEWAY		# packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+options 	INET6		# IPV6
+#options 	IPSEC		# IP security
+#options 	IPSEC_DEBUG	# debug for IP security
+#options 	MROUTING	# IP multicast routing
+#options 	PIM		# Protocol Independent Multicast
+#options 	NETATALK	# AppleTalk networking protocols
+#options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
+#options 	PPP_DEFLATE	# Deflate compression support for PPP
+#options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
+#options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
+#options 	TCP_SIGNATURE	# Enable RFC-2385 TCP md5 signatures
+
+# These options enable verbose messages for several subsystems.
+# Warning, these may compile large string tables into the kernel!
+#options 	ACPIVERBOSE	# verbose ACPI configuration messages
+#options 	MIIVERBOSE	# verbose PHY autoconfig messages
+options 	PCIVERBOSE	# verbose PCI device autoconfig messages
+#options 	PCI_CONFIG_DUMP	# verbosely dump PCI config space
+#options 	PCMCIAVERBOSE	# verbose PCMCIA configuration messages
+options 	SCSIVERBOSE	# human readable SCSI error messages
+#options 	USBVERBOSE	# verbose USB device autoconfig messages
+#options 	HDAUDIOVERBOSE	# verbose HDAUDIO driver messages
+
+
+# Enable the hooks used for initializing the root memory-disk.
+#options 	MEMORY_DISK_HOOKS
+#options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
+#options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
+#options 	MEMORY_DISK_ROOT_SIZE=3074	# size of memory disk, in blocks
+#options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
+
+# Kernel root file system and dump configuration.
+config		netbsd	root on ? type ?
+
+
+#
+# Device configuration
+#
+mainbus0 at root
+
+shb* at mainbus?
+
+# serial (console)
+stasc0 at mainbus?
+
+
+# Pseudo-Devices
+
+pseudo-device	swcrypto		# software crypto implementation
+
+# disk/mass storage pseudo-devices
+#pseudo-device	bio			# RAID control device driver
+#pseudo-device	ccd			# concatenated/striped disk devices
+#pseudo-device	cgd			# cryptographic disk devices
+
+#pseudo-device	raid			# RAIDframe disk driver
+#options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
+#Options to enable various other RAIDframe RAID types.
+#options 	RF_INCLUDE_EVENODD=1
+#options 	RF_INCLUDE_RAID5_RS=1
+#options 	RF_INCLUDE_PARITYLOGGING=1
+#options 	RF_INCLUDE_CHAINDECLUSTER=1
+#options 	RF_INCLUDE_INTERDECLUSTER=1
+#options 	RF_INCLUDE_PARITY_DECLUSTERING=1
+#options 	RF_INCLUDE_PARITY_DECLUSTERING_DS=1
+
+#pseudo-device	fss			# file system snapshot device
+
+pseudo-device	md			# memory disk device (ramdisk
+#options 	MEMORY_DISK_DYNAMIC	# loaded via kernel module(7)
+
+#pseudo-device	vnd			# disk-like interface to files
+#options 	VND_COMPRESSION		# compressed vnd(4)
+
+# network pseudo-devices
+pseudo-device	bpfilter		# Berkeley packet filter
+#pseudo-device	carp			# Common Address Redundancy Protocol
+pseudo-device	loop			# network loopback
+#pseudo-device	mpls			# MPLS pseudo-interface
+#pseudo-device	ppp			# Point-to-Point Protocol
+#pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)
+#pseudo-device	sl			# Serial Line IP
+#pseudo-device	irframetty		# IrDA frame line discipline
+#pseudo-device	tun			# network tunneling over tty
+#pseudo-device	tap			# virtual Ethernet
+#pseudo-device	gre			# generic L3 over IP tunnel
+#pseudo-device	gif			# IPv[46] over IPv[46] tunnel (RFC1933)
+#pseudo-device	ipsecif			# tunnel interface for routing based ipsec
+#pseudo-device	faith			# IPv[46] tcp relay translation i/f
+#pseudo-device	stf			# 6to4 IPv6 over IPv4 encapsulation
+#pseudo-device	vlan			# IEEE 802.1q encapsulation
+#pseudo-device	bridge			# simple inter-network bridging
+#options 	BRIDGE_IPF		# bridge uses IP/IPv6 pfil hooks too
+#pseudo-device	agr			# IEEE 802.3ad link aggregation
+#pseudo-device	l2tp			# L2TPv3 interface
+#pseudo-device	npf			# NPF packet filter
+
+# miscellaneous pseudo-devices
+pseudo-device	pty			# pseudo-terminals
+pseudo-device	clockctl		# user control of clock subsystem
+pseudo-device	ksyms			# /dev/ksyms
+#pseudo-device	lockstat		# lock profiling
+#pseudo-device	bcsp			# BlueCore Serial Protocol
+#pseudo-device	btuart			# Bluetooth HCI UART (H4)
+
+# wscons pseudo-devices
+#pseudo-device	wsmux			# mouse & keyboard multiplexor
+#pseudo-device	wsfont
+# Give us a choice of fonts based on monitor size
+#options 	FONT_BOLD8x16
+#options 	FONT_BOLD16x32
+
+# pseudo audio device driver
+#pseudo-device	pad
+
+# userland interface to drivers, including autoconf and properties retrieval
+pseudo-device	drvctl
+
+#include "dev/veriexec.config"
Index: src/sys/arch/evbsh3/conf/files.nextvod
diff -u /dev/null src/sys/arch/evbsh3/conf/files.nextvod:1.1
--- /dev/null	Sun Jul 19 23:44:36 2020
+++ src/sys/arch/evbsh3/conf/files.nextvod	Sun Jul 19 23:44:36 2020
@@ -0,0 +1,8 @@
+# $NetBSD: files.nextvod,v 1.1 2020/07/19 23:44:36 uwe Exp $
+
+file	arch/evbsh3/nextvod/nextvod.c
+file	arch/evbsh3/nextvod/clock_machdep.c
+
+device	stasc: tty
+attach	stasc at mainbus
+file	arch/evbsh3/nextvod/stasc.c	stasc needs-flag
Index: src/sys/arch/evbsh3/conf/mk.nextvod
diff -u /dev/null src/sys/arch/evbsh3/conf/mk.nextvod:1.1
--- /dev/null	Sun Jul 19 23:44:36 2020
+++ src/sys/arch/evbsh3/conf/mk.nextvod	Sun Jul 19 23:44:36 2020
@@ -0,0 +1,22 @@
+# $NetBSD: mk.nextvod,v 1.1 2020/07/19 23:44:36 uwe Exp $
+
+# tell locore where it is
+AFLAGS.locore.S = -DTEXTADDR=${TEXTADDR}
+
+_OSRELEASE!=		${HOST_SH} $S/conf/osrelease.sh
+
+LOADADDR ?= ${DEFLOADADDR}
+
+MKUBOOTIMAGEARGS=	-A sh -T kernel -O netbsd -C none
+MKUBOOTIMAGEARGS+=	-a ${LOADADDR} -e ${TEXTADDR}
+#MKUBOOTIMAGEARGS+=	-n "NetBSD/${BOARDTYPE:U${MACHINE_ARCH}} ${_OSRELEASE}"
+MKUBOOTIMAGEARGS+=	-n "Test $$(date +'%Y-%m-%d %H:%M')"
+
+SYSTEM_LD_TAIL_EXTRA+=; \
+	${_MKSHMSG} "  image " ${.CURDIR:T}/[email protected]; \
+	${OBJCOPY} -S -O binary $@ [email protected]; \
+	${_MKSHMSG} " u-boot " ${.CURDIR:T}/[email protected]; \
+	${TOOL_MKUBOOTIMAGE} ${MKUBOOTIMAGEARGS} [email protected] [email protected]
+
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.img@}
+EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.ub@}
Index: src/sys/arch/evbsh3/conf/std.nextvod
diff -u /dev/null src/sys/arch/evbsh3/conf/std.nextvod:1.1
--- /dev/null	Sun Jul 19 23:44:36 2020
+++ src/sys/arch/evbsh3/conf/std.nextvod	Sun Jul 19 23:44:36 2020
@@ -0,0 +1,23 @@
+# $NetBSD: std.nextvod,v 1.1 2020/07/19 23:44:36 uwe Exp $
+
+include "arch/evbsh3/conf/std.evbsh3.el"
+include "arch/evbsh3/conf/files.nextvod"
+
+options 	EVBSH3_BOARDTYPE="nextvod"
+makeoptions	BOARDTYPE="nextvod"
+makeoptions	BOARDMKFRAG="${THISSH3}/conf/mk.nextvod"
+
+# CPU support
+options 	SH4
+options 	SH7751R		# a white lie to get it to compile
+options 	DONT_INIT_BSC
+
+options 	IOM_RAM_BEGIN=0x00000000 	# NB: physical address
+#options 	IOM_RAM_SIZE=0x10000000		# 256MB
+options 	IOM_RAM_SIZE=0x08000000		# 128MB
+
+# override the value from std.evbsh3.el
+no makeoptions	DEFTEXTADDR
+#
+makeoptions	DEFLOADADDR="0x80000000"	# NB: P1 address
+makeoptions	DEFTEXTADDR="0x80000040"	# skip u-boot image header

Index: src/sys/arch/evbsh3/nextvod/clock_machdep.c
diff -u /dev/null src/sys/arch/evbsh3/nextvod/clock_machdep.c:1.1
--- /dev/null	Sun Jul 19 23:44:36 2020
+++ src/sys/arch/evbsh3/nextvod/clock_machdep.c	Sun Jul 19 23:44:36 2020
@@ -0,0 +1,42 @@
+/*	$NetBSD: clock_machdep.c,v 1.1 2020/07/19 23:44:36 uwe Exp $	*/
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: clock_machdep.c,v 1.1 2020/07/19 23:44:36 uwe Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <sh3/clock.h>
+
+void
+machine_clock_init(void)
+{
+
+	sh_clock_init(SH_CLOCK_NORTC);
+}
Index: src/sys/arch/evbsh3/nextvod/nextvod.c
diff -u /dev/null src/sys/arch/evbsh3/nextvod/nextvod.c:1.1
--- /dev/null	Sun Jul 19 23:44:36 2020
+++ src/sys/arch/evbsh3/nextvod/nextvod.c	Sun Jul 19 23:44:36 2020
@@ -0,0 +1,45 @@
+/*	$NetBSD: nextvod.c,v 1.1 2020/07/19 23:44:36 uwe Exp $	*/
+
+/*-
+ * Copyright (c) 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: nextvod.c,v 1.1 2020/07/19 23:44:36 uwe Exp $");
+
+/* XXX: this is not publicly declared */
+void machine_init(void);
+
+
+/*
+ * Machine-dependent initialization.
+ * Called by evbsh3 cpu_configure(9).
+ */
+void
+machine_init(void)
+{
+
+	/* nothing to do */
+}
Index: src/sys/arch/evbsh3/nextvod/stasc.c
diff -u /dev/null src/sys/arch/evbsh3/nextvod/stasc.c:1.1
--- /dev/null	Sun Jul 19 23:44:36 2020
+++ src/sys/arch/evbsh3/nextvod/stasc.c	Sun Jul 19 23:44:36 2020
@@ -0,0 +1,210 @@
+/* $NetBSD: stasc.c,v 1.1 2020/07/19 23:44:36 uwe Exp $ */
+/*
+ * Copyright (c) 2020 Valery Ushakov
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * STMicroelectronics ST40 Asynchronous Serial Controller
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: stasc.c,v 1.1 2020/07/19 23:44:36 uwe Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+
+#include <dev/cons.h>
+
+
+#define STM_ASC_BASE	0xfd032000
+
+#define ASC_BAUDRATE_OFFSET	0x00
+#define ASC_TX_BUFF_OFFSET	0x04
+#define ASC_RX_BUFF_OFFSET	0x08
+#define ASC_CTRL_OFFSET		0x0C
+#define ASC_INT_EN_OFFSET	0x10
+#define ASC_INT_STA_OFFSET	0x14
+#define ASC_GUARDTIME_OFFSET	0x18
+#define ASC_TIMEOUT_OFFSET	0x1C
+#define ASC_TX_RST_OFFSET	0x20
+#define ASC_RX_RST_OFFSET	0x24
+#define ASC_RETRIES_OFFSET	0x28
+
+#define ASC_TX_BUFF	(*(volatile uint32_t *)(STM_ASC_BASE + ASC_TX_BUFF_OFFSET))
+#define ASC_INT_EN	(*(volatile uint32_t *)(STM_ASC_BASE + ASC_INT_EN_OFFSET))
+#define ASC_INT_STA	(*(volatile uint32_t *)(STM_ASC_BASE + ASC_INT_STA_OFFSET))
+
+
+#define ASC_CTRL_NACK_DISABLE	0x2000
+#define ASC_CTRL_BAUDMODE	0x1000
+#define ASC_CTRL_CTS_EN		0x0800
+#define ASC_CTRL_FIFO_EN	0x0400
+#define ASC_CTRL_SC_EN		0x0200
+#define ASC_CTRL_RX_EN		0x0100
+#define ASC_CTRL_RUN		0x0080
+#define ASC_CTRL_LOOPBACK	0x0040
+#define ASC_CTRL_PARITYODD	0x0020
+#define ASC_CTRL_STOPBITS_MASK	0x0018
+#define     ASC_CTRL_STOPBITS_0_5	0x0000
+#define     ASC_CTRL_STOPBITS_1_0	0x0008
+#define     ASC_CTRL_STOPBITS_1_5	0x0010
+#define     ASC_CTRL_STOPBITS_2_0	0x0018
+#define ASC_CTRL_MODE_MASK	0x0007
+#define     ASC_CTRL_MODE_8N		0x0001 /* 8 bit */
+#define     ASC_CTRL_MODE_7P		0x0003 /* 7 bit + parity  */
+#define     ASC_CTRL_MODE_9N		0x0004 /* 9 bit */
+#define     ASC_CTRL_MODE_8W		0x0005 /* 8 bit + wakeup */
+#define     ASC_CTRL_MODE_8P		0x0007 /* 8 bit + parity */
+
+
+#define ASC_INT_EN_RHF		0x0100 /* ASC_INT_STA_RHF */
+#define ASC_INT_EN_TOE		0x0080 /* ASC_INT_STA_TOE */
+#define ASC_INT_EN_TNE		0x0040 /* ASC_INT_STA_TNE */
+#define ASC_INT_EN_OE		0x0020 /* ASC_INT_STA_OE */
+#define ASC_INT_EN_FE		0x0010 /* ASC_INT_STA_FE */
+#define ASC_INT_EN_PE		0x0008 /* ASC_INT_STA_PE */
+#define	ASC_INT_EN_THE		0x0004 /* ASC_INT_STA_THE */
+#define ASC_INT_EN_TE		0x0002 /* ASC_INT_STA_TE */
+#define ASC_INT_EN_RBF		0x0001 /* ASC_INT_STA_RBF */
+
+#define ASC_INT_STA_NKD		0x0400 /* Tx: NACK Data */
+#define ASC_INT_STA_TF		0x0200 /* Tx: Transmitter Full */
+#define ASC_INT_STA_RHF		0x0100 /* Rx: Receiver FIFO Half Full */
+#define ASC_INT_STA_TOE		0x0080 /* Rx: Timeout Or Empty */
+#define ASC_INT_STA_TNE		0x0040 /* Rx: Timeout Or Not Empty */
+#define ASC_INT_STA_OE		0x0020 /* Rx: Overrun Error */
+#define ASC_INT_STA_FE		0x0010 /* Rx: Frame Error */
+#define ASC_INT_STA_PE		0x0008 /* Rx: Parity Error */
+#define	ASC_INT_STA_THE		0x0004 /* Tx: Transmitter FIFO Half Empty */
+#define ASC_INT_STA_TE		0x0002 /* Tx: Transmitter Empty */
+#define ASC_INT_STA_RBF		0x0001 /* Rx: Reciever Buffer Full */
+
+
+
+struct stasc_softc {
+	device_t sc_dev;
+};
+
+
+static int stasc_match(device_t, cfdata_t, void *);
+static void stasc_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(stasc, sizeof(struct stasc_softc),
+    stasc_match, stasc_attach, NULL, NULL);
+
+
+/* console */
+cons_decl(stasc_)
+
+/* assign to cn_tab after cleaning bss to get printf early for the cpu setup */
+struct consdev stasc_earlycons = cons_init(stasc_);
+
+extern struct cfdriver stasc_cd;
+
+const struct cdevsw stasc_cdevsw = {
+	.d_open = noopen,
+	.d_close = noclose,
+	.d_read = noread,
+	.d_write = nowrite,
+	.d_ioctl = noioctl,
+	.d_stop = nostop,
+	.d_tty = notty,
+	.d_poll = nopoll,
+	.d_mmap = nommap,
+	.d_kqfilter = nokqfilter,
+	.d_discard = nodiscard,
+	.d_flag = D_TTY
+};
+
+
+
+static int
+stasc_match(device_t parent, cfdata_t cfp, void *aux)
+{
+
+	if (strcmp(cfp->cf_name, "stasc") != 0)
+		return 0;
+
+	return 0;		/* just stub it out for now */
+}
+
+
+static void
+stasc_attach(device_t parent, device_t self, void *aux)
+{
+	struct stasc_softc *sc;
+
+	sc = device_private(self);
+	sc->sc_dev = self;
+
+	aprint_normal("\n");
+}
+
+
+void
+stasc_cnprobe(struct consdev *cp)
+{
+
+	cp->cn_pri = CN_NORMAL;
+}
+
+
+void
+stasc_cninit(struct consdev *cp)
+{
+
+	return;
+}
+
+
+int
+stasc_cngetc(dev_t dev)
+{
+	return -1;
+}
+
+
+void
+stasc_cnputc(dev_t dev, int c)
+{
+	uint32_t status;
+
+	/* wait for Tx FULL to become zero */
+	do {
+		status = ASC_INT_STA;
+	} while ((status & ASC_INT_STA_TF) != 0);
+
+	/* can write the character now */
+	ASC_TX_BUFF = c;
+}
+
+
+void
+stasc_cnpollc(dev_t dev, int on)
+{
+
+	return;
+}

Reply via email to