NetBSD/x68k, by Masaru Oki.
This commit is contained in:
parent
1febcb957e
commit
320e7320ef
|
@ -0,0 +1,179 @@
|
|||
.\" Copyright (c) 1995 MINOURA Makoto.
|
||||
.\" 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.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by Minoura Makoto.
|
||||
.\" 4. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.Dd July 2, 1995
|
||||
.Os
|
||||
.Dt pow 4
|
||||
.Sh NAME
|
||||
.Nm pow
|
||||
.Nd "X68k power switch device"
|
||||
.Sh DESCRIPTION
|
||||
Files
|
||||
.Pa /dev/pow
|
||||
and
|
||||
.Pa /dev/pow1
|
||||
are devices used to access the x68k power switch / bootstrap information and
|
||||
the RTC alarm timer. The following operations are allowed using
|
||||
.Xr ioctl 2
|
||||
system call:
|
||||
|
||||
.Bl -tag -width POWIOCGPOWERINFO -compact -offset indent
|
||||
.It POWIOGPOWERINFO
|
||||
Getting power switch status
|
||||
.It POWIOGALARMINFO
|
||||
Getting RTC alarm timer status
|
||||
.It POWIOSALARMINFO
|
||||
Setting RTC alarm timer
|
||||
.It POWIOSSIGNAL
|
||||
Setting signal number which is sent at changing the power status
|
||||
.El
|
||||
.Sh GETTING POWER SWITCH STATUS
|
||||
.Bd -literal
|
||||
.Fd #include <sys/ioctl.h>
|
||||
.Fd #include <machine/powioctl.h>
|
||||
|
||||
.Fd ioctl (fd, POWIOCGPOWERINFO, &powerinfo);
|
||||
.Fd struct x68k_powerinfo powerinfo;
|
||||
.Ed
|
||||
.Pp
|
||||
Returns the power switch status etc. in the following structure.
|
||||
.Bd -literal -offset indent
|
||||
struct x68k_powerinfo {
|
||||
int pow_switch_boottime;
|
||||
int pow_switch_current;
|
||||
time_t pow_boottime;
|
||||
unsigned int pow_bootcount;
|
||||
time_t pow_usedtotal;
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
Each member means:
|
||||
.Bl -hang -compact
|
||||
.It pow_switch_boottime:
|
||||
The power switch status at the system start time.
|
||||
The status is known by applying logical and (&) with:
|
||||
|
||||
.Bl -tag -compact -width POW_EXTERNALSW
|
||||
.It POW_ALARMSW
|
||||
True if the system started by the RTC alarm timer
|
||||
.It POW_EXTERNALSW
|
||||
True if the EXPWON signal of the I/O slot is on
|
||||
.It POW_FRONTSW
|
||||
True if the front power switch is on
|
||||
.El
|
||||
|
||||
EXPWON-related information is not tested.
|
||||
|
||||
.It pow_switch_current:
|
||||
Current power switch status. See above.
|
||||
|
||||
.It pow_boottime:
|
||||
The time when NetBSD started.
|
||||
|
||||
.It pow_bootcount:
|
||||
.It pow_usedtotal:
|
||||
Host's boot information from the system memory switch.
|
||||
Total usage in count (pow_bootcount) and second (pow_usedtotal).
|
||||
.El
|
||||
.Sh ACCESSING RTC ALARM TIMER
|
||||
.Bd -literal
|
||||
.Fd #include <sys/ioctl.h>
|
||||
.Fd #include <machine/powioctl.h>
|
||||
|
||||
.Fd ioctl (fd, POWIOCGALARMINFO, &alarminfo);
|
||||
.Fd struct x68k_alarminfo alarminfo;
|
||||
.Ed
|
||||
.Pp
|
||||
Returns x68k's alarm timer information in the following structure.
|
||||
.Bd -literal -offset indent
|
||||
struct x68k_alarminfo {
|
||||
int al_enable;
|
||||
unsigned int al_ontime;
|
||||
int al_dowhat;
|
||||
time_t al_offtime;
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
Each of the members means:
|
||||
.Bl -hang
|
||||
.It al_enable:
|
||||
True if the alarm timer is enable.
|
||||
.It al_ontime:
|
||||
Internal expression of the alarm timer. See `C Compiler PRO-68K Programmers' Manual'
|
||||
Chapter 3 Section ALARMSET.
|
||||
.It al_dowhat:
|
||||
What to do when started by the alarm timer.
|
||||
See `Programers' manual'.
|
||||
.It al_offtime:
|
||||
Display the time in seconds since the alarm is activated until
|
||||
the power is turned off (though the resolution
|
||||
is resolved to minutes). Be cautious when using IOCS
|
||||
and the like as these require minute time units. 0 indicates an infinity.
|
||||
.El
|
||||
|
||||
.Bd -literal
|
||||
.Fd ioctl (fd, POWIOCSALARMINFO, &alarminfo);
|
||||
.Fd struct x68k_alarminfo alarminfo;
|
||||
.Ed
|
||||
.Pp
|
||||
Sets the alarm timer according to the argument
|
||||
.Ar alarminfo
|
||||
(see above).
|
||||
.Pp
|
||||
.Sh SIGNAL
|
||||
.Bd -literal
|
||||
.Fd #include <sys/ioctl.h>
|
||||
.Fd #include <machine/powioctl.h>
|
||||
|
||||
.Fd ioctl (fd, POWIOCSSIGNAL, &signum);
|
||||
.Fd int signum;
|
||||
.Ed
|
||||
.Pp
|
||||
Signal
|
||||
.Ar signum
|
||||
is sent when the state of the power switch
|
||||
(front or external) changes. It becomes invalid when
|
||||
.Xr close 2
|
||||
is called.
|
||||
Note that this function is not provided with
|
||||
.Pa /dev/pow1 .
|
||||
.Sh SEE ALSO
|
||||
.Xr ioctl 2 ,
|
||||
.Xr poffd 8 ,
|
||||
.Xr rtcalarm 8
|
||||
.Rs
|
||||
`C Compiler PRO-68K Programmers' Manual', Chapter 3 IOCS Calls, Section ALARMSET, Sharp
|
||||
.Re
|
||||
.Sh AUTHOR
|
||||
Minoura Makoto <minoura@flab.fujitsu.co.jp>.
|
||||
.Sh SPECIAL THANKS
|
||||
Liam Hahne Minn <hahne@sail.t.u-tokyo.ac.jp>.
|
||||
.Sh BUGS
|
||||
The file
|
||||
.Pa /dev/pow
|
||||
can only be opened by one process at a time.
|
|
@ -0,0 +1,84 @@
|
|||
.\" Copyright (c) 1995 MINOURA Makoto.
|
||||
.\" 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.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by Minoura Makoto.
|
||||
.\" 4. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.Dd June 29, 1995
|
||||
.Os
|
||||
.Dt POFFD 8
|
||||
.Sh NAME
|
||||
.Nm poffd
|
||||
.Nd "X68k shutdown deamon"
|
||||
.Sh SYNOPSIS
|
||||
.Nm poffd
|
||||
.Op Ar shutdown-program
|
||||
.Sh DESCRIPTION
|
||||
.Nm Poffd
|
||||
looks at the power switch of x68k.
|
||||
When the switch is turned off,
|
||||
.Nm poffd
|
||||
executes
|
||||
.Ar shutdown-program
|
||||
.Po
|
||||
using
|
||||
.Pa /bin/sh -c
|
||||
.Pc .
|
||||
|
||||
If the system is started by x68k's RTC timer,
|
||||
.Ar shutdown-program
|
||||
is executed when the system's shut down time (predefined using
|
||||
other utility, SX-Window Control Pannel and
|
||||
.Xr rtcalarm 8
|
||||
for example) arrives.
|
||||
|
||||
The argument
|
||||
.Ar shutdown-program
|
||||
may contain the character `%'. It is substituted with a number
|
||||
which indicates the way how the system was started:
|
||||
.Bl -item -compact -offset indent
|
||||
.It
|
||||
0: Front power switch
|
||||
.It
|
||||
1: External (I/O slot) power signal
|
||||
.It
|
||||
2: RTC alarm
|
||||
.El
|
||||
This is useful when choosing the shutdown message.
|
||||
|
||||
If the argument
|
||||
.Ar shutdown-program
|
||||
is omitted, `/sbin/shutdown -r +1' is executed instead.
|
||||
.Sh SEE ALSO
|
||||
.Xr pow 4 ,
|
||||
.Xr shutdown 8 ,
|
||||
.Xr rtcalarm 8
|
||||
.Sh AUTHOR
|
||||
.Nm Poffd
|
||||
was written by MINOURA Makoto <minoura@flab.fujitsu.co.jp>.
|
||||
.Sh SPECIAL THANKS
|
||||
Liam Hahne Minn <hahne@sail.t.u-tokyo.ac.jp>.
|
||||
.Sh BUGS
|
||||
Many, probably.
|
|
@ -0,0 +1,76 @@
|
|||
.\" Copyright (c) 1995 MINOURA Makoto.
|
||||
.\" 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.
|
||||
.\" 3. All advertising materials mentioning features or use of this software
|
||||
.\" must display the following acknowledgement:
|
||||
.\" This product includes software developed by Minoura Makoto.
|
||||
.\" 4. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission
|
||||
.\"
|
||||
.\" 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.
|
||||
.\"
|
||||
.Dd June 28, 1995
|
||||
.Os
|
||||
.Dt RTCALARM 8
|
||||
.Sh NAME
|
||||
.Nm rtcalarm
|
||||
.Nd "Display or set x68k's RTC alarm timer"
|
||||
.Sh SYNOPSIS
|
||||
.Nm rtcalarm
|
||||
.Op Fl w Ar day-of-the-week
|
||||
.Op Fl d Ar day-of-the-month
|
||||
.Bo
|
||||
.Op Fl m Ar minites
|
||||
|
|
||||
.Op Fl s Ar seconds
|
||||
.Bc
|
||||
.Op Fl c channel
|
||||
.Ar hh:mm
|
||||
.Nm rtcalarm
|
||||
off
|
||||
.Nm rtcalarm
|
||||
.Sh DESCRIPTION
|
||||
.Nm Rtcalarm
|
||||
displays or sets x68k's RTC alarm timer.
|
||||
|
||||
First form of
|
||||
.Nm rtcalarm
|
||||
sets the alarm timer to specified time and enables it.
|
||||
.Ar Day-of-the-week
|
||||
is a number from 0 to 6, which means Sunday, Monday,.. etc.
|
||||
|
||||
If
|
||||
.Fl c
|
||||
is omitted, the alarm timer starts the x68k in computer mode.
|
||||
|
||||
The second form disables the alarm timer.
|
||||
|
||||
If no arguments are supplied (the third form),
|
||||
.Nm rtcalarm
|
||||
displays the current settings of the alarm timer.
|
||||
|
||||
Note that setting the alarm timer is allowed only for the super user.
|
||||
.Sh SEE ALSO
|
||||
.Xr pow 4
|
||||
.Sh AUTHOR
|
||||
.Nm Rtcalarm
|
||||
was written by MINOURA Makoto <minoura@flab.fujitsu.co.jp>.
|
||||
.Sh BUGS
|
||||
Many, probably.
|
|
@ -0,0 +1,40 @@
|
|||
# $NetBSD: Makefile,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
# @(#)Makefile 7.3 (Berkeley) 6/9/91
|
||||
|
||||
# Makefile for x68k tags file and boot blocks
|
||||
|
||||
NOPROG= noprog
|
||||
NOMAN= noman
|
||||
|
||||
SUBDIR=usr.bin usr.sbin sdboot fdboot
|
||||
|
||||
TX68K= ../x68k/tags
|
||||
SX68K= ../m68k/m68k/*.c ../m68k/include/*.h \
|
||||
../x68k/x68k/*.[ch] ../x68k/include/*.h \
|
||||
../x68k/dev/*.[ch]
|
||||
AX68K= ../m68k/m68k/*.s ../x68k/x68k/*.s
|
||||
|
||||
# Directories in which to place x68k tags links
|
||||
DX68K= x68k dev include
|
||||
|
||||
TAGS:
|
||||
-etags -dt ${COMM} ${SX68K} ${AX68k}
|
||||
egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AX68K} | \
|
||||
sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
|
||||
>> ${TX68K}/tags
|
||||
|
||||
tags:
|
||||
-ctags -dtf ${TX68K} ${COMM} ${SX68K}
|
||||
egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AX68K} | \
|
||||
sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
|
||||
>> ${TX68K}
|
||||
sort -o ${TX68K} ${TX68K}
|
||||
|
||||
links:
|
||||
-for i in ${DX68K}; do \
|
||||
cd ../$$i && rm -f tags TAGS; ln -s ../tags ../TAGS .; done
|
||||
|
||||
obj: _SUBDIRUSE
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,150 @@
|
|||
# $NetBSD: ALL,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
#
|
||||
# ALL -- everything that's currently supported
|
||||
#
|
||||
|
||||
# architecture type and name of kernel; REQUIRED
|
||||
machine x68k m68k
|
||||
|
||||
# different CPU types; you must have at least the correct one; REQUIRED
|
||||
options M68030
|
||||
options M68040
|
||||
|
||||
# time zone RTC is expected to be set in; REQUIRED
|
||||
options TIMEZONE=-540 # Set the timezone that the kernel will use
|
||||
options DST=0 # Set the timezone that the kernel will use
|
||||
|
||||
# estimated number of users
|
||||
maxusers 32
|
||||
|
||||
# standard options
|
||||
options GENERIC # historical
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options VNODEPAGER # vnode pager (mapped files)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
options DDB # kernel debugger; recommended
|
||||
options DIAGNOSTIC # internal consistency checking
|
||||
|
||||
options KTRACE # system call tracing, a la ktrace(1)
|
||||
options FIFO # FIFOs; RECOMMENDED
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
options SHMMAXPGS=1024 # 1024 pages in the defualt
|
||||
options LKM # loadable kernel modules
|
||||
|
||||
# compatibility options
|
||||
options COMPAT_NOMID # old zmagic executables
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_44 # compatibility with 4.4BSD binaries
|
||||
options COMPAT_09 # compatibility with NetBSD 0.9
|
||||
options COMPAT_10 # compatibility with NetBSD 1.0
|
||||
options COMPAT_11 # compatibility with NetBSD 1.1
|
||||
options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
|
||||
# file system options
|
||||
options QUOTA # file system quotas
|
||||
options FFS # Berkeley fast file system
|
||||
options FASTLINKS # fast symbolic links in FFS
|
||||
options MFS # memory file system; uses RAM and swap
|
||||
options NFSSERVER # Network File System server
|
||||
options NFSCLIENT # Network File System client
|
||||
options CD9660 # ISO 9660 CD-ROM file system, with RR
|
||||
options MSDOSFS # MS-DOS FAT file system
|
||||
options FDESC # /dev/fd
|
||||
options KERNFS # kernel file system; recommended
|
||||
options PROCFS # /proc
|
||||
options NULLFS # Loop-back filesystem
|
||||
options PORTAL # portal filesystem (still experimental)
|
||||
options ADOSFS # AmigaDOS filesystem
|
||||
options LFS # Log-based filesystem (still experimental)
|
||||
options UMAPFS # uid/gid remapping filesystem
|
||||
options UNION # union mount
|
||||
|
||||
# networking options
|
||||
options INET # Internet protocols
|
||||
options GATEWAY # IP packet forwarding
|
||||
options MROUTING # Multicast routing support
|
||||
options NS # XNS
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
options MULTICAST # multicast
|
||||
options TUN # tunnelling
|
||||
|
||||
# Options specific to this host.
|
||||
#options INSECURE # Disable kernel security.
|
||||
options MACHINE_NONCONTIG # support for noncontig memory
|
||||
options DEBUG # extra kernel debugging support
|
||||
options FPSP # floating point emulation for MC68040
|
||||
options ITEKANJI # Kanji display for console
|
||||
options PANICBUTTON # enable interrupt switch
|
||||
options JUPITER # support for "JUPITER-X"
|
||||
options EIOMAPSIZE=0 # do not map PCI address space
|
||||
#options MAPPEDCOPY # use page mapping for large copyin/copyout
|
||||
#options NKMEMCLUSTERS=1024 # 4K pages in kernel malloc pool
|
||||
#options KGDB # support for kernel gdb
|
||||
#options KGDBRATE=19200 # kernel gdb port rate (default 9600)
|
||||
#options KGDBDEV=15*256+2 # device for kernel gdb
|
||||
|
||||
#config netbsd root on sd6a swap on sd6b
|
||||
config netbsd swap generic
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
zs0 at mainbus0 # Zilog serial
|
||||
zs1 at mainbus0 # Zilog serial
|
||||
par0 at mainbus0 # builtin parallel port
|
||||
spc0 at mainbus0 # builtin scsi
|
||||
spc1 at mainbus0 # external scsi
|
||||
scsibus* at spc?
|
||||
grfbus0 at mainbus0 # bitmapped display's
|
||||
grf0 at grfbus0 # multiplane graphics
|
||||
grf1 at grfbus0 # flexible graphics
|
||||
ite0 at grf0 # console
|
||||
fdc0 at mainbus0 # floppy controller
|
||||
fd* at fdc0 unit ? # builtin floppy drive
|
||||
com0 at mainbus0 # NS16550
|
||||
com1 at mainbus0 # NS16550
|
||||
|
||||
# SCSI disks
|
||||
#sd* at scsibus? target ? lun ?
|
||||
sd0 at scsibus? target 0 lun ?
|
||||
sd1 at scsibus? target 1 lun ?
|
||||
sd2 at scsibus? target 2 lun ?
|
||||
sd3 at scsibus? target 3 lun ?
|
||||
sd4 at scsibus? target 4 lun ?
|
||||
sd5 at scsibus? target 5 lun ?
|
||||
sd6 at scsibus? target 6 lun ?
|
||||
sd7 at scsibus? target 7 lun ?
|
||||
|
||||
# SCSI CD-ROMs
|
||||
cd* at scsibus? target ? lun ?
|
||||
|
||||
# SCSI tapes
|
||||
st* at scsibus? target ? lun 0
|
||||
|
||||
# SCSI scanners
|
||||
ss* at scsibus? target ? lun ?
|
||||
|
||||
# ethernet board
|
||||
#se0 at scsibus? target ? lun ?
|
||||
#ed0 at mainbus0
|
||||
|
||||
# /dev/audio
|
||||
#adpcm0 at mainbus0
|
||||
|
||||
pseudo-device sl 4 # compressed SLIP
|
||||
pseudo-device ppp 4 # point-to-point protocol
|
||||
pseudo-device bpfilter 16 # packet filter
|
||||
pseudo-device tun 4 # tunnel
|
||||
pseudo-device pty 64 # pseudo-terminals
|
||||
pseudo-device kbd # kbd
|
||||
pseudo-device mouse # mouse
|
||||
pseudo-device sram # battery-backuped static RAM
|
||||
pseudo-device bell # OPM bell
|
||||
pseudo-device pow 2 # software power switch
|
||||
pseudo-device loop # loopback; recommended
|
||||
pseudo-device vnd 10 # vn virtual filesystem device
|
||||
pseudo-device ccd 4 # concatenating disk driver
|
|
@ -0,0 +1,87 @@
|
|||
# $NetBSD: EMPTY,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
#
|
||||
# EMPTY
|
||||
#
|
||||
|
||||
#--- from std.x68k
|
||||
# $NetBSD: EMPTY,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
#
|
||||
# standard x68k information
|
||||
#
|
||||
|
||||
machine x68k m68k
|
||||
|
||||
options MACHINE_NONCONTIG # Non-contiguous memory support
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
zs0 at mainbus0 # Zilog serial
|
||||
#par0 at mainbus0 # builtin parallel port
|
||||
spc0 at mainbus0 # scsi
|
||||
scsibus* at spc?
|
||||
grfbus0 at mainbus0 # bitmapped display's
|
||||
grf0 at grfbus0 # graphics driver
|
||||
ite0 at grf0 # console
|
||||
|
||||
pseudo-device mouse # standard mouse
|
||||
pseudo-device kbd # standard keyboard
|
||||
|
||||
#sd* at scsibus? target ? lun ?
|
||||
sd0 at scsibus? target 0 lun ?
|
||||
sd1 at scsibus? target 1 lun ?
|
||||
sd2 at scsibus? target 2 lun ?
|
||||
sd3 at scsibus? target 3 lun ?
|
||||
sd4 at scsibus? target 4 lun ?
|
||||
sd5 at scsibus? target 5 lun ?
|
||||
sd6 at scsibus? target 6 lun ?
|
||||
st* at scsibus? target ? lun 0
|
||||
cd* at scsibus? target ? lun ?
|
||||
#---
|
||||
|
||||
# estimated number of users
|
||||
maxusers 8
|
||||
|
||||
# different CPU types; you must have at least the correct one; REQUIRED
|
||||
options "M68040"
|
||||
|
||||
# time zone RTC is expected to be set in; REQUIRED
|
||||
options TIMEZONE=-540 # Set the timezone that the kernel will use
|
||||
options DST=0 # Set the timezone that the kernel will use
|
||||
|
||||
# standard options
|
||||
options GENERIC # historical
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options VNODEPAGER # vnode pager (mapped files)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
#options DDB # kernel debugger; recommended
|
||||
#options DIAGNOSTIC # internal consistency checking
|
||||
|
||||
options FIFO # FIFOs; RECOMMENDED
|
||||
|
||||
# compatibility options
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_10 # compatibility with NetBSD 1.0
|
||||
options COMPAT_11 # compatibility with NetBSD 1.1
|
||||
|
||||
# file system options
|
||||
options FFS # Berkeley fast file system
|
||||
options FASTLINKS # fast symbolic links in FFS
|
||||
|
||||
# networking options
|
||||
options INET # IP
|
||||
|
||||
# Options specific to this host.
|
||||
options DEBUG # extra kernel debugging support
|
||||
options FPSP # floating point emulation for MC68040
|
||||
options ITEKANJI # Kanji display for console
|
||||
options PANICBUTTON # enable interrupt switch
|
||||
options "EIOMAPSIZE=0" # do not map PCI address space
|
||||
|
||||
config netbsd swap on generic
|
||||
|
||||
pseudo-device pty 4 # pseudo-terminals
|
||||
pseudo-device loop # loopback; recommended
|
||||
pseudo-device vnd 10 # vn virtual filesystem device
|
||||
pseudo-device ccd 4 # concatenating disk driver
|
||||
pseudo-device ppp 4 # point-to-point protocol
|
|
@ -0,0 +1,138 @@
|
|||
# $NetBSD: GENERIC,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
#
|
||||
# GENERIC
|
||||
#
|
||||
|
||||
# architecture type and name of kernel; REQUIRED
|
||||
machine x68k m68k
|
||||
|
||||
# different CPU types; you must have at least the correct one; REQUIRED
|
||||
options M68030
|
||||
options M68040
|
||||
|
||||
# time zone RTC is expected to be set in; REQUIRED
|
||||
options TIMEZONE=-540 # Set the timezone that the kernel will use
|
||||
options DST=0 # Set the timezone that the kernel will use
|
||||
|
||||
# estimated number of users
|
||||
maxusers 8
|
||||
|
||||
# standard options
|
||||
options GENERIC # historical
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options VNODEPAGER # vnode pager (mapped files)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
options DDB # kernel debugger; recommended
|
||||
options DIAGNOSTIC # internal consistency checking
|
||||
|
||||
options KTRACE # system call tracing, a la ktrace(1)
|
||||
options FIFO # FIFOs; RECOMMENDED
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
options SHMMAXPGS=1024 # 1024 pages in the defualt
|
||||
options LKM # loadable kernel modules
|
||||
|
||||
# compatibility options
|
||||
#options COMPAT_NOMID # old zmagic executables
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
#options COMPAT_44 # compatibility with 4.4BSD binaries
|
||||
options COMPAT_09 # compatibility with NetBSD 0.9
|
||||
options TCP_COMPAT_42 # 4.2 networking ABI
|
||||
#options COMPAT_SUNOS # SunOS binaries
|
||||
#options COMPAT_HPUX # HP-UX binaries; VERY EXPERIMENTAL
|
||||
|
||||
# file system options
|
||||
options QUOTA # file system quotas
|
||||
options FFS # Berkeley fast file system
|
||||
options FASTLINKS # fast symbolic links in FFS
|
||||
options MFS # memory file system; uses RAM and swap
|
||||
#options NFSSERVER # Network File System server
|
||||
#options NFSCLIENT # Network File System client
|
||||
options CD9660 # ISO 9660 CD-ROM file system, with RR
|
||||
options MSDOSFS # MS-DOS FAT file system
|
||||
options FDESC # /dev/fd
|
||||
options KERNFS # kernel file system; recommended
|
||||
options PROCFS # /proc
|
||||
options NULLFS # Loop-back filesystem
|
||||
#options PORTAL # portal filesystem (still experimental)
|
||||
#options ADOSFS # AmigaDOS filesystem
|
||||
#options LFS # Log-based filesystem (still experimental)
|
||||
#options UMAPFS # uid/gid remapping filesystem
|
||||
#options UNION # union mount
|
||||
|
||||
# networking options
|
||||
#options GATEWAY # IP packet forwarding
|
||||
options INET # Internet protocols
|
||||
#options NS # XNS
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#options MULTICAST # multicast
|
||||
#options TUN # tunnelling
|
||||
|
||||
# Options specific to this host.
|
||||
options DEBUG
|
||||
#options MACHINE_NONCONTIG # support for noncontig memory
|
||||
options FPSP # '40 Floating Point Software
|
||||
options ITEKANJI # Kanji display for console
|
||||
options PANICBUTTON # enable interrupt switch
|
||||
options EIOMAPSIZE=0 # do not map PCI address space
|
||||
#options MAPPEDCOPY # use page mapping for large copyin/copyout
|
||||
#options BUFPAGES=900
|
||||
#options NKMEMCLUSTERS=256
|
||||
#options PROFTIMER, PRF_INTERVAL=500
|
||||
#options KGDB,"KGDBDEV=15*256+2", KGDBRATE=19200
|
||||
#options PPP_OUTQ_SIZE=4096
|
||||
|
||||
#config netbsd root on sd6a swap on sd6b
|
||||
config netbsd swap generic
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
zs0 at mainbus0 # Zilog serial
|
||||
par0 at mainbus0 # builtin parallel port
|
||||
spc0 at mainbus0 # scsi
|
||||
scsibus* at spc?
|
||||
grfbus0 at mainbus0 # bitmapped display's
|
||||
grf0 at grfbus0 # graphics driver
|
||||
ite0 at grf0 # console
|
||||
#fdc0 at mainbus0 # floppy controller
|
||||
#fd* at fdc0 unit ? # builtin floppy drive
|
||||
|
||||
# SCSI disks
|
||||
#sd* at scsibus? target ? lun ?
|
||||
sd0 at scsibus? target 0 lun ?
|
||||
sd1 at scsibus? target 1 lun ?
|
||||
sd2 at scsibus? target 2 lun ?
|
||||
sd3 at scsibus? target 3 lun ?
|
||||
sd4 at scsibus? target 4 lun ?
|
||||
sd5 at scsibus? target 5 lun ?
|
||||
sd6 at scsibus? target 6 lun ?
|
||||
sd7 at scsibus? target 7 lun ?
|
||||
|
||||
# SCSI CD-ROMs
|
||||
cd* at scsibus? target ? lun ?
|
||||
|
||||
# SCSI tapes
|
||||
st* at scsibus? target ? lun 0
|
||||
|
||||
# ethernet board
|
||||
#se0 at scsibus? target ? lun ?
|
||||
#ed0 at mainbus0
|
||||
|
||||
#device bsdaudio0 at nexus0 # /dev/audio
|
||||
|
||||
#pseudo-device sl 4 # compressed SLIP
|
||||
pseudo-device ppp 4 # point-to-point protocol
|
||||
#pseudo-device bpfilter 16 # packet filter
|
||||
pseudo-device pty 32 # pseudo-terminals
|
||||
pseudo-device kbd # kbd
|
||||
pseudo-device mouse # mouse
|
||||
#pseudo-device sram # static RAM
|
||||
pseudo-device bell # OPM bell
|
||||
pseudo-device pow 2 # software power switch
|
||||
pseudo-device loop # loopback; recommended
|
||||
#pseudo-device vnd 10 # vn virtual filesystem device
|
||||
#pseudo-device ccd 4 # concatenating disk driver
|
|
@ -0,0 +1,141 @@
|
|||
# $NetBSD: JUPITER,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
#
|
||||
# JUPITER
|
||||
#
|
||||
|
||||
# architecture type and name of kernel; REQUIRED
|
||||
machine x68k m68k
|
||||
|
||||
# different CPU types; you must have at least the correct one; REQUIRED
|
||||
options M68030
|
||||
options M68040
|
||||
options M68060
|
||||
|
||||
# time zone RTC is expected to be set in; REQUIRED
|
||||
options TIMEZONE=-540 # Set the timezone that the kernel will use
|
||||
options DST=0 # Set the timezone that the kernel will use
|
||||
|
||||
# estimated number of users
|
||||
maxusers 32
|
||||
|
||||
# standard options
|
||||
options GENERIC # historical
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options VNODEPAGER # vnode pager (mapped files)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
options DDB # kernel debugger; recommended
|
||||
options DIAGNOSTIC # internal consistency checking
|
||||
|
||||
options KTRACE # system call tracing, a la ktrace(1)
|
||||
options FIFO # FIFOs; RECOMMENDED
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
options SHMMAXPGS=1024 # 1024 pages in the defualt
|
||||
options LKM # loadable kernel modules
|
||||
|
||||
# compatibility options
|
||||
options COMPAT_NOMID # old zmagic executables
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_44 # compatibility with 4.4BSD binaries
|
||||
options COMPAT_09 # compatibility with NetBSD 0.9
|
||||
options COMPAT_10 # compatibility with NetBSD 1.0
|
||||
options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
|
||||
# file system options
|
||||
options QUOTA # file system quotas
|
||||
options FFS # Berkeley fast file system
|
||||
options FASTLINKS # fast symbolic links in FFS
|
||||
options MFS # memory file system; uses RAM and swap
|
||||
options NFSSERVER # Network File System server
|
||||
options NFSCLIENT # Network File System client
|
||||
options CD9660 # ISO 9660 CD-ROM file system, with RR
|
||||
options MSDOSFS # MS-DOS FAT file system
|
||||
options FDESC # /dev/fd
|
||||
options KERNFS # kernel file system; recommended
|
||||
options PROCFS # /proc
|
||||
options NULLFS # Loop-back filesystem
|
||||
options PORTAL # portal filesystem (still experimental)
|
||||
#options ADOSFS # AmigaDOS filesystem
|
||||
options LFS # Log-based filesystem (still experimental)
|
||||
options UMAPFS # uid/gid remapping filesystem
|
||||
options UNION # union mount
|
||||
|
||||
# networking options
|
||||
options INET # Internet protocols
|
||||
options GATEWAY # IP packet forwarding
|
||||
options MROUTING # Multicast routing support
|
||||
#options NS # XNS
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
options MULTICAST # multicast
|
||||
options TUN # tunnelling
|
||||
|
||||
# Options specific to this host.
|
||||
options MACHINE_NONCONTIG # support for noncontig memory
|
||||
options DEBUG # extra kernel debugging support
|
||||
options FPSP # floating point emulation for MC68040
|
||||
options M060SP # floating point / integer emulation for M68060
|
||||
options JUPITER # JUPITER-X extension
|
||||
options ITEKANJI # Kanji display for console
|
||||
options PANICBUTTON # enable interrupt switch
|
||||
options EIOMAPSIZE=0 # do not mapping PCI address space
|
||||
#options MAPPEDCOPY # use page mapping for large copyin/copyout
|
||||
#options NKMEMCLUSTERS=1024 # 4K pages in kernel malloc pool
|
||||
#options KGDB # support for kernel gdb
|
||||
#options KGDBRATE=19200 # kernel gdb port rate (default 9600)
|
||||
#options KGDBDEV=15*256+2 # device for kernel gdb
|
||||
|
||||
#config netbsd root on sd6a swap on sd6b
|
||||
config netbsd swap generic
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
zs0 at mainbus0 # Zilog serial
|
||||
par0 at mainbus0 # builtin parallel port
|
||||
spc0 at mainbus0 # scsi
|
||||
scsibus* at spc?
|
||||
grfbus0 at mainbus0 # bitmapped display's
|
||||
grf0 at grfbus0 # graphics driver
|
||||
ite0 at grf0 # console
|
||||
#fdc0 at mainbus0 # floppy controller
|
||||
#fd* at fdc0 unit ? # builtin floppy drive
|
||||
|
||||
# SCSI disks
|
||||
#sd* at scsibus? target ? lun ?
|
||||
sd0 at scsibus? target 0 lun ?
|
||||
sd1 at scsibus? target 1 lun ?
|
||||
sd2 at scsibus? target 2 lun ?
|
||||
sd3 at scsibus? target 3 lun ?
|
||||
sd4 at scsibus? target 4 lun ?
|
||||
sd5 at scsibus? target 5 lun ?
|
||||
sd6 at scsibus? target 6 lun ?
|
||||
sd7 at scsibus? target 7 lun ?
|
||||
|
||||
# SCSI CD-ROMs
|
||||
cd* at scsibus? target ? lun ?
|
||||
|
||||
# SCSI tapes
|
||||
st* at scsibus? target ? lun 0
|
||||
|
||||
# ethernet board
|
||||
#se0 at scsibus? target ? lun ?
|
||||
#ed0 at mainbus0
|
||||
|
||||
#device bsdaudio0 at nexus0 # /dev/audio
|
||||
|
||||
pseudo-device sl 4 # compressed SLIP
|
||||
pseudo-device ppp 4 # point-to-point protocol
|
||||
pseudo-device bpfilter 16 # packet filter
|
||||
pseudo-device tun 4 # tunnel
|
||||
pseudo-device pty 64 # pseudo-terminals
|
||||
pseudo-device kbd # kbd
|
||||
pseudo-device mouse # mouse
|
||||
pseudo-device sram # static RAM
|
||||
pseudo-device bell # OPM bell
|
||||
pseudo-device pow 2 # software power switch
|
||||
pseudo-device loop # loopback; recommended
|
||||
pseudo-device vnd 10 # virtual filesystem device
|
||||
pseudo-device ccd 4 # concatenating disk driver
|
|
@ -0,0 +1,149 @@
|
|||
# $NetBSD: MARINE,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
#
|
||||
# MARINE
|
||||
#
|
||||
|
||||
# architecture type and name of kernel; REQUIRED
|
||||
machine "x68k"
|
||||
ident MARINE
|
||||
|
||||
# different CPU types; you must have at least the correct one; REQUIRED
|
||||
#cpu "M68030"
|
||||
cpu "M68040"
|
||||
|
||||
# time zone RTC is expected to be set in; REQUIRED
|
||||
timezone -9
|
||||
|
||||
# estimated number of users
|
||||
maxusers 8
|
||||
|
||||
# standard options
|
||||
options GENERIC # historical
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options VNODEPAGER # vnode pager (mapped files)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
options DDB # kernel debugger; recommended
|
||||
#options DIAGNOSTIC # internal consistency checking
|
||||
|
||||
#options KTRACE # system call tracing, a la ktrace(1)
|
||||
options FIFO # FIFOs; RECOMMENDED
|
||||
#options SYSVMSG # System V-like message queues
|
||||
#options SYSVSEM # System V-like semaphores
|
||||
#options SYSVSHM # System V-like memory sharing
|
||||
#options SHMMAXPGS=1024 # 1024 pages in the defualt
|
||||
#options LKM # loadable kernel modules
|
||||
|
||||
# compatibility options
|
||||
#options COMPAT_NOMID # old zmagic executables
|
||||
options "COMPAT_43" # compatibility with 4.3BSD binaries
|
||||
#options "COMPAT_44" # compatibility with 4.4BSD binaries
|
||||
#options "COMPAT_09" # compatibility with NetBSD 0.9
|
||||
#options "TCP_COMPAT_42" # compatibility with 4.2BSD TCP/IP
|
||||
|
||||
# file system options
|
||||
#options QUOTA # file system quotas
|
||||
options FFS # Berkeley fast file system
|
||||
options FASTLINKS # fast symbolic links in FFS
|
||||
#options MFS # memory file system; uses RAM and swap
|
||||
#options NFSSERVER # Network File System server
|
||||
#options NFSCLIENT # Network File System client
|
||||
options "CD9660" # ISO 9660 CD-ROM file system, with RR
|
||||
#options MSDOSFS # MS-DOS FAT file system
|
||||
options HUMANFS # MS-DOS FAT file system with Human Ext.
|
||||
#options FDESC # /dev/fd
|
||||
#options KERNFS # kernel file system; recommended
|
||||
#options PROCFS # /proc
|
||||
#options NULLFS # Loop-back filesystem
|
||||
#options PORTAL # portal filesystem (still experimental)
|
||||
#options ADOSFS # AmigaDOS filesystem
|
||||
#options LFS # Log-based filesystem (still experimental)
|
||||
#options UMAPFS # uid/gid remapping filesystem
|
||||
#options UNION # union mount
|
||||
|
||||
# networking options
|
||||
options INET # Internet protocls
|
||||
#options GATEWAY # IP packet forwarding
|
||||
#options MROUTING # Multicast routing support
|
||||
#options NS # XNS
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#options MULTICAST # multicast
|
||||
#options TUN # tunnelling
|
||||
|
||||
# Options specific to this host.
|
||||
options MACHINE_NONCONTIG # support for noncontig memory
|
||||
#options DEBUG # extra kernel debugging support
|
||||
options FPSP # floating point emulation for MC68040
|
||||
options ITEKANJI # Kanji display for console
|
||||
options PANICBUTTON # enable interrupt switch
|
||||
options NODISCONNECT # do not use disconnect for SCSI
|
||||
#options MAPPEDCOPY # use page mapping for large copyin/copyout
|
||||
#options "NKMEMCLUSTERS=1024" # 4K pages in kernel malloc pool
|
||||
#options KGDB # support for kernel gdb
|
||||
#options "KGDBRATE=19200" # kernel gdb port rate (default 9600)
|
||||
#options "KGDBDEV=15*256+2" # device for kernel gdb
|
||||
|
||||
#config netbsd root on sd6a swap on sd6b
|
||||
config netbsd swap generic
|
||||
|
||||
# manufacturer 1 is a pseudo and stands for `builtin'
|
||||
master scsi0 at nexus0 # internal SCSI port
|
||||
master scsi1 at nexus0 # external SCSI board
|
||||
master fdc0 at nexus0
|
||||
|
||||
# further builtin devices
|
||||
device zs0 at nexus0
|
||||
device zs1 at nexus0
|
||||
#device par0 at nexus0
|
||||
device fd0 at fdc0 slave 0
|
||||
device fd1 at fdc0 slave 1
|
||||
device fd2 at fdc0 slave 2
|
||||
#device fd3 at fdc0 slave 3
|
||||
|
||||
# SCSI disks
|
||||
disk sd0 at scsi0 slave 0
|
||||
disk sd1 at scsi0 slave 1
|
||||
disk sd2 at scsi0 slave 2
|
||||
disk sd3 at scsi0 slave 3
|
||||
#disk sd4 at scsi0 slave 4
|
||||
disk sd5 at scsi0 slave 5
|
||||
#disk sd6 at scsi0 slave 6
|
||||
#disk sd7 at scsi0 slave 7
|
||||
|
||||
# SCSI CD-ROMs
|
||||
disk cd0 at scsi0 slave 6
|
||||
|
||||
# SCSI tapes
|
||||
tape st0 at scsi0 slave 4
|
||||
tape st1 at scsi1 slave 0
|
||||
tape st1 at scsi1 slave 1
|
||||
tape st1 at scsi1 slave 2
|
||||
tape st1 at scsi1 slave 3
|
||||
tape st1 at scsi1 slave 4
|
||||
tape st1 at scsi1 slave 5
|
||||
tape st1 at scsi1 slave 6
|
||||
|
||||
device grf0 at nexus0
|
||||
|
||||
# builtin clock (should all identify as "rtclock")
|
||||
device rtclock0 at nexus0
|
||||
|
||||
# ethernet board
|
||||
#device se0 at scsi0 slave 2
|
||||
|
||||
device bsdaudio0 at nexus0 # /dev/audio
|
||||
device kbd0 at nexus0
|
||||
#device sram0 at nexus0 # battery backuped memory
|
||||
|
||||
#pseudo-device sl 4 # compressed SLIP
|
||||
pseudo-device ppp 1 # point-to-point protocol
|
||||
#pseudo-device bpfilter 16 # packet filter
|
||||
#pseudo-device tun 4 # tunnel
|
||||
pseudo-device ite # internal terminal emulator
|
||||
pseudo-device pty 32 # pseudo-terminals
|
||||
pseudo-device mouse # mouse
|
||||
pseudo-device loop # loopback; recommended
|
||||
pseudo-device ether # ethernet
|
||||
pseudo-device vnd 1 # vn virtual filesystem device
|
|
@ -0,0 +1,178 @@
|
|||
# $NetBSD: Makefile.x68k,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
# Makefile for NetBSD
|
||||
#
|
||||
# This makefile is constructed from a machine description:
|
||||
# config machineid
|
||||
# Most changes should be made in the machine description
|
||||
# /sys/arch/x68k/conf/``machineid''
|
||||
# after which you should do
|
||||
# config machineid
|
||||
# Machine generic makefile changes should be made in
|
||||
# /sys/arch/x68k/conf/Makefile.x68k
|
||||
# after which config should be rerun for all machines of that type.
|
||||
#
|
||||
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
|
||||
# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
|
||||
#
|
||||
# -DTRACE compile in kernel tracing hooks
|
||||
# -DQUOTA compile in file system quotas
|
||||
|
||||
# DEBUG is set to -g if debugging.
|
||||
# PROF is set to -pg if profiling.
|
||||
|
||||
AS?= as
|
||||
CC?= cc
|
||||
CPP?= cpp
|
||||
LD?= ld
|
||||
STRIP?= strip -d
|
||||
TOUCH?= touch -f -c
|
||||
|
||||
# source tree is located via $S relative to the compilation directory
|
||||
S= ../../../..
|
||||
X68K= ../..
|
||||
|
||||
INCLUDES= -I. -I$S/arch -I$S
|
||||
CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dx68k -DFPCOPROC
|
||||
CFLAGS= ${DEBUG} -O2 -Werror -msoft-float
|
||||
AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
|
||||
LINKFLAGS= -n -Ttext 0 -e start
|
||||
|
||||
### find out what to use for libkern
|
||||
.include "$S/lib/libkern/Makefile.inc"
|
||||
.ifndef PROF
|
||||
LIBKERN= ${KERNLIB}
|
||||
.else
|
||||
LIBKERN= ${KERNLIB_PROF}
|
||||
.endif
|
||||
|
||||
### find out what to use for libcompat
|
||||
.include "$S/compat/common/Makefile.inc"
|
||||
.ifndef PROF
|
||||
LIBCOMPAT= ${COMPATLIB}
|
||||
.else
|
||||
LIBCOMPAT= ${COMPATLIB_PROF}
|
||||
.endif
|
||||
|
||||
### for the Motorola 68040 Floating Point Software Product
|
||||
.include "$S/arch/m68k/fpsp/Makefile.inc"
|
||||
|
||||
# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
|
||||
# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
|
||||
# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
|
||||
# is marked as config-dependent.
|
||||
|
||||
NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
|
||||
NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
|
||||
|
||||
DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
|
||||
DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
|
||||
|
||||
NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
|
||||
NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
|
||||
|
||||
%OBJS
|
||||
|
||||
%CFILES
|
||||
|
||||
#%SFILES
|
||||
|
||||
# load lines for config "xxx" will be emitted as:
|
||||
# xxx: ${SYSTEM_DEP} swapxxx.o
|
||||
# ${SYSTEM_LD_HEAD}
|
||||
# ${SYSTEM_LD} swapxxx.o
|
||||
# ${SYSTEM_LD_TAIL}
|
||||
SYSTEM_OBJ= locore.o ${FPSP} \
|
||||
param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
|
||||
SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
|
||||
SYSTEM_LD_HEAD= @rm -f $@
|
||||
SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
|
||||
${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
|
||||
SYSTEM_LD_TAIL= @size $@; chmod 755 $@
|
||||
|
||||
DEBUG?=
|
||||
.if ${DEBUG} == "-g"
|
||||
LINKFLAGS+= -X
|
||||
SYSTEM_LD_TAIL+=; \
|
||||
echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
|
||||
echo ${STRIP} $@; ${STRIP} $@
|
||||
.else
|
||||
LINKFLAGS+= -x
|
||||
.endif
|
||||
|
||||
%LOAD
|
||||
|
||||
assym.h: genassym
|
||||
./genassym >assym.h
|
||||
|
||||
genassym: genassym.o
|
||||
${CC} -o $@ genassym.o
|
||||
|
||||
genassym.o: ${X68K}/x68k/genassym.c
|
||||
${NORMAL_C_C}
|
||||
|
||||
param.c: $S/conf/param.c
|
||||
rm -f param.c
|
||||
cp $S/conf/param.c .
|
||||
|
||||
param.o: param.c Makefile
|
||||
${NORMAL_C_C}
|
||||
|
||||
ioconf.o: ioconf.c
|
||||
${NORMAL_C}
|
||||
|
||||
newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
|
||||
sh $S/conf/newvers.sh
|
||||
${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
|
||||
|
||||
|
||||
clean::
|
||||
rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
|
||||
[Ee]rrs linterrs makelinks genassym genassym.o assym.h
|
||||
|
||||
lint:
|
||||
@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
|
||||
${X68K}/x68k/Locore.c ${CFILES} ${X68K}/x68k/swapgeneric.c \
|
||||
ioconf.c param.c | \
|
||||
grep -v 'static function .* unused'
|
||||
|
||||
tags:
|
||||
@echo "see $S/kern/Makefile for tags"
|
||||
|
||||
links:
|
||||
egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
|
||||
sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
|
||||
echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
|
||||
sort -u | comm -23 - dontlink | \
|
||||
sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
|
||||
sh makelinks && rm -f dontlink
|
||||
|
||||
SRCS= ${X68K}/x68k/locore.s \
|
||||
param.c ioconf.c ${CFILES} ${SFILES}
|
||||
depend: .depend
|
||||
.depend: ${SRCS} assym.h param.c
|
||||
mkdep ${AFLAGS} ${CPPFLAGS} ${X68K}/x68k/locore.s
|
||||
mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
|
||||
-if test -n "${SFILES}"; then \
|
||||
mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
|
||||
fi
|
||||
mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${X68K}/x68k/genassym.c
|
||||
|
||||
|
||||
# depend on root or device configuration
|
||||
autoconf.o conf.o: Makefile
|
||||
|
||||
# depend on network or filesystem configuration
|
||||
uipc_proto.o vfs_conf.o: Makefile
|
||||
|
||||
# depend on maxusers
|
||||
genassym.o machdep.o: Makefile
|
||||
|
||||
# depend on CPU configuration
|
||||
dma.o genassym.o hpux_machdep.o locore.o machdep.o pmap.o pmap_boostrap.o sys_machdep.o trap.o: Makefile
|
||||
|
||||
|
||||
locore.o: ${X68K}/x68k/locore.s assym.h
|
||||
${NORMAL_S}
|
||||
|
||||
%RULES
|
|
@ -0,0 +1,154 @@
|
|||
# $NetBSD: NBTY,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
#
|
||||
# ALL -- everything that's currently supported
|
||||
#
|
||||
|
||||
# architecture type and name of kernel; REQUIRED
|
||||
machine x68k m68k
|
||||
|
||||
# different CPU types; you must have at least the correct one; REQUIRED
|
||||
options M68030
|
||||
options M68040
|
||||
|
||||
# time zone RTC is expected to be set in; REQUIRED
|
||||
options TIMEZONE=-540 # Set the timezone that the kernel will use
|
||||
options DST=0 # Set the timezone that the kernel will use
|
||||
|
||||
# estimated number of users
|
||||
maxusers 16
|
||||
|
||||
# standard options
|
||||
options GENERIC # historical
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options VNODEPAGER # vnode pager (mapped files)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
options DDB # kernel debugger; recommended
|
||||
options DIAGNOSTIC # internal consistency checking
|
||||
|
||||
options KTRACE # system call tracing, a la ktrace(1)
|
||||
options FIFO # FIFOs; RECOMMENDED
|
||||
options SYSVMSG # System V-like message queues
|
||||
options SYSVSEM # System V-like semaphores
|
||||
options SYSVSHM # System V-like memory sharing
|
||||
options SHMMAXPGS=1024 # 1024 pages in the defualt
|
||||
options LKM # loadable kernel modules
|
||||
|
||||
# compatibility options
|
||||
options COMPAT_NOMID # old zmagic executables
|
||||
options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
options COMPAT_44 # compatibility with 4.4BSD binaries
|
||||
#options COMPAT_09 # compatibility with NetBSD 0.9
|
||||
#options COMPAT_10 # compatibility with NetBSD 1.0
|
||||
#options COMPAT_11 # compatibility with NetBSD 1.1
|
||||
options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP
|
||||
|
||||
#options COMPAT_SUNOS # SunOS binaries
|
||||
#options COMPAT_HPUX # HP-UX binaries
|
||||
|
||||
# file system options
|
||||
options QUOTA # file system quotas
|
||||
options FFS # Berkeley fast file system
|
||||
options FASTLINKS # fast symbolic links in FFS
|
||||
options MFS # memory file system; uses RAM and swap
|
||||
options NFSSERVER # Network File System server
|
||||
options NFSCLIENT # Network File System client
|
||||
options "CD9660" # ISO 9660 CD-ROM file system, with RR
|
||||
#options MSDOSFS # MS-DOS FAT file system
|
||||
options HUMANFS # MS-DOS FAT file system with Human Ext.
|
||||
options FDESC # /dev/fd
|
||||
options KERNFS # kernel file system; recommended
|
||||
options PROCFS # /proc
|
||||
options NULLFS # Loop-back filesystem
|
||||
options PORTAL # portal filesystem (still experimental)
|
||||
#options ADOSFS # AmigaDOS filesystem
|
||||
#options LFS # Log-based filesystem (still experimental)
|
||||
options UMAPFS # uid/gid remapping filesystem
|
||||
options UNION # union mount
|
||||
|
||||
# networking options
|
||||
options INET # Internet protocols
|
||||
options GATEWAY # IP packet forwarding
|
||||
options MROUTING # Multicast routing support
|
||||
#options NS # XNS
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
options MULTICAST # multicast
|
||||
options TUN # tunnelling
|
||||
|
||||
# Options specific to this host.
|
||||
#options INSECURE # Disable kernel security.
|
||||
#options MACHINE_NONCONTIG # support for noncontig memory
|
||||
options DEBUG # extra kernel debugging support
|
||||
options FPSP # floating point emulation for MC68040
|
||||
options ITEKANJI # Kanji display for console
|
||||
options PANICBUTTON # enable interrupt switch
|
||||
#options JUPITER # support for "JUPITER-X"
|
||||
#options EIOMAPSIZE=0 # do not map PCI address space
|
||||
#options MAPPEDCOPY # use page mapping for large copyin/copy
|
||||
#options BUFPAGES=900
|
||||
#options NKMEMCLUSTERS=256
|
||||
#options PROFTIMER, PRF_INTERVAL=500
|
||||
#options KGDB,"KGDBDEV=15*256+2", KGDBRATE=19200
|
||||
#options PPP_OUTQ_SIZE=4096
|
||||
options SLMTU=552
|
||||
|
||||
#config netbsd root on sd6a swap on sd6b
|
||||
config netbsd swap generic
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
spc0 at mainbus0 # builtin scsi
|
||||
spc1 at mainbus0 # external scsi
|
||||
scsibus* at spc?
|
||||
fdc0 at mainbus0 # floppy controller
|
||||
fd* at fdc0 unit ? # builtin floppy drive
|
||||
|
||||
# further builtin devices
|
||||
zs0 at mainbus0 # Zilog serial
|
||||
zs1 at mainbus0 # Zilog serial
|
||||
par0 at mainbus0 # builtin parallel port
|
||||
|
||||
com0 at mainbus0 # NS16550
|
||||
com1 at mainbus0 # NS16550
|
||||
|
||||
# SCSI disks
|
||||
#sd* at scsibus? target ? lun ?
|
||||
sd0 at scsibus? target 0 lun ?
|
||||
sd1 at scsibus? target 1 lun ?
|
||||
sd2 at scsibus? target 2 lun ?
|
||||
sd3 at scsibus? target 3 lun ?
|
||||
sd4 at scsibus? target 4 lun ?
|
||||
sd5 at scsibus? target 5 lun ?
|
||||
sd6 at scsibus? target 6 lun ?
|
||||
sd7 at scsibus? target 7 lun ?
|
||||
|
||||
# SCSI CD-ROMs
|
||||
cd* at scsibus? target ? lun ?
|
||||
|
||||
# SCSI tapes
|
||||
#st* at scsibus? target ? lun 0
|
||||
|
||||
grfbus0 at mainbus0 # bitmapped display's
|
||||
grf0 at grfbus0 # graphics driver
|
||||
ite0 at grf0 # console
|
||||
|
||||
# ethernet board
|
||||
se0 at scsibus? target ? lun ?
|
||||
#ed0 at mainbus0
|
||||
|
||||
device bsdaudio0 at nexus0 # /dev/audio
|
||||
|
||||
pseudo-device sl 1 # compressed SLIP
|
||||
#pseudo-device ppp 1 # point-to-point protocol
|
||||
pseudo-device bpfilter 8 # packet filter
|
||||
pseudo-device tun 4 # tunnel
|
||||
pseudo-device pty 64 # pseudo-terminals
|
||||
pseudo-device kbd # kbd
|
||||
pseudo-device mouse # mouse
|
||||
pseudo-device sram # static RAM
|
||||
pseudo-device loop # loopback; recommended
|
||||
#pseudo-device ether # ethernet
|
||||
pseudo-device vnd 10 # vn virtual filesystem device
|
||||
#pseudo-device ccd 4 # concatenating disk driver
|
|
@ -0,0 +1,113 @@
|
|||
# $NetBSD: SMALL,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
#
|
||||
# SMALL
|
||||
#
|
||||
|
||||
include "std.x68k"
|
||||
|
||||
# estimated number of users
|
||||
maxusers 8
|
||||
|
||||
# different CPU types; you must have at least the correct one; REQUIRED
|
||||
#options "M68030"
|
||||
options "M68040"
|
||||
|
||||
# time zone RTC is expected to be set in; REQUIRED
|
||||
options TIMEZONE=-540 # Set the timezone that the kernel will use
|
||||
options DST=0 # Set the timezone that the kernel will use
|
||||
|
||||
# standard options
|
||||
options GENERIC # historical
|
||||
options SWAPPAGER # swap pager (anonymous and swap space)
|
||||
options VNODEPAGER # vnode pager (mapped files)
|
||||
options DEVPAGER # device pager (mapped devices)
|
||||
options DDB # kernel debugger; recommended
|
||||
#options DIAGNOSTIC # internal consistency checking
|
||||
|
||||
#options KTRACE # system call tracing, a la ktrace(1)
|
||||
options FIFO # FIFOs; RECOMMENDED
|
||||
#options SYSVMSG # System V-like message queues
|
||||
#options SYSVSEM # System V-like semaphores
|
||||
#options SYSVSHM # System V-like memory sharing
|
||||
#options SHMMAXPGS=1024 # 1024 pages in the defualt
|
||||
#options LKM # loadable kernel modules
|
||||
|
||||
# compatibility options
|
||||
#options COMPAT_NOMID # old zmagic executables
|
||||
options "COMPAT_43" # compatibility with 4.3BSD binaries
|
||||
#options "COMPAT_44" # compatibility with 4.4BSD binaries
|
||||
#options "COMPAT_09" # compatibility with NetBSD 0.9
|
||||
options "COMPAT_10" # compatibility with NetBSD 1.0
|
||||
#options "TCP_COMPAT_42" # compatibility with 4.2BSD TCP/IP
|
||||
|
||||
# file system options
|
||||
#options QUOTA # file system quotas
|
||||
options FFS # Berkeley fast file system
|
||||
options FASTLINKS # fast symbolic links in FFS
|
||||
#options MFS # memory file system; uses RAM and swap
|
||||
#options NFSSERVER # Network File System server
|
||||
#options NFSCLIENT # Network File System client
|
||||
#options "CD9660" # ISO 9660 CD-ROM file system, with RR
|
||||
#options MSDOSFS # MS-DOS FAT file system
|
||||
#options HUMANFS # Human68k FAT file system
|
||||
#options FDESC # /dev/fd
|
||||
#options KERNFS # kernel file system; recommended
|
||||
#options PROCFS # /proc
|
||||
#options NULLFS # Loop-back filesystem
|
||||
#options PORTAL # portal filesystem (still experimental)
|
||||
#options ADOSFS # AmigaDOS filesystem
|
||||
#options LFS # Log-based filesystem (still experimental)
|
||||
#options UMAPFS # uid/gid remapping filesystem
|
||||
#options UNION # union mount
|
||||
|
||||
# networking options
|
||||
options INET # IP
|
||||
#options GATEWAY # IP packet forwarding
|
||||
#options MROUTING # Multicast routing support
|
||||
#options NS # XNS
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#options MULTICAST # multicast
|
||||
#options TUN # tunnelling
|
||||
|
||||
# Options specific to this host.
|
||||
#options INSECURE # Disable kernel security.
|
||||
options DEBUG # extra kernel debugging support
|
||||
options FPSP # floating point emulation for MC68040
|
||||
options ITEKANJI # Kanji display for console
|
||||
options PANICBUTTON # enable interrupt switch
|
||||
options NODISCONNECT # do not use disconnect for SCSI
|
||||
#options JUPITER # support for "JUPITER-X"
|
||||
options "EIOMAPSIZE=0" # do not mapping PCI address space
|
||||
#options MAPPEDCOPY # use page mapping for large copyin/copyout
|
||||
#options "NKMEMCLUSTERS=1024" # 4K pages in kernel malloc pool
|
||||
#options KGDB # support for kernel gdb
|
||||
#options "KGDBRATE=19200" # kernel gdb port rate (default 9600)
|
||||
#options "KGDBDEV=15*256+2" # device for kernel gdb
|
||||
#options BUFPAGES=900
|
||||
#options PROFTIMER, PRF_INTERVAL=500
|
||||
|
||||
#config netbsd root on sd6a swap on sd6b
|
||||
config netbsd swap on generic
|
||||
|
||||
# ethernet board
|
||||
#device se0 at scsi? slave 2
|
||||
#device ed0 at nexus0
|
||||
|
||||
#device bsdaudio0 at nexus0 # /dev/audio
|
||||
#device sram0 at nexus0 # battery backuped memory
|
||||
#device pow0 at nexus0 # power switch device
|
||||
#device pow1 at nexus0 # power switch device
|
||||
#device bell0 at nexus0 # /dev/bell
|
||||
|
||||
#pseudo-device sl 4 # compressed SLIP
|
||||
pseudo-device ppp 1 # point-to-point protocol
|
||||
#pseudo-device bpfilter 16 # packet filter
|
||||
pseudo-device pty 4 # pseudo-terminals
|
||||
#pseudo-device kbd # kbd
|
||||
pseudo-device loop # loopback; recommended
|
||||
#pseudo-device ether # ethernet
|
||||
#pseudo-device vnd 10 # vn virtual filesystem device
|
||||
#pseudo-device ccd 4 # concatenating disk driver
|
|
@ -0,0 +1,134 @@
|
|||
#
|
||||
# ALL -- everything that's currently supported
|
||||
#
|
||||
# $Id: SMALL030,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
#
|
||||
|
||||
# architecture type and name of kernel; REQUIRED
|
||||
machine "x68k"
|
||||
ident SMALL
|
||||
|
||||
# different CPU types; you must have at least the correct one; REQUIRED
|
||||
cpu "M68030"
|
||||
#cpu "M68040"
|
||||
|
||||
# time zone RTC is expected to be set in; REQUIRED
|
||||
timezone -9
|
||||
|
||||
# estimated number of users
|
||||
maxusers 8
|
||||
|
||||
# standard options
|
||||
options GENERIC # historical
|
||||
options SWAPPAGER # paging
|
||||
options VNODEPAGER,DEVPAGER # vnode and device node caching
|
||||
options DDB # kernel debugger; recommended
|
||||
options DIAGNOSTIC # internal consistency checking
|
||||
|
||||
#options KTRACE # system call tracing, a la ktrace(1)
|
||||
options FIFO # fifos; recommended
|
||||
#options SYSVSHM # System V shared memory; broken
|
||||
#options SHMMAXPGS=1024
|
||||
#options LKM # loadable kernel modules
|
||||
|
||||
# compatibility options
|
||||
#options COMPAT_NOMID # old zmagic executables
|
||||
#options "COMPAT_09" # older NetBSD binaries
|
||||
options "COMPAT_43" # 4.3 system calls
|
||||
#options "TCP_COMPAT_42" # 4.2 networking ABI
|
||||
#options COMPAT_SUNOS # SunOS binaries
|
||||
#options COMPAT_HPUX # HP-UX binaries
|
||||
|
||||
# file system options
|
||||
#options QUOTA # file system quotas
|
||||
options FFS # Berkeley fast file system
|
||||
options FASTLINKS # fast symbolic links in FFS
|
||||
#options MFS # memory file system; uses RAM and swap
|
||||
#options NFSSERVER # Network File System server
|
||||
#options NFSCLIENT # Network File System client
|
||||
#options "CD9660" # ISO 9660 CD-ROM file system, with RR
|
||||
#options MSDOSFS # MS-DOS FAT file system
|
||||
#options HUMANFS # MS-DOS FAT file system with Human Ext.
|
||||
#options FDESC # /dev/fd
|
||||
#options KERNFS # kernel file system; recommended
|
||||
#options PROCFS # /proc
|
||||
#options LOFS # Loop-back filesystem
|
||||
#options PORTAL # portal filesystem (still experimental)
|
||||
#options ADOSFS # AmigaDOS filesystem
|
||||
#options LFS # Log-based filesystem (still experimental)
|
||||
#options UMAPFS # uid/gid remapping filesystem
|
||||
#options HAVE_USL_UFS # SVR4 ufs
|
||||
|
||||
# networking options
|
||||
#options GATEWAY # packet forwarding
|
||||
options INET # IP
|
||||
#options NS # XNS
|
||||
#options CCITT # X.25
|
||||
#options ISO # OSI networking
|
||||
#options TPIP # ?
|
||||
#options EON # ?
|
||||
#options MULTICAST # multicast
|
||||
|
||||
# Options specific to this host.
|
||||
options DEBUG
|
||||
#options FPSP # '40 Floating Point Software
|
||||
options ITEKANJI # Kanji display for console
|
||||
#options PANICBUTTON
|
||||
#options BUFPAGES=900
|
||||
#options NKMEMCLUSTERS=256
|
||||
#options PROFTIMER, PRF_INTERVAL=500
|
||||
#options KGDB,"KGDBDEV=15*256+2", KGDBRATE=19200
|
||||
#options PPP_OUTQ_SIZE=4096
|
||||
|
||||
#config netbsd root on sd6a swap on sd6b
|
||||
config netbsd swap generic
|
||||
|
||||
# manufacturer 1 is a pseudo and stands for `builtin'
|
||||
master scsi0 at nexus0
|
||||
master scsi1 at nexus0
|
||||
#master fdc0 at nexus0
|
||||
|
||||
# further builtin devices
|
||||
device zs0 at nexus0
|
||||
#device ser2 at nexus0
|
||||
#device clock at manufacturer 1 product 4
|
||||
#device kbd at manufacturer 1 product 5
|
||||
#device par0 at nexus0
|
||||
#device fd0 at fdc0 slave 0
|
||||
#device fd1 at fdc0 slave 1
|
||||
|
||||
# SCSI disks
|
||||
disk sd0 at scsi0 slave 0
|
||||
disk sd1 at scsi0 slave 1
|
||||
disk sd2 at scsi0 slave 2
|
||||
disk sd3 at scsi0 slave 3
|
||||
disk sd4 at scsi0 slave 4
|
||||
disk sd5 at scsi0 slave 5
|
||||
disk sd6 at scsi0 slave 6
|
||||
disk sd7 at scsi0 slave 7
|
||||
|
||||
# SCSI tapes
|
||||
tape st0 at scsi0 slave 4
|
||||
#tape st1 at scsi0 slave ?
|
||||
|
||||
device grf0 at manufacturer 1 product 7
|
||||
#device grf1 at manufacturer 18260 product 6
|
||||
|
||||
# builtin clock (should all identify as "rtclock")
|
||||
device rtclock0 at nexus0
|
||||
|
||||
# ethernet board
|
||||
#device le0 at manufacturer ? product ?
|
||||
|
||||
device bsdaudio0 at nexus0
|
||||
|
||||
#pseudo-device sl 4 # compressed SLIP
|
||||
#pseudo-device ppp 4 # point-to-point protocol
|
||||
#pseudo-device bpfilter 16 # packet filter
|
||||
pseudo-device ite # internal terminal emulator
|
||||
pseudo-device view 10 # ?
|
||||
pseudo-device pty 16 # pseudo-terminals
|
||||
#pseudo-device mouse # mouse
|
||||
pseudo-device loop # loopback; recommended
|
||||
pseudo-device ether # ethernet
|
||||
#pseudo-device vnd 10 # vn virtual filesystem device
|
|
@ -0,0 +1,127 @@
|
|||
# $NetBSD: files.x68k,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
#
|
||||
# new style config file for x68k architecture
|
||||
#
|
||||
|
||||
# maxpartitions must be first item in files.${ARCH}.newconf
|
||||
maxpartitions 8
|
||||
|
||||
maxusers 2 16 64
|
||||
|
||||
device mainbus {}
|
||||
attach mainbus at root
|
||||
|
||||
device cpu
|
||||
attach cpu at mainbus
|
||||
|
||||
define event {}
|
||||
file arch/x68k/dev/event.c event
|
||||
|
||||
# keyboard
|
||||
pseudo-device kbd: event
|
||||
file arch/x68k/dev/kbd.c kbd
|
||||
|
||||
file arch/x68k/x68k/x68k_init.c
|
||||
file arch/x68k/x68k/autoconf.c
|
||||
file arch/x68k/x68k/clock.c
|
||||
file arch/x68k/x68k/conf.c
|
||||
file arch/x68k/x68k/disksubr.c disk
|
||||
file arch/x68k/x68k/dkbad.c
|
||||
file arch/x68k/x68k/machdep.c
|
||||
file arch/x68k/x68k/mem.c
|
||||
file arch/x68k/x68k/pmap_bootstrap.c
|
||||
file arch/x68k/x68k/pmap.c
|
||||
file arch/x68k/x68k/sys_machdep.c
|
||||
file arch/x68k/x68k/trap.c
|
||||
file arch/x68k/x68k/vm_machdep.c
|
||||
file arch/x68k/x68k/db_memrw.c ddb
|
||||
file arch/m68k/m68k/copy.s
|
||||
file arch/m68k/fpe/fpe_emulate.c fpu_emulate
|
||||
file dev/cons.c
|
||||
file dev/cninit.c ite
|
||||
major {vnd = 14}
|
||||
|
||||
# Emulation modules
|
||||
# 6888x emulator (FPU_EMULATE)
|
||||
include "../../m68k/fpe/files.fpe"
|
||||
|
||||
#
|
||||
# SCSI drivers
|
||||
#
|
||||
include "../../../scsi/files.scsi"
|
||||
major {cd = 6}
|
||||
major {sd = 4}
|
||||
major {st = 5}
|
||||
|
||||
device spc: scsi
|
||||
attach spc at mainbus
|
||||
file arch/x68k/dev/spc.c spc needs-count
|
||||
|
||||
device se: ether, ifnet
|
||||
attach se at scsibus
|
||||
file arch/x68k/dev/if_se.c se needs-flag
|
||||
|
||||
device ed: ether, ifnet
|
||||
attach ed at mainbus
|
||||
file arch/x68k/dev/if_ed.c ed needs-flag
|
||||
|
||||
device fdc { unit = -1 }
|
||||
attach fdc at mainbus
|
||||
|
||||
device fd
|
||||
attach fd at fdc
|
||||
file arch/x68k/dev/fd.c fd needs-flag
|
||||
|
||||
device zs: tty
|
||||
attach zs at mainbus
|
||||
file arch/x68k/dev/zs.c zs needs-count
|
||||
|
||||
device com: tty
|
||||
attach com at mainbus
|
||||
file arch/x68k/dev/com.c com needs-count
|
||||
|
||||
device par
|
||||
attach par at mainbus
|
||||
file arch/x68k/dev/par.c par needs-flag
|
||||
|
||||
file arch/x68k/dev/rtclock.c
|
||||
pseudo-device mouse
|
||||
file arch/x68k/dev/ms.c mouse
|
||||
|
||||
# graphic devices
|
||||
define grfb {}
|
||||
|
||||
device grfbus: grfb
|
||||
attach grfbus at mainbus
|
||||
|
||||
device grf {}
|
||||
attach grf at grfb
|
||||
file arch/x68k/dev/grf.c grf needs-count
|
||||
file arch/x68k/dev/grf_conf.c grf|ite
|
||||
file arch/x68k/dev/grf_machdep.c grf|ite
|
||||
file arch/x68k/dev/grf_tv.c grf|ite
|
||||
file arch/x68k/dev/grf_gv.c grf|ite
|
||||
|
||||
device ite
|
||||
attach ite at grf
|
||||
file arch/x68k/dev/ite.c ite needs-flag
|
||||
file arch/x68k/dev/ite_in.c grf|ite
|
||||
file arch/x68k/dev/kernel_font.c ite
|
||||
file arch/x68k/dev/kbdmap.c ite
|
||||
|
||||
pseudo-device bell
|
||||
file arch/x68k/dev/opmbell.c bell needs-flag
|
||||
file arch/x68k/dev/opm.c bell|fdc
|
||||
|
||||
device adpcm: audio
|
||||
attach adpcm at mainbus
|
||||
file arch/x68k/dev/bsd_audio.c adpcm needs-flag
|
||||
file arch/x68k/dev/adpcm.c adpcm
|
||||
pseudo-device sram
|
||||
file arch/x68k/dev/sram.c sram needs-flag
|
||||
pseudo-device pow
|
||||
file arch/x68k/dev/pow.c pow needs-count
|
||||
file arch/x68k/dev/dma.c fdc|adpcm
|
||||
|
||||
include "../../../compat/sunos/files.sunos"
|
||||
file arch/m68k/m68k/sunos_machdep.c compat_sunos
|
|
@ -0,0 +1,30 @@
|
|||
# $NetBSD: std.x68k,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
#
|
||||
# standard x68k information
|
||||
#
|
||||
|
||||
machine x68k m68k
|
||||
|
||||
options MACHINE_NONCONTIG # Non-contiguous memory support
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
#clock0 at mainbus0 # system clock
|
||||
zs0 at mainbus0 # Zilog serial
|
||||
#par0 at mainbus0 # builtin parallel port
|
||||
#fdc0 at mainbus0 # floppy controller
|
||||
#fd0 at fdc0 unit 0 # builtin floppy drive
|
||||
#fd1 at fdc0 unit 1 # builtin floppy drive
|
||||
spc0 at mainbus0 # SCSI driver
|
||||
scsibus* at spc? # SCSI bus
|
||||
grfbus0 at mainbus0 # bitmapped display's
|
||||
grf0 at grfbus0 # graphics driver
|
||||
ite0 at grf0 # console
|
||||
|
||||
pseudo-device mouse # standard mouse
|
||||
pseudo-device kbd # standard keyboard
|
||||
|
||||
# any disk/tape drives on configured controllers.
|
||||
sd* at scsibus? target ? lun ?
|
||||
st* at scsibus? target ? lun 0
|
||||
cd* at scsibus? target ? lun ?
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1993 Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* $Id: adpcm.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*/
|
||||
|
||||
#include "bsdaudio.h"
|
||||
#if NBSDAUDIO > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <x68k/dev/bsd_audiovar.h>
|
||||
#include <x68k/dev/bsd_audioreg.h>
|
||||
#include <x68k/dev/opmreg.h>
|
||||
#include <machine/bsd_audioio.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
|
||||
#define RATE_15K 15625
|
||||
#define RATE_10K 10417
|
||||
#define RATE_7K 7813
|
||||
#define RATE_5K 5208
|
||||
#define RATE_3K 3906
|
||||
|
||||
struct adpcm_l2r {
|
||||
u_int low;
|
||||
u_int rate;
|
||||
u_char clk;
|
||||
u_char den;
|
||||
} l2r[5] = {
|
||||
{ 13021, RATE_15K, ADPCM_CLOCK_8MHZ, ADPCM_RATE_512},
|
||||
{ 9115, RATE_10K, ADPCM_CLOCK_8MHZ, ADPCM_RATE_768},
|
||||
{ 6510, RATE_7K, ADPCM_CLOCK_8MHZ, ADPCM_RATE_1024},
|
||||
{ 4557, RATE_5K, ADPCM_CLOCK_4MHZ, ADPCM_RATE_768},
|
||||
{ 0, RATE_3K, ADPCM_CLOCK_4MHZ, ADPCM_RATE_1024}
|
||||
};
|
||||
|
||||
u_int
|
||||
adpcm_round_sr(rate)
|
||||
u_int rate;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (rate >= l2r[i].low)
|
||||
return (l2r[i].rate);
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
void
|
||||
adpcm_set_sr(rate)
|
||||
u_int rate;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (rate >= l2r[i].low) {
|
||||
PPI.portc = (PPI.portc & 0xf0) | l2r[i].den;
|
||||
adpcm_chgclk(l2r[i].clk);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)bsd_audioreg.h 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: bsd_audioreg.h,v 1.3 92/06/07 21:12:50 mccanne Exp (LBL)
|
||||
* $Id: bsd_audioreg.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Bit encodings for chip commands from "Microprocessor Access Guide for
|
||||
* Indirect Registers", p.19 Am79C30A/32A Advanced Micro Devices spec
|
||||
* sheet (preliminary).
|
||||
*
|
||||
* Indirect register numbers (the value written into cr to select a given
|
||||
* chip registers) have the form AMDR_*. Register fields look like AMD_*.
|
||||
*/
|
||||
|
||||
#define ADPCM_CMD_STOP 0x01
|
||||
#define ADPCM_CMD_PLAY 0x02
|
||||
#define ADPCM_CMD_REC 0x04
|
||||
|
||||
#define ADPCM_CLOCK_4MHZ 0x80
|
||||
#define ADPCM_CLOCK_8MHZ 0x00
|
||||
|
||||
#define ADPCM_RATE_512 0x08
|
||||
#define ADPCM_RATE_768 0x04
|
||||
#define ADPCM_RATE_1024 0x00
|
||||
|
||||
#define ADPCM_PAN_LEFT_OFF 0x01
|
||||
#define ADPCM_PAN_RIGHT_OFF 0x02
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1993 Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* From: Header: audiovar.h,v 1.3 93/07/18 14:07:25 mccanne Exp (LBL)
|
||||
* $Id: bsd_audiovar.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*/
|
||||
|
||||
#define DEFBLKSIZE 1024
|
||||
|
||||
struct adpcm_softc {
|
||||
short sc_amp;
|
||||
signed char sc_estim;
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,124 @@
|
|||
/* $NetBSD: comreg.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)comreg.h 7.2 (Berkeley) 5/9/91
|
||||
*/
|
||||
|
||||
#include <dev/ic/ns16550reg.h>
|
||||
|
||||
#if 0
|
||||
#define COM_FREQ 1843200 /* 16-bit baud rate divisor */
|
||||
#else
|
||||
#define COM_FREQ (22118400/2) /* 16-bit baud rate divisor */
|
||||
#endif
|
||||
#define COM_TOLERANCE 30 /* baud rate tolerance, in 0.1% units */
|
||||
|
||||
/* interrupt enable register */
|
||||
#define IER_ERXRDY 0x1 /* Enable receiver interrupt */
|
||||
#define IER_ETXRDY 0x2 /* Enable transmitter empty interrupt */
|
||||
#define IER_ERLS 0x4 /* Enable line status interrupt */
|
||||
#define IER_EMSC 0x8 /* Enable modem status interrupt */
|
||||
|
||||
/* interrupt identification register */
|
||||
#define IIR_IMASK 0xf
|
||||
#define IIR_RXTOUT 0xc
|
||||
#define IIR_RLS 0x6 /* Line status change */
|
||||
#define IIR_RXRDY 0x4 /* Receiver ready */
|
||||
#define IIR_TXRDY 0x2 /* Transmitter ready */
|
||||
#define IIR_MLSC 0x0 /* Modem status */
|
||||
#define IIR_NOPEND 0x1 /* No pending interrupts */
|
||||
#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
|
||||
|
||||
/* fifo control register */
|
||||
#define FIFO_ENABLE 0x01 /* Turn the FIFO on */
|
||||
#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */
|
||||
#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */
|
||||
#define FIFO_DMA_MODE 0x08
|
||||
#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */
|
||||
#define FIFO_TRIGGER_4 0x40 /* ibid 4 */
|
||||
#define FIFO_TRIGGER_8 0x80 /* ibid 8 */
|
||||
#define FIFO_TRIGGER_14 0xc0 /* ibid 14 */
|
||||
|
||||
/* line control register */
|
||||
#define LCR_DLAB 0x80 /* Divisor latch access enable */
|
||||
#define LCR_SBREAK 0x40 /* Break Control */
|
||||
#define LCR_PZERO 0x38 /* Space parity */
|
||||
#define LCR_PONE 0x28 /* Mark parity */
|
||||
#define LCR_PEVEN 0x18 /* Even parity */
|
||||
#define LCR_PODD 0x08 /* Odd parity */
|
||||
#define LCR_PNONE 0x00 /* No parity */
|
||||
#define LCR_PENAB 0x08 /* XXX - low order bit of all parity */
|
||||
#define LCR_STOPB 0x04 /* 2 stop bits per serial word */
|
||||
#define LCR_8BITS 0x03 /* 8 bits per serial word */
|
||||
#define LCR_7BITS 0x02 /* 7 bits */
|
||||
#define LCR_6BITS 0x01 /* 6 bits */
|
||||
#define LCR_5BITS 0x00 /* 5 bits */
|
||||
|
||||
/* modem control register */
|
||||
#define MCR_LOOPBACK 0x10 /* Loop test: echos from TX to RX */
|
||||
#define MCR_IENABLE 0x08 /* Out2: enables UART interrupts */
|
||||
#define MCR_DRS 0x04 /* Out1: resets some internal modems */
|
||||
#define MCR_RTS 0x02 /* Request To Send */
|
||||
#define MCR_DTR 0x01 /* Data Terminal Ready */
|
||||
|
||||
/* line status register */
|
||||
#define LSR_RCV_FIFO 0x80
|
||||
#define LSR_TSRE 0x40 /* Transmitter empty: byte sent */
|
||||
#define LSR_TXRDY 0x20 /* Transmitter buffer empty */
|
||||
#define LSR_BI 0x10 /* Break detected */
|
||||
#define LSR_FE 0x08 /* Framing error: bad stop bit */
|
||||
#define LSR_PE 0x04 /* Parity error */
|
||||
#define LSR_OE 0x02 /* Overrun, lost incoming byte */
|
||||
#define LSR_RXRDY 0x01 /* Byte ready in Receive Buffer */
|
||||
#define LSR_RCV_MASK 0x1f /* Mask for incoming data or error */
|
||||
|
||||
/* modem status register */
|
||||
/* All deltas are from the last read of the MSR. */
|
||||
#define MSR_DCD 0x80 /* Current Data Carrier Detect */
|
||||
#define MSR_RI 0x40 /* Current Ring Indicator */
|
||||
#define MSR_DSR 0x20 /* Current Data Set Ready */
|
||||
#define MSR_CTS 0x10 /* Current Clear to Send */
|
||||
#define MSR_DDCD 0x08 /* DCD has changed state */
|
||||
#define MSR_TERI 0x04 /* RI has toggled low to high */
|
||||
#define MSR_DDSR 0x02 /* DSR has changed state */
|
||||
#define MSR_DCTS 0x01 /* CTS has changed state */
|
||||
|
||||
#define COM_NPORTS 8
|
||||
|
||||
/*
|
||||
* WARNING: Serial console is assumed to be at COM1 address
|
||||
* and CONUNIT must be 0.
|
||||
*/
|
||||
#define CONADDR (0x3f8)
|
||||
#define CONUNIT (0)
|
|
@ -0,0 +1,214 @@
|
|||
/* $NetBSD: dma.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994 Charles Hannum.
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Don Ahn.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/uio.h>
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
#include <x68k/dev/dmavar.h>
|
||||
|
||||
#define NDMA 4
|
||||
|
||||
/* region of physical memory known to be contiguous */
|
||||
caddr_t dma_dataaddr[NDMA];
|
||||
caddr_t dma_bouncebuf[NDMA];
|
||||
vm_size_t dma_bouncebytes[NDMA];
|
||||
char dma_bounced[NDMA];
|
||||
|
||||
/*
|
||||
* Check for problems with the address range of a DMA transfer
|
||||
* (non-contiguous physical pages, outside of bus address space,
|
||||
* crossing DMA page boundaries).
|
||||
* Return true if special handling needed.
|
||||
*/
|
||||
int
|
||||
dmarangecheck(va, length)
|
||||
vm_offset_t va;
|
||||
u_long length;
|
||||
{
|
||||
vm_offset_t phys, priorpage = 0, endva;
|
||||
u_int dma_pgmsk = ~PGOFSET;
|
||||
|
||||
endva = round_page(va + length);
|
||||
for (; va < endva ; va += NBPG) {
|
||||
phys = trunc_page(pmap_extract(pmap_kernel(), va));
|
||||
if (phys == 0)
|
||||
panic("dmacheck: no physical page present");
|
||||
if (phys >= (1<<24))
|
||||
return 1; /* XXX */
|
||||
if (priorpage) {
|
||||
if (priorpage + NBPG != phys)
|
||||
return 1;
|
||||
/* check if crossing a DMA page boundary */
|
||||
if ((priorpage ^ phys) & dma_pgmsk)
|
||||
return 1;
|
||||
}
|
||||
priorpage = phys;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* program HD63450 DMAC channel.
|
||||
*/
|
||||
void
|
||||
x68k_dmastart(flag, addr, nbytes, chan)
|
||||
int flag;
|
||||
caddr_t addr;
|
||||
int nbytes;
|
||||
int chan;
|
||||
{
|
||||
volatile struct dmac *dmac = &IODEVbase->io_dma[chan];
|
||||
|
||||
if (dmarangecheck((vm_offset_t)addr, nbytes)) {
|
||||
dma_bouncebytes[chan] = nbytes;
|
||||
dma_dataaddr[chan] = addr;
|
||||
if (!(flag)) {
|
||||
bcopy(addr, dma_bouncebuf[chan], nbytes);
|
||||
dma_bounced[chan] = DMA_BWR;
|
||||
} else {
|
||||
dma_bounced[chan] = DMA_BRD;
|
||||
}
|
||||
addr = dma_bouncebuf[chan];
|
||||
} else {
|
||||
dma_bounced[chan] = 0;
|
||||
}
|
||||
dmac->csr = 0xff;
|
||||
dmac->ocr = flag ? 0xb2 : 0x32;
|
||||
dmac->mtc = (unsigned short)nbytes;
|
||||
asm("nop");
|
||||
asm("nop");
|
||||
dmac->mar = (unsigned long)kvtop(addr);
|
||||
#if defined(M68040)
|
||||
/*
|
||||
* Push back dirty cache lines
|
||||
*/
|
||||
if (mmutype == MMU_68040)
|
||||
DCFP(kvtop(addr));
|
||||
#endif
|
||||
dmac->ccr = 0x88;
|
||||
}
|
||||
#if 0
|
||||
void
|
||||
isa_dmadone(flags, addr, nbytes, chan)
|
||||
int flags;
|
||||
caddr_t addr;
|
||||
vm_size_t nbytes;
|
||||
int chan;
|
||||
{
|
||||
u_char tc;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan < 0 || chan > 7)
|
||||
panic("isa_dmadone: impossible request");
|
||||
#endif
|
||||
|
||||
/* check that the terminal count was reached */
|
||||
if ((chan & 4) == 0)
|
||||
tc = inb(DMA1_SR) & (1 << chan);
|
||||
else
|
||||
tc = inb(DMA2_SR) & (1 << (chan & 3));
|
||||
if (tc == 0)
|
||||
/* XXX probably should panic or something */
|
||||
log(LOG_ERR, "dma channel %d not finished\n", chan);
|
||||
|
||||
/* copy bounce buffer on read */
|
||||
if (dma_bounced[chan]) {
|
||||
bcopy(dma_bounce[chan], addr, nbytes);
|
||||
dma_bounced[chan] = 0;
|
||||
}
|
||||
|
||||
/* mask channel */
|
||||
if ((chan & 4) == 0)
|
||||
outb(DMA1_SMSK, DMA37SM_SET | chan);
|
||||
else
|
||||
outb(DMA2_SMSK, DMA37SM_SET | (chan & 3));
|
||||
}
|
||||
|
||||
/* head of queue waiting for physmem to become available */
|
||||
struct buf isa_physmemq;
|
||||
|
||||
/* blocked waiting for resource to become free for exclusive use */
|
||||
static isaphysmemflag;
|
||||
/* if waited for and call requested when free (B_CALL) */
|
||||
static void (*isaphysmemunblock)(); /* needs to be a list */
|
||||
|
||||
/*
|
||||
* Allocate contiguous physical memory for transfer, returning
|
||||
* a *virtual* address to region. May block waiting for resource.
|
||||
* (assumed to be called at splbio())
|
||||
*/
|
||||
caddr_t
|
||||
isa_allocphysmem(caddr_t va, unsigned length, void (*func)()) {
|
||||
|
||||
isaphysmemunblock = func;
|
||||
while (isaphysmemflag & B_BUSY) {
|
||||
isaphysmemflag |= B_WANTED;
|
||||
sleep((caddr_t)&isaphysmemflag, PRIBIO);
|
||||
}
|
||||
isaphysmemflag |= B_BUSY;
|
||||
|
||||
return((caddr_t)isaphysmem);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free contiguous physical memory used for transfer.
|
||||
* (assumed to be called at splbio())
|
||||
*/
|
||||
void
|
||||
isa_freephysmem(caddr_t va, unsigned length) {
|
||||
|
||||
isaphysmemflag &= ~B_BUSY;
|
||||
if (isaphysmemflag & B_WANTED) {
|
||||
isaphysmemflag &= B_WANTED;
|
||||
wakeup((caddr_t)&isaphysmemflag);
|
||||
if (isaphysmemunblock)
|
||||
(*isaphysmemunblock)();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,46 @@
|
|||
/* $NetBSD: dmavar.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Masanobu Saitoh. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Don Ahn.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#define DMA_BRD 0x01
|
||||
#define DMA_BWR 0x02
|
||||
|
||||
int dmarangecheck __P((vm_offset_t, u_long));
|
||||
|
||||
extern caddr_t dma_dataaddr[4]; /* XXX */
|
||||
extern caddr_t dma_bouncebuf[4]; /* XXX */
|
||||
extern vm_size_t dma_bouncebytes[4]; /* XXX */
|
||||
extern char dma_bounced[4]; /* XXX */
|
|
@ -0,0 +1,546 @@
|
|||
/* $NetBSD: dp8390reg.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* National Semiconductor DS8390 NIC register definitions.
|
||||
*
|
||||
* Copyright (C) 1993, David Greenman. This software may be used, modified,
|
||||
* copied, distributed, and sold, in both source and binary form provided that
|
||||
* the above copyright and these terms are retained. Under no circumstances is
|
||||
* the author responsible for the proper functioning of this software, nor does
|
||||
* the author assume any responsibility for damages incurred with its use.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Page 0 register offsets
|
||||
*/
|
||||
#define ED_P0_CR 0x00 /* Command Register */
|
||||
|
||||
#define ED_P0_CLDA0 0x02 /* Current Local DMA Addr low (read) */
|
||||
#define ED_P0_PSTART 0x02 /* Page Start register (write) */
|
||||
|
||||
#define ED_P0_CLDA1 0x04 /* Current Local DMA Addr high (read) */
|
||||
#define ED_P0_PSTOP 0x04 /* Page Stop register (write) */
|
||||
|
||||
#define ED_P0_BNRY 0x06 /* Boundary Pointer */
|
||||
|
||||
#define ED_P0_TSR 0x08 /* Transmit Status Register (read) */
|
||||
#define ED_P0_TPSR 0x08 /* Transmit Page Start (write) */
|
||||
|
||||
#define ED_P0_NCR 0x0a /* Number of Collisions Reg (read) */
|
||||
#define ED_P0_TBCR0 0x0a /* Transmit Byte count, low (write) */
|
||||
|
||||
#define ED_P0_FIFO 0x0c /* FIFO register (read) */
|
||||
#define ED_P0_TBCR1 0x0c /* Transmit Byte count, high (write) */
|
||||
|
||||
#define ED_P0_ISR 0x0e /* Interrupt Status Register */
|
||||
|
||||
#define ED_P0_CRDA0 0x10 /* Current Remote DMA Addr low (read) */
|
||||
#define ED_P0_RSAR0 0x10 /* Remote Start Address low (write) */
|
||||
|
||||
#define ED_P0_CRDA1 0x12 /* Current Remote DMA Addr high (read) */
|
||||
#define ED_P0_RSAR1 0x12 /* Remote Start Address high (write) */
|
||||
|
||||
#define ED_P0_RBCR0 0x14 /* Remote Byte Count low (write) */
|
||||
|
||||
#define ED_P0_RBCR1 0x16 /* Remote Byte Count high (write) */
|
||||
|
||||
#define ED_P0_RSR 0x18 /* Receive Status (read) */
|
||||
#define ED_P0_RCR 0x18 /* Receive Configuration Reg (write) */
|
||||
|
||||
#define ED_P0_CNTR0 0x1a /* frame alignment error counter (read) */
|
||||
#define ED_P0_TCR 0x1a /* Transmit Configuration Reg (write) */
|
||||
|
||||
#define ED_P0_CNTR1 0x1c /* CRC error counter (read) */
|
||||
#define ED_P0_DCR 0x1c /* Data Configuration Reg (write) */
|
||||
|
||||
#define ED_P0_CNTR2 0x1e /* missed packet counter (read) */
|
||||
#define ED_P0_IMR 0x1e /* Interrupt Mask Register (write) */
|
||||
|
||||
/*
|
||||
* Page 1 register offsets
|
||||
*/
|
||||
#define ED_P1_CR 0x00 /* Command Register */
|
||||
#define ED_P1_PAR0 0x02 /* Physical Address Register 0 */
|
||||
#define ED_P1_PAR1 0x04 /* Physical Address Register 1 */
|
||||
#define ED_P1_PAR2 0x06 /* Physical Address Register 2 */
|
||||
#define ED_P1_PAR3 0x08 /* Physical Address Register 3 */
|
||||
#define ED_P1_PAR4 0x0a /* Physical Address Register 4 */
|
||||
#define ED_P1_PAR5 0x0c /* Physical Address Register 5 */
|
||||
#define ED_P1_CURR 0x0e /* Current RX ring-buffer page */
|
||||
#define ED_P1_MAR0 0x10 /* Multicast Address Register 0 */
|
||||
#define ED_P1_MAR1 0x12 /* Multicast Address Register 1 */
|
||||
#define ED_P1_MAR2 0x14 /* Multicast Address Register 2 */
|
||||
#define ED_P1_MAR3 0x16 /* Multicast Address Register 3 */
|
||||
#define ED_P1_MAR4 0x18 /* Multicast Address Register 4 */
|
||||
#define ED_P1_MAR5 0x1a /* Multicast Address Register 5 */
|
||||
#define ED_P1_MAR6 0x1c /* Multicast Address Register 6 */
|
||||
#define ED_P1_MAR7 0x1e /* Multicast Address Register 7 */
|
||||
|
||||
/*
|
||||
* Page 2 register offsets
|
||||
*/
|
||||
#define ED_P2_CR 0x00 /* Command Register */
|
||||
#define ED_P2_PSTART 0x02 /* Page Start (read) */
|
||||
#define ED_P2_CLDA0 0x02 /* Current Local DMA Addr 0 (write) */
|
||||
#define ED_P2_PSTOP 0x04 /* Page Stop (read) */
|
||||
#define ED_P2_CLDA1 0x04 /* Current Local DMA Addr 1 (write) */
|
||||
#define ED_P2_RNPP 0x06 /* Remote Next Packet Pointer */
|
||||
#define ED_P2_TPSR 0x08 /* Transmit Page Start (read) */
|
||||
#define ED_P2_LNPP 0x0a /* Local Next Packet Pointer */
|
||||
#define ED_P2_ACU 0x0c /* Address Counter Upper */
|
||||
#define ED_P2_ACL 0x0e /* Address Counter Lower */
|
||||
#define ED_P2_RCR 0x18 /* Receive Configuration Register (read) */
|
||||
#define ED_P2_TCR 0x1a /* Transmit Configuration Register (read) */
|
||||
#define ED_P2_DCR 0x1c /* Data Configuration Register (read) */
|
||||
#define ED_P2_IMR 0x1e /* Interrupt Mask Register (read) */
|
||||
|
||||
/*
|
||||
* Command Register (CR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* STP: SToP. Software reset command. Takes the controller offline. No
|
||||
* packets will be received or transmitted. Any reception or transmission in
|
||||
* progress will continue to completion before entering reset state. To exit
|
||||
* this state, the STP bit must reset and the STA bit must be set. The
|
||||
* software reset has executed only when indicated by the RST bit in the ISR
|
||||
* being set.
|
||||
*/
|
||||
#define ED_CR_STP 0x01
|
||||
|
||||
/*
|
||||
* STA: STArt. This bit is used to activate the NIC after either power-up, or
|
||||
* when the NIC has been put in reset mode by software command or error.
|
||||
*/
|
||||
#define ED_CR_STA 0x02
|
||||
|
||||
/*
|
||||
* TXP: Transmit Packet. This bit must be set to indicate transmission of a
|
||||
* packet. TXP is internally reset either after the transmission is completed
|
||||
* or aborted. This bit should be set only after the Transmit Byte Count and
|
||||
* Transmit Page Start register have been programmed.
|
||||
*/
|
||||
#define ED_CR_TXP 0x04
|
||||
|
||||
/*
|
||||
* RD0, RD1, RD2: Remote DMA Command. These three bits control the operation
|
||||
* of the remote DMA channel. RD2 can be set to abort any remote DMA command
|
||||
* in progress. The Remote Byte Count registers should be cleared when a
|
||||
* remote DMA has been aborted. The Remote Start Addresses are not restored
|
||||
* to the starting address if the remote DMA is aborted.
|
||||
*
|
||||
* RD2 RD1 RD0 function
|
||||
* 0 0 0 not allowed
|
||||
* 0 0 1 remote read
|
||||
* 0 1 0 remote write
|
||||
* 0 1 1 send packet
|
||||
* 1 X X abort
|
||||
*/
|
||||
#define ED_CR_RD0 0x08
|
||||
#define ED_CR_RD1 0x10
|
||||
#define ED_CR_RD2 0x20
|
||||
|
||||
/*
|
||||
* PS0, PS1: Page Select. The two bits select which register set or 'page' to
|
||||
* access.
|
||||
*
|
||||
* PS1 PS0 page
|
||||
* 0 0 0
|
||||
* 0 1 1
|
||||
* 1 0 2
|
||||
* 1 1 reserved
|
||||
*/
|
||||
#define ED_CR_PS0 0x40
|
||||
#define ED_CR_PS1 0x80
|
||||
/* bit encoded aliases */
|
||||
#define ED_CR_PAGE_0 0x00 /* (for consistency) */
|
||||
#define ED_CR_PAGE_1 0x40
|
||||
#define ED_CR_PAGE_2 0x80
|
||||
|
||||
/*
|
||||
* Interrupt Status Register (ISR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* PRX: Packet Received. Indicates packet received with no errors.
|
||||
*/
|
||||
#define ED_ISR_PRX 0x01
|
||||
|
||||
/*
|
||||
* PTX: Packet Transmitted. Indicates packet transmitted with no errors.
|
||||
*/
|
||||
#define ED_ISR_PTX 0x02
|
||||
|
||||
/*
|
||||
* RXE: Receive Error. Indicates that a packet was received with one or more
|
||||
* the following errors: CRC error, frame alignment error, FIFO overrun,
|
||||
* missed packet.
|
||||
*/
|
||||
#define ED_ISR_RXE 0x04
|
||||
|
||||
/*
|
||||
* TXE: Transmission Error. Indicates that an attempt to transmit a packet
|
||||
* resulted in one or more of the following errors: excessive collisions, FIFO
|
||||
* underrun.
|
||||
*/
|
||||
#define ED_ISR_TXE 0x08
|
||||
|
||||
/*
|
||||
* OVW: OverWrite. Indicates a receive ring-buffer overrun. Incoming network
|
||||
* would exceed (has exceeded?) the boundary pointer, resulting in data that
|
||||
* was previously received and not yet read from the buffer to be overwritten.
|
||||
*/
|
||||
#define ED_ISR_OVW 0x10
|
||||
|
||||
/*
|
||||
* CNT: Counter Overflow. Set when the MSB of one or more of the Network Tally
|
||||
* Counters has been set.
|
||||
*/
|
||||
#define ED_ISR_CNT 0x20
|
||||
|
||||
/*
|
||||
* RDC: Remote Data Complete. Indicates that a Remote DMA operation has
|
||||
* completed.
|
||||
*/
|
||||
#define ED_ISR_RDC 0x40
|
||||
|
||||
/*
|
||||
* RST: Reset status. Set when the NIC enters the reset state and cleared when
|
||||
* a Start Command is issued to the CR. This bit is also set when a receive
|
||||
* ring-buffer overrun (OverWrite) occurs and is cleared when one or more
|
||||
* packets have been removed from the ring. This is a read-only bit.
|
||||
*/
|
||||
#define ED_ISR_RST 0x80
|
||||
|
||||
/*
|
||||
* Interrupt Mask Register (IMR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* PRXE: Packet Received interrupt Enable. If set, a received packet will
|
||||
* cause an interrupt.
|
||||
*/
|
||||
#define ED_IMR_PRXE 0x01
|
||||
|
||||
/*
|
||||
* PTXE: Packet Transmit interrupt Enable. If set, an interrupt is generated
|
||||
* when a packet transmission completes.
|
||||
*/
|
||||
#define ED_IMR_PTXE 0x02
|
||||
|
||||
/*
|
||||
* RXEE: Receive Error interrupt Enable. If set, an interrupt will occur
|
||||
* whenever a packet is received with an error.
|
||||
*/
|
||||
#define ED_IMR_RXEE 0x04
|
||||
|
||||
/*
|
||||
* TXEE: Transmit Error interrupt Enable. If set, an interrupt will occur
|
||||
* whenever a transmission results in an error.
|
||||
*/
|
||||
#define ED_IMR_TXEE 0x08
|
||||
|
||||
/*
|
||||
* OVWE: OverWrite error interrupt Enable. If set, an interrupt is generated
|
||||
* whenever the receive ring-buffer is overrun. i.e. when the boundary pointer
|
||||
* is exceeded.
|
||||
*/
|
||||
#define ED_IMR_OVWE 0x10
|
||||
|
||||
/*
|
||||
* CNTE: Counter overflow interrupt Enable. If set, an interrupt is generated
|
||||
* whenever the MSB of one or more of the Network Statistics counters has been
|
||||
* set.
|
||||
*/
|
||||
#define ED_IMR_CNTE 0x20
|
||||
|
||||
/*
|
||||
* RDCE: Remote DMA Complete interrupt Enable. If set, an interrupt is
|
||||
* generated when a remote DMA transfer has completed.
|
||||
*/
|
||||
#define ED_IMR_RDCE 0x40
|
||||
|
||||
/*
|
||||
* Bit 7 is unused/reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Data Configuration Register (DCR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* WTS: Word Transfer Select. WTS establishes byte or word transfers for both
|
||||
* remote and local DMA transfers
|
||||
*/
|
||||
#define ED_DCR_WTS 0x01
|
||||
|
||||
/*
|
||||
* BOS: Byte Order Select. BOS sets the byte order for the host. Should be 0
|
||||
* for 80x86, and 1 for 68000 series processors
|
||||
*/
|
||||
#define ED_DCR_BOS 0x02
|
||||
|
||||
/*
|
||||
* LAS: Long Address Select. When LAS is 1, the contents of the remote DMA
|
||||
* registers RSAR0 and RSAR1 are used to provide A16-A31.
|
||||
*/
|
||||
#define ED_DCR_LAS 0x04
|
||||
|
||||
/*
|
||||
* LS: Loopback Select. When 0, loopback mode is selected. Bits D1 and D2 of
|
||||
* the TCR must also be programmed for loopback operation. When 1, normal
|
||||
* operation is selected.
|
||||
*/
|
||||
#define ED_DCR_LS 0x08
|
||||
|
||||
/*
|
||||
* AR: Auto-initialize Remote. When 0, data must be removed from ring-buffer
|
||||
* under program control. When 1, remote DMA is automatically initiated and
|
||||
* the boundary pointer is automatically updated.
|
||||
*/
|
||||
#define ED_DCR_AR 0x10
|
||||
|
||||
/*
|
||||
* FT0, FT1: Fifo Threshold select.
|
||||
*
|
||||
* FT1 FT0 Word-width Byte-width
|
||||
* 0 0 1 word 2 bytes
|
||||
* 0 1 2 words 4 bytes
|
||||
* 1 0 4 words 8 bytes
|
||||
* 1 1 8 words 12 bytes
|
||||
*
|
||||
* During transmission, the FIFO threshold indicates the number of bytes or
|
||||
* words that the FIFO has filled from the local DMA before BREQ is asserted.
|
||||
* The transmission threshold is 16 bytes minus the receiver threshold.
|
||||
*/
|
||||
#define ED_DCR_FT0 0x20
|
||||
#define ED_DCR_FT1 0x40
|
||||
|
||||
/*
|
||||
* bit 7 (0x80) is unused/reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Transmit Configuration Register (TCR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* CRC: Inhibit CRC. If 0, CRC will be appended by the transmitter, if 0, CRC
|
||||
* is not appended by the transmitter.
|
||||
*/
|
||||
#define ED_TCR_CRC 0x01
|
||||
|
||||
/*
|
||||
* LB0, LB1: Loopback control. These two bits set the type of loopback that is
|
||||
* to be performed.
|
||||
*
|
||||
* LB1 LB0 mode
|
||||
* 0 0 0 - normal operation (DCR_LS = 0)
|
||||
* 0 1 1 - internal loopback (DCR_LS = 0)
|
||||
* 1 0 2 - external loopback (DCR_LS = 1)
|
||||
* 1 1 3 - external loopback (DCR_LS = 0)
|
||||
*/
|
||||
#define ED_TCR_LB0 0x02
|
||||
#define ED_TCR_LB1 0x04
|
||||
|
||||
/*
|
||||
* ATD: Auto Transmit Disable. Clear for normal operation. When set, allows
|
||||
* another station to disable the NIC's transmitter by transmitting to a
|
||||
* multicast address hashing to bit 62. Reception of a multicast address
|
||||
* hashing to bit 63 enables the transmitter.
|
||||
*/
|
||||
#define ED_TCR_ATD 0x08
|
||||
|
||||
/*
|
||||
* OFST: Collision Offset enable. This bit when set modifies the backoff
|
||||
* algorithm to allow prioritization of nodes.
|
||||
*/
|
||||
#define ED_TCR_OFST 0x10
|
||||
|
||||
/*
|
||||
* bits 5, 6, and 7 are unused/reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Transmit Status Register (TSR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* PTX: Packet Transmitted. Indicates successful transmission of packet.
|
||||
*/
|
||||
#define ED_TSR_PTX 0x01
|
||||
|
||||
/*
|
||||
* bit 1 (0x02) is unused/reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* COL: Transmit Collided. Indicates that the transmission collided at least
|
||||
* once with another station on the network.
|
||||
*/
|
||||
#define ED_TSR_COL 0x04
|
||||
|
||||
/*
|
||||
* ABT: Transmit aborted. Indicates that the transmission was aborted due to
|
||||
* excessive collisions.
|
||||
*/
|
||||
#define ED_TSR_ABT 0x08
|
||||
|
||||
/*
|
||||
* CRS: Carrier Sense Lost. Indicates that carrier was lost during the
|
||||
* transmission of the packet. (Transmission is not aborted because of a loss
|
||||
* of carrier).
|
||||
*/
|
||||
#define ED_TSR_CRS 0x10
|
||||
|
||||
/*
|
||||
* FU: FIFO Underrun. Indicates that the NIC wasn't able to access bus/
|
||||
* transmission memory before the FIFO emptied. Transmission of the packet was
|
||||
* aborted.
|
||||
*/
|
||||
#define ED_TSR_FU 0x20
|
||||
|
||||
/*
|
||||
* CDH: CD Heartbeat. Indicates that the collision detection circuitry isn't
|
||||
* working correctly during a collision heartbeat test.
|
||||
*/
|
||||
#define ED_TSR_CDH 0x40
|
||||
|
||||
/*
|
||||
* OWC: Out of Window Collision: Indicates that a collision occurred after a
|
||||
* slot time (51.2us). The transmission is rescheduled just as in normal
|
||||
* collisions.
|
||||
*/
|
||||
#define ED_TSR_OWC 0x80
|
||||
|
||||
/*
|
||||
* Receiver Configuration Register (RCR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* SEP: Save Errored Packets. If 0, error packets are discarded. If set to 1,
|
||||
* packets with CRC and frame errors are not discarded.
|
||||
*/
|
||||
#define ED_RCR_SEP 0x01
|
||||
|
||||
/*
|
||||
* AR: Accept Runt packet. If 0, packet with less than 64 byte are discarded.
|
||||
* If set to 1, packets with less than 64 byte are not discarded.
|
||||
*/
|
||||
#define ED_RCR_AR 0x02
|
||||
|
||||
/*
|
||||
* AB: Accept Broadcast. If set, packets sent to the broadcast address will be
|
||||
* accepted.
|
||||
*/
|
||||
#define ED_RCR_AB 0x04
|
||||
|
||||
/*
|
||||
* AM: Accept Multicast. If set, packets sent to a multicast address are
|
||||
* checked for a match in the hashing array. If clear, multicast packets are
|
||||
* ignored.
|
||||
*/
|
||||
#define ED_RCR_AM 0x08
|
||||
|
||||
/*
|
||||
* PRO: Promiscuous Physical. If set, all packets with a physical addresses
|
||||
* are accepted. If clear, a physical destination address must match this
|
||||
* station's address. Note: for full promiscuous mode, RCR_AB and RCR_AM must
|
||||
* also be set. In addition, the multicast hashing array must be set to all
|
||||
* 1's so that all multicast addresses are accepted.
|
||||
*/
|
||||
#define ED_RCR_PRO 0x10
|
||||
|
||||
/*
|
||||
* MON: Monitor Mode. If set, packets will be checked for good CRC and
|
||||
* framing, but are not stored in the ring-buffer. If clear, packets are
|
||||
* stored (normal operation).
|
||||
*/
|
||||
#define ED_RCR_MON 0x20
|
||||
|
||||
/*
|
||||
* Bits 6 and 7 are unused/reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Receiver Status Register (RSR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* PRX: Packet Received without error.
|
||||
*/
|
||||
#define ED_RSR_PRX 0x01
|
||||
|
||||
/*
|
||||
* CRC: CRC error. Indicates that a packet has a CRC error. Also set for
|
||||
* frame alignment errors.
|
||||
*/
|
||||
#define ED_RSR_CRC 0x02
|
||||
|
||||
/*
|
||||
* FAE: Frame Alignment Error. Indicates that the incoming packet did not end
|
||||
* on a byte boundary and the CRC did not match at the last byte boundary.
|
||||
*/
|
||||
#define ED_RSR_FAE 0x04
|
||||
|
||||
/*
|
||||
* FO: FIFO Overrun. Indicates that the FIFO was not serviced (during local
|
||||
* DMA) causing it to overrun. Reception of the packet is aborted.
|
||||
*/
|
||||
#define ED_RSR_FO 0x08
|
||||
|
||||
/*
|
||||
* MPA: Missed Packet. Indicates that the received packet couldn't be stored
|
||||
* in the ring-buffer because of insufficient buffer space (exceeding the
|
||||
* boundary pointer), or because the transfer to the ring-buffer was inhibited
|
||||
* by RCR_MON - monitor mode.
|
||||
*/
|
||||
#define ED_RSR_MPA 0x10
|
||||
|
||||
/*
|
||||
* PHY: Physical address. If 0, the packet received was sent to a physical
|
||||
* address. If 1, the packet was accepted because of a multicast/broadcast
|
||||
* address match.
|
||||
*/
|
||||
#define ED_RSR_PHY 0x20
|
||||
|
||||
/*
|
||||
* DIS: Receiver Disabled. Set to indicate that the receiver has enetered
|
||||
* monitor mode. Cleared when the receiver exits monitor mode.
|
||||
*/
|
||||
#define ED_RSR_DIS 0x40
|
||||
|
||||
/*
|
||||
* DFR: Deferring. Set to indicate a 'jabber' condition. The CRS and COL
|
||||
* inputs are active, and the transceiver has set the CD line as a result of
|
||||
* the jabber.
|
||||
*/
|
||||
#define ED_RSR_DFR 0x80
|
||||
|
||||
/*
|
||||
* receive ring discriptor
|
||||
*
|
||||
* The National Semiconductor DS8390 Network interface controller uses the
|
||||
* following receive ring headers. The way this works is that the memory on
|
||||
* the interface card is chopped up into 256 bytes blocks. A contiguous
|
||||
* portion of those blocks are marked for receive packets by setting start and
|
||||
* end block #'s in the NIC. For each packet that is put into the receive
|
||||
* ring, one of these headers (4 bytes each) is tacked onto the front. The
|
||||
* first byte is a copy of the receiver status register at the time the packet
|
||||
* was received.
|
||||
*/
|
||||
struct ed_ring {
|
||||
u_char rsr; /* receiver status */
|
||||
u_char next_packet; /* pointer to next packet */
|
||||
u_char count_l; /* bytes in packet (length + 4) */
|
||||
u_char count_h;
|
||||
};
|
||||
|
||||
/*
|
||||
* Common constants
|
||||
*/
|
||||
#define ED_PAGE_SIZE 256 /* Size of RAM pages in bytes */
|
||||
#define ED_PAGE_MASK 255
|
||||
#define ED_PAGE_SHIFT 8
|
||||
|
||||
#define ED_TXBUF_SIZE 6 /* Size of TX buffer in pages */
|
|
@ -0,0 +1,171 @@
|
|||
/* $NetBSD: event.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)event.c 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Internal `Firm_event' interface for the keyboard and mouse drivers.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <machine/vuid_event.h>
|
||||
#include <x68k/dev/event_var.h>
|
||||
|
||||
/*
|
||||
* Initialize a firm_event queue.
|
||||
*/
|
||||
void
|
||||
ev_init(ev)
|
||||
register struct evvar *ev;
|
||||
{
|
||||
|
||||
ev->ev_get = ev->ev_put = 0;
|
||||
ev->ev_q = malloc((u_long)EV_QSIZE * sizeof(struct firm_event),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
bzero((caddr_t)ev->ev_q, EV_QSIZE * sizeof(struct firm_event));
|
||||
}
|
||||
|
||||
/*
|
||||
* Tear down a firm_event queue.
|
||||
*/
|
||||
void
|
||||
ev_fini(ev)
|
||||
register struct evvar *ev;
|
||||
{
|
||||
|
||||
free(ev->ev_q, M_DEVBUF);
|
||||
}
|
||||
|
||||
/*
|
||||
* User-level interface: read, select.
|
||||
* (User cannot write an event queue.)
|
||||
*/
|
||||
int
|
||||
ev_read(ev, uio, flags)
|
||||
register struct evvar *ev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
{
|
||||
int s, n, cnt, error;
|
||||
|
||||
/*
|
||||
* Make sure we can return at least 1.
|
||||
*/
|
||||
if (uio->uio_resid < sizeof(struct firm_event))
|
||||
return (EMSGSIZE); /* ??? */
|
||||
s = splev();
|
||||
while (ev->ev_get == ev->ev_put) {
|
||||
if (flags & IO_NDELAY) {
|
||||
splx(s);
|
||||
return (EWOULDBLOCK);
|
||||
}
|
||||
ev->ev_wanted = 1;
|
||||
error = tsleep((caddr_t)ev, PEVENT | PCATCH, "firm_event", 0);
|
||||
if (error) {
|
||||
splx(s);
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Move firm_events from tail end of queue (there is at least one
|
||||
* there).
|
||||
*/
|
||||
if (ev->ev_put < ev->ev_get)
|
||||
cnt = EV_QSIZE - ev->ev_get; /* events in [get..QSIZE) */
|
||||
else
|
||||
cnt = ev->ev_put - ev->ev_get; /* events in [get..put) */
|
||||
splx(s);
|
||||
n = howmany(uio->uio_resid, sizeof(struct firm_event));
|
||||
if (cnt > n)
|
||||
cnt = n;
|
||||
error = uiomove((caddr_t)&ev->ev_q[ev->ev_get],
|
||||
cnt * sizeof(struct firm_event), uio);
|
||||
n -= cnt;
|
||||
/*
|
||||
* If we do not wrap to 0, used up all our space, or had an error,
|
||||
* stop. Otherwise move from front of queue to put index, if there
|
||||
* is anything there to move.
|
||||
*/
|
||||
if ((ev->ev_get = (ev->ev_get + cnt) % EV_QSIZE) != 0 ||
|
||||
n == 0 || error || (cnt = ev->ev_put) == 0)
|
||||
return (error);
|
||||
if (cnt > n)
|
||||
cnt = n;
|
||||
error = uiomove((caddr_t)&ev->ev_q[0],
|
||||
cnt * sizeof(struct firm_event), uio);
|
||||
ev->ev_get = cnt;
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
ev_select(ev, rw, p)
|
||||
register struct evvar *ev;
|
||||
int rw;
|
||||
struct proc *p;
|
||||
{
|
||||
int s = splev();
|
||||
|
||||
switch (rw) {
|
||||
|
||||
case FREAD:
|
||||
/* succeed if there is something to read */
|
||||
if (ev->ev_get != ev->ev_put) {
|
||||
splx(s);
|
||||
return (1);
|
||||
}
|
||||
selrecord(p, &ev->ev_sel);
|
||||
break;
|
||||
|
||||
case FWRITE:
|
||||
return (1); /* always fails => never blocks */
|
||||
}
|
||||
splx(s);
|
||||
return (0);
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/* $NetBSD: event_var.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)event_var.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Internal `Firm_event' interface for the keyboard and mouse drivers.
|
||||
* The drivers are expected not to place events in the queue above spltty(),
|
||||
* i.e., are expected to run off serial ports.
|
||||
*/
|
||||
|
||||
/* EV_QSIZE should be a power of two so that `%' is fast */
|
||||
#define EV_QSIZE 256 /* may need tuning; this uses 2k */
|
||||
|
||||
struct evvar {
|
||||
u_int ev_get; /* get (read) index (modified synchronously) */
|
||||
volatile u_int ev_put; /* put (write) index (modified by interrupt) */
|
||||
struct selinfo ev_sel; /* process selecting */
|
||||
struct proc *ev_io; /* process that opened queue (can get SIGIO) */
|
||||
char ev_wanted; /* wake up on input ready */
|
||||
char ev_async; /* send SIGIO on input ready */
|
||||
struct firm_event *ev_q;/* circular buffer (queue) of events */
|
||||
};
|
||||
|
||||
#define splev() spltty()
|
||||
|
||||
#define EV_WAKEUP(ev) { \
|
||||
selwakeup(&(ev)->ev_sel); \
|
||||
if ((ev)->ev_wanted) { \
|
||||
(ev)->ev_wanted = 0; \
|
||||
wakeup((caddr_t)(ev)); \
|
||||
} \
|
||||
if ((ev)->ev_async) \
|
||||
psignal((ev)->ev_io, SIGIO); \
|
||||
}
|
||||
|
||||
void ev_init __P((struct evvar *));
|
||||
void ev_fini __P((struct evvar *));
|
||||
int ev_read __P((struct evvar *, struct uio *, int));
|
||||
int ev_select __P((struct evvar *, int, struct proc *));
|
||||
|
||||
/*
|
||||
* PEVENT is set just above PSOCK, which is just above TTIPRI, on the
|
||||
* theory that mouse and keyboard `user' input should be quick.
|
||||
*/
|
||||
#define PEVENT 23
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,102 @@
|
|||
/* $NetBSD: fdreg.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)fdreg.h 7.1 (Berkeley) 5/9/91
|
||||
*/
|
||||
|
||||
/*
|
||||
* x680x0 floppy controller registers and bitfields
|
||||
*/
|
||||
|
||||
/* uses NEC72065 controller */
|
||||
#include <dev/ic/nec765reg.h>
|
||||
|
||||
/* Status registers returned as result of operation. */
|
||||
#define ST0 0x00 /* status register 0 */
|
||||
#define ST1 0x01 /* status register 1 */
|
||||
#define ST2 0x02 /* status register 2 */
|
||||
#define ST3 0x00 /* status register 3 (return by DRIVE_SENSE) */
|
||||
#define ST_CYL 0x03 /* slot where controller reports cylinder */
|
||||
#define ST_HEAD 0x04 /* slot where controller reports head */
|
||||
#define ST_SEC 0x05 /* slot where controller reports sector */
|
||||
#define ST_PCN 0x01 /* slot where controller reports present cyl */
|
||||
|
||||
/* Fields within the I/O ports. */
|
||||
/* FDD registers */
|
||||
#define EJECT 0x20
|
||||
#define MOTOR_ON 0x80
|
||||
|
||||
/* Floppy disk controller command bytes. */
|
||||
#define FDC_SEEK 0x0F /* command the drive to seek */
|
||||
#define FDC_READ 0xE6 /* command the drive to read */
|
||||
#define FDC_WRITE 0xC5 /* command the drive to write */
|
||||
#define FDC_SENSE 0x08 /* command the controller to tell its status */
|
||||
#define FDC_RECALIBRATE 0x07 /* command the drive to go to cyl 0 */
|
||||
#define FDC_SPECIFY 0x03 /* command the drive to accept params */
|
||||
#define FDC_READ_ID 0x4A /* command the drive to read sector identity */
|
||||
#define FDC_FORMAT 0x4D /* command the drive to format a track */
|
||||
#define FDC_RESET 0x36 /* reset command for fdc */
|
||||
|
||||
/* Main status register. */
|
||||
#define NE7_D0B 0x01 /* Diskette drive 0 is seeking, thus busy */
|
||||
#define NE7_D1B 0x02 /* Diskette drive 1 is seeking, thus busy */
|
||||
#define NE7_D2B 0x01 /* Diskette drive 2 is seeking, thus busy */
|
||||
#define NE7_D3B 0x02 /* Diskette drive 3 is seeking, thus busy */
|
||||
#define NE7_CB 0x10 /* Diskette Controller Busy */
|
||||
#define NE7_NDM 0x20 /* Diskette Controller in Non Dma Mode */
|
||||
#define NE7_DIO 0x40 /* Diskette Controller Data register I/O */
|
||||
#define NE7_RQM 0x80 /* Diskette Controller ReQuest for Master */
|
||||
|
||||
/* registers */
|
||||
#define fdout 2 /* Digital Output Register (W) */
|
||||
#define FDO_FDSEL 0x03 /* floppy device select */
|
||||
#define FDO_FRST 0x04 /* floppy controller reset */
|
||||
#define FDO_FDMAEN 0x08 /* enable floppy DMA and Interrupt */
|
||||
#define FDO_MOEN(n) ((1 << n) * 0x10) /* motor enable */
|
||||
|
||||
#define fdsts 4 /* NEC 765 Main Status Register (R) */
|
||||
#define fddata 5 /* NEC 765 Data Register (R/W) */
|
||||
|
||||
#define fdctl 7 /* Control Register (W) */
|
||||
#define FDC_500KBPS 0x00 /* 500KBPS MFM drive transfer rate */
|
||||
#define FDC_300KBPS 0x01 /* 300KBPS MFM drive transfer rate */
|
||||
#define FDC_250KBPS 0x02 /* 250KBPS MFM drive transfer rate */
|
||||
#define FDC_125KBPS 0x03 /* 125KBPS FM drive transfer rate */
|
||||
|
||||
#define fdin 7 /* Digital Input Register (R) */
|
||||
#define FDI_DCHG 0x80 /* diskette has been changed */
|
||||
|
||||
#define FDC_BSIZE 512
|
||||
#define FDC_NPORT 8
|
||||
#define FDC_MAXIOSIZE NBPG /* XXX should be MAXBSIZE */
|
|
@ -0,0 +1,680 @@
|
|||
/* $NetBSD: grf.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: grf.c 1.36 93/08/13$
|
||||
*
|
||||
* @(#)grf.c 8.4 (Berkeley) 1/12/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Graphics display driver for the X68K machines.
|
||||
* This is the hardware-independent portion of the driver.
|
||||
* Hardware access is through the machine dependent grf switch routines.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <x68k/dev/grfioctl.h>
|
||||
#include <x68k/dev/grfvar.h>
|
||||
#include <x68k/dev/itevar.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#ifdef COMPAT_HPUX
|
||||
#include <compat/hpux/hpux.h>
|
||||
extern struct emul emul_hpux;
|
||||
#endif
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_pager.h>
|
||||
|
||||
#include <miscfs/specfs/specdev.h>
|
||||
|
||||
#include "ite.h"
|
||||
#if NITE == 0
|
||||
#define iteon(u,f)
|
||||
#define iteoff(u,f)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
int grfdebug = 0;
|
||||
#define GDB_DEVNO 0x01
|
||||
#define GDB_MMAP 0x02
|
||||
#define GDB_IOMAP 0x04
|
||||
#define GDB_LOCK 0x08
|
||||
#endif
|
||||
|
||||
struct cfdriver grf_cd;
|
||||
|
||||
/*ARGSUSED*/
|
||||
grfopen(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
int unit = GRFUNIT(dev);
|
||||
register struct grf_softc *gp = grf_cd.cd_devs[unit];
|
||||
int error = 0;
|
||||
|
||||
if (unit >= grf_cd.cd_ndevs || (gp->g_flags & GF_ALIVE) == 0)
|
||||
return(ENXIO);
|
||||
if ((gp->g_flags & (GF_OPEN|GF_EXCLUDE)) == (GF_OPEN|GF_EXCLUDE))
|
||||
return(EBUSY);
|
||||
#ifdef COMPAT_HPUX
|
||||
/*
|
||||
* XXX: cannot handle both HPUX and BSD processes at the same time
|
||||
*/
|
||||
if (curproc->p_emul == &emul_hpux)
|
||||
if (gp->g_flags & GF_BSDOPEN)
|
||||
return(EBUSY);
|
||||
else
|
||||
gp->g_flags |= GF_HPUXOPEN;
|
||||
else
|
||||
if (gp->g_flags & GF_HPUXOPEN)
|
||||
return(EBUSY);
|
||||
else
|
||||
gp->g_flags |= GF_BSDOPEN;
|
||||
#endif
|
||||
/*
|
||||
* First open.
|
||||
* XXX: always put in graphics mode.
|
||||
*/
|
||||
error = 0;
|
||||
if ((gp->g_flags & GF_OPEN) == 0) {
|
||||
gp->g_flags |= GF_OPEN;
|
||||
error = grfon(dev);
|
||||
}
|
||||
return(error);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
grfclose(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
register struct grf_softc *gp = grf_cd.cd_devs[GRFUNIT(dev)];
|
||||
|
||||
(void) grfoff(dev);
|
||||
#ifdef COMPAT_HPUX
|
||||
(void) grfunlock(gp);
|
||||
#endif
|
||||
gp->g_flags &= GF_ALIVE;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
grfioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
int unit = GRFUNIT(dev);
|
||||
register struct grf_softc *gp = grf_cd.cd_devs[unit];
|
||||
int error;
|
||||
|
||||
#ifdef COMPAT_HPUX
|
||||
if (p->p_emul == &emul_hpux)
|
||||
return(hpuxgrfioctl(dev, cmd, data, flag, p));
|
||||
#endif
|
||||
error = 0;
|
||||
switch (cmd) {
|
||||
|
||||
case GRFIOCGINFO:
|
||||
bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo));
|
||||
break;
|
||||
|
||||
case GRFIOCON:
|
||||
error = grfon(dev);
|
||||
break;
|
||||
|
||||
case GRFIOCOFF:
|
||||
error = grfoff(dev);
|
||||
break;
|
||||
|
||||
case GRFIOCMAP:
|
||||
error = grfmap(dev, (caddr_t *)data, p);
|
||||
break;
|
||||
|
||||
case GRFIOCUNMAP:
|
||||
error = grfunmap(dev, *(caddr_t *)data, p);
|
||||
break;
|
||||
|
||||
case GRFSETVMODE:
|
||||
error = (*gp->g_sw->gd_mode)(gp, GM_GRFSETVMODE, data);
|
||||
if (error == 0)
|
||||
ite_reinit(unit);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
|
||||
}
|
||||
return(error);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
grfselect(dev, rw)
|
||||
dev_t dev;
|
||||
int rw;
|
||||
{
|
||||
if (rw == FREAD)
|
||||
return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
grfmmap(dev, off, prot)
|
||||
dev_t dev;
|
||||
int off, prot;
|
||||
{
|
||||
return(grfaddr(grf_cd.cd_devs[GRFUNIT(dev)], off));
|
||||
}
|
||||
|
||||
grfon(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
int unit = GRFUNIT(dev);
|
||||
struct grf_softc *gp = grf_cd.cd_devs[unit];
|
||||
|
||||
/*
|
||||
* XXX: iteoff call relies on devices being in same order
|
||||
* as ITEs and the fact that iteoff only uses the minor part
|
||||
* of the dev arg.
|
||||
*/
|
||||
iteoff(unit, 2);
|
||||
return((*gp->g_sw->gd_mode)(gp,
|
||||
(dev&GRFOVDEV) ? GM_GRFOVON : GM_GRFON,
|
||||
(caddr_t)0));
|
||||
}
|
||||
|
||||
grfoff(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
int unit = GRFUNIT(dev);
|
||||
struct grf_softc *gp = grf_cd.cd_devs[unit];
|
||||
int error;
|
||||
|
||||
(void) grfunmap(dev, (caddr_t)0, curproc);
|
||||
error = (*gp->g_sw->gd_mode)(gp,
|
||||
(dev&GRFOVDEV) ? GM_GRFOVOFF : GM_GRFOFF,
|
||||
(caddr_t)0);
|
||||
/* XXX: see comment for iteoff above */
|
||||
iteon(unit, 2);
|
||||
return(error);
|
||||
}
|
||||
|
||||
grfaddr(gp, off)
|
||||
struct grf_softc *gp;
|
||||
register int off;
|
||||
{
|
||||
register struct grfinfo *gi = &gp->g_display;
|
||||
|
||||
/* control registers */
|
||||
if (off >= 0 && off < gi->gd_regsize)
|
||||
return(((u_int)gi->gd_regaddr + off) >> PGSHIFT);
|
||||
|
||||
/* frame buffer */
|
||||
if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
|
||||
off -= gi->gd_regsize;
|
||||
return(((u_int)gi->gd_fbaddr + off) >> PGSHIFT);
|
||||
}
|
||||
/* bogus */
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* HP-UX compatibility routines
|
||||
*/
|
||||
#ifdef COMPAT_HPUX
|
||||
|
||||
/*ARGSUSED*/
|
||||
hpuxgrfioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
register struct grf_softc *gp = grf_cd.cd_devs[GRFUNIT(dev)];
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
switch (cmd) {
|
||||
|
||||
case GCID:
|
||||
*(int *)data = gp->g_display.gd_id;
|
||||
break;
|
||||
|
||||
case GCON:
|
||||
error = grfon(dev);
|
||||
break;
|
||||
|
||||
case GCOFF:
|
||||
error = grfoff(dev);
|
||||
break;
|
||||
|
||||
case GCLOCK:
|
||||
error = grflock(gp, 1);
|
||||
break;
|
||||
|
||||
case GCUNLOCK:
|
||||
error = grfunlock(gp);
|
||||
break;
|
||||
|
||||
case GCAON:
|
||||
case GCAOFF:
|
||||
break;
|
||||
|
||||
/* GCSTATIC is implied by our implementation */
|
||||
case GCSTATIC_CMAP:
|
||||
case GCVARIABLE_CMAP:
|
||||
break;
|
||||
|
||||
/* map in control regs and frame buffer */
|
||||
case GCMAP:
|
||||
error = grfmap(dev, (caddr_t *)data, p);
|
||||
break;
|
||||
|
||||
case GCUNMAP:
|
||||
error = grfunmap(dev, *(caddr_t *)data, p);
|
||||
/* XXX: HP-UX uses GCUNMAP to get rid of GCSLOT memory */
|
||||
if (error)
|
||||
error = grflckunmmap(dev, *(caddr_t *)data);
|
||||
break;
|
||||
|
||||
case GCSLOT:
|
||||
{
|
||||
struct grf_slot *sp = (struct grf_slot *)data;
|
||||
|
||||
sp->slot = grffindpid(gp);
|
||||
if (sp->slot) {
|
||||
error = grflckmmap(dev, (caddr_t *)&sp->addr);
|
||||
if (error && gp->g_pid) {
|
||||
free((caddr_t)gp->g_pid, M_DEVBUF);
|
||||
gp->g_pid = NULL;
|
||||
}
|
||||
} else
|
||||
error = EINVAL; /* XXX */
|
||||
break;
|
||||
}
|
||||
|
||||
case GCDESCRIBE:
|
||||
error = (*gp->g_sw->gd_mode)(gp, GM_DESCRIBE, data);
|
||||
break;
|
||||
|
||||
/*
|
||||
* XXX: only used right now to map in rbox control registers
|
||||
* Will be replaced in the future with a real IOMAP interface.
|
||||
*/
|
||||
case IOMAPMAP:
|
||||
error = iommap(dev, (caddr_t *)data);
|
||||
#if 0
|
||||
/*
|
||||
* It may not be worth kludging this (using p_devtmp) to
|
||||
* make this work. It was an undocumented side-effect
|
||||
* in HP-UX that the mapped address was the return value
|
||||
* of the ioctl. The only thing I remember that counted
|
||||
* on this behavior was the rbox X10 server.
|
||||
*/
|
||||
if (!error)
|
||||
u.u_r.r_val1 = *(int *)data; /* XXX: this sux */
|
||||
#endif
|
||||
break;
|
||||
|
||||
case IOMAPUNMAP:
|
||||
error = iounmmap(dev, *(caddr_t *)data);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
return(error);
|
||||
}
|
||||
|
||||
grflock(gp, block)
|
||||
register struct grf_softc *gp;
|
||||
int block;
|
||||
{
|
||||
struct proc *p = curproc; /* XXX */
|
||||
int error;
|
||||
extern char devioc[];
|
||||
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_LOCK)
|
||||
printf("grflock(%d): dev %x flags %x lockpid %x\n",
|
||||
p->p_pid, gp-grf_softc, gp->g_flags,
|
||||
gp->g_lockp ? gp->g_lockp->p_pid : -1);
|
||||
#endif
|
||||
if (gp->g_pid) {
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_LOCK)
|
||||
printf(" lockpslot %d lockslot %d lock[lockslot] %d\n",
|
||||
gp->g_lock->gl_lockslot, gp->g_lockpslot,
|
||||
gp->g_lock->gl_locks[gp->g_lockpslot]);
|
||||
#endif
|
||||
gp->g_lock->gl_lockslot = 0;
|
||||
if (gp->g_lock->gl_locks[gp->g_lockpslot] == 0) {
|
||||
gp->g_lockp = NULL;
|
||||
gp->g_lockpslot = 0;
|
||||
}
|
||||
}
|
||||
if (gp->g_lockp) {
|
||||
if (gp->g_lockp == p)
|
||||
return(EBUSY);
|
||||
if (!block)
|
||||
return(OEAGAIN);
|
||||
do {
|
||||
gp->g_flags |= GF_WANTED;
|
||||
if (error = tsleep((caddr_t)&gp->g_flags,
|
||||
(PZERO+1) | PCATCH, devioc, 0))
|
||||
return (error);
|
||||
} while (gp->g_lockp);
|
||||
}
|
||||
gp->g_lockp = p;
|
||||
if (gp->g_pid) {
|
||||
int slot = grffindpid(gp);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_LOCK)
|
||||
printf(" slot %d\n", slot);
|
||||
#endif
|
||||
gp->g_lockpslot = gp->g_lock->gl_lockslot = slot;
|
||||
gp->g_lock->gl_locks[slot] = 1;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
grfunlock(gp)
|
||||
register struct grf_softc *gp;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_LOCK)
|
||||
printf("grfunlock(%d): dev %x flags %x lockpid %d\n",
|
||||
curproc->p_pid, gp-grf_softc, gp->g_flags,
|
||||
gp->g_lockp ? gp->g_lockp->p_pid : -1);
|
||||
#endif
|
||||
if (gp->g_lockp != curproc)
|
||||
return(EBUSY);
|
||||
if (gp->g_pid) {
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_LOCK)
|
||||
printf(" lockpslot %d lockslot %d lock[lockslot] %d\n",
|
||||
gp->g_lock->gl_lockslot, gp->g_lockpslot,
|
||||
gp->g_lock->gl_locks[gp->g_lockpslot]);
|
||||
#endif
|
||||
gp->g_lock->gl_locks[gp->g_lockpslot] = 0;
|
||||
gp->g_lockpslot = gp->g_lock->gl_lockslot = 0;
|
||||
}
|
||||
if (gp->g_flags & GF_WANTED) {
|
||||
wakeup((caddr_t)&gp->g_flags);
|
||||
gp->g_flags &= ~GF_WANTED;
|
||||
}
|
||||
gp->g_lockp = NULL;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a BSD style minor devno to HPUX style.
|
||||
* We cannot just create HPUX style nodes as they require 24 bits
|
||||
* of minor device number and we only have 8.
|
||||
* XXX: This may give the wrong result for remote stats of other
|
||||
* machines where device 10 exists.
|
||||
*/
|
||||
grfdevno(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
int unit = GRFUNIT(dev);
|
||||
struct grf_softc *gp = grf_cd.cd_devs[unit];
|
||||
int newdev;
|
||||
|
||||
if (unit >= grf_cd.cd_ndevs || (gp->g_flags&GF_ALIVE) == 0)
|
||||
return(bsdtohpuxdev(dev));
|
||||
/* magic major number */
|
||||
newdev = 12 << 24;
|
||||
/* now construct minor number */
|
||||
if (gp->g_display.gd_regaddr != (caddr_t)GRFIADDR) {
|
||||
int sc = patosc(gp->g_display.gd_regaddr);
|
||||
newdev |= (sc << 16) | 0x200;
|
||||
}
|
||||
if (dev & GRFIMDEV)
|
||||
newdev |= 0x02;
|
||||
else if (dev & GRFOVDEV)
|
||||
newdev |= 0x01;
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_DEVNO)
|
||||
printf("grfdevno: dev %x newdev %x\n", dev, newdev);
|
||||
#endif
|
||||
return(newdev);
|
||||
}
|
||||
|
||||
#endif /* COMPAT_HPUX */
|
||||
|
||||
grfmap(dev, addrp, p)
|
||||
dev_t dev;
|
||||
caddr_t *addrp;
|
||||
struct proc *p;
|
||||
{
|
||||
struct grf_softc *gp = grf_cd.cd_devs[GRFUNIT(dev)];
|
||||
int len, error;
|
||||
struct vnode vn;
|
||||
struct specinfo si;
|
||||
int flags;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_MMAP)
|
||||
printf("grfmap(%d): addr %x\n", p->p_pid, *addrp);
|
||||
#endif
|
||||
len = gp->g_display.gd_regsize + gp->g_display.gd_fbsize;
|
||||
flags = MAP_SHARED;
|
||||
if (*addrp)
|
||||
flags |= MAP_FIXED;
|
||||
else
|
||||
*addrp = (caddr_t)0x1000000; /* XXX */
|
||||
vn.v_type = VCHR; /* XXX */
|
||||
vn.v_specinfo = &si; /* XXX */
|
||||
vn.v_rdev = dev; /* XXX */
|
||||
error = vm_mmap(&p->p_vmspace->vm_map, (vm_offset_t *)addrp,
|
||||
(vm_size_t)len, VM_PROT_ALL, VM_PROT_ALL,
|
||||
flags, (caddr_t)&vn, 0);
|
||||
if (error == 0)
|
||||
(void) (*gp->g_sw->gd_mode)(gp, GM_MAP, *addrp);
|
||||
return(error);
|
||||
}
|
||||
|
||||
grfunmap(dev, addr, p)
|
||||
dev_t dev;
|
||||
caddr_t addr;
|
||||
struct proc *p;
|
||||
{
|
||||
struct grf_softc *gp = grf_cd.cd_devs[GRFUNIT(dev)];
|
||||
vm_size_t size;
|
||||
int rv;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_MMAP)
|
||||
printf("grfunmap(%d): dev %x addr %x\n", p->p_pid, dev, addr);
|
||||
#endif
|
||||
if (addr == 0)
|
||||
return(EINVAL); /* XXX: how do we deal with this? */
|
||||
(void) (*gp->g_sw->gd_mode)(gp, GM_UNMAP, 0);
|
||||
size = round_page(gp->g_display.gd_regsize + gp->g_display.gd_fbsize);
|
||||
rv = vm_deallocate(&p->p_vmspace->vm_map, (vm_offset_t)addr, size);
|
||||
return(rv == KERN_SUCCESS ? 0 : EINVAL);
|
||||
}
|
||||
|
||||
#ifdef COMPAT_HPUX
|
||||
iommap(dev, addrp)
|
||||
dev_t dev;
|
||||
caddr_t *addrp;
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & (GDB_MMAP|GDB_IOMAP))
|
||||
printf("iommap(%d): addr %x\n", curproc->p_pid, *addrp);
|
||||
#endif
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
iounmmap(dev, addr)
|
||||
dev_t dev;
|
||||
caddr_t addr;
|
||||
{
|
||||
int unit = minor(dev);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & (GDB_MMAP|GDB_IOMAP))
|
||||
printf("iounmmap(%d): id %d addr %x\n",
|
||||
curproc->p_pid, unit, addr);
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Processes involved in framebuffer mapping via GCSLOT are recorded in
|
||||
* an array of pids. The first element is used to record the last slot used
|
||||
* (for faster lookups). The remaining elements record up to GRFMAXLCK-1
|
||||
* process ids. Returns a slot number between 1 and GRFMAXLCK or 0 if no
|
||||
* slot is available.
|
||||
*/
|
||||
grffindpid(gp)
|
||||
struct grf_softc *gp;
|
||||
{
|
||||
register short pid, *sp;
|
||||
register int i, limit;
|
||||
int ni;
|
||||
|
||||
if (gp->g_pid == NULL) {
|
||||
gp->g_pid = (short *)
|
||||
malloc(GRFMAXLCK * sizeof(short), M_DEVBUF, M_WAITOK);
|
||||
bzero((caddr_t)gp->g_pid, GRFMAXLCK * sizeof(short));
|
||||
}
|
||||
pid = curproc->p_pid;
|
||||
ni = limit = gp->g_pid[0];
|
||||
for (i = 1, sp = &gp->g_pid[1]; i <= limit; i++, sp++) {
|
||||
if (*sp == pid)
|
||||
goto done;
|
||||
if (*sp == 0)
|
||||
ni = i;
|
||||
}
|
||||
i = ni;
|
||||
if (i < limit) {
|
||||
gp->g_pid[i] = pid;
|
||||
goto done;
|
||||
}
|
||||
if (++i == GRFMAXLCK)
|
||||
return(0);
|
||||
gp->g_pid[0] = i;
|
||||
gp->g_pid[i] = pid;
|
||||
done:
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_LOCK)
|
||||
printf("grffindpid(%d): slot %d of %d\n",
|
||||
pid, i, gp->g_pid[0]);
|
||||
#endif
|
||||
return(i);
|
||||
}
|
||||
|
||||
grfrmpid(gp)
|
||||
struct grf_softc *gp;
|
||||
{
|
||||
register short pid, *sp;
|
||||
register int limit, i;
|
||||
int mi;
|
||||
|
||||
if (gp->g_pid == NULL || (limit = gp->g_pid[0]) == 0)
|
||||
return;
|
||||
pid = curproc->p_pid;
|
||||
limit = gp->g_pid[0];
|
||||
mi = 0;
|
||||
for (i = 1, sp = &gp->g_pid[1]; i <= limit; i++, sp++) {
|
||||
if (*sp == pid)
|
||||
*sp = 0;
|
||||
else if (*sp)
|
||||
mi = i;
|
||||
}
|
||||
i = mi;
|
||||
if (i < limit)
|
||||
gp->g_pid[0] = i;
|
||||
#ifdef DEBUG
|
||||
if (grfdebug & GDB_LOCK)
|
||||
printf("grfrmpid(%d): slot %d of %d\n",
|
||||
pid, sp-gp->g_pid, gp->g_pid[0]);
|
||||
#endif
|
||||
}
|
||||
|
||||
grflckmmap(dev, addrp)
|
||||
dev_t dev;
|
||||
caddr_t *addrp;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
struct proc *p = curproc; /* XXX */
|
||||
|
||||
if (grfdebug & (GDB_MMAP|GDB_LOCK))
|
||||
printf("grflckmmap(%d): addr %x\n",
|
||||
p->p_pid, *addrp);
|
||||
#endif
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
grflckunmmap(dev, addr)
|
||||
dev_t dev;
|
||||
caddr_t addr;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
int unit = minor(dev);
|
||||
|
||||
if (grfdebug & (GDB_MMAP|GDB_LOCK))
|
||||
printf("grflckunmmap(%d): id %d addr %x\n",
|
||||
curproc->p_pid, unit, addr);
|
||||
#endif
|
||||
return(EINVAL);
|
||||
}
|
||||
#endif /* COMPAT_HPUX */
|
|
@ -0,0 +1,130 @@
|
|||
/* $NetBSD: grf_conf.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991 University of Utah.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: grf_conf.c 1.2 92/01/22$
|
||||
*
|
||||
* @(#)grf_conf.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* XXX this information could be generated by config.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <x68k/dev/grfioctl.h>
|
||||
#include <x68k/dev/grfvar.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
/*#include <x68k/dev/grfreg.h>*/
|
||||
|
||||
extern int cc_init(), cc_mode();
|
||||
extern int gv_init(), gv_mode();
|
||||
#if 0
|
||||
extern int tc_init(), tc_mode();
|
||||
extern int gb_init(), gb_mode();
|
||||
extern int rb_init(), rb_mode();
|
||||
extern int dv_init(), dv_mode();
|
||||
extern int hy_init(), hy_mode();
|
||||
#endif
|
||||
|
||||
struct grfsw grfsw[] = {
|
||||
GID_BUILTIN, GRFBUILTIN, "builtin", cc_init, cc_mode,
|
||||
GID_GVRAM, GRFBUILTIN, "graphic", gv_init, gv_mode,
|
||||
#if 0
|
||||
GID_TOPCAT, GRFBOBCAT, "topcat", tc_init, tc_mode,
|
||||
GID_GATORBOX, GRFGATOR, "gatorbox", gb_init, gb_mode,
|
||||
GID_RENAISSANCE,GRFRBOX, "renaissance", rb_init, rb_mode,
|
||||
GID_LRCATSEYE, GRFCATSEYE, "lo-res catseye", tc_init, tc_mode,
|
||||
GID_HRCCATSEYE, GRFCATSEYE, "hi-res catseye", tc_init, tc_mode,
|
||||
GID_HRMCATSEYE, GRFCATSEYE, "hi-res catseye", tc_init, tc_mode,
|
||||
GID_DAVINCI, GRFDAVINCI, "davinci", dv_init, dv_mode,
|
||||
GID_HYPERION, GRFHYPERION, "hyperion", hy_init, hy_mode,
|
||||
#endif
|
||||
};
|
||||
int ngrfsw = sizeof(grfsw) / sizeof(grfsw[0]);
|
||||
|
||||
#if 0 /* XXX? */
|
||||
#include "ite.h"
|
||||
#if NITE > 0
|
||||
|
||||
#include <x68k/dev/itevar.h>
|
||||
|
||||
extern u_char ite_readbyte();
|
||||
extern int ite_writeglyph();
|
||||
extern int topcat_scroll(), topcat_init(), topcat_deinit();
|
||||
extern int topcat_clear(), topcat_putc(), topcat_cursor();
|
||||
extern int gbox_scroll(), gbox_init(), gbox_deinit();
|
||||
extern int gbox_clear(), gbox_putc(), gbox_cursor();
|
||||
extern int rbox_scroll(), rbox_init(), rbox_deinit();
|
||||
extern int rbox_clear(), rbox_putc(), rbox_cursor();
|
||||
extern int dvbox_scroll(), dvbox_init(), dvbox_deinit();
|
||||
extern int dvbox_clear(), dvbox_putc(), dvbox_cursor();
|
||||
extern int hyper_scroll(), hyper_init(), hyper_deinit();
|
||||
extern int hyper_clear(), hyper_putc(), hyper_cursor();
|
||||
|
||||
struct itesw itesw[] = {
|
||||
GID_TOPCAT,
|
||||
topcat_init, topcat_deinit, topcat_clear, topcat_putc,
|
||||
topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
|
||||
GID_GATORBOX,
|
||||
gbox_init, gbox_deinit, gbox_clear, gbox_putc,
|
||||
gbox_cursor, gbox_scroll, ite_readbyte, ite_writeglyph,
|
||||
GID_RENAISSANCE,
|
||||
rbox_init, rbox_deinit, rbox_clear, rbox_putc,
|
||||
rbox_cursor, rbox_scroll, ite_readbyte, ite_writeglyph,
|
||||
GID_LRCATSEYE,
|
||||
topcat_init, topcat_deinit, topcat_clear, topcat_putc,
|
||||
topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
|
||||
GID_HRCCATSEYE,
|
||||
topcat_init, topcat_deinit, topcat_clear, topcat_putc,
|
||||
topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
|
||||
GID_HRMCATSEYE,
|
||||
topcat_init, topcat_deinit, topcat_clear, topcat_putc,
|
||||
topcat_cursor, topcat_scroll, ite_readbyte, ite_writeglyph,
|
||||
GID_DAVINCI,
|
||||
dvbox_init, dvbox_deinit, dvbox_clear, dvbox_putc,
|
||||
dvbox_cursor, dvbox_scroll, ite_readbyte, ite_writeglyph,
|
||||
GID_HYPERION,
|
||||
hyper_init, hyper_deinit, hyper_clear, hyper_putc,
|
||||
hyper_cursor, hyper_scroll, ite_readbyte, ite_writeglyph,
|
||||
};
|
||||
int nitesw = sizeof(itesw) / sizeof(itesw[0]);
|
||||
#endif
|
||||
#endif /* 0 */
|
|
@ -0,0 +1,224 @@
|
|||
/* $NetBSD: grf_gv.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: grf_tc.c 1.20 93/08/13$
|
||||
*
|
||||
* @(#)grf_tc.c 8.4 (Berkeley) 1/12/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Graphics routines for the X68K native custom chip set.
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include <x68k/dev/grfioctl.h>
|
||||
#include <x68k/dev/grfvar.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
/* Initialize hardware.
|
||||
* Must fill in the grfinfo structure in g_softc.
|
||||
* Returns 0 if hardware not present, non-zero ow.
|
||||
*/
|
||||
gv_init(gp, addr)
|
||||
struct grf_softc *gp;
|
||||
caddr_t addr;
|
||||
{
|
||||
struct grfinfo *gi = &gp->g_display;
|
||||
int rc;
|
||||
long start, off;
|
||||
|
||||
gi->gd_fbwidth = 1024;
|
||||
gi->gd_fbheight = 1024;
|
||||
gi->gd_planes = 4;
|
||||
gi->gd_regaddr = (void *)0x00e80000;
|
||||
gi->gd_regsize = 0x00010000; /* contains system port */
|
||||
gi->gd_fbaddr = (void *)0x00c00000;
|
||||
gi->gd_fbsize = gi->gd_fbwidth * gi->gd_fbheight * 2;
|
||||
gp->g_regkva = addr;
|
||||
gp->g_fbkva = addr;
|
||||
switch(IODEVbase->io_sram[0x1d]) {
|
||||
case 18:
|
||||
/*
|
||||
* mode 18, 24kHz
|
||||
*/
|
||||
gi->gd_dwidth = 1024;
|
||||
gi->gd_dheight = 848;
|
||||
break;
|
||||
case 19:
|
||||
/*
|
||||
* mode 19, 31kHz VGA mode
|
||||
*/
|
||||
gi->gd_dwidth = 640;
|
||||
gi->gd_dheight = 480;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* mode 16, 31kHz (default)
|
||||
*/
|
||||
gi->gd_dwidth = 768;
|
||||
gi->gd_dheight = 512;
|
||||
break;
|
||||
}
|
||||
gi->gd_colors = 16;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Change the mode of the display.
|
||||
* Right now all we can do is grfon/grfoff.
|
||||
* Return a UNIX error number or 0 for success.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
gv_mode(gp, cmd, data)
|
||||
register struct grf_softc *gp;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
switch (cmd) {
|
||||
case GM_GRFON:
|
||||
case GM_GRFOFF:
|
||||
break;
|
||||
|
||||
/*
|
||||
* Remember UVA of mapping for GCDESCRIBE.
|
||||
* XXX this should be per-process.
|
||||
*/
|
||||
case GM_MAP:
|
||||
gp->g_data = data;
|
||||
break;
|
||||
|
||||
case GM_UNMAP:
|
||||
gp->g_data = 0;
|
||||
break;
|
||||
|
||||
#ifdef COMPAT_HPUX
|
||||
case GM_DESCRIBE:
|
||||
{
|
||||
struct grf_fbinfo *fi = (struct grf_fbinfo *)data;
|
||||
struct grfinfo *gi = &gp->g_display;
|
||||
int i;
|
||||
|
||||
/* feed it what HP-UX expects */
|
||||
fi->id = gi->gd_id;
|
||||
fi->mapsize = gi->gd_fbsize;
|
||||
fi->dwidth = gi->gd_dwidth;
|
||||
fi->dlength = gi->gd_dheight;
|
||||
fi->width = gi->gd_fbwidth;
|
||||
fi->length = gi->gd_fbheight;
|
||||
fi->bpp = NBBY;
|
||||
fi->xlen = (fi->width * fi->bpp) / NBBY;
|
||||
fi->npl = gi->gd_planes;
|
||||
fi->bppu = fi->npl;
|
||||
fi->nplbytes = fi->xlen * ((fi->length * fi->bpp) / NBBY);
|
||||
/* XXX */
|
||||
switch (gp->g_sw->gd_hwid) {
|
||||
case GID_HRCCATSEYE:
|
||||
bcopy("HP98550", fi->name, 8);
|
||||
break;
|
||||
case GID_LRCATSEYE:
|
||||
bcopy("HP98549", fi->name, 8);
|
||||
break;
|
||||
case GID_HRMCATSEYE:
|
||||
bcopy("HP98548", fi->name, 8);
|
||||
break;
|
||||
case GID_TOPCAT:
|
||||
switch (gi->gd_colors) {
|
||||
case 64:
|
||||
bcopy("HP98547", fi->name, 8);
|
||||
break;
|
||||
case 16:
|
||||
bcopy("HP98545", fi->name, 8);
|
||||
break;
|
||||
case 2:
|
||||
bcopy("HP98544", fi->name, 8);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
fi->attr = 2; /* HW block mover */
|
||||
/*
|
||||
* If mapped, return the UVA where mapped.
|
||||
*/
|
||||
if (gp->g_data) {
|
||||
fi->regbase = gp->g_data;
|
||||
fi->fbbase = fi->regbase + gp->g_display.gd_regsize;
|
||||
} else {
|
||||
fi->fbbase = 0;
|
||||
fi->regbase = 0;
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
fi->regions[i] = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
case GM_GRFSETVMODE:
|
||||
if (*(int *)data == 1) {
|
||||
struct grfinfo *gi = &gp->g_display;
|
||||
volatile struct crtc *crtc = &IODEVbase->io_crtc;
|
||||
/* CRTC $B$K@_Dj$r9T$J$$!"(Bdwidth $B$H(B dheight $B$r$$$8$k(B */
|
||||
crtc->r20 = (crtc->r20 & 0xFF00) | 0x1a;
|
||||
crtc->r08 = 0x1b;
|
||||
crtc->r07 = 0x19c;
|
||||
crtc->r06 = 0x1c;
|
||||
crtc->r05 = 0x02;
|
||||
crtc->r04 = 0x019f;
|
||||
crtc->r03 = 0x9a;
|
||||
crtc->r02 = 0x1a;
|
||||
crtc->r01 = 0x09;
|
||||
crtc->r00 = 0xa4;
|
||||
gi->gd_dwidth = 1024;
|
||||
gi->gd_dheight = 768;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
return(error);
|
||||
}
|
|
@ -0,0 +1,243 @@
|
|||
/* $NetBSD: grf_machdep.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991 University of Utah.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: grf_machdep.c 1.1 92/01/21
|
||||
*
|
||||
* @(#)grf_machdep.c 8.2 (Berkeley) 1/12/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Graphics display driver for the HP300/400 DIO/DIO-II based machines.
|
||||
* This is the hardware-dependent configuration portion of the driver.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <x68k/dev/grfioctl.h>
|
||||
#include <x68k/dev/grfvar.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
|
||||
/*
|
||||
* false when initing for the console.
|
||||
*/
|
||||
extern int x68k_realconfig;
|
||||
|
||||
int grfbusprint __P((void *auxp, char *));
|
||||
int grfbusmatch __P((struct device *, void *, void *));
|
||||
void grfbusattach __P((struct device *, struct device *, void *));
|
||||
void grfbusscan __P((struct device *, void *));
|
||||
|
||||
void grfattach __P((struct device *, struct device *, void *));
|
||||
int grfmatch __P((struct device *, void *, void *));
|
||||
int grfprint __P((void *, char *));
|
||||
|
||||
struct cfattach grfbus_ca = {
|
||||
sizeof(struct device), grfbusmatch, grfbusattach
|
||||
};
|
||||
|
||||
struct cfdriver grfbus_cd = {
|
||||
NULL, "grfbus", DV_DULL
|
||||
};
|
||||
|
||||
struct cfattach grf_ca = {
|
||||
sizeof(struct grf_softc), grfmatch, grfattach
|
||||
};
|
||||
|
||||
struct cfdriver grf_cd = {
|
||||
NULL, "grf", DV_DULL
|
||||
};
|
||||
|
||||
/*
|
||||
* only used in console init.
|
||||
*/
|
||||
static struct cfdata *cfdata_gbus = NULL;
|
||||
static struct cfdata *cfdata_grf = NULL;
|
||||
|
||||
int
|
||||
grfbusmatch(pdp, match, auxp)
|
||||
struct device *pdp;
|
||||
void *match, *auxp;
|
||||
{
|
||||
struct cfdata *cfp = match;
|
||||
|
||||
if (strcmp(auxp, grfbus_cd.cd_name))
|
||||
return(0);
|
||||
|
||||
if((x68k_realconfig == 0) || (cfdata_gbus == NULL)) {
|
||||
/*
|
||||
* Probe layers we depend on
|
||||
*/
|
||||
if(x68k_realconfig == 0) {
|
||||
cfdata_gbus = cfp;
|
||||
}
|
||||
}
|
||||
return(1); /* Always there */
|
||||
}
|
||||
|
||||
void
|
||||
grfbusattach(pdp, dp, auxp)
|
||||
struct device *pdp, *dp;
|
||||
void *auxp;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (dp == NULL) {
|
||||
i = 0;
|
||||
x68k_config_found(cfdata_gbus, NULL, (void*)&i, grfbusprint);
|
||||
} else {
|
||||
printf("\n");
|
||||
config_scan(grfbusscan, dp);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grfbusscan(dp, auxp)
|
||||
struct device *dp;
|
||||
void *auxp;
|
||||
{
|
||||
int i = 0;
|
||||
config_found(dp, (void*)&i, grfbusprint);
|
||||
}
|
||||
|
||||
int
|
||||
grfbusprint(auxp, name)
|
||||
void *auxp;
|
||||
char *name;
|
||||
{
|
||||
if(name == NULL)
|
||||
return(UNCONF);
|
||||
return(QUIET);
|
||||
}
|
||||
|
||||
static struct grf_softc congrf;
|
||||
/*
|
||||
* XXX called from ite console init routine.
|
||||
* Does just what configure will do later but without printing anything.
|
||||
*/
|
||||
grfconfig(dp)
|
||||
struct device *dp;
|
||||
{
|
||||
int unit;
|
||||
if (!dp)
|
||||
dp = (void *)&congrf;
|
||||
unit = dp->dv_unit;
|
||||
|
||||
grfinit(dp, unit); /* XXX */
|
||||
}
|
||||
|
||||
/*
|
||||
* Normal init routine called by configure() code
|
||||
*/
|
||||
int
|
||||
grfmatch(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match, *aux;
|
||||
{
|
||||
struct cfdata *cfp = match;
|
||||
|
||||
/* XXX console at grf0 */
|
||||
if (x68k_realconfig == 0) {
|
||||
if (cfp->cf_unit != 0)
|
||||
return(0);
|
||||
cfdata_grf = cfp;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
void
|
||||
grfattach(parent, dp, aux)
|
||||
struct device *parent;
|
||||
struct device *dp;
|
||||
void *aux;
|
||||
{
|
||||
/* static struct grf_softc congrf;*/
|
||||
struct grf_softc *gp;
|
||||
|
||||
grfconfig(dp);
|
||||
/*
|
||||
* Handle exeption case: early console init
|
||||
*/
|
||||
if(dp == NULL) {
|
||||
/* Attach console ite */
|
||||
x68k_config_found(cfdata_grf, NULL, &congrf, grfprint);
|
||||
return;
|
||||
}
|
||||
gp = (struct grf_softc *)dp;
|
||||
printf(": %d x %d ", gp->g_display.gd_dwidth,
|
||||
gp->g_display.gd_dheight);
|
||||
if (gp->g_display.gd_colors == 2)
|
||||
printf("monochrome");
|
||||
else
|
||||
printf("%d colors", gp->g_display.gd_colors);
|
||||
printf(" %s display\n", gp->g_sw->gd_desc);
|
||||
|
||||
/*
|
||||
* try and attach an ite
|
||||
*/
|
||||
config_found(dp, gp, grfprint);
|
||||
}
|
||||
|
||||
int
|
||||
grfprint(auxp, pnp)
|
||||
void *auxp;
|
||||
char *pnp;
|
||||
{
|
||||
if(pnp)
|
||||
printf("ite at %s", pnp);
|
||||
return(UNCONF);
|
||||
}
|
||||
|
||||
grfinit(dp, unit)
|
||||
void *dp;
|
||||
int unit;
|
||||
{
|
||||
struct grf_softc *gp = dp;
|
||||
register struct grfsw *gsw;
|
||||
caddr_t addr = (void *)(unit < 1 ? IODEVbase->tvram : IODEVbase->gvram);
|
||||
|
||||
gsw = &grfsw[unit];
|
||||
if (gsw < &grfsw[ngrfsw] && (*gsw->gd_init)(gp, addr)) {
|
||||
gp->g_sw = gsw;
|
||||
gp->g_display.gd_id = gsw->gd_swid;
|
||||
gp->g_flags = GF_ALIVE;
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
|
@ -0,0 +1,224 @@
|
|||
/* $NetBSD: grf_tv.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: grf_tc.c 1.20 93/08/13$
|
||||
*
|
||||
* @(#)grf_tc.c 8.4 (Berkeley) 1/12/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Graphics routines for the X68K native custom chip set.
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include <x68k/dev/grfioctl.h>
|
||||
#include <x68k/dev/grfvar.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
/* Initialize hardware.
|
||||
* Must fill in the grfinfo structure in g_softc.
|
||||
* Returns 0 if hardware not present, non-zero ow.
|
||||
*/
|
||||
cc_init(gp, addr)
|
||||
struct grf_softc *gp;
|
||||
caddr_t addr;
|
||||
{
|
||||
struct grfinfo *gi = &gp->g_display;
|
||||
int rc;
|
||||
long start, off;
|
||||
|
||||
gi->gd_fbwidth = 1024; /* XXX */
|
||||
gi->gd_fbheight = 1024; /* XXX */
|
||||
gi->gd_planes = 4; /* XXX */
|
||||
gi->gd_regaddr = (void *)0x00e80000; /* XXX */
|
||||
gi->gd_regsize = 0x00004000; /* XXX */
|
||||
gi->gd_fbaddr = (void *)0x00e00000; /* XXX */
|
||||
gi->gd_fbsize = gi->gd_fbwidth / 8 * gi->gd_fbheight * gi->gd_planes;
|
||||
gp->g_regkva = addr;
|
||||
gp->g_fbkva = addr;
|
||||
switch(IODEVbase->io_sram[0x1d]) {
|
||||
case 18:
|
||||
/*
|
||||
* mode 18, 24kHz
|
||||
*/
|
||||
gi->gd_dwidth = 1024;
|
||||
gi->gd_dheight = 848;
|
||||
break;
|
||||
case 19:
|
||||
/*
|
||||
* mode 19, 31kHz VGA mode
|
||||
*/
|
||||
gi->gd_dwidth = 640;
|
||||
gi->gd_dheight = 480;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* mode 16, 31kHz (default)
|
||||
*/
|
||||
gi->gd_dwidth = 768;
|
||||
gi->gd_dheight = 512;
|
||||
break;
|
||||
}
|
||||
gi->gd_colors = 1 << gi->gd_planes;
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Change the mode of the display.
|
||||
* Right now all we can do is grfon/grfoff.
|
||||
* Return a UNIX error number or 0 for success.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
cc_mode(gp, cmd, data)
|
||||
register struct grf_softc *gp;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
{
|
||||
int error = 0;
|
||||
|
||||
switch (cmd) {
|
||||
case GM_GRFON:
|
||||
case GM_GRFOFF:
|
||||
break;
|
||||
|
||||
/*
|
||||
* Remember UVA of mapping for GCDESCRIBE.
|
||||
* XXX this should be per-process.
|
||||
*/
|
||||
case GM_MAP:
|
||||
gp->g_data = data;
|
||||
break;
|
||||
|
||||
case GM_UNMAP:
|
||||
gp->g_data = 0;
|
||||
break;
|
||||
|
||||
#ifdef COMPAT_HPUX
|
||||
case GM_DESCRIBE:
|
||||
{
|
||||
struct grf_fbinfo *fi = (struct grf_fbinfo *)data;
|
||||
struct grfinfo *gi = &gp->g_display;
|
||||
int i;
|
||||
|
||||
/* feed it what HP-UX expects */
|
||||
fi->id = gi->gd_id;
|
||||
fi->mapsize = gi->gd_fbsize;
|
||||
fi->dwidth = gi->gd_dwidth;
|
||||
fi->dlength = gi->gd_dheight;
|
||||
fi->width = gi->gd_fbwidth;
|
||||
fi->length = gi->gd_fbheight;
|
||||
fi->bpp = NBBY;
|
||||
fi->xlen = (fi->width * fi->bpp) / NBBY;
|
||||
fi->npl = gi->gd_planes;
|
||||
fi->bppu = fi->npl;
|
||||
fi->nplbytes = fi->xlen * ((fi->length * fi->bpp) / NBBY);
|
||||
/* XXX */
|
||||
switch (gp->g_sw->gd_hwid) {
|
||||
case GID_HRCCATSEYE:
|
||||
bcopy("HP98550", fi->name, 8);
|
||||
break;
|
||||
case GID_LRCATSEYE:
|
||||
bcopy("HP98549", fi->name, 8);
|
||||
break;
|
||||
case GID_HRMCATSEYE:
|
||||
bcopy("HP98548", fi->name, 8);
|
||||
break;
|
||||
case GID_TOPCAT:
|
||||
switch (gi->gd_colors) {
|
||||
case 64:
|
||||
bcopy("HP98547", fi->name, 8);
|
||||
break;
|
||||
case 16:
|
||||
bcopy("HP98545", fi->name, 8);
|
||||
break;
|
||||
case 2:
|
||||
bcopy("HP98544", fi->name, 8);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
fi->attr = 2; /* HW block mover */
|
||||
/*
|
||||
* If mapped, return the UVA where mapped.
|
||||
*/
|
||||
if (gp->g_data) {
|
||||
fi->regbase = gp->g_data;
|
||||
fi->fbbase = fi->regbase + gp->g_display.gd_regsize;
|
||||
} else {
|
||||
fi->fbbase = 0;
|
||||
fi->regbase = 0;
|
||||
}
|
||||
for (i = 0; i < 6; i++)
|
||||
fi->regions[i] = 0;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
case GM_GRFSETVMODE:
|
||||
if (*(int *)data == 1) {
|
||||
struct grfinfo *gi = &gp->g_display;
|
||||
volatile struct crtc *crtc = &IODEVbase->io_crtc;
|
||||
/* CRTC $B$K@_Dj$r9T$J$$!"(Bdwidth $B$H(B dheight $B$r$$$8$k(B */
|
||||
crtc->r20 = (crtc->r20 & 0xFF00) | 0x1a;
|
||||
crtc->r08 = 0x1b;
|
||||
crtc->r07 = 0x19c;
|
||||
crtc->r06 = 0x1c;
|
||||
crtc->r05 = 0x02;
|
||||
crtc->r04 = 0x019f;
|
||||
crtc->r03 = 0x9a;
|
||||
crtc->r02 = 0x1a;
|
||||
crtc->r01 = 0x09;
|
||||
crtc->r00 = 0xa4;
|
||||
gi->gd_dwidth = 1024;
|
||||
gi->gd_dheight = 768;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
return(error);
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
/* $NetBSD: grfioctl.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: grfioctl.h 1.17 93/08/13$
|
||||
*
|
||||
* @(#)grfioctl.h 8.2 (Berkeley) 9/9/93
|
||||
*/
|
||||
|
||||
struct grfinfo {
|
||||
int gd_id; /* HPUX identifier */
|
||||
caddr_t gd_regaddr; /* control registers physaddr */
|
||||
int gd_regsize; /* control registers size */
|
||||
caddr_t gd_fbaddr; /* frame buffer physaddr */
|
||||
int gd_fbsize; /* frame buffer size */
|
||||
short gd_colors; /* number of colors */
|
||||
short gd_planes; /* number of planes */
|
||||
/* new stuff */
|
||||
int gd_fbwidth; /* frame buffer width */
|
||||
int gd_fbheight; /* frame buffer height */
|
||||
int gd_dwidth; /* displayed part width */
|
||||
int gd_dheight; /* displayed part height */
|
||||
int gd_pad[6]; /* for future expansion */
|
||||
};
|
||||
|
||||
/* XXX */
|
||||
#define GID_BUILTIN 1
|
||||
#define GID_GVRAM 2
|
||||
|
||||
/* types */
|
||||
#define GRFBUILTIN 8
|
||||
#define GRFGATOR 8
|
||||
#if 0
|
||||
#define GRFBOBCAT 9
|
||||
#define GRFCATSEYE 9
|
||||
#define GRFRBOX 10
|
||||
#define GRFFIREEYE 11
|
||||
#define GRFHYPERION 12
|
||||
#define GRFDAVINCI 14
|
||||
#endif
|
||||
|
||||
/*
|
||||
* HPUX ioctls (here for the benefit of the driver)
|
||||
*/
|
||||
struct grf_slot {
|
||||
int slot;
|
||||
u_char *addr;
|
||||
};
|
||||
|
||||
struct grf_fbinfo {
|
||||
int id;
|
||||
int mapsize;
|
||||
int dwidth, dlength;
|
||||
int width, length;
|
||||
int xlen;
|
||||
int bpp, bppu;
|
||||
int npl, nplbytes;
|
||||
char name[32];
|
||||
int attr;
|
||||
caddr_t fbbase, regbase;
|
||||
caddr_t regions[6];
|
||||
};
|
||||
|
||||
#ifndef _IOH
|
||||
#define _IOH(x,y) (IOC_IN|((x)<<8)|y) /* IOC_IN is IOC_VOID */
|
||||
|
||||
#define GCID _IOR('G', 0, int)
|
||||
#define GCON _IOH('G', 1)
|
||||
#define GCOFF _IOH('G', 2)
|
||||
#define GCAON _IOH('G', 3)
|
||||
#define GCAOFF _IOH('G', 4)
|
||||
#define GCMAP _IOWR('G', 5, int)
|
||||
#define GCUNMAP _IOWR('G', 6, int)
|
||||
#define GCLOCK _IOH('G', 7)
|
||||
#define GCUNLOCK _IOH('G', 8)
|
||||
#define GCLOCK_MINIMUM _IOH('G', 9)
|
||||
#define GCUNLOCK_MINIMUM _IOH('G', 10)
|
||||
#define GCSTATIC_CMAP _IOH('G', 11)
|
||||
#define GCVARIABLE_CMAP _IOH('G', 12)
|
||||
#define GCSLOT _IOWR('G', 13, struct grf_slot)
|
||||
#define GCDESCRIBE _IOR('G', 21, struct grf_fbinfo)
|
||||
|
||||
/* XXX: for now */
|
||||
#define IOMAPID _IOR('M',0,int) /* ??? */
|
||||
#define IOMAPMAP _IOWR('M',1,int)
|
||||
#define IOMAPUNMAP _IOWR('M',2,int)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* BSD ioctls
|
||||
*/
|
||||
#define GRFIOCGINFO _IOR('G', 0, struct grfinfo) /* get info on device */
|
||||
#define GRFIOCON _IO('G', 1) /* turn graphics on */
|
||||
#define GRFIOCOFF _IO('G', 2) /* turn graphics off */
|
||||
#define GRFIOCMAP _IOWR('G', 5, int) /* map in regs+framebuffer */
|
||||
#define GRFIOCUNMAP _IOW('G', 6, int) /* unmap regs+framebuffer */
|
||||
|
||||
#define GRFSETVMODE _IOW('G', 42, int)
|
|
@ -0,0 +1,115 @@
|
|||
/* $NetBSD: grfvar.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: grfvar.h 1.11 93/08/13$
|
||||
*
|
||||
* @(#)grfvar.h 8.2 (Berkeley) 9/9/93
|
||||
*/
|
||||
|
||||
/* internal structure of lock page */
|
||||
#define GRFMAXLCK 256
|
||||
struct grf_lockpage {
|
||||
u_char gl_locks[GRFMAXLCK];
|
||||
};
|
||||
#define gl_lockslot gl_locks[0]
|
||||
|
||||
/*
|
||||
* Static configuration info for display types
|
||||
*/
|
||||
struct grfsw {
|
||||
int gd_hwid; /* id returned by hardware */
|
||||
int gd_swid; /* id to be returned by software */
|
||||
char *gd_desc; /* description printed at config time */
|
||||
int (*gd_init)(); /* boot time init routine */
|
||||
int (*gd_mode)(); /* misc function routine */
|
||||
};
|
||||
|
||||
/* per display info */
|
||||
struct grf_softc {
|
||||
struct device g_device; /* for config */
|
||||
int g_flags; /* software flags */
|
||||
struct grfsw *g_sw; /* static configuration info */
|
||||
caddr_t g_regkva; /* KVA of registers */
|
||||
caddr_t g_fbkva; /* KVA of framebuffer */
|
||||
struct grfinfo g_display; /* hardware description (for ioctl) */
|
||||
struct grf_lockpage *g_lock; /* lock page associated with device */
|
||||
struct proc *g_lockp; /* process holding lock */
|
||||
short *g_pid; /* array of pids with device open */
|
||||
int g_lockpslot; /* g_pid entry of g_lockp */
|
||||
caddr_t g_data; /* device dependent data */
|
||||
};
|
||||
|
||||
/* flags */
|
||||
#define GF_ALIVE 0x01
|
||||
#define GF_OPEN 0x02
|
||||
#define GF_EXCLUDE 0x04
|
||||
#define GF_WANTED 0x08
|
||||
#define GF_BSDOPEN 0x10
|
||||
#define GF_HPUXOPEN 0x20
|
||||
|
||||
/* display types - indices into grfdev */
|
||||
#define GT_CUSTOMCHIPS 0
|
||||
|
||||
/* requests to mode routine */
|
||||
#define GM_GRFON 1
|
||||
#define GM_GRFOFF 2
|
||||
#define GM_GRFOVON 3
|
||||
#define GM_GRFOVOFF 4
|
||||
#define GM_DESCRIBE 5
|
||||
#define GM_MAP 6
|
||||
#define GM_UNMAP 7
|
||||
|
||||
#define GM_GRFCONFIG 8
|
||||
#define GM_GRFGETVMODE 9
|
||||
#define GM_GRFSETVMODE 10
|
||||
#define GM_GRFGETNUMVM 11
|
||||
#define GM_GRFGETBANK 12
|
||||
#define GM_GRFSETBANK 13
|
||||
#define GM_GRFGETCURBANK 14
|
||||
#define GM_GRFIOCTL 15
|
||||
|
||||
/* minor device interpretation */
|
||||
#define GRFOVDEV 0x10 /* overlay planes */
|
||||
#define GRFIMDEV 0x20 /* images planes */
|
||||
#define GRFUNIT(d) ((d) & 0x7)
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern struct grfsw grfsw[];
|
||||
extern int ngrfsw;
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,398 @@
|
|||
/* $NetBSD: if_edreg.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* National Semiconductor DS8390 NIC register definitions.
|
||||
*
|
||||
* Copyright (C) 1993, David Greenman. This software may be used, modified,
|
||||
* copied, distributed, and sold, in both source and binary form provided that
|
||||
* the above copyright and these terms are retained. Under no circumstances is
|
||||
* the author responsible for the proper functioning of this software, nor does
|
||||
* the author assume any responsibility for damages incurred with its use.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Vendor types
|
||||
*/
|
||||
#define ED_VENDOR_WD_SMC 0x00 /* Western Digital/SMC */
|
||||
#define ED_VENDOR_3COM 0x01 /* 3Com */
|
||||
#define ED_VENDOR_NOVELL 0x02 /* Novell */
|
||||
|
||||
/*
|
||||
* Compile-time config flags
|
||||
*/
|
||||
/*
|
||||
* This sets the default for enabling/disablng the tranceiver.
|
||||
*/
|
||||
#define ED_FLAGS_DISABLE_TRANCEIVER 0x0001
|
||||
|
||||
/*
|
||||
* This forces the board to be used in 8/16-bit mode even if it autoconfigs
|
||||
* differently.
|
||||
*/
|
||||
#define ED_FLAGS_FORCE_8BIT_MODE 0x0002
|
||||
#define ED_FLAGS_FORCE_16BIT_MODE 0x0004
|
||||
|
||||
/*
|
||||
* This disables the use of double transmit buffers.
|
||||
*/
|
||||
#define ED_FLAGS_NO_MULTI_BUFFERING 0x0008
|
||||
|
||||
/*
|
||||
* This forces all operations with the NIC memory to use Programmed I/O (i.e.
|
||||
* not via shared memory).
|
||||
*/
|
||||
#define ED_FLAGS_FORCE_PIO 0x0010
|
||||
|
||||
/*
|
||||
* Definitions for Western digital/SMC WD80x3 series ASIC
|
||||
*/
|
||||
/*
|
||||
* Memory Select Register (MSR)
|
||||
*/
|
||||
#define ED_WD_MSR 0
|
||||
|
||||
/* next three definitions for Toshiba */
|
||||
#define ED_WD_MSR_POW 0x02 /* 0 = power save, 1 = normal (R/W) */
|
||||
#define ED_WD_MSR_BSY 0x04 /* gate array busy (R) */
|
||||
#define ED_WD_MSR_LEN 0x20 /* 0 = 16-bit, 1 = 8-bit (R/W) */
|
||||
|
||||
#define ED_WD_MSR_ADDR 0x3f /* Memory decode bits 18-13 */
|
||||
#define ED_WD_MSR_MENB 0x40 /* Memory enable */
|
||||
#define ED_WD_MSR_RST 0x80 /* Reset board */
|
||||
|
||||
/*
|
||||
* Interface Configuration Register (ICR)
|
||||
*/
|
||||
#define ED_WD_ICR 1
|
||||
|
||||
#define ED_WD_ICR_16BIT 0x01 /* 16-bit interface */
|
||||
#define ED_WD_ICR_OAR 0x02 /* select register (0=BIO 1=EAR) */
|
||||
#define ED_WD_ICR_IR2 0x04 /* high order bit of encoded IRQ */
|
||||
#define ED_WD_ICR_MSZ 0x08 /* memory size (0=8k 1=32k) */
|
||||
#define ED_WD_ICR_RLA 0x10 /* recall LAN address */
|
||||
#define ED_WD_ICR_RX7 0x20 /* recall all but i/o and LAN address */
|
||||
#define ED_WD_ICR_RIO 0x40 /* recall i/o address */
|
||||
#define ED_WD_ICR_STO 0x80 /* store to non-volatile memory */
|
||||
#ifdef TOSH_ETHER
|
||||
#define ED_WD_ICR_MEM 0xe0 /* shared mem address A15-A13 (R/W) */
|
||||
#define ED_WD_ICR_MSZ1 0x0f /* memory size, 0x08 = 64K, 0x04 = 32K,
|
||||
0x02 = 16K, 0x01 = 8K */
|
||||
/* 64K can only be used if mem address
|
||||
above 1MB */
|
||||
/* IAR holds address A23-A16 (R/W) */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IO Address Register (IAR)
|
||||
*/
|
||||
#define ED_WD_IAR 2
|
||||
|
||||
/*
|
||||
* EEROM Address Register
|
||||
*/
|
||||
#define ED_WD_EAR 3
|
||||
|
||||
/*
|
||||
* Interrupt Request Register (IRR)
|
||||
*/
|
||||
#define ED_WD_IRR 4
|
||||
|
||||
#define ED_WD_IRR_0WS 0x01 /* use 0 wait-states on 8 bit bus */
|
||||
#define ED_WD_IRR_OUT1 0x02 /* WD83C584 pin 1 output */
|
||||
#define ED_WD_IRR_OUT2 0x04 /* WD83C584 pin 2 output */
|
||||
#define ED_WD_IRR_OUT3 0x08 /* WD83C584 pin 3 output */
|
||||
#define ED_WD_IRR_FLASH 0x10 /* Flash RAM is in the ROM socket */
|
||||
|
||||
/*
|
||||
* The three bits of the encoded IRQ are decoded as follows:
|
||||
*
|
||||
* IR2 IR1 IR0 IRQ
|
||||
* 0 0 0 2/9
|
||||
* 0 0 1 3
|
||||
* 0 1 0 5
|
||||
* 0 1 1 7
|
||||
* 1 0 0 10
|
||||
* 1 0 1 11
|
||||
* 1 1 0 15
|
||||
* 1 1 1 4
|
||||
*/
|
||||
#define ED_WD_IRR_IR0 0x20 /* bit 0 of encoded IRQ */
|
||||
#define ED_WD_IRR_IR1 0x40 /* bit 1 of encoded IRQ */
|
||||
#define ED_WD_IRR_IEN 0x80 /* Interrupt enable */
|
||||
|
||||
/*
|
||||
* LA Address Register (LAAR)
|
||||
*/
|
||||
#define ED_WD_LAAR 5
|
||||
|
||||
#define ED_WD_LAAR_ADDRHI 0x1f /* bits 23-19 of RAM address */
|
||||
#define ED_WD_LAAR_0WS16 0x20 /* enable 0 wait-states on 16 bit bus */
|
||||
#define ED_WD_LAAR_L16EN 0x40 /* enable 16-bit operation */
|
||||
#define ED_WD_LAAR_M16EN 0x80 /* enable 16-bit memory access */
|
||||
|
||||
/* i/o base offset to station address/card-ID PROM */
|
||||
#define ED_WD_PROM 8
|
||||
|
||||
/*
|
||||
* 83C790 specific registers
|
||||
*/
|
||||
/*
|
||||
* Hardware Support Register (HWR) ('790)
|
||||
*/
|
||||
#define ED_WD790_HWR 4
|
||||
|
||||
#define ED_WD790_HWR_RST 0x10 /* hardware reset */
|
||||
#define ED_WD790_HWR_LPRM 0x40 /* LAN PROM select */
|
||||
#define ED_WD790_HWR_SWH 0x80 /* switch register set */
|
||||
|
||||
/*
|
||||
* ICR790 Interrupt Control Register for the 83C790
|
||||
*/
|
||||
#define ED_WD790_ICR 6
|
||||
|
||||
#define ED_WD790_ICR_EIL 0x01 /* enable interrupts */
|
||||
|
||||
/*
|
||||
* General Control Register (GCR)
|
||||
* Eanbled with SWH bit == 1 in HWR register
|
||||
*/
|
||||
#define ED_WD790_GCR 0x0d
|
||||
|
||||
#define ED_WD790_GCR_IR0 0x04 /* bit 0 of encoded IRQ */
|
||||
#define ED_WD790_GCR_IR1 0x08 /* bit 1 of encoded IRQ */
|
||||
#define ED_WD790_GCR_ZWSEN 0x20 /* zero wait state enable */
|
||||
#define ED_WD790_GCR_IR2 0x40 /* bit 2 of encoded IRQ */
|
||||
/*
|
||||
* The three bits of the encoded IRQ are decoded as follows:
|
||||
*
|
||||
* IR2 IR1 IR0 IRQ
|
||||
* 0 0 0 none
|
||||
* 0 0 1 9
|
||||
* 0 1 0 3
|
||||
* 0 1 1 5
|
||||
* 1 0 0 7
|
||||
* 1 0 1 10
|
||||
* 1 1 0 11
|
||||
* 1 1 1 15
|
||||
*/
|
||||
|
||||
/* i/o base offset to CARD ID */
|
||||
#define ED_WD_CARD_ID ED_WD_PROM+6
|
||||
|
||||
/* Board type codes in card ID */
|
||||
#define ED_TYPE_WD8003S 0x02
|
||||
#define ED_TYPE_WD8003E 0x03
|
||||
#define ED_TYPE_WD8013EBT 0x05
|
||||
#define ED_TYPE_TOSHIBA1 0x11 /* named PCETA1 */
|
||||
#define ED_TYPE_TOSHIBA2 0x12 /* named PCETA2 */
|
||||
#define ED_TYPE_TOSHIBA3 0x13 /* named PCETB */
|
||||
#define ED_TYPE_TOSHIBA4 0x14 /* named PCETC */
|
||||
#define ED_TYPE_WD8003W 0x24
|
||||
#define ED_TYPE_WD8003EB 0x25
|
||||
#define ED_TYPE_WD8013W 0x26
|
||||
#define ED_TYPE_WD8013EP 0x27
|
||||
#define ED_TYPE_WD8013WC 0x28
|
||||
#define ED_TYPE_WD8013EPC 0x29
|
||||
#define ED_TYPE_SMC8216T 0x2a
|
||||
#define ED_TYPE_SMC8216C 0x2b
|
||||
#define ED_TYPE_WD8013EBP 0x2c
|
||||
|
||||
/* Bit definitions in card ID */
|
||||
#define ED_WD_REV_MASK 0x1f /* Revision mask */
|
||||
#define ED_WD_SOFTCONFIG 0x20 /* Soft config */
|
||||
#define ED_WD_LARGERAM 0x40 /* Large RAM */
|
||||
#define ED_MICROCHANEL 0x80 /* Microchannel bus (vs. isa) */
|
||||
|
||||
/*
|
||||
* Checksum total. All 8 bytes in station address PROM will add up to this.
|
||||
*/
|
||||
#ifdef TOSH_ETHER
|
||||
#define ED_WD_ROM_CHECKSUM_TOTAL 0xA5
|
||||
#else
|
||||
#define ED_WD_ROM_CHECKSUM_TOTAL 0xFF
|
||||
#endif
|
||||
|
||||
#define ED_WD_NIC_OFFSET 0x10 /* I/O base offset to NIC */
|
||||
#define ED_WD_ASIC_OFFSET 0 /* I/O base offset to ASIC */
|
||||
#define ED_WD_IO_PORTS 32 /* # of i/o addresses used */
|
||||
|
||||
#define ED_WD_PAGE_OFFSET 0 /* page offset for NIC access to mem */
|
||||
|
||||
/*
|
||||
* Definitions for 3Com 3c503
|
||||
*/
|
||||
#define ED_3COM_NIC_OFFSET 0
|
||||
#define ED_3COM_ASIC_OFFSET 0x400 /* offset to nic i/o regs */
|
||||
|
||||
/*
|
||||
* XXX - The I/O address range is fragmented in the 3c503; this is the
|
||||
* number of regs at iobase.
|
||||
*/
|
||||
#define ED_3COM_IO_PORTS 16 /* # of i/o addresses used */
|
||||
|
||||
/* tx memory starts in second bank on 8bit cards */
|
||||
#define ED_3COM_TX_PAGE_OFFSET_8BIT 0x20
|
||||
|
||||
/* tx memory starts in first bank on 16bit cards */
|
||||
#define ED_3COM_TX_PAGE_OFFSET_16BIT 0x0
|
||||
|
||||
/* ...and rx memory starts in second bank */
|
||||
#define ED_3COM_RX_PAGE_OFFSET_16BIT 0x20
|
||||
|
||||
|
||||
/*
|
||||
* Page Start Register. Must match PSTART in NIC.
|
||||
*/
|
||||
#define ED_3COM_PSTR 0
|
||||
|
||||
/*
|
||||
* Page Stop Register. Must match PSTOP in NIC.
|
||||
*/
|
||||
#define ED_3COM_PSPR 1
|
||||
|
||||
/*
|
||||
* DrQ Timer Register. Determines number of bytes to be transfered during a
|
||||
* DMA burst.
|
||||
*/
|
||||
#define ED_3COM_DQTR 2
|
||||
|
||||
/*
|
||||
* Base Configuration Register. Read-only register which contains the
|
||||
* board-configured I/O base address of the adapter. Bit encoded.
|
||||
*/
|
||||
#define ED_3COM_BCFR 3
|
||||
|
||||
/*
|
||||
* EPROM Configuration Register. Read-only register which contains the
|
||||
* board-configured memory base address. Bit encoded.
|
||||
*/
|
||||
#define ED_3COM_PCFR 4
|
||||
|
||||
/*
|
||||
* GA Configuration Register. Gate-Array Configuration Register.
|
||||
*
|
||||
* mbs2 mbs1 mbs0 start address
|
||||
* 0 0 0 0x0000
|
||||
* 0 0 1 0x2000
|
||||
* 0 1 0 0x4000
|
||||
* 0 1 1 0x6000
|
||||
*
|
||||
* Note that with adapters with only 8K, the setting for 0x2000 must always be
|
||||
* used.
|
||||
*/
|
||||
#define ED_3COM_GACFR 5
|
||||
|
||||
#define ED_3COM_GACFR_MBS0 0x01
|
||||
#define ED_3COM_GACFR_MBS1 0x02
|
||||
#define ED_3COM_GACFR_MBS2 0x04
|
||||
|
||||
#define ED_3COM_GACFR_RSEL 0x08 /* enable shared memory */
|
||||
#define ED_3COM_GACFR_TEST 0x10 /* for GA testing */
|
||||
#define ED_3COM_GACFR_OWS 0x20 /* select 0WS access to GA */
|
||||
#define ED_3COM_GACFR_TCM 0x40 /* Mask DMA interrupts */
|
||||
#define ED_3COM_GACFR_NIM 0x80 /* Mask NIC interrupts */
|
||||
|
||||
/*
|
||||
* Control Register. Miscellaneous control functions.
|
||||
*/
|
||||
#define ED_3COM_CR 6
|
||||
|
||||
#define ED_3COM_CR_RST 0x01 /* Reset GA and NIC */
|
||||
#define ED_3COM_CR_XSEL 0x02 /* Transceiver select. BNC=1(def) AUI=0 */
|
||||
#define ED_3COM_CR_EALO 0x04 /* window EA PROM 0-15 to I/O base */
|
||||
#define ED_3COM_CR_EAHI 0x08 /* window EA PROM 16-31 to I/O base */
|
||||
#define ED_3COM_CR_SHARE 0x10 /* select interrupt sharing option */
|
||||
#define ED_3COM_CR_DBSEL 0x20 /* Double buffer select */
|
||||
#define ED_3COM_CR_DDIR 0x40 /* DMA direction select */
|
||||
#define ED_3COM_CR_START 0x80 /* Start DMA controller */
|
||||
|
||||
/*
|
||||
* Status Register. Miscellaneous status information.
|
||||
*/
|
||||
#define ED_3COM_STREG 7
|
||||
|
||||
#define ED_3COM_STREG_REV 0x07 /* GA revision */
|
||||
#define ED_3COM_STREG_DIP 0x08 /* DMA in progress */
|
||||
#define ED_3COM_STREG_DTC 0x10 /* DMA terminal count */
|
||||
#define ED_3COM_STREG_OFLW 0x20 /* Overflow */
|
||||
#define ED_3COM_STREG_UFLW 0x40 /* Underflow */
|
||||
#define ED_3COM_STREG_DPRDY 0x80 /* Data port ready */
|
||||
|
||||
/*
|
||||
* Interrupt/DMA Configuration Register
|
||||
*/
|
||||
#define ED_3COM_IDCFR 8
|
||||
|
||||
#define ED_3COM_IDCFR_DRQ 0x07 /* DMA request */
|
||||
#define ED_3COM_IDCFR_UNUSED 0x08 /* not used */
|
||||
#if 0
|
||||
#define ED_3COM_IDCFR_IRQ 0xF0 /* Interrupt request */
|
||||
#else
|
||||
#define ED_3COM_IDCFR_IRQ2 0x10 /* Interrupt request 2 select */
|
||||
#define ED_3COM_IDCFR_IRQ3 0x20 /* Interrupt request 3 select */
|
||||
#define ED_3COM_IDCFR_IRQ4 0x40 /* Interrupt request 4 select */
|
||||
#define ED_3COM_IDCFR_IRQ5 0x80 /* Interrupt request 5 select */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* DMA Address Register MSB
|
||||
*/
|
||||
#define ED_3COM_DAMSB 9
|
||||
|
||||
/*
|
||||
* DMA Address Register LSB
|
||||
*/
|
||||
#define ED_3COM_DALSB 0x0a
|
||||
|
||||
/*
|
||||
* Vector Pointer Register 2
|
||||
*/
|
||||
#define ED_3COM_VPTR2 0x0b
|
||||
|
||||
/*
|
||||
* Vector Pointer Register 1
|
||||
*/
|
||||
#define ED_3COM_VPTR1 0x0c
|
||||
|
||||
/*
|
||||
* Vector Pointer Register 0
|
||||
*/
|
||||
#define ED_3COM_VPTR0 0x0d
|
||||
|
||||
/*
|
||||
* Register File Access MSB
|
||||
*/
|
||||
#define ED_3COM_RFMSB 0x0e
|
||||
|
||||
/*
|
||||
* Register File Access LSB
|
||||
*/
|
||||
#define ED_3COM_RFLSB 0x0f
|
||||
|
||||
/*
|
||||
* Definitions for Novell NE1000/2000 boards
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board type codes
|
||||
*/
|
||||
#define ED_TYPE_NE1000 0x01
|
||||
#define ED_TYPE_NE2000 0x02
|
||||
|
||||
/*
|
||||
* Register offsets/total
|
||||
*/
|
||||
#define ED_NOVELL_NIC_OFFSET 0x200
|
||||
#define ED_NOVELL_ASIC_OFFSET 0x220
|
||||
#define ED_NOVELL_IO_PORTS 32
|
||||
|
||||
/*
|
||||
* Remote DMA data register; for reading or writing to the NIC mem via
|
||||
* programmed I/O (offset from ASIC base).
|
||||
*/
|
||||
#define ED_NOVELL_DATA 0x00
|
||||
|
||||
/*
|
||||
* Reset register; reading from this register causes a board reset.
|
||||
*/
|
||||
#define ED_NOVELL_RESET 0x1e
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,604 @@
|
|||
/*
|
||||
* National Semiconductor DS8390 NIC register definitions
|
||||
*
|
||||
* $Id: if_sereg.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*
|
||||
* Modification history
|
||||
*
|
||||
* $Log: if_sereg.h,v $
|
||||
* Revision 1.1.1.1 1996/05/05 12:17:03 oki
|
||||
* NetBSD/x68k, by Masaru Oki.
|
||||
*
|
||||
* Revision 1.1 1995/05/16 19:54:23 oki
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.2 1994/03/01 15:24:26 briggs
|
||||
* More Dayna separation.
|
||||
*
|
||||
* Revision 1.1 1993/11/29 00:32:46 briggs
|
||||
* Update to current work in progress. This includes an update to
|
||||
* use config.new.
|
||||
* Numerous updates to console so it works better on the SE/30 screen.
|
||||
* Some nice changes from Brad Parker for handling NuBUS and an ethernet
|
||||
* driver that I haven't worked on, yet.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#define CMD_CLEAR_TALLIES 0x02
|
||||
#define CMD_SEND_ETHERPACKET 0x05
|
||||
#define CMD_RECIEVE_ETHERPACKET 0x0e
|
||||
#define CMD_SET_ETHERADDR 0x06
|
||||
#define CMD_SET_MULTICASTADDR 0x09
|
||||
#define CMD_SET_PACKETRECEPTMODE 0x0c
|
||||
#define CMD_ETHERNET_RECIEVE 0x0d
|
||||
|
||||
/*
|
||||
* Page 0 register offsets
|
||||
*/
|
||||
#define SE_P0_CR 0x00 /* Command Register */
|
||||
|
||||
#define SE_P0_CLDA0 0x01 /* Current Local DMA Addr low (read) */
|
||||
#define SE_P0_PSTART 0x01 /* Page Start register (write) */
|
||||
|
||||
#define SE_P0_CLDA1 0x02 /* Current Local DMA Addr high (read) */
|
||||
#define SE_P0_PSTOP 0x02 /* Page Stop register (write) */
|
||||
|
||||
#define SE_P0_BNRY 0x03 /* Boundary Pointer */
|
||||
|
||||
#define SE_P0_TSR 0x04 /* Transmit Status Register (read) */
|
||||
#define SE_P0_TPSR 0x04 /* Transmit Page Start (write) */
|
||||
|
||||
#define SE_P0_NCR 0x05 /* Number of Collisions Reg (read) */
|
||||
#define SE_P0_TBCR0 0x05 /* Transmit Byte count, low (write) */
|
||||
|
||||
#define SE_P0_FIFO 0x06 /* FIFO register (read) */
|
||||
#define SE_P0_TBCR1 0x06 /* Transmit Byte count, high (write) */
|
||||
|
||||
#define SE_P0_ISR 0x07 /* Interrupt Status Register */
|
||||
|
||||
#define SE_P0_CRDA0 0x08 /* Current Remote DMA Addr low (read) */
|
||||
#define SE_P0_RSAR0 0x08 /* Remote Start Address low (write) */
|
||||
|
||||
#define SE_P0_CRDA1 0x09 /* Current Remote DMA Addr high (read) */
|
||||
#define SE_P0_RSAR1 0x09 /* Remote Start Address high (write) */
|
||||
|
||||
#define SE_P0_RBCR0 0x0a /* Remote Byte Count low (write) */
|
||||
|
||||
#define SE_P0_RBCR1 0x0b /* Remote Byte Count high (write) */
|
||||
|
||||
#define SE_P0_RSR 0x0c /* Receive Status (read) */
|
||||
#define SE_P0_RCR 0x0c /* Receive Configuration Reg (write) */
|
||||
|
||||
#define SE_P0_CNTR0 0x0d /* frame alignment error counter (read) */
|
||||
#define SE_P0_TCR 0x0d /* Transmit Configuration Reg (write) */
|
||||
|
||||
#define SE_P0_CNTR1 0x0e /* CRC error counter (read) */
|
||||
#define SE_P0_DCR 0x0e /* Data Configuration Reg (write) */
|
||||
|
||||
#define SE_P0_CNTR2 0x0f /* missed packet counter (read) */
|
||||
#define SE_P0_IMR 0x0f /* Interrupt Mask Register (write) */
|
||||
|
||||
/*
|
||||
* Page 1 register offsets
|
||||
*/
|
||||
#define SE_P1_CR 0x00 /* Command Register */
|
||||
#define SE_P1_PAR0 0x01 /* Physical Address Register 0 */
|
||||
#define SE_P1_PAR1 0x02 /* Physical Address Register 1 */
|
||||
#define SE_P1_PAR2 0x03 /* Physical Address Register 2 */
|
||||
#define SE_P1_PAR3 0x04 /* Physical Address Register 3 */
|
||||
#define SE_P1_PAR4 0x05 /* Physical Address Register 4 */
|
||||
#define SE_P1_PAR5 0x06 /* Physical Address Register 5 */
|
||||
#define SE_P1_CURR 0x07 /* Current RX ring-buffer page */
|
||||
#define SE_P1_MAR0 0x08 /* Multicast Address Register 0 */
|
||||
#define SE_P1_MAR1 0x09 /* Multicast Address Register 1 */
|
||||
#define SE_P1_MAR2 0x0a /* Multicast Address Register 2 */
|
||||
#define SE_P1_MAR3 0x0b /* Multicast Address Register 3 */
|
||||
#define SE_P1_MAR4 0x0c /* Multicast Address Register 4 */
|
||||
#define SE_P1_MAR5 0x0d /* Multicast Address Register 5 */
|
||||
#define SE_P1_MAR6 0x0e /* Multicast Address Register 6 */
|
||||
#define SE_P1_MAR7 0x0f /* Multicast Address Register 7 */
|
||||
|
||||
/*
|
||||
* Page 2 register offsets
|
||||
*/
|
||||
#define SE_P2_CR 0x00 /* Command Register */
|
||||
#define SE_P2_PSTART 0x01 /* Page Start (read) */
|
||||
#define SE_P2_CLDA0 0x01 /* Current Local DMA Addr 0 (write) */
|
||||
#define SE_P2_PSTOP 0x02 /* Page Stop (read) */
|
||||
#define SE_P2_CLDA1 0x02 /* Current Local DMA Addr 1 (write) */
|
||||
#define SE_P2_RNPP 0x03 /* Remote Next Packet Pointer */
|
||||
#define SE_P2_TPSR 0x04 /* Transmit Page Start (read) */
|
||||
#define SE_P2_LNPP 0x05 /* Local Next Packet Pointer */
|
||||
#define SE_P2_ACU 0x06 /* Address Counter Upper */
|
||||
#define SE_P2_ACL 0x07 /* Address Counter Lower */
|
||||
#define SE_P2_RCR 0x0c /* Receive Configuration Register (read) */
|
||||
#define SE_P2_TCR 0x0d /* Transmit Configuration Register (read) */
|
||||
#define SE_P2_DCR 0x0e /* Data Configuration Register (read) */
|
||||
#define SE_P2_IMR 0x0f /* Interrupt Mask Register (read) */
|
||||
|
||||
/*
|
||||
* Command Register (CR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* STP: SToP. Software reset command. Takes the controller offline. No
|
||||
* packets will be received or transmitted. Any reception or
|
||||
* transmission in progress will continue to completion before
|
||||
* entering reset state. To exit this state, the STP bit must
|
||||
* reset and the STA bit must be set. The software reset has
|
||||
* executed only when indicated by the RST bit in the ISR being
|
||||
* set.
|
||||
*/
|
||||
#define SE_CR_STP 0x01
|
||||
|
||||
/*
|
||||
* STA: STArt. This bit is used to activate the NIC after either power-up,
|
||||
* or when the NIC has been put in reset mode by software command
|
||||
* or error.
|
||||
*/
|
||||
#define SE_CR_STA 0x02
|
||||
|
||||
/*
|
||||
* TXP: Transmit Packet. This bit must be set to indicate transmission of
|
||||
* a packet. TXP is internally reset either after the transmission is
|
||||
* completed or aborted. This bit should be set only after the Transmit
|
||||
* Byte Count and Transmit Page Start register have been programmed.
|
||||
*/
|
||||
#define SE_CR_TXP 0x04
|
||||
|
||||
/*
|
||||
* RD0, RD1, RD2: Remote DMA Command. These three bits control the operation
|
||||
* of the remote DMA channel. RD2 can be set to abort any remote DMA
|
||||
* command in progress. The Remote Byte Count registers should be cleared
|
||||
* when a remote DMA has been aborted. The Remote Start Addresses are not
|
||||
* restored to the starting address if the remote DMA is aborted.
|
||||
*
|
||||
* RD2 RD1 RD0 function
|
||||
* 0 0 0 not allowed
|
||||
* 0 0 1 remote read
|
||||
* 0 1 0 remote write
|
||||
* 0 1 1 send packet
|
||||
* 1 X X abort
|
||||
*/
|
||||
#define SE_CR_RD0 0x08
|
||||
#define SE_CR_RD1 0x10
|
||||
#define SE_CR_RD2 0x20
|
||||
|
||||
/*
|
||||
* PS0, PS1: Page Select. The two bits select which register set or 'page' to
|
||||
* access.
|
||||
*
|
||||
* PS1 PS0 page
|
||||
* 0 0 0
|
||||
* 0 1 1
|
||||
* 1 0 2
|
||||
* 1 1 reserved
|
||||
*/
|
||||
#define SE_CR_PS0 0x40
|
||||
#define SE_CR_PS1 0x80
|
||||
/* bit encoded aliases */
|
||||
#define SE_CR_PAGE_0 0x00 /* (for consistency) */
|
||||
#define SE_CR_PAGE_1 0x40
|
||||
#define SE_CR_PAGE_2 0x80
|
||||
|
||||
/*
|
||||
* Interrupt Status Register (ISR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* PRX: Packet Received. Indicates packet received with no errors.
|
||||
*/
|
||||
#define SE_ISR_PRX 0x01
|
||||
|
||||
/*
|
||||
* PTX: Packet Transmitted. Indicates packet transmitted with no errors.
|
||||
*/
|
||||
#define SE_ISR_PTX 0x02
|
||||
|
||||
/*
|
||||
* RXE: Receive Error. Indicates that a packet was received with one or more
|
||||
* the following errors: CRC error, frame alignment error, FIFO overrun,
|
||||
* missed packet.
|
||||
*/
|
||||
#define SE_ISR_RXE 0x04
|
||||
|
||||
/*
|
||||
* TXE: Transmission Error. Indicates that an attempt to transmit a packet
|
||||
* resulted in one or more of the following errors: excessive
|
||||
* collisions, FIFO underrun.
|
||||
*/
|
||||
#define SE_ISR_TXE 0x08
|
||||
|
||||
/*
|
||||
* OVW: OverWrite. Indicates a receive ring-buffer overrun. Incoming network
|
||||
* would exceed (has exceeded?) the boundry pointer, resulting in data
|
||||
* that was previously received and not yet read from the buffer to be
|
||||
* overwritten.
|
||||
*/
|
||||
#define SE_ISR_OVW 0x10
|
||||
|
||||
/*
|
||||
* CNT: Counter Overflow. Set when the MSB of one or more of the Network Talley
|
||||
* Counters has been set.
|
||||
*/
|
||||
#define SE_ISR_CNT 0x20
|
||||
|
||||
/*
|
||||
* RDC: Remote Data Complete. Indicates that a Remote DMA operation has completed.
|
||||
*/
|
||||
#define SE_ISR_RDC 0x40
|
||||
|
||||
/*
|
||||
* RST: Reset status. Set when the NIC enters the reset state and cleared when a
|
||||
* Start Command is issued to the CR. This bit is also set when a receive
|
||||
* ring-buffer overrun (OverWrite) occurs and is cleared when one or more
|
||||
* packets have been removed from the ring. This is a read-only bit.
|
||||
*/
|
||||
#define SE_ISR_RST 0x80
|
||||
|
||||
/*
|
||||
* Interrupt Mask Register (IMR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* PRXE: Packet Received interrupt Enable. If set, a received packet will cause
|
||||
* an interrupt.
|
||||
*/
|
||||
#define SE_IMR_PRXE 0x01
|
||||
|
||||
/*
|
||||
* PTXE: Packet Transmit interrupt Enable. If set, an interrupt is generated when
|
||||
* a packet transmission completes.
|
||||
*/
|
||||
#define SE_IMR_PTXE 0x02
|
||||
|
||||
/*
|
||||
* RXEE: Receive Error interrupt Enable. If set, an interrupt will occur whenever a
|
||||
* packet is received with an error.
|
||||
*/
|
||||
#define SE_IMR_RXEE 0x04
|
||||
|
||||
/*
|
||||
* TXEE: Transmit Error interrupt Enable. If set, an interrupt will occur whenever
|
||||
* a transmission results in an error.
|
||||
*/
|
||||
#define SE_IMR_TXEE 0x08
|
||||
|
||||
/*
|
||||
* OVWE: OverWrite error interrupt Enable. If set, an interrupt is generated whenever
|
||||
* the receive ring-buffer is overrun. i.e. when the boundry pointer is exceeded.
|
||||
*/
|
||||
#define SE_IMR_OVWE 0x10
|
||||
|
||||
/*
|
||||
* CNTE: Counter overflow interrupt Enable. If set, an interrupt is generated whenever
|
||||
* the MSB of one or more of the Network Statistics counters has been set.
|
||||
*/
|
||||
#define SE_IMR_CNTE 0x20
|
||||
|
||||
/*
|
||||
* RDCE: Remote DMA Complete interrupt Enable. If set, an interrupt is generated
|
||||
* when a remote DMA transfer has completed.
|
||||
*/
|
||||
#define SE_IMR_RDCE 0x40
|
||||
|
||||
/*
|
||||
* bit 7 is unused/reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Data Configuration Register (DCR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* WTS: Word Transfer Select. WTS establishes byte or word transfers for
|
||||
* both remote and local DMA transfers
|
||||
*/
|
||||
#define SE_DCR_WTS 0x01
|
||||
|
||||
/*
|
||||
* BOS: Byte Order Select. BOS sets the byte order for the host.
|
||||
* Should be 0 for 80x86, and 1 for 68000 series processors
|
||||
*/
|
||||
#define SE_DCR_BOS 0x02
|
||||
|
||||
/*
|
||||
* LAS: Long Address Select. When LAS is 1, the contents of the remote
|
||||
* DMA registers RSAR0 and RSAR1 are used to provide A16-A31
|
||||
*/
|
||||
#define SE_DCR_LAS 0x04
|
||||
|
||||
#ifdef huh
|
||||
/*
|
||||
* LS: Loopback Select. When 0, loopback mode is selected. Bits D1 and D2
|
||||
* of the TCR must also be programmed for loopback operation.
|
||||
* When 1, normal operation is selected.
|
||||
*/
|
||||
#define SE_DCR_LS 0x08
|
||||
#endif
|
||||
/*
|
||||
* BMS: Burst Mode Select
|
||||
*/
|
||||
#define SE_DCR_BMS 0x08
|
||||
|
||||
/*
|
||||
* AR: Auto-initialize Remote. When 0, data must be removed from ring-buffer
|
||||
* under program control. When 1, remote DMA is automatically initiated
|
||||
* and the boundry pointer is automatically updated
|
||||
*/
|
||||
#define SE_DCR_AR 0x10
|
||||
|
||||
/*
|
||||
* FT0, FT1: Fifo Threshold select.
|
||||
* FT1 FT0 Word-width Byte-width
|
||||
* 0 0 1 word 2 bytes
|
||||
* 0 1 2 words 4 bytes
|
||||
* 1 0 4 words 8 bytes
|
||||
* 1 1 8 words 12 bytes
|
||||
*
|
||||
* During transmission, the FIFO threshold indicates the number of bytes
|
||||
* or words that the FIFO has filled from the local DMA before BREQ is
|
||||
* asserted. The transmission threshold is 16 bytes minus the receiver
|
||||
* threshold.
|
||||
*/
|
||||
#define SE_DCR_FT0 0x20
|
||||
#define SE_DCR_FT1 0x40
|
||||
|
||||
/*
|
||||
* bit 7 (0x80) is unused/reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Transmit Configuration Register (TCR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* CRC: Inhibit CRC. If 0, CRC will be appended by the transmitter, if 0, CRC
|
||||
* is not appended by the transmitter.
|
||||
*/
|
||||
#define SE_TCR_CRC 0x01
|
||||
|
||||
/*
|
||||
* LB0, LB1: Loopback control. These two bits set the type of loopback that is
|
||||
* to be performed.
|
||||
*
|
||||
* LB1 LB0 mode
|
||||
* 0 0 0 - normal operation (DCR_LS = 0)
|
||||
* 0 1 1 - internal loopback (DCR_LS = 0)
|
||||
* 1 0 2 - external loopback (DCR_LS = 1)
|
||||
* 1 1 3 - external loopback (DCR_LS = 0)
|
||||
*/
|
||||
#define SE_TCR_LB0 0x02
|
||||
#define SE_TCR_LB1 0x04
|
||||
|
||||
/*
|
||||
* ATD: Auto Transmit Disable. Clear for normal operation. When set, allows
|
||||
* another station to disable the NIC's transmitter by transmitting to
|
||||
* a multicast address hashing to bit 62. Reception of a multicast address
|
||||
* hashing to bit 63 enables the transmitter.
|
||||
*/
|
||||
#define SE_TCR_ATD 0x08
|
||||
|
||||
/*
|
||||
* OFST: Collision Offset enable. This bit when set modifies the backoff
|
||||
* algorithm to allow prioritization of nodes.
|
||||
*/
|
||||
#define SE_TCR_OFST 0x10
|
||||
|
||||
/*
|
||||
* bits 5, 6, and 7 are unused/reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* Transmit Status Register (TSR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* PTX: Packet Transmitted. Indicates successful transmission of packet.
|
||||
*/
|
||||
#define SE_TSR_PTX 0x01
|
||||
|
||||
/*
|
||||
* bit 1 (0x02) is unused/reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
* COL: Transmit Collided. Indicates that the transmission collided at least
|
||||
* once with another station on the network.
|
||||
*/
|
||||
#define SE_TSR_COL 0x04
|
||||
|
||||
/*
|
||||
* ABT: Transmit aborted. Indicates that the transmission was aborted due to
|
||||
* excessive collisions.
|
||||
*/
|
||||
#define SE_TSR_ABT 0x08
|
||||
|
||||
/*
|
||||
* CRS: Carrier Sense Lost. Indicates that carrier was lost during the
|
||||
* transmission of the packet. (Transmission is not aborted because
|
||||
* of a loss of carrier)
|
||||
*/
|
||||
#define SE_TSR_CRS 0x10
|
||||
|
||||
/*
|
||||
* FU: FIFO Underrun. Indicates that the NIC wasn't able to access bus/
|
||||
* transmission memory before the FIFO emptied. Transmission of the
|
||||
* packet was aborted.
|
||||
*/
|
||||
#define SE_TSR_FU 0x20
|
||||
|
||||
/*
|
||||
* CDH: CD Heartbeat. Indicates that the collision detection circuitry
|
||||
* isn't working correctly during a collision heartbeat test.
|
||||
*/
|
||||
#define SE_TSR_CDH 0x40
|
||||
|
||||
/*
|
||||
* OWC: Out of Window Collision: Indicates that a collision occurred after
|
||||
* a slot time (51.2us). The transmission is rescheduled just as in
|
||||
* normal collisions.
|
||||
*/
|
||||
#define SE_TSR_OWC 0x80
|
||||
|
||||
/*
|
||||
* Receiver Configuration Register (RCR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* SEP: Save Errored Packets. If 0, error packets are discarded. If set to 1,
|
||||
* packets with CRC and frame errors are not discarded.
|
||||
*/
|
||||
#define SE_RCR_SEP 0x01
|
||||
|
||||
/*
|
||||
* AR: Accept Runt packet. If 0, packet with less than 64 byte are discarded.
|
||||
* If set to 1, packets with less than 64 byte are not discarded.
|
||||
*/
|
||||
#define SE_RCR_AR 0x02
|
||||
|
||||
/*
|
||||
* AB: Accept Broadcast. If set, packets sent to the broadcast address will be
|
||||
* accepted.
|
||||
*/
|
||||
#define SE_RCR_AB 0x04
|
||||
|
||||
/*
|
||||
* AM: Accept Multicast. If set, packets sent to a multicast address are checked
|
||||
* for a match in the hashing array. If clear, multicast packets are ignored.
|
||||
*/
|
||||
#define SE_RCR_AM 0x08
|
||||
|
||||
/*
|
||||
* PRO: Promiscuous Physical. If set, all packets with a physical addresses are
|
||||
* accepted. If clear, a physical destination address must match this
|
||||
* station's address. Note: for full promiscuous mode, RCR_AB and RCR_AM
|
||||
* must also be set. In addition, the multicast hashing array must be set
|
||||
* to all 1's so that all multicast addresses are accepted.
|
||||
*/
|
||||
#define SE_RCR_PRO 0x10
|
||||
|
||||
/*
|
||||
* MON: Monitor Mode. If set, packets will be checked for good CRC and framing,
|
||||
* but are not stored in the ring-buffer. If clear, packets are stored (normal
|
||||
* operation).
|
||||
*/
|
||||
#define SE_RCR_MON 0x20
|
||||
|
||||
/*
|
||||
* bits 6 and 7 are unused/reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Receiver Status Register (RSR) definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* PRX: Packet Received without error.
|
||||
*/
|
||||
#define SE_RSR_PRX 0x01
|
||||
|
||||
/*
|
||||
* CRC: CRC error. Indicates that a packet has a CRC error. Also set for frame
|
||||
* alignment errors.
|
||||
*/
|
||||
#define SE_RSR_CRC 0x02
|
||||
|
||||
/*
|
||||
* FAE: Frame Alignment Error. Indicates that the incoming packet did not end on
|
||||
* a byte boundry and the CRC did not match at the last byte boundry.
|
||||
*/
|
||||
#define SE_RSR_FAE 0x04
|
||||
|
||||
/*
|
||||
* FO: FIFO Overrun. Indicates that the FIFO was not serviced (during local DMA)
|
||||
* causing it to overrun. Reception of the packet is aborted.
|
||||
*/
|
||||
#define SE_RSR_FO 0x08
|
||||
|
||||
/*
|
||||
* MPA: Missed Packet. Indicates that the received packet couldn't be stored in
|
||||
* the ring-buffer because of insufficient buffer space (exceeding the
|
||||
* boundry pointer), or because the transfer to the ring-buffer was inhibited
|
||||
* by RCR_MON - monitor mode.
|
||||
*/
|
||||
#define SE_RSR_MPA 0x10
|
||||
|
||||
/*
|
||||
* PHY: Physical address. If 0, the packet received was sent to a physical address.
|
||||
* If 1, the packet was accepted because of a multicast/broadcast address
|
||||
* match.
|
||||
*/
|
||||
#define SE_RSR_PHY 0x20
|
||||
|
||||
/*
|
||||
* DIS: Receiver Disabled. Set to indicate that the receiver has enetered monitor
|
||||
* mode. Cleared when the receiver exits monitor mode.
|
||||
*/
|
||||
#define SE_RSR_DIS 0x40
|
||||
|
||||
/*
|
||||
* DFR: Deferring. Set to indicate a 'jabber' condition. The CRS and COL inputs
|
||||
* are active, and the transceiver has set the CD line as a result of the
|
||||
* jabber.
|
||||
*/
|
||||
#define SE_RSR_DFR 0x80
|
||||
|
||||
/*
|
||||
* receive ring discriptor
|
||||
*
|
||||
* The National Semiconductor DS8390 Network interface controller uses
|
||||
* the following receive ring headers. The way this works is that the
|
||||
* memory on the interface card is chopped up into 256 bytes blocks.
|
||||
* A contiguous portion of those blocks are marked for receive packets
|
||||
* by setting start and end block #'s in the NIC. For each packet that
|
||||
* is put into the receive ring, one of these headers (4 bytes each) is
|
||||
* tacked onto the front.
|
||||
*/
|
||||
struct SE_ring {
|
||||
u_char rcv_status; /* received packet status */
|
||||
u_char next_packet; /* pointer to next packet */
|
||||
u_char count[2]; /* bytes in packet (length + 4) */
|
||||
};
|
||||
|
||||
/*
|
||||
* Common constants
|
||||
*/
|
||||
#define SE_PAGE_SIZE 256 /* Size of RAM pages in bytes */
|
||||
#define SE_TXBUF_SIZE 6 /* Size of TX buffer in pages */
|
||||
|
||||
/*
|
||||
* Vendor types
|
||||
*/
|
||||
#define SE_VENDOR_UNKNOWN 0xFF /* Unknown network card */
|
||||
#define SE_VENDOR_APPLE 0x00 /* Apple Ethernet card */
|
||||
#define SE_VENDOR_INTERLAN 0x01 /* Interlan A310 card (GatorCard) */
|
||||
#define SE_VENDOR_DAYNA 0x02 /* DaynaPORT E/30s (and others?) */
|
||||
|
||||
/*
|
||||
* Compile-time config flags
|
||||
*/
|
||||
/*
|
||||
* this sets the default for enabling/disablng the tranceiver
|
||||
*/
|
||||
#define SE_FLAGS_DISABLE_TRANCEIVER 0x01
|
||||
|
||||
/*
|
||||
* This disables the use of double transmit buffers.
|
||||
*/
|
||||
#define SE_FLAGS_NO_DOUBLE_BUFFERING 0x08
|
||||
|
||||
/* */
|
||||
#define GC_RESET_OFFSET 0x000c0000 /* writes here reset NIC */
|
||||
#define GC_ROM_OFFSET 0x000c0000 /* address prom */
|
||||
#define GC_DATA_OFFSET 0x000d0000 /* Offset to NIC memory */
|
||||
#define GC_NIC_OFFSET 0x000e0000 /* Offset to NIC registers */
|
||||
|
||||
#define DP_ROM_OFFSET 0x000f0000
|
||||
#define DP_DATA_OFFSET 0x000d0000 /* Offset to SONIC memory */
|
||||
#define DP_NIC_OFFSET 0x000e0000 /* Offset to SONIC registers */
|
||||
|
||||
#define SE_ROM_OFFSET 0x000f0000
|
||||
#define SE_DATA_OFFSET 0x000d0000 /* Offset to NIC memory */
|
||||
#define SE_NIC_OFFSET 0x000e0000 /* Offset to NIC registers */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: iteioctl.h 1.1 90/07/09$
|
||||
*
|
||||
* @(#)iteioctl.h 7.2 (Berkeley) 11/4/90
|
||||
* $Id: iteioctl.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*/
|
||||
|
||||
struct itewinsize {
|
||||
int x; /* leftedge offset to the right */
|
||||
int y; /* topedge offset down */
|
||||
u_int width; /* width of ite display */
|
||||
u_int height; /* height of ite display */
|
||||
u_int depth; /* depth of ite display */
|
||||
};
|
||||
|
||||
struct itebell {
|
||||
u_int volume; /* volume of bell (0-64) */
|
||||
u_int pitch; /* pitch of bell (10-2000) */
|
||||
u_int msec; /* duration of bell */
|
||||
};
|
||||
#define MAXBVOLUME (63)
|
||||
#define MAXBPITCH (2000)
|
||||
#define MINBPITCH (10)
|
||||
#define MAXBTIME (5000) /* 5 seconds */
|
||||
|
||||
struct iterepeat {
|
||||
int start; /* number of 100/s before repeat start */
|
||||
int next; /* number of 100/s before next repeat */
|
||||
};
|
||||
#define ITEMINREPEAT 5 /* mininum number of 100/s for key repeat */
|
||||
|
||||
#define ITEIOCSKMAP _IOW('Z',0x70, struct kbdmap)
|
||||
#define ITEIOCGKMAP _IOR('Z',0x71, struct kbdmap)
|
||||
#define ITEIOCGWINSZ _IOR('Z',0x72, struct itewinsize)
|
||||
#define ITEIOCSWINSZ _IOW('Z',0x73, struct itewinsize)
|
||||
#define ITEIOCDSPWIN _IO('Z', 0x74)
|
||||
#define ITEIOCREMWIN _IO('Z', 0x75)
|
||||
#define ITEIOCGBELL _IOR('Z', 0x76, struct itebell)
|
||||
#define ITEIOCSBELL _IOW('Z', 0x77, struct itebell)
|
||||
#define ITEIOCGREPT _IOR('Z', 0x78, struct iterepeat)
|
||||
#define ITEIOCSREPT _IOW('Z', 0x79, struct iterepeat)
|
||||
|
||||
#define ITESWITCH _IOW('Z',0x69, int) /* XXX */
|
||||
|
||||
#if ITEKANJI
|
||||
#define ITELOADFONT _IOW('Z',0x80, unsigned char [4096])
|
||||
#endif
|
||||
|
||||
#define ITETVCTRL _IOW('Z',0x81, unsigned char)
|
||||
#define TVC_VOLUP 0x01
|
||||
#define TVC_VOLDOWN 0x02
|
||||
#define TVC_VOLNORM 0x03
|
||||
#define TVC_CHCALL 0x04 /* toggle channel call */
|
||||
#define TVC_RESET 0x05
|
||||
#define TVC_VOLMUTE 0x06
|
||||
#define TVC_POWERON 0x07
|
||||
#define TVC_RGBTV 0x08 /* toggle rgb/TV */
|
||||
#define TVC_EXTTV 0x09 /* toggle video/TV */
|
||||
#define TVC_OVERSCAN 0x09 /* toggle normal/overscan (RGB) */
|
||||
#define TVC_CONTNORM 0x0a
|
||||
#define TVC_CHNLUP 0x0b
|
||||
#define TVC_CHNLDOWN 0x0c
|
||||
#define TVC_POWEROFF 0x0d
|
||||
#define TVC_POWER 0x0e
|
||||
#define TVC_TSUPER1 0x0f /* toggle super */
|
||||
#define TVC_CHAN1 (0x0f + 1)
|
||||
#define TVC_CHAN2 (0x0f + 2)
|
||||
#define TVC_CHAN3 (0x0f + 3)
|
||||
#define TVC_CHAN4 (0x0f + 4)
|
||||
#define TVC_CHAN5 (0x0f + 5)
|
||||
#define TVC_CHAN6 (0x0f + 6)
|
||||
#define TVC_CHAN7 (0x0f + 7)
|
||||
#define TVC_CHAN8 (0x0f + 8)
|
||||
#define TVC_CHAN9 (0x0f + 9)
|
||||
#define TVC_CHAN10 (0x0f + 10)
|
||||
#define TVC_CHAN11 (0x0f + 11)
|
||||
#define TVC_CHAN12 (0x0f + 12)
|
||||
#define TVC_TV (0x1c)
|
||||
#define TVC_RGB (0x1d)
|
||||
#define TVC_SUPER1 (0x1e)
|
||||
#define TVC_SUPER2 (0x1f)
|
||||
#define TVC_PWON (0x20) /* optional bits */
|
|
@ -0,0 +1,271 @@
|
|||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: itevar.h 1.1 90/07/09$
|
||||
*
|
||||
* @(#)itevar.h 7.2 (Berkeley) 11/4/90
|
||||
*/
|
||||
|
||||
#define UNIT(dev) minor(dev)
|
||||
|
||||
struct ite_softc;
|
||||
|
||||
struct itesw {
|
||||
int (*ite_cnprobe) __P((int minor));
|
||||
void (*ite_init) __P((struct ite_softc *));
|
||||
void (*ite_deinit) __P((struct ite_softc *));
|
||||
void (*ite_clear) __P((struct ite_softc *,int,int,int,int));
|
||||
void (*ite_putc) __P((struct ite_softc *,int,int,int,int));
|
||||
void (*ite_cursor) __P((struct ite_softc *,int));
|
||||
void (*ite_scroll) __P((struct ite_softc *,int,int,int,int));
|
||||
};
|
||||
|
||||
enum ite_arraymaxs {
|
||||
MAX_ARGSIZE = 256,
|
||||
MAX_TABS = 256,
|
||||
};
|
||||
|
||||
/* maximum number of argument characters (<CSI>33;34;3m for example) */
|
||||
#define ARGBUF_SIZE 256
|
||||
|
||||
struct ite_softc {
|
||||
struct device device;
|
||||
struct grf_softc *grf;
|
||||
struct itesw *isw;
|
||||
int flags;
|
||||
int type;
|
||||
int open_cnt;
|
||||
void *priv;
|
||||
short curx, cury;
|
||||
short cursorx, cursory;
|
||||
u_char *font;
|
||||
u_char *cursor;
|
||||
u_char font_lo, font_hi;
|
||||
short rows, cols;
|
||||
short cpl;
|
||||
short ftheight, ftwidth, ftbaseline, ftboldsmear;
|
||||
short attribute;
|
||||
u_char *attrbuf;
|
||||
short planemask;
|
||||
short pos;
|
||||
char imode, fpd, hold;
|
||||
u_char escape, cursor_opt, key_repeat;
|
||||
char *GL, *GR, *save_GL;
|
||||
char G0, G1, G2, G3;
|
||||
char fgcolor, bgcolor;
|
||||
char linefeed_newline, auto_wrap;
|
||||
char cursor_appmode, keypad_appmode;
|
||||
char argbuf[ARGBUF_SIZE], *ap, *tabs;
|
||||
char emul_level, eightbit_C1;
|
||||
int top_margin, bottom_margin;
|
||||
char inside_margins, sc_om;
|
||||
short save_curx, save_cury, save_attribute, save_char;
|
||||
char sc_G0, sc_G1, sc_G2, sc_G3;
|
||||
char *sc_GL, *sc_GR;
|
||||
};
|
||||
|
||||
enum emul_level {
|
||||
EMUL_VT100 = 1,
|
||||
EMUL_VT300_8,
|
||||
EMUL_VT300_7
|
||||
};
|
||||
|
||||
/* Flags */
|
||||
#define ITE_ALIVE 0x01 /* hardware exists */
|
||||
#define ITE_INITED 0x02 /* device has been initialized */
|
||||
#define ITE_CONSOLE 0x04 /* device can be console */
|
||||
#define ITE_ISCONS 0x08 /* device is console */
|
||||
#define ITE_ACTIVE 0x10 /* device is being used as ITE */
|
||||
#define ITE_INGRF 0x20 /* device in use as non-ITE */
|
||||
|
||||
#ifdef DO_WEIRD_ATTRIBUTES
|
||||
#define attrloc(ip, y, x) \
|
||||
(ip->attrbuf + ((y) * ip->cols) + (x))
|
||||
|
||||
#define attrclr(ip, sy, sx, h, w) \
|
||||
bzero(ip->attrbuf + ((sy) * ip->cols) + (sx), (h) * (w))
|
||||
|
||||
#define attrmov(ip, sy, sx, dy, dx, h, w) \
|
||||
bcopy(ip->attrbuf + ((sy) * ip->cols) + (sx), \
|
||||
ip->attrbuf + ((dy) * ip->cols) + (dx), \
|
||||
(h) * (w))
|
||||
|
||||
#define attrtest(ip, attr) \
|
||||
((* (u_char *) attrloc(ip, ip->cury, ip->curx)) & attr)
|
||||
|
||||
#define attrset(ip, attr) \
|
||||
((* (u_char *) attrloc(ip, ip->cury, ip->curx)) = attr)
|
||||
#else
|
||||
#define attrloc(ip, y, x) 0
|
||||
#define attrclr(ip, sy, sx, h, w)
|
||||
#define attrmov(ip, sy, sx, dy, dx, h, w)
|
||||
#define attrtest(ip, attr) 0
|
||||
#define attrset(ip, attr)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* X and Y location of character 'c' in the framebuffer, in pixels.
|
||||
*/
|
||||
#define charX(ip,c) \
|
||||
(((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
|
||||
|
||||
#define charY(ip,c) \
|
||||
(((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
|
||||
|
||||
/* Character attributes */
|
||||
#define ATTR_NOR 0x0 /* normal */
|
||||
#define ATTR_INV 0x1 /* inverse */
|
||||
#define ATTR_UL 0x2 /* underline */
|
||||
#define ATTR_BOLD 0x4 /* bold */
|
||||
#define ATTR_BLINK 0x8 /* blink */
|
||||
#define ATTR_ALL (ATTR_INV | ATTR_UL|ATTR_BOLD|ATTR_BLINK)
|
||||
|
||||
/* Keyboard attributes */
|
||||
#define ATTR_KPAD 0x80 /* keypad transmit */
|
||||
|
||||
/* Replacement Rules */
|
||||
#define RR_CLEAR 0x0
|
||||
#define RR_COPY 0x3
|
||||
#define RR_XOR 0x6
|
||||
#define RR_COPYINVERTED 0xc
|
||||
|
||||
#define SCROLL_UP 0x01
|
||||
#define SCROLL_DOWN 0x02
|
||||
#define SCROLL_LEFT 0x03
|
||||
#define SCROLL_RIGHT 0x04
|
||||
#define DRAW_CURSOR 0x05
|
||||
#define ERASE_CURSOR 0x06
|
||||
#define MOVE_CURSOR 0x07
|
||||
#define START_CURSOROPT 0x08 /* at start of output. May disable cursor */
|
||||
#define END_CURSOROPT 0x09 /* at end, make sure cursor state is ok */
|
||||
|
||||
/* special key codes */
|
||||
#define KBD_LEFT_SHIFT 0x70
|
||||
#define KBD_RIGHT_SHIFT 0x70
|
||||
#define KBD_CAPS_LOCK 0x5d
|
||||
#define KBD_CTRL 0x71
|
||||
#define KBD_LEFT_ALT 0x55
|
||||
#define KBD_RIGHT_ALT 0x58
|
||||
#define KBD_LEFT_META 0x56
|
||||
#define KBD_RIGHT_META 0x57
|
||||
#define KBD_OPT1 0x72
|
||||
#define KBD_OPT2 0x73
|
||||
#define KBD_RECONNECT 0x7f
|
||||
|
||||
/* modifier map for use in itefilter() */
|
||||
#define KBD_MOD_LSHIFT (1<<0)
|
||||
#define KBD_MOD_RSHIFT (1<<1)
|
||||
#define KBD_MOD_SHIFT (KBD_MOD_LSHIFT | KBD_MOD_RSHIFT)
|
||||
#define KBD_MOD_CTRL (1<<2)
|
||||
#define KBD_MOD_LALT (1<<3)
|
||||
#define KBD_MOD_RALT (1<<4)
|
||||
#define KBD_MOD_ALT (KBD_MOD_LALT | KBD_MOD_RALT)
|
||||
#define KBD_MOD_LMETA (1<<5)
|
||||
#define KBD_MOD_RMETA (1<<6)
|
||||
#define KBD_MOD_META (KBD_MOD_LMETA | KBD_MOD_RMETA)
|
||||
#define KBD_MOD_CAPS (1<<7)
|
||||
#define KBD_MOD_OPT1 (1<<8)
|
||||
#define KBD_MOD_OPT2 (1<<9)
|
||||
|
||||
/* type for the second argument to itefilter(). Note that the
|
||||
driver doesn't support key-repeat for console-mode, since it can't use
|
||||
timeout() for polled I/O. */
|
||||
|
||||
enum caller { ITEFILT_TTY, ITEFILT_CONSOLE, ITEFILT_REPEATER };
|
||||
|
||||
enum tab_size { TABSIZE = 8 };
|
||||
#define TABEND(u) (ite_tty[u]->t_windsize.ws_col - TABSIZE) /* XXX */
|
||||
|
||||
#define set_attr(ip, attr) ((ip)->attribute |= (attr))
|
||||
#define clr_attr(ip, attr) ((ip)->attribute &= ~(attr))
|
||||
#define attrloc(ip, y, x) 0
|
||||
#define attrclr(ip, sy, sx, h, w)
|
||||
#define attrmov(ip, sy, sx, dy, dx, h, w)
|
||||
#define attrtest(ip, attr) 0
|
||||
#define attrset(ip, attr)
|
||||
|
||||
/* character set */
|
||||
#define CSET_MULTI 0x80 /* multibytes flag */
|
||||
#define CSET_ASCII 0 /* ascii */
|
||||
#define CSET_JISROMA 1 /* iso2022jp romaji */
|
||||
#define CSET_JISKANA 2 /* iso2022jp kana */
|
||||
#define CSET_JIS1978 (3|CSET_MULTI) /* iso2022jp old jis kanji */
|
||||
#define CSET_JIS1983 (4|CSET_MULTI) /* iso2022jp new jis kanji */
|
||||
#define CSET_JIS1990 (5|CSET_MULTI) /* iso2022jp hojo kanji */
|
||||
|
||||
struct consdev;
|
||||
|
||||
/* console related function */
|
||||
void itecnprobe __P((struct consdev *));
|
||||
void itecninit __P((struct consdev *));
|
||||
int itecngetc __P((dev_t));
|
||||
void itecnputc __P((dev_t, int));
|
||||
void itecnfinish __P((struct ite_softc *));
|
||||
|
||||
/* standard ite device entry points. */
|
||||
void iteinit __P((dev_t));
|
||||
int iteopen __P((dev_t, int, int, struct proc *));
|
||||
int iteclose __P((dev_t, int, int, struct proc *));
|
||||
int iteread __P((dev_t, struct uio *, int));
|
||||
int itewrite __P((dev_t, struct uio *, int));
|
||||
int iteioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
|
||||
void itestart __P((struct tty *));
|
||||
|
||||
/* ite functions */
|
||||
int ite_on __P((dev_t, int));
|
||||
int ite_off __P((dev_t, int));
|
||||
void ite_reinit __P((dev_t));
|
||||
void ite_reset __P((struct ite_softc *));
|
||||
int ite_cnfilter __P((u_char, enum caller));
|
||||
void ite_filter __P((u_char ,enum caller));
|
||||
|
||||
/* lower layer functions */
|
||||
int view_cnprobe __P((int));
|
||||
void view_init __P((struct ite_softc *));
|
||||
void view_deinit __P((struct ite_softc *));
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern struct ite_softc ite_softc[];
|
||||
#if ITEKANJI
|
||||
extern unsigned char kern_font[];
|
||||
#endif
|
||||
#if x68k
|
||||
/* keyboard LED status variable */
|
||||
extern unsigned char kbdled;
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,350 @@
|
|||
/* $NetBSD: kbd.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 "ite.h"
|
||||
#include "bell.h"
|
||||
|
||||
#if NITE > 0
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include <x68k/dev/itevar.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
|
||||
/* for sun-like event mode, if you go thru /dev/kbd. */
|
||||
#include <x68k/dev/event_var.h>
|
||||
#include <machine/kbio.h>
|
||||
#include <machine/kbd.h>
|
||||
#include <machine/vuid_event.h>
|
||||
|
||||
struct kbd_softc {
|
||||
int k_event_mode; /* if true, collect events, else pass to ite */
|
||||
struct evvar k_events; /* event queue state */
|
||||
} kbd_softc;
|
||||
|
||||
void kbdattach __P((int));
|
||||
|
||||
/*
|
||||
* Called from main() during pseudo-device setup. If this keyboard is
|
||||
* the console, this is our chance to open the underlying serial port and
|
||||
* send a RESET, so that we can find out what kind of keyboard it is.
|
||||
*/
|
||||
void
|
||||
kbdattach(kbd)
|
||||
int kbd;
|
||||
{
|
||||
}
|
||||
|
||||
/* definitions for x68k keyboard encoding. */
|
||||
#define KEY_CODE(c) ((c) & 0x7f)
|
||||
#define KEY_UP(c) ((c) & 0x80)
|
||||
|
||||
void
|
||||
kbdenable ()
|
||||
{
|
||||
int s = spltty();
|
||||
|
||||
sysport.keyctrl = 8; /* send character from keyboard enable */
|
||||
mfp.iera &= (~0x11); /* MPSC RBF, Timer-B interrupt disable */
|
||||
mfp.tbcr = MFP_TIMERB_RESET | MFP_TIMERB_STOP; /* Timer-B stop */
|
||||
mfp.tbdr = 13; /* Timer-B 38400 Hz clock (interrupt 76800Hz) */
|
||||
mfp.tbcr = 1; /* Timer-B deray mode, prescale 1/4 */
|
||||
mfp.ucr = MFP_UCR_CLKX16 | MFP_UCR_RW_8 | MFP_UCR_ONESB;
|
||||
mfp.rsr = MFP_RSR_RE; /* USART receive enable */
|
||||
mfp.iera |= 0x11; /* MPSC RBF, Timer-B interrupt enable */
|
||||
|
||||
while(!(mfp.tsr & MFP_TSR_BE)) ;
|
||||
mfp.udr = 0x49; /* send character from keyboard enable */
|
||||
kbdled = 0; /* all keyboard LED turn off. */
|
||||
kbd_setLED();
|
||||
|
||||
if (!(sysport.keyctrl & 8))
|
||||
printf("WARNING: no connected keyboard\n");
|
||||
kbd_softc.k_event_mode = 0;
|
||||
kbd_softc.k_events.ev_io = 0;
|
||||
splx(s);
|
||||
}
|
||||
|
||||
int
|
||||
kbdopen(dev, flags, mode, p)
|
||||
dev_t dev;
|
||||
int flags, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int s, error;
|
||||
|
||||
if (kbd_softc.k_events.ev_io)
|
||||
return (EBUSY);
|
||||
kbd_softc.k_events.ev_io = p;
|
||||
ev_init(&kbd_softc.k_events);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
kbdclose(dev, flags, mode, p)
|
||||
dev_t dev;
|
||||
int flags, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
/* Turn off event mode, dump the queue */
|
||||
kbd_softc.k_event_mode = 0;
|
||||
ev_fini(&kbd_softc.k_events);
|
||||
kbd_softc.k_events.ev_io = NULL;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
kbdread(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
{
|
||||
return ev_read(&kbd_softc.k_events, uio, flags);
|
||||
}
|
||||
|
||||
/* this routine should not exist, but is convenient to write here for now */
|
||||
int
|
||||
kbdwrite(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
{
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
|
||||
int
|
||||
kbdioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
register struct kbd_softc *k = &kbd_softc;
|
||||
int cmd_data;
|
||||
|
||||
switch (cmd) {
|
||||
case KIOCTRANS:
|
||||
if (*(int *)data == TR_UNTRANS_EVENT)
|
||||
return (0);
|
||||
break;
|
||||
|
||||
case KIOCGTRANS:
|
||||
/*
|
||||
* Get translation mode
|
||||
*/
|
||||
*(int *)data = TR_UNTRANS_EVENT;
|
||||
return (0);
|
||||
|
||||
case KIOCSDIRECT:
|
||||
k->k_event_mode = *(int *)data;
|
||||
return (0);
|
||||
|
||||
case KIOCCMD:
|
||||
cmd_data = *(int *)data;
|
||||
return kbd_send_command(cmd_data);
|
||||
|
||||
case KIOCSLED:
|
||||
kbdled = *(char *)data;
|
||||
kbd_setLED();
|
||||
return (0);
|
||||
|
||||
case KIOCGLED:
|
||||
*(char *)data = kbdled;
|
||||
return (0);
|
||||
|
||||
case KIOCSBELL:
|
||||
#if NBELL > 0
|
||||
/* XXX - so tricky! */
|
||||
return opm_bell_setup((struct kbiocbell *)data);
|
||||
#else
|
||||
return (0); /* allways success */
|
||||
#endif
|
||||
|
||||
case FIONBIO: /* we will remove this someday (soon???) */
|
||||
return (0);
|
||||
|
||||
case FIOASYNC:
|
||||
k->k_events.ev_async = *(int *)data != 0;
|
||||
return (0);
|
||||
|
||||
case TIOCSPGRP:
|
||||
if (*(int *)data != k->k_events.ev_io->p_pgid)
|
||||
return (EPERM);
|
||||
return (0);
|
||||
|
||||
default:
|
||||
return (ENOTTY);
|
||||
}
|
||||
|
||||
/*
|
||||
* We identified the ioctl, but we do not handle it.
|
||||
*/
|
||||
return (EOPNOTSUPP); /* misuse, but what the heck */
|
||||
}
|
||||
|
||||
int
|
||||
kbdselect(dev, rw, p)
|
||||
dev_t dev;
|
||||
int rw;
|
||||
struct proc *p;
|
||||
{
|
||||
return ev_select (&kbd_softc.k_events, rw, p);
|
||||
}
|
||||
|
||||
#define KBDBUFMASK 63
|
||||
#define KBDBUFSIZ 64
|
||||
static u_char kbdbuf[KBDBUFSIZ];
|
||||
static int kbdputoff = 0;
|
||||
static int kbdgetoff = 0;
|
||||
|
||||
int
|
||||
kbdintr()
|
||||
{
|
||||
u_char c, in;
|
||||
struct kbd_softc *k = &kbd_softc;
|
||||
struct firm_event *fe;
|
||||
int put;
|
||||
|
||||
c = in = mfp.udr;
|
||||
|
||||
/* if not in event mode, deliver straight to ite to process key stroke */
|
||||
if (! k->k_event_mode) {
|
||||
kbdbuf[kbdputoff++ & KBDBUFMASK] = c;
|
||||
setsoftkbd();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Keyboard is generating events. Turn this keystroke into an
|
||||
event and put it in the queue. If the queue is full, the
|
||||
keystroke is lost (sorry!). */
|
||||
|
||||
put = k->k_events.ev_put;
|
||||
fe = &k->k_events.ev_q[put];
|
||||
put = (put + 1) % EV_QSIZE;
|
||||
if (put == k->k_events.ev_get) {
|
||||
log(LOG_WARNING, "keyboard event queue overflow\n"); /* ??? */
|
||||
return;
|
||||
}
|
||||
fe->id = KEY_CODE(c);
|
||||
fe->value = KEY_UP(c) ? VKEY_UP : VKEY_DOWN;
|
||||
fe->time = time;
|
||||
k->k_events.ev_put = put;
|
||||
EV_WAKEUP(&k->k_events);
|
||||
}
|
||||
|
||||
kbdsoftint()
|
||||
{
|
||||
int s = splhigh();
|
||||
|
||||
while(kbdgetoff < kbdputoff)
|
||||
ite_filter(kbdbuf[kbdgetoff++ & KBDBUFMASK], ITEFILT_TTY);
|
||||
kbdgetoff = kbdputoff = 0;
|
||||
|
||||
splx(s);
|
||||
}
|
||||
|
||||
int
|
||||
kbd_bell(mode)
|
||||
int mode;
|
||||
{
|
||||
#if NBELL > 0
|
||||
if (mode)
|
||||
opm_bell_on();
|
||||
else
|
||||
opm_bell_off();
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
kbdgetcn()
|
||||
{
|
||||
int s = spltty();
|
||||
u_char ints, c, in;
|
||||
|
||||
ints = mfp.iera;
|
||||
|
||||
mfp.iera &= 0xef;
|
||||
mfp.rsr |= 1;
|
||||
while (!(mfp.rsr & MFP_RSR_BF))
|
||||
asm("nop");
|
||||
in = c = mfp.udr;
|
||||
|
||||
mfp.iera = ints;
|
||||
splx (s);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
kbd_setLED()
|
||||
{
|
||||
while(!(mfp.tsr & MFP_TSR_BE)) ;
|
||||
mfp.udr = ~kbdled | 0x80;
|
||||
}
|
||||
|
||||
int
|
||||
kbd_send_command(cmd)
|
||||
int cmd;
|
||||
{
|
||||
switch (cmd) {
|
||||
case KBD_CMD_RESET:
|
||||
/* XXX */
|
||||
return 0;
|
||||
|
||||
case KBD_CMD_BELL:
|
||||
kbd_bell(1);
|
||||
return 0;
|
||||
|
||||
case KBD_CMD_NOBELL:
|
||||
kbd_bell(0);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return ENOTTY;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,301 @@
|
|||
/* from: arch/amiga/dev/kbdmap.c */
|
||||
/* modified for X680x0 by Masaru Oki */
|
||||
|
||||
#include "kbdmap.h"
|
||||
|
||||
/* define a default keymap. This can be changed by keyboard ioctl's
|
||||
(later at least..) */
|
||||
|
||||
/* mode shortcuts: */
|
||||
#define S KBD_MODE_STRING
|
||||
#define DG (KBD_MODE_DEAD | KBD_MODE_GRAVE)
|
||||
#define DA (KBD_MODE_DEAD | KBD_MODE_ACUTE)
|
||||
#define DC (KBD_MODE_DEAD | KBD_MODE_CIRC)
|
||||
#define DT (KBD_MODE_DEAD | KBD_MODE_TILDE)
|
||||
#define DD (KBD_MODE_DEAD | KBD_MODE_DIER)
|
||||
#define C KBD_MODE_CAPS
|
||||
#define K KBD_MODE_KPAD
|
||||
#define D KBD_MODE_DEAD
|
||||
|
||||
struct kbdmap kbdmap;
|
||||
struct kbdmap ascii_kbdmap = {
|
||||
/* normal map */
|
||||
{
|
||||
0, 0, /* 0x00 */
|
||||
0, ESC,
|
||||
0, '1',
|
||||
0, '2',
|
||||
0, '3',
|
||||
0, '4',
|
||||
0, '5',
|
||||
0, '6',
|
||||
0, '7', /* 0x08 */
|
||||
0, '8',
|
||||
0, '9',
|
||||
0, '0',
|
||||
0, '-',
|
||||
0, '^',
|
||||
0, '\\',
|
||||
0, DEL, /* really BS, DEL & BS swapped */
|
||||
0, '\t', /* 0x10 */
|
||||
C, 'q',
|
||||
C, 'w',
|
||||
C, 'e',
|
||||
C, 'r',
|
||||
C, 't',
|
||||
C, 'y',
|
||||
C, 'u',
|
||||
C, 'i', /* 0x18 */
|
||||
C, 'o',
|
||||
C, 'p',
|
||||
0, '@',
|
||||
0, '[',
|
||||
0, '\r', /* return */
|
||||
C, 'a',
|
||||
C, 's',
|
||||
C, 'd', /* 0x20 */
|
||||
C, 'f',
|
||||
C, 'g',
|
||||
C, 'h',
|
||||
C, 'j',
|
||||
C, 'k',
|
||||
C, 'l',
|
||||
0, ';',
|
||||
0, ':', /* 0x28 */
|
||||
0, ']',
|
||||
C, 'z',
|
||||
C, 'x',
|
||||
C, 'c',
|
||||
C, 'v',
|
||||
C, 'b',
|
||||
C, 'n',
|
||||
C, 'm', /* 0x30 */
|
||||
0, ',',
|
||||
0, '.',
|
||||
0, '/',
|
||||
0, '_',
|
||||
0, ' ',
|
||||
0, 0, /* HOME */
|
||||
0, '\b', /* really DEL, BS & DEL swapped */
|
||||
0, 0, /* 0x38 ROLLUP */
|
||||
0, 0, /* ROLLDOWN */
|
||||
0, 0, /* UNDO */
|
||||
S, 0x0C, /* CRSR LEFT */
|
||||
S, 0x00, /* now it gets hairy.. CRSR UP */
|
||||
S, 0x08, /* CRSR RIGHT */
|
||||
S, 0x04, /* CRSR DOWN */
|
||||
D, 0, /* CLR */
|
||||
K, '/', /* 0x40 */
|
||||
K, '*',
|
||||
K, '-',
|
||||
K, '7',
|
||||
K, '8',
|
||||
K, '9',
|
||||
K, '+',
|
||||
K, '4',
|
||||
K, '5', /* 0x48 */
|
||||
K, '6',
|
||||
K, '=',
|
||||
K, '1',
|
||||
K, '2',
|
||||
K, '3',
|
||||
K, '\r', /* enter */
|
||||
K, '0',
|
||||
K, ',', /* 0x50 */
|
||||
K, '.',
|
||||
0, 0,
|
||||
0, 0,
|
||||
S, 0x42, /* HELP */
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0, /* 0x58 */
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0, /* 0x60 */
|
||||
0, 0,
|
||||
0, 0,
|
||||
S, 0x10, /* F1 */
|
||||
S, 0x15, /* F2 */
|
||||
S, 0x1A, /* F3 */
|
||||
S, 0x1F, /* F4 */
|
||||
S, 0x24, /* F5 */
|
||||
S, 0x29, /* F6 */
|
||||
S, 0x2E, /* F7 */
|
||||
S, 0x33, /* 0x58 F8 */
|
||||
S, 0x38, /* F9 */
|
||||
S, 0x3D, /* F10 */
|
||||
},
|
||||
|
||||
/* shifted map */
|
||||
{
|
||||
0, 0, /* 0x00 */
|
||||
0, ESC,
|
||||
0, '!',
|
||||
0, '\"',
|
||||
0, '#',
|
||||
0, '$',
|
||||
0, '%',
|
||||
0, '&',
|
||||
0, '\'', /* 0x08 */
|
||||
0, '(',
|
||||
0, ')',
|
||||
0, 0,
|
||||
0, '=',
|
||||
0, '~',
|
||||
0, '|',
|
||||
0, DEL, /* really BS, DEL & BS swapped */
|
||||
0, '\t', /* 0x10 shift TAB */
|
||||
C, 'Q',
|
||||
C, 'W',
|
||||
C, 'E',
|
||||
C, 'R',
|
||||
C, 'T',
|
||||
C, 'Y',
|
||||
C, 'U',
|
||||
C, 'I', /* 0x18 */
|
||||
C, 'O',
|
||||
C, 'P',
|
||||
0, '`',
|
||||
0, '{',
|
||||
0, '\r', /* return */
|
||||
C, 'A',
|
||||
C, 'S',
|
||||
C, 'D', /* 0x20 */
|
||||
C, 'F',
|
||||
C, 'G',
|
||||
C, 'H',
|
||||
C, 'J',
|
||||
C, 'K',
|
||||
C, 'L',
|
||||
0, '+',
|
||||
0, '*', /* 0x28 */
|
||||
0, '}',
|
||||
C, 'Z',
|
||||
C, 'X',
|
||||
C, 'C',
|
||||
C, 'V',
|
||||
C, 'B',
|
||||
C, 'N',
|
||||
C, 'M', /* 0x30 */
|
||||
0, '<', /* 0x38 */
|
||||
0, '>',
|
||||
0, '?',
|
||||
0, '_',
|
||||
0, ' ',
|
||||
0, 0, /* HOME */
|
||||
0, '\b', /* really DEL, BS & DEL swapped */
|
||||
0, 0, /* 0x38 ROLLUP */
|
||||
0, 0, /* ROLLDOWN */
|
||||
0, 0, /* UNDO */
|
||||
D, 0, /* shift CRSR LEFT */
|
||||
D, 0, /* shift CRSR UP */
|
||||
D, 0, /* shift CRSR RIGHT */
|
||||
D, 0, /* shift CRSR DOWN */
|
||||
D, 0, /* CLR */
|
||||
D, '/', /* 0x40 */
|
||||
D, '*',
|
||||
D, '-',
|
||||
D, '7',
|
||||
D, '8',
|
||||
D, '9',
|
||||
D, '+',
|
||||
D, '4',
|
||||
D, '5', /* 0x48 */
|
||||
D, '6',
|
||||
D, '=',
|
||||
D, '1',
|
||||
D, '2',
|
||||
D, '3',
|
||||
K, '\r', /* enter */
|
||||
D, '0',
|
||||
D, ',', /* 0x50 */
|
||||
D, '.',
|
||||
0, 0,
|
||||
0, 0,
|
||||
S, 0x42, /* HELP */
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0, /* 0x58 */
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0, /* 0x60 */
|
||||
0, 0,
|
||||
0, 0,
|
||||
S, 0x5D, /* shift F1 */
|
||||
S, 0x63, /* shift F2 */
|
||||
S, 0x69, /* shift F3 */
|
||||
S, 0x6F, /* shift F4 */
|
||||
S, 0x75, /* shift F5 */
|
||||
S, 0x7B, /* shift F6 */
|
||||
S, 0x81, /* shift F7 */
|
||||
S, 0x87, /* 0x58 shift F8 */
|
||||
S, 0x8D, /* shift F9 */
|
||||
S, 0x93, /* shift F10 */
|
||||
},
|
||||
|
||||
|
||||
/* alt map */
|
||||
{
|
||||
},
|
||||
|
||||
/* shift alt map */
|
||||
{
|
||||
},
|
||||
|
||||
{
|
||||
/* string table. If there's a better way to get the offsets into the
|
||||
above table, please tell me..
|
||||
|
||||
NOTE: save yourself and others a lot of grief by *not* using
|
||||
CSI == 0x9b, using the two-character sequence gives
|
||||
much less trouble, especially in GNU-Emacs.. */
|
||||
|
||||
3, ESC, '[', 'A', /* 0x00: CRSR UP */
|
||||
3, ESC, '[', 'B', /* 0x04: CRSR DOWN */
|
||||
3, ESC, '[', 'C', /* 0x08: CRSR RIGHT */
|
||||
3, ESC, '[', 'D', /* 0x0C: CRSR LEFT */
|
||||
4, ESC, '[', '0', '~', /* 0x10: F1 */
|
||||
4, ESC, '[', '1', '~', /* 0x15: F2 */
|
||||
4, ESC, '[', '2', '~', /* 0x1A: F3 */
|
||||
4, ESC, '[', '3', '~', /* 0x1F: F4 */
|
||||
4, ESC, '[', '4', '~', /* 0x24: F5 */
|
||||
4, ESC, '[', '5', '~', /* 0x29: F6 */
|
||||
4, ESC, '[', '6', '~', /* 0x2E: F7 */
|
||||
4, ESC, '[', '7', '~', /* 0x33: F8 */
|
||||
4, ESC, '[', '8', '~', /* 0x38: F9 */
|
||||
4, ESC, '[', '9', '~', /* 0x3D: F10 */
|
||||
4, ESC, '[', '?', '~', /* 0x42: HELP */
|
||||
|
||||
4, ESC, '[', 'T', '~', /* 0x47: shift CRSR UP */
|
||||
4, ESC, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
|
||||
5, ESC, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
|
||||
5, ESC, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
|
||||
5, ESC, '[', '1', '0', '~', /* 0x5D: shift F1 */
|
||||
5, ESC, '[', '1', '1', '~', /* 0x63: shift F2 */
|
||||
5, ESC, '[', '1', '2', '~', /* 0x69: shift F3 */
|
||||
5, ESC, '[', '1', '3', '~', /* 0x6F: shift F4 */
|
||||
5, ESC, '[', '1', '4', '~', /* 0x75: shift F5 */
|
||||
5, ESC, '[', '1', '5', '~', /* 0x7B: shift F6 */
|
||||
5, ESC, '[', '1', '6', '~', /* 0x81: shift F7 */
|
||||
5, ESC, '[', '1', '7', '~', /* 0x87: shift F8 */
|
||||
5, ESC, '[', '1', '8', '~', /* 0x8D: shift F9 */
|
||||
5, ESC, '[', '1', '9', '~', /* 0x93: shift F10 */
|
||||
3, ESC, '[', 'Z', /* 0x99: shift TAB */
|
||||
2, ESC, '[', /* 0x9d: alt ESC == CSI */
|
||||
},
|
||||
};
|
||||
|
||||
unsigned char acctable[KBD_NUM_ACC][64] = {
|
||||
};
|
|
@ -0,0 +1,303 @@
|
|||
/* from: arch/amiga/dev/kbdmap.c */
|
||||
/* modified for X680x0 by Masaru Oki */
|
||||
|
||||
#include "kbdmap.h"
|
||||
|
||||
/* define a default keymap. This can be changed by keyboard ioctl's
|
||||
(later at least..) */
|
||||
|
||||
/* mode shortcuts: */
|
||||
#define S KBD_MODE_STRING
|
||||
#define DG (KBD_MODE_DEAD | KBD_MODE_GRAVE)
|
||||
#define DA (KBD_MODE_DEAD | KBD_MODE_ACUTE)
|
||||
#define DC (KBD_MODE_DEAD | KBD_MODE_CIRC)
|
||||
#define DT (KBD_MODE_DEAD | KBD_MODE_TILDE)
|
||||
#define DD (KBD_MODE_DEAD | KBD_MODE_DIER)
|
||||
#define C KBD_MODE_CAPS
|
||||
#define K KBD_MODE_KPAD
|
||||
|
||||
struct kbdmap kbdmap;
|
||||
struct kbdmap ascii_kbdmap = {
|
||||
/* normal map */
|
||||
{
|
||||
0, 0, /* 0x00 */
|
||||
0, ESC,
|
||||
0, '1',
|
||||
0, '2',
|
||||
0, '3',
|
||||
0, '4',
|
||||
0, '5',
|
||||
0, '6',
|
||||
0, '7', /* 0x08 */
|
||||
0, '8',
|
||||
0, '9',
|
||||
0, '0',
|
||||
0, '-',
|
||||
0, '=',
|
||||
0, '\\',
|
||||
0, DEL, /* really BS, DEL & BS swapped */
|
||||
0, '\t', /* 0x10 */
|
||||
C, 'q',
|
||||
C, 'w',
|
||||
C, 'e',
|
||||
C, 'r',
|
||||
C, 't',
|
||||
C, 'y',
|
||||
C, 'u',
|
||||
C, 'i', /* 0x18 */
|
||||
C, 'o',
|
||||
C, 'p',
|
||||
0, '[',
|
||||
0, ']',
|
||||
0, '\r', /* return */
|
||||
C, 'a',
|
||||
C, 's',
|
||||
C, 'd', /* 0x20 */
|
||||
C, 'f',
|
||||
C, 'g',
|
||||
C, 'h',
|
||||
C, 'j',
|
||||
C, 'k',
|
||||
C, 'l',
|
||||
0, ';',
|
||||
0, '\'', /* 0x28 */
|
||||
0, '`',
|
||||
C, 'z',
|
||||
C, 'x',
|
||||
C, 'c',
|
||||
C, 'v',
|
||||
C, 'b',
|
||||
C, 'n',
|
||||
C, 'm', /* 0x30 */
|
||||
0, ',',
|
||||
0, '.',
|
||||
0, '/',
|
||||
0, '_',
|
||||
0, ' ',
|
||||
0, 0, /* HOME */
|
||||
0, '\b', /* really DEL, BS & DEL swapped */
|
||||
0, 0, /* 0x38 ROLLUP */
|
||||
0, 0, /* ROLLDOWN */
|
||||
0, 0, /* UNDO */
|
||||
S, 0x0C, /* CRSR LEFT */
|
||||
S, 0x00, /* now it gets hairy.. CRSR UP */
|
||||
S, 0x08, /* CRSR RIGHT */
|
||||
S, 0x04, /* CRSR DOWN */
|
||||
K, 0, /* CLR */
|
||||
K, '/', /* 0x40 */
|
||||
K, '*',
|
||||
K, '-',
|
||||
K, '7',
|
||||
K, '8',
|
||||
K, '9',
|
||||
K, '+',
|
||||
K, '4',
|
||||
K, '5', /* 0x48 */
|
||||
K, '6',
|
||||
K, '=',
|
||||
K, '1',
|
||||
K, '2',
|
||||
K, '3',
|
||||
K, '\r', /* enter */
|
||||
K, '0',
|
||||
K, ',', /* 0x50 */
|
||||
K, '.',
|
||||
0, 0,
|
||||
0, 0,
|
||||
S, 0x42, /* HELP */
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0, /* 0x58 */
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0, /* 0x60 */
|
||||
0, 0,
|
||||
0, 0,
|
||||
S, 0x10, /* F1 */
|
||||
S, 0x15, /* F2 */
|
||||
S, 0x1A, /* F3 */
|
||||
S, 0x1F, /* F4 */
|
||||
S, 0x24, /* F5 */
|
||||
S, 0x29, /* F6 */
|
||||
S, 0x2E, /* F7 */
|
||||
S, 0x33, /* 0x58 F8 */
|
||||
S, 0x38, /* F9 */
|
||||
S, 0x3D, /* F10 */
|
||||
},
|
||||
|
||||
/* shifted map */
|
||||
{
|
||||
0, 0, /* 0x00 */
|
||||
0, ESC,
|
||||
0, '!',
|
||||
0, '@',
|
||||
0, '#',
|
||||
0, '$',
|
||||
0, '%',
|
||||
0, '^',
|
||||
0, '&', /* 0x08 */
|
||||
0, '*',
|
||||
0, '(',
|
||||
0, ')',
|
||||
0, '_',
|
||||
0, '+',
|
||||
0, '|',
|
||||
0, DEL, /* really BS, DEL & BS swapped */
|
||||
S, 0x99, /* 0x10 shift TAB */
|
||||
C, 'Q',
|
||||
C, 'W',
|
||||
C, 'E',
|
||||
C, 'R',
|
||||
C, 'T',
|
||||
C, 'Y',
|
||||
C, 'U',
|
||||
C, 'I', /* 0x18 */
|
||||
C, 'O',
|
||||
C, 'P',
|
||||
0, '{',
|
||||
0, '}',
|
||||
0, '\r', /* return */
|
||||
C, 'A',
|
||||
C, 'S',
|
||||
C, 'D', /* 0x20 */
|
||||
C, 'F',
|
||||
C, 'G',
|
||||
C, 'H',
|
||||
C, 'J',
|
||||
C, 'K',
|
||||
C, 'L',
|
||||
0, ':',
|
||||
0, '\"', /* 0x28 */
|
||||
0, '~',
|
||||
C, 'Z',
|
||||
C, 'X',
|
||||
C, 'C',
|
||||
C, 'V',
|
||||
C, 'B',
|
||||
C, 'N',
|
||||
C, 'M', /* 0x30 */
|
||||
0, '<', /* 0x38 */
|
||||
0, '>',
|
||||
0, '?',
|
||||
0, '_',
|
||||
0, ' ',
|
||||
0, 0, /* HOME */
|
||||
0, '\b', /* really DEL, BS & DEL swapped */
|
||||
0, 0, /* 0x38 ROLLUP */
|
||||
0, 0, /* ROLLDOWN */
|
||||
0, 0, /* UNDO */
|
||||
S, 0x51, /* shift CRSR RIGHT */
|
||||
S, 0x47, /* shift CRSR UP */
|
||||
S, 0x57, /* shift CRSR LEFT */
|
||||
S, 0x4C, /* shift CRSR DOWN */
|
||||
K, 0, /* CLR */
|
||||
K, '/', /* 0x40 */
|
||||
0, 0,
|
||||
K, '*',
|
||||
K, '-',
|
||||
K, '7',
|
||||
K, '8',
|
||||
K, '9',
|
||||
K, '+',
|
||||
K, '4',
|
||||
K, '5', /* 0x48 */
|
||||
K, '6',
|
||||
K, '=',
|
||||
K, '1',
|
||||
K, '2',
|
||||
K, '3',
|
||||
K, '\r', /* enter */
|
||||
K, '0',
|
||||
K, ',', /* 0x50 */
|
||||
K, '.',
|
||||
0, 0,
|
||||
0, 0,
|
||||
S, 0x42, /* HELP */
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0, /* 0x58 */
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0, /* 0x60 */
|
||||
0, 0,
|
||||
0, 0,
|
||||
S, 0x5D, /* shift F1 */
|
||||
S, 0x63, /* shift F2 */
|
||||
S, 0x69, /* shift F3 */
|
||||
S, 0x6F, /* shift F4 */
|
||||
S, 0x75, /* shift F5 */
|
||||
S, 0x7B, /* shift F6 */
|
||||
S, 0x81, /* shift F7 */
|
||||
S, 0x87, /* 0x58 shift F8 */
|
||||
S, 0x8D, /* shift F9 */
|
||||
S, 0x93, /* shift F10 */
|
||||
},
|
||||
|
||||
|
||||
/* alt map */
|
||||
{
|
||||
},
|
||||
|
||||
/* shift alt map */
|
||||
{
|
||||
},
|
||||
|
||||
{
|
||||
/* string table. If there's a better way to get the offsets into the
|
||||
above table, please tell me..
|
||||
|
||||
NOTE: save yourself and others a lot of grief by *not* using
|
||||
CSI == 0x9b, using the two-character sequence gives
|
||||
much less trouble, especially in GNU-Emacs.. */
|
||||
|
||||
3, ESC, '[', 'A', /* 0x00: CRSR UP */
|
||||
3, ESC, '[', 'B', /* 0x04: CRSR DOWN */
|
||||
3, ESC, '[', 'C', /* 0x08: CRSR RIGHT */
|
||||
3, ESC, '[', 'D', /* 0x0C: CRSR LEFT */
|
||||
4, ESC, '[', '0', '~', /* 0x10: F1 */
|
||||
4, ESC, '[', '1', '~', /* 0x15: F2 */
|
||||
4, ESC, '[', '2', '~', /* 0x1A: F3 */
|
||||
4, ESC, '[', '3', '~', /* 0x1F: F4 */
|
||||
4, ESC, '[', '4', '~', /* 0x24: F5 */
|
||||
4, ESC, '[', '5', '~', /* 0x29: F6 */
|
||||
4, ESC, '[', '6', '~', /* 0x2E: F7 */
|
||||
4, ESC, '[', '7', '~', /* 0x33: F8 */
|
||||
4, ESC, '[', '8', '~', /* 0x38: F9 */
|
||||
4, ESC, '[', '9', '~', /* 0x3D: F10 */
|
||||
4, ESC, '[', '?', '~', /* 0x42: HELP */
|
||||
|
||||
4, ESC, '[', 'T', '~', /* 0x47: shift CRSR UP */
|
||||
4, ESC, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
|
||||
5, ESC, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
|
||||
5, ESC, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
|
||||
5, ESC, '[', '1', '0', '~', /* 0x5D: shift F1 */
|
||||
5, ESC, '[', '1', '1', '~', /* 0x63: shift F2 */
|
||||
5, ESC, '[', '1', '2', '~', /* 0x69: shift F3 */
|
||||
5, ESC, '[', '1', '3', '~', /* 0x6F: shift F4 */
|
||||
5, ESC, '[', '1', '4', '~', /* 0x75: shift F5 */
|
||||
5, ESC, '[', '1', '5', '~', /* 0x7B: shift F6 */
|
||||
5, ESC, '[', '1', '6', '~', /* 0x81: shift F7 */
|
||||
5, ESC, '[', '1', '7', '~', /* 0x87: shift F8 */
|
||||
5, ESC, '[', '1', '8', '~', /* 0x8D: shift F9 */
|
||||
5, ESC, '[', '1', '9', '~', /* 0x93: shift F10 */
|
||||
3, ESC, '[', 'Z', /* 0x99: shift TAB */
|
||||
2, ESC, '[', /* 0x9d: alt ESC == CSI */
|
||||
},
|
||||
};
|
||||
|
||||
unsigned char acctable[KBD_NUM_ACC][64] = {
|
||||
};
|
||||
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
#define NUL 0
|
||||
#define SOH 1
|
||||
#define STX 2
|
||||
#define ETX 3
|
||||
#define EOT 4
|
||||
#define ENQ 5
|
||||
#define ACK 6
|
||||
#define BEL 7
|
||||
#define BS 8
|
||||
#define HT 9
|
||||
#define LF 10
|
||||
#define VT 11
|
||||
#define FF 12
|
||||
#define CR 13
|
||||
#define SO 14
|
||||
#define SI 15
|
||||
#define DLE 16
|
||||
#define DC1 17
|
||||
#define DC2 18
|
||||
#define DC3 19
|
||||
#define DC4 20
|
||||
#define NAK 21
|
||||
#define SYN 22
|
||||
#define ETB 23
|
||||
#define CAN 24
|
||||
#define EM 25
|
||||
#define SUB 26
|
||||
#define ESC 27
|
||||
#define FS 28
|
||||
#define GS 29
|
||||
#define RS 30
|
||||
#define US 31
|
||||
#define DEL 127
|
||||
#define IND 132
|
||||
#define NEL 133
|
||||
#define SSA 134
|
||||
#define ESA 135
|
||||
#define HTS 136
|
||||
#define HTJ 137
|
||||
#define VTS 138
|
||||
#define PLD 139
|
||||
#define PLU 140
|
||||
#define RI 141
|
||||
#define SS2 142
|
||||
#define SS3 143
|
||||
#define DCS 144
|
||||
#define PU1 145
|
||||
#define PU2 146
|
||||
#define STS 147
|
||||
#define CCH 148
|
||||
#define MW 149
|
||||
#define SPA 150
|
||||
#define EPA 151
|
||||
#define CSI 155
|
||||
#define ST 156
|
||||
#define OSC 157
|
||||
#define PM 158
|
||||
#define APC 159
|
||||
|
||||
|
||||
/* a normal Amiga keyboard has 0x60 `normal' keys, plus modifier keys that
|
||||
don't appear in the keymap */
|
||||
#define KBD_NUM_KEYS 0x6d
|
||||
|
||||
/* size of string table */
|
||||
#define KBD_STRTAB_SIZE 255
|
||||
|
||||
/* for dead keys, index into acctable */
|
||||
#define KBD_ACC_GRAVE 0
|
||||
#define KBD_ACC_ACUTE 1
|
||||
#define KBD_ACC_CIRC 2
|
||||
#define KBD_ACC_TILDE 3
|
||||
#define KBD_ACC_DIER 4
|
||||
#define KBD_NUM_ACC 5
|
||||
|
||||
|
||||
struct key {
|
||||
unsigned char mode; /* see possible values below */
|
||||
unsigned char code;
|
||||
};
|
||||
|
||||
#define KBD_MODE_STRING (1<<0) /* code is index into strings[] */
|
||||
#define KBD_MODE_DEAD (1<<1) /* acc-index in upper nibble, code = plain acc */
|
||||
#define KBD_MODE_CAPS (1<<2) /* key is capsable. Only used in non-shifted maps */
|
||||
#define KBD_MODE_KPAD (1<<3) /* key is on keypad */
|
||||
#define KBD_MODE_GRAVE (KBD_ACC_GRAVE << 4)
|
||||
#define KBD_MODE_ACUTE (KBD_ACC_ACUTE << 4)
|
||||
#define KBD_MODE_CIRC (KBD_ACC_CIRC << 4)
|
||||
#define KBD_MODE_TILDE (KBD_ACC_TILDE << 4)
|
||||
#define KBD_MODE_DIER (KBD_ACC_DIER << 4)
|
||||
#define KBD_MODE_ACCENT(m) ((m) >> 4) /* get accent from mode */
|
||||
#define KBD_MODE_ACCMASK (0xf0)
|
||||
|
||||
struct kbdmap {
|
||||
struct key keys[KBD_NUM_KEYS],
|
||||
shift_keys[KBD_NUM_KEYS],
|
||||
alt_keys[KBD_NUM_KEYS],
|
||||
alt_shift_keys[KBD_NUM_KEYS];
|
||||
unsigned char strings[KBD_STRTAB_SIZE];
|
||||
};
|
||||
|
||||
|
||||
#ifdef _KERNEL
|
||||
/* XXX: ITE interface */
|
||||
extern struct kbdmap kbdmap, ascii_kbdmap;
|
||||
extern unsigned char acctable[KBD_NUM_ACC][64];
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,129 @@
|
|||
/* $NetBSD: mb89352reg.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Van Jacobson of Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)scsireg.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* FUJITSU MB89352A SCSI Protocol Controler Hardware Description.
|
||||
*/
|
||||
|
||||
struct mb89352 {
|
||||
u_char p32, scsi_bdid;
|
||||
u_char p34, scsi_sctl;
|
||||
#define SCTL_DISABLE 0x80
|
||||
#define SCTL_CTRLRST 0x40
|
||||
#define SCTL_DIAG 0x20
|
||||
#define SCTL_ABRT_ENAB 0x10
|
||||
#define SCTL_PARITY_ENAB 0x08
|
||||
#define SCTL_SEL_ENAB 0x04
|
||||
#define SCTL_RESEL_ENAB 0x02
|
||||
#define SCTL_INTR_ENAB 0x01
|
||||
u_char p36, scsi_scmd;
|
||||
#define SCMD_RST 0x10
|
||||
#define SCMD_ICPT_XFR 0x08
|
||||
#define SCMD_PROG_XFR 0x04
|
||||
#define SCMD_PAD 0x01 /* if initiator */
|
||||
#define SCMD_PERR_STOP 0x01 /* if target */
|
||||
/* command codes */
|
||||
#define SCMD_BUS_REL 0x00
|
||||
#define SCMD_SELECT 0x20
|
||||
#define SCMD_RST_ATN 0x40
|
||||
#define SCMD_SET_ATN 0x60
|
||||
#define SCMD_XFR 0x80
|
||||
#define SCMD_XFR_PAUSE 0xa0
|
||||
#define SCMD_RST_ACK 0xc0
|
||||
#define SCMD_SET_ACK 0xe0
|
||||
u_char p38, scsi_tmod;
|
||||
#define TMOD_SYNC 0x80
|
||||
u_char p40, scsi_ints;
|
||||
#define INTS_SEL 0x80
|
||||
#define INTS_RESEL 0x40
|
||||
#define INTS_DISCON 0x20
|
||||
#define INTS_CMD_DONE 0x10
|
||||
#define INTS_SRV_REQ 0x08
|
||||
#define INTS_TIMEOUT 0x04
|
||||
#define INTS_HARD_ERR 0x02
|
||||
#define INTS_RST 0x01
|
||||
u_char p42, scsi_psns;
|
||||
#define PSNS_REQ 0x80
|
||||
#define PSNS_ACK 0x40
|
||||
#define PSNS_ATN 0x20
|
||||
#define PSNS_SEL 0x10
|
||||
#define PSNS_BSY 0x08
|
||||
u_char p44, scsi_ssts;
|
||||
#define SSTS_INITIATOR 0x80
|
||||
#define SSTS_TARGET 0x40
|
||||
#define SSTS_BUSY 0x20
|
||||
#define SSTS_XFR 0x10
|
||||
#define SSTS_ACTIVE (SSTS_INITIATOR|SSTS_XFR)
|
||||
#define SSTS_RST 0x08
|
||||
#define SSTS_TCZERO 0x04
|
||||
#define SSTS_DREG_FULL 0x02
|
||||
#define SSTS_DREG_EMPTY 0x01
|
||||
u_char p46, scsi_serr;
|
||||
#define SERR_SCSI_PAR 0x80
|
||||
#define SERR_SPC_PAR 0x40
|
||||
#define SERR_TC_PAR 0x08
|
||||
#define SERR_PHASE_ERR 0x04
|
||||
#define SERR_SHORT_XFR 0x02
|
||||
#define SERR_OFFSET 0x01
|
||||
u_char p48, scsi_pctl;
|
||||
#define PCTL_BFINT_ENAB 0x80
|
||||
u_char p50, scsi_mbc;
|
||||
u_char p52, scsi_dreg;
|
||||
u_char p54, scsi_temp;
|
||||
u_char p56, scsi_tch;
|
||||
u_char p58, scsi_tcm;
|
||||
u_char p60, scsi_tcl;
|
||||
u_char p62, scsi_exbf;
|
||||
};
|
||||
|
||||
/* psns/pctl phase lines as bits */
|
||||
#define PHASE_MSG 0x04
|
||||
#define PHASE_CD 0x02 /* =1 if 'command' */
|
||||
#define PHASE_IO 0x01 /* =1 if data inbound */
|
||||
/* Phase lines as values */
|
||||
#define PHASE 0x07 /* mask for psns/pctl phase */
|
||||
#define DATA_OUT_PHASE 0x00
|
||||
#define DATA_IN_PHASE 0x01
|
||||
#define CMD_PHASE 0x02
|
||||
#define STATUS_PHASE 0x03
|
||||
#define BUS_FREE_PHASE 0x04
|
||||
#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */
|
||||
#define MESG_OUT_PHASE 0x06
|
||||
#define MESG_IN_PHASE 0x07
|
|
@ -0,0 +1,340 @@
|
|||
/* $NetBSD: ms.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)ms.c 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mouse driver.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/tty.h>
|
||||
|
||||
#include <x68k/dev/event_var.h>
|
||||
#include <machine/vuid_event.h>
|
||||
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
|
||||
/*
|
||||
* Mouse state. A SHARP X1/X680x0 mouse is a fairly simple device,
|
||||
* producing three-byte blobs of the form:
|
||||
*
|
||||
* b dx dy
|
||||
*
|
||||
* where b is the button state, encoded as 0x80|(buttons)---there are
|
||||
* two buttons (2=left, 1=right)---and dx,dy are X and Y delta values.
|
||||
*/
|
||||
struct ms_softc {
|
||||
short ms_byteno; /* input byte number, for decode */
|
||||
char ms_mb; /* mouse button state */
|
||||
char ms_ub; /* user button state */
|
||||
int ms_dx; /* delta-x */
|
||||
int ms_dy; /* delta-y */
|
||||
struct tty *ms_mouse; /* downlink for output to mouse */
|
||||
void (*ms_open) __P((struct tty *)); /* enable dataflow */
|
||||
void (*ms_close) __P((struct tty *));/* disable dataflow */
|
||||
volatile int ms_ready; /* event queue is ready */
|
||||
struct evvar ms_events; /* event queue state */
|
||||
} ms_softc;
|
||||
|
||||
/*
|
||||
* Attach the mouse serial (down-link) interface.
|
||||
* Do we need to set it to 4800 baud, 8 bits?
|
||||
* Test by power cycling and not booting Human68k before BSD?
|
||||
*/
|
||||
void
|
||||
ms_serial(tp, iopen, iclose)
|
||||
struct tty *tp;
|
||||
void (*iopen)(), (*iclose)();
|
||||
{
|
||||
|
||||
ms_softc.ms_mouse = tp;
|
||||
ms_softc.ms_open = iopen;
|
||||
ms_softc.ms_close = iclose;
|
||||
}
|
||||
|
||||
void
|
||||
ms_modem(onoff)
|
||||
register int onoff;
|
||||
{
|
||||
static int oonoff;
|
||||
|
||||
if (ms_softc.ms_ready == 1) {
|
||||
if (ms_softc.ms_byteno == -1)
|
||||
ms_softc.ms_byteno = onoff = 0;
|
||||
if (oonoff != onoff) {
|
||||
zs_msmodem(onoff);
|
||||
oonoff = onoff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ms_rint(c)
|
||||
register int c;
|
||||
{
|
||||
register struct firm_event *fe;
|
||||
register struct ms_softc *ms = &ms_softc;
|
||||
register int mb, ub, d, get, put, any;
|
||||
static const char to_one[] = { 1, 2, 3 };
|
||||
static const int to_id[] = { MS_LEFT, MS_RIGHT, MS_MIDDLE };
|
||||
|
||||
/*
|
||||
* Discard input if not ready. Drop sync on parity or framing
|
||||
* error; gain sync on button byte.
|
||||
*/
|
||||
if (ms->ms_ready == 0)
|
||||
return;
|
||||
if (c & (TTY_FE|TTY_PE)) {
|
||||
log(LOG_WARNING,
|
||||
"mouse input parity or framing error (0x%x)\n", c);
|
||||
ms->ms_byteno = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run the decode loop, adding to the current information.
|
||||
* We add, rather than replace, deltas, so that if the event queue
|
||||
* fills, we accumulate data for when it opens up again.
|
||||
*/
|
||||
switch (ms->ms_byteno) {
|
||||
|
||||
case -1:
|
||||
return;
|
||||
|
||||
case 0:
|
||||
/* buttons */
|
||||
ms->ms_byteno = 1;
|
||||
ms->ms_mb = c & 0x7;
|
||||
return;
|
||||
|
||||
case 1:
|
||||
/* delta-x */
|
||||
ms->ms_byteno = 2;
|
||||
ms->ms_dx += (char)c;
|
||||
return;
|
||||
|
||||
case 2:
|
||||
/* delta-y */
|
||||
ms->ms_byteno = -1 /* wait for button-byte again */;
|
||||
ms->ms_dy += (char)c;
|
||||
break;
|
||||
|
||||
default:
|
||||
panic("ms_rint");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
/*
|
||||
* We have at least one event (mouse button, delta-X, or
|
||||
* delta-Y; possibly all three, and possibly three separate
|
||||
* button events). Deliver these events until we are out
|
||||
* of changes or out of room. As events get delivered,
|
||||
* mark them `unchanged'.
|
||||
*/
|
||||
any = 0;
|
||||
get = ms->ms_events.ev_get;
|
||||
put = ms->ms_events.ev_put;
|
||||
fe = &ms->ms_events.ev_q[put];
|
||||
|
||||
/* NEXT prepares to put the next event, backing off if necessary */
|
||||
#define NEXT \
|
||||
if ((++put) % EV_QSIZE == get) { \
|
||||
put--; \
|
||||
goto out; \
|
||||
}
|
||||
/* ADVANCE completes the `put' of the event */
|
||||
#define ADVANCE \
|
||||
fe++; \
|
||||
if (put >= EV_QSIZE) { \
|
||||
put = 0; \
|
||||
fe = &ms->ms_events.ev_q[0]; \
|
||||
} \
|
||||
any = 1
|
||||
|
||||
mb = ms->ms_mb;
|
||||
ub = ms->ms_ub;
|
||||
while ((d = mb ^ ub) != 0) {
|
||||
/*
|
||||
* Mouse button change. Convert up to three changes
|
||||
* to the `first' change, and drop it into the event queue.
|
||||
*/
|
||||
NEXT;
|
||||
d = to_one[d - 1]; /* from 1..7 to {1,2,4} */
|
||||
fe->id = to_id[d - 1]; /* from {1,2,4} to ID */
|
||||
fe->value = mb & d ? VKEY_DOWN : VKEY_UP;
|
||||
fe->time = time;
|
||||
ADVANCE;
|
||||
ub ^= d;
|
||||
}
|
||||
if (ms->ms_dx) {
|
||||
NEXT;
|
||||
fe->id = LOC_X_DELTA;
|
||||
fe->value = ms->ms_dx;
|
||||
fe->time = time;
|
||||
ADVANCE;
|
||||
ms->ms_dx = 0;
|
||||
}
|
||||
if (ms->ms_dy) {
|
||||
NEXT;
|
||||
fe->id = LOC_Y_DELTA;
|
||||
fe->value = -ms->ms_dy; /* XXX? */
|
||||
fe->time = time;
|
||||
ADVANCE;
|
||||
ms->ms_dy = 0;
|
||||
}
|
||||
out:
|
||||
if (any) {
|
||||
ms->ms_ub = ub;
|
||||
ms->ms_events.ev_put = put;
|
||||
EV_WAKEUP(&ms->ms_events);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
msopen(dev, flags, mode, p)
|
||||
dev_t dev;
|
||||
int flags, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
int s, error;
|
||||
|
||||
if (ms_softc.ms_events.ev_io)
|
||||
return (EBUSY);
|
||||
ms_softc.ms_events.ev_io = p;
|
||||
ev_init(&ms_softc.ms_events); /* may cause sleep */
|
||||
ms_softc.ms_ready = 1; /* start accepting events */
|
||||
(*ms_softc.ms_open)(ms_softc.ms_mouse);
|
||||
return (0);
|
||||
}
|
||||
int
|
||||
msclose(dev, flags, mode, p)
|
||||
dev_t dev;
|
||||
int flags, mode;
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
ms_modem(0);
|
||||
ms_softc.ms_ready = 0; /* stop accepting events */
|
||||
ev_fini(&ms_softc.ms_events);
|
||||
(*ms_softc.ms_close)(ms_softc.ms_mouse);
|
||||
ms_softc.ms_events.ev_io = NULL;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
msread(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
{
|
||||
|
||||
return (ev_read(&ms_softc.ms_events, uio, flags));
|
||||
}
|
||||
|
||||
/* this routine should not exist, but is convenient to write here for now */
|
||||
int
|
||||
mswrite(dev, uio, flags)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
int flags;
|
||||
{
|
||||
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
int
|
||||
msioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
register caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
int s;
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
case FIONBIO: /* we will remove this someday (soon???) */
|
||||
return (0);
|
||||
|
||||
case FIOASYNC:
|
||||
ms_softc.ms_events.ev_async = *(int *)data != 0;
|
||||
return (0);
|
||||
|
||||
case TIOCSPGRP:
|
||||
if (*(int *)data != ms_softc.ms_events.ev_io->p_pgid)
|
||||
return (EPERM);
|
||||
return (0);
|
||||
|
||||
case VUIDGFORMAT:
|
||||
/* we only do firm_events */
|
||||
*(int *)data = VUID_FIRM_EVENT;
|
||||
return (0);
|
||||
|
||||
case VUIDSFORMAT:
|
||||
if (*(int *)data != VUID_FIRM_EVENT)
|
||||
return (EINVAL);
|
||||
return (0);
|
||||
}
|
||||
return (ENOTTY);
|
||||
}
|
||||
|
||||
int
|
||||
msselect(dev, rw, p)
|
||||
dev_t dev;
|
||||
int rw;
|
||||
struct proc *p;
|
||||
{
|
||||
|
||||
return (ev_select(&ms_softc.ms_events, rw, p));
|
||||
}
|
||||
|
||||
mouseattach(){} /* XXX pseudo-device */
|
|
@ -0,0 +1,186 @@
|
|||
/* $NetBSD: opm.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Masanobu Saitoh, Takuya Harakawa.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Masanobu Saitoh.
|
||||
* 4. Neither the name of the University nor of the Laboratory may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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 "fd.h"
|
||||
/*#include "bsdaudio.h"*/
|
||||
#include "bell.h"
|
||||
|
||||
#if ((NBSDAUDIO > 0) || (NFD > 0) || (NBELL > 0))
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <x68k/dev/opmreg.h>
|
||||
#include <x68k/dev/bsd_audioreg.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
|
||||
static u_char opmreg[0x100];
|
||||
static struct opm_voice vdata[8];
|
||||
|
||||
void opm_set_voice(int, struct opm_voice *);
|
||||
void opm_set_voice_sub(int, struct opm_operator *);
|
||||
|
||||
static inline void
|
||||
writeopm(reg, dat)
|
||||
int reg, dat;
|
||||
{
|
||||
while (OPM.data & 0x80);
|
||||
OPM.reg = reg;
|
||||
while (OPM.data & 0x80);
|
||||
OPM.data = opmreg[reg] = dat;
|
||||
}
|
||||
|
||||
static inline int
|
||||
readopm(reg)
|
||||
int reg;
|
||||
{
|
||||
return opmreg[reg];
|
||||
}
|
||||
|
||||
void
|
||||
adpcm_chgclk(clk)
|
||||
u_char clk;
|
||||
{
|
||||
writeopm(0x1b, readopm(0x1b) & ~OPM1B_CT1MSK | clk);
|
||||
}
|
||||
|
||||
void
|
||||
fdc_force_ready(rdy)
|
||||
u_char rdy;
|
||||
{
|
||||
writeopm(0x1b, readopm(0x1b) & ~OPM1B_CT2MSK | rdy);
|
||||
}
|
||||
|
||||
void
|
||||
opm_key_on(channel)
|
||||
u_char channel;
|
||||
{
|
||||
writeopm(0x08, vdata[channel].sm << 3 | channel);
|
||||
}
|
||||
|
||||
void
|
||||
opm_key_off(channel)
|
||||
u_char channel;
|
||||
{
|
||||
writeopm(0x08, channel);
|
||||
}
|
||||
|
||||
void
|
||||
opm_set_voice(channel, voice)
|
||||
int channel;
|
||||
struct opm_voice *voice;
|
||||
{
|
||||
bcopy(voice, &vdata[channel], sizeof(struct opm_voice));
|
||||
|
||||
opm_set_voice_sub(0x40 + channel, &voice->m1);
|
||||
opm_set_voice_sub(0x48 + channel, &voice->m2);
|
||||
opm_set_voice_sub(0x50 + channel, &voice->c1);
|
||||
opm_set_voice_sub(0x58 + channel, &voice->c2);
|
||||
writeopm(0x20 + channel, 0xc0 | (voice->fb & 0x7) << 3 | (voice->con & 0x7));
|
||||
}
|
||||
|
||||
void
|
||||
opm_set_voice_sub(reg, op)
|
||||
register int reg;
|
||||
struct opm_operator *op;
|
||||
{
|
||||
/* DT1/MUL */
|
||||
writeopm(reg, (op->dt1 & 0x7) << 3 | (op->mul & 0x7));
|
||||
|
||||
/* TL */
|
||||
writeopm(reg + 0x20, op->tl & 0x7f);
|
||||
|
||||
/* KS/AR */
|
||||
writeopm(reg + 0x40, (op->ks & 0x3) << 6 | (op->ar & 0x1f));
|
||||
|
||||
/* AMS/D1R */
|
||||
writeopm(reg + 0x60, (op->ame & 0x1) << 7 | (op->d1r & 0x1f));
|
||||
|
||||
/* DT2/D2R */
|
||||
writeopm(reg + 0x80, (op->dt2 & 0x3) << 6 | (op->d2r & 0x1f));
|
||||
|
||||
/* D1L/RR */
|
||||
writeopm(reg + 0xa0, (op->d1l & 0xf) << 4 | (op->rr & 0xf));
|
||||
}
|
||||
|
||||
void
|
||||
opm_set_volume(channel, volume)
|
||||
int channel;
|
||||
int volume;
|
||||
{
|
||||
int value;
|
||||
|
||||
switch (vdata[channel].con) {
|
||||
case 7:
|
||||
value = vdata[channel].m1.tl + volume;
|
||||
writeopm(0x60 + channel, ((value > 0x7f) ? 0x7f : value));
|
||||
case 6:
|
||||
case 5:
|
||||
value = vdata[channel].m2.tl + volume;
|
||||
writeopm(0x68 + channel, ((value > 0x7f) ? 0x7f : value));
|
||||
case 4:
|
||||
value = vdata[channel].c1.tl + volume;
|
||||
writeopm(0x70 + channel, ((value > 0x7f) ? 0x7f : value));
|
||||
case 3:
|
||||
case 2:
|
||||
case 1:
|
||||
case 0:
|
||||
value = vdata[channel].c2.tl + volume;
|
||||
writeopm(0x78 + channel, ((value > 0x7f) ? 0x7f : value));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
opm_set_key(channel, tone)
|
||||
int channel;
|
||||
int tone;
|
||||
{
|
||||
writeopm(0x28 + channel, tone >> 8);
|
||||
writeopm(0x30 + channel, tone & 0xff);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
opmopen(dev, flag, mode)
|
||||
dev_t dev;
|
||||
{
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
opmclose(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,490 @@
|
|||
/* $NetBSD: opmbell.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 MINOURA Makoto, Takuya Harakawa.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by MINOURA Makoto,
|
||||
* Takuya Harakawa.
|
||||
* 4. Neither the name of the authors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* bell device driver
|
||||
*/
|
||||
|
||||
#include "bell.h"
|
||||
#if NBELL > 0
|
||||
|
||||
#if NBELL > 1
|
||||
#undef NBELL
|
||||
#define NBELL 1
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
#include <machine/opmbellio.h>
|
||||
#include <x68k/dev/opmreg.h>
|
||||
#include <x68k/dev/opmbellvar.h>
|
||||
|
||||
static u_int bell_pitchtokey __P((u_int));
|
||||
static void bell_timeout();
|
||||
|
||||
struct bell_softc {
|
||||
int sc_flags;
|
||||
u_char ch;
|
||||
u_char volume;
|
||||
u_int pitch;
|
||||
u_int msec;
|
||||
u_int key;
|
||||
};
|
||||
|
||||
struct bell_softc *bell_softc;
|
||||
|
||||
static struct opm_voice vtab[NBELL];
|
||||
|
||||
/* sc_flags values */
|
||||
#define BELLF_READ 0x01
|
||||
#define BELLF_WRITE 0x02
|
||||
#define BELLF_ALIVE 0x04
|
||||
#define BELLF_OPEN 0x08
|
||||
#define BELLF_OUT 0x10
|
||||
#define BELLF_ON 0x20
|
||||
|
||||
#define UNIT(x) minor(x)
|
||||
|
||||
int
|
||||
bellattach(num)
|
||||
int num;
|
||||
{
|
||||
char *mem;
|
||||
register u_long size;
|
||||
register struct bell_softc *sc;
|
||||
int unit;
|
||||
|
||||
if (num <= 0)
|
||||
return;
|
||||
size = num * sizeof(struct bell_softc);
|
||||
mem = malloc(size, M_DEVBUF, M_NOWAIT);
|
||||
if (mem == NULL) {
|
||||
printf("WARNING: no memory for opm bell\n");
|
||||
return;
|
||||
}
|
||||
bzero(mem, size);
|
||||
bell_softc = (struct bell_softc *)mem;
|
||||
|
||||
for (unit = 0; unit < num; unit++) {
|
||||
sc = &bell_softc[unit];
|
||||
sc->sc_flags = BELLF_ALIVE;
|
||||
sc->ch = BELL_CHANNEL;
|
||||
sc->volume = BELL_VOLUME;
|
||||
sc->pitch = BELL_PITCH;
|
||||
sc->msec = BELL_DURATION;
|
||||
sc->key = bell_pitchtokey(sc->pitch);
|
||||
|
||||
/* setup initial voice parameter */
|
||||
bcopy(&bell_voice, &vtab[unit], sizeof(bell_voice));
|
||||
opm_set_voice(sc->ch, &vtab[unit]);
|
||||
|
||||
printf("bell%d: YM2151 OPM bell emulation.\n", unit);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
bellopen(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
register int unit = UNIT(dev);
|
||||
register struct bell_softc *sc = &bell_softc[unit];
|
||||
|
||||
if (unit >= NBELL || !(sc->sc_flags & BELLF_ALIVE))
|
||||
return ENXIO;
|
||||
|
||||
if (sc->sc_flags & BELLF_OPEN)
|
||||
return EBUSY;
|
||||
|
||||
sc->sc_flags |= BELLF_OPEN;
|
||||
sc->sc_flags |= (flags & (FREAD | FWRITE));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
bellclose(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
int unit = UNIT(dev);
|
||||
struct bell_softc *sc = &bell_softc[unit];
|
||||
|
||||
sc->sc_flags &= ~BELLF_OPEN;
|
||||
}
|
||||
|
||||
int
|
||||
bellioctl(dev, cmd, addr, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t addr;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
int unit = UNIT(dev);
|
||||
struct bell_softc *sc = &bell_softc[unit];
|
||||
|
||||
switch (cmd) {
|
||||
case BELLIOCGPARAM:
|
||||
{
|
||||
struct bell_info *bp = (struct bell_info *)addr;
|
||||
if (!(sc->sc_flags & FREAD))
|
||||
return EBADF;
|
||||
|
||||
bp->volume = sc->volume;
|
||||
bp->pitch = sc->pitch;
|
||||
bp->msec = sc->msec;
|
||||
break;
|
||||
}
|
||||
|
||||
case BELLIOCSPARAM:
|
||||
{
|
||||
struct bell_info *bp = (struct bell_info *)addr;
|
||||
|
||||
if (!(sc->sc_flags & FWRITE))
|
||||
return EBADF;
|
||||
|
||||
return opm_bell_setup(bp);
|
||||
}
|
||||
|
||||
case BELLIOCGVOICE:
|
||||
if (!(sc->sc_flags & FREAD))
|
||||
return EBADF;
|
||||
|
||||
if (addr == NULL)
|
||||
return EFAULT;
|
||||
|
||||
bcopy(&vtab[unit], addr, sizeof(struct opm_voice));
|
||||
break;
|
||||
|
||||
case BELLIOCSVOICE:
|
||||
if (!(sc->sc_flags & FWRITE))
|
||||
return EBADF;
|
||||
|
||||
if (addr == NULL)
|
||||
return EFAULT;
|
||||
|
||||
bcopy(addr, &vtab[unit], sizeof(struct opm_voice));
|
||||
opm_set_voice(sc->ch, &vtab[unit]);
|
||||
break;
|
||||
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The next table is used for calculating KeyCode/KeyFraction pair
|
||||
* from frequency.
|
||||
*/
|
||||
|
||||
static u_int note[] = {
|
||||
0x0800, 0x0808, 0x0810, 0x081c,
|
||||
0x0824, 0x0830, 0x0838, 0x0844,
|
||||
0x084c, 0x0858, 0x0860, 0x086c,
|
||||
0x0874, 0x0880, 0x0888, 0x0890,
|
||||
0x089c, 0x08a4, 0x08b0, 0x08b8,
|
||||
0x08c4, 0x08cc, 0x08d8, 0x08e0,
|
||||
0x08ec, 0x08f4, 0x0900, 0x0908,
|
||||
0x0910, 0x091c, 0x0924, 0x092c,
|
||||
0x0938, 0x0940, 0x0948, 0x0954,
|
||||
0x095c, 0x0968, 0x0970, 0x0978,
|
||||
0x0984, 0x098c, 0x0994, 0x09a0,
|
||||
0x09a8, 0x09b4, 0x09bc, 0x09c4,
|
||||
0x09d0, 0x09d8, 0x09e0, 0x09ec,
|
||||
0x09f4, 0x0a00, 0x0a08, 0x0a10,
|
||||
0x0a18, 0x0a20, 0x0a28, 0x0a30,
|
||||
0x0a38, 0x0a44, 0x0a4c, 0x0a54,
|
||||
0x0a5c, 0x0a64, 0x0a6c, 0x0a74,
|
||||
0x0a80, 0x0a88, 0x0a90, 0x0a98,
|
||||
0x0aa0, 0x0aa8, 0x0ab0, 0x0ab8,
|
||||
0x0ac4, 0x0acc, 0x0ad4, 0x0adc,
|
||||
0x0ae4, 0x0aec, 0x0af4, 0x0c00,
|
||||
0x0c08, 0x0c10, 0x0c18, 0x0c20,
|
||||
0x0c28, 0x0c30, 0x0c38, 0x0c40,
|
||||
0x0c48, 0x0c50, 0x0c58, 0x0c60,
|
||||
0x0c68, 0x0c70, 0x0c78, 0x0c84,
|
||||
0x0c8c, 0x0c94, 0x0c9c, 0x0ca4,
|
||||
0x0cac, 0x0cb4, 0x0cbc, 0x0cc4,
|
||||
0x0ccc, 0x0cd4, 0x0cdc, 0x0ce4,
|
||||
0x0cec, 0x0cf4, 0x0d00, 0x0d04,
|
||||
0x0d0c, 0x0d14, 0x0d1c, 0x0d24,
|
||||
0x0d2c, 0x0d34, 0x0d3c, 0x0d44,
|
||||
0x0d4c, 0x0d54, 0x0d5c, 0x0d64,
|
||||
0x0d6c, 0x0d74, 0x0d7c, 0x0d80,
|
||||
0x0d88, 0x0d90, 0x0d98, 0x0da0,
|
||||
0x0da8, 0x0db0, 0x0db8, 0x0dc0,
|
||||
0x0dc8, 0x0dd0, 0x0dd8, 0x0de0,
|
||||
0x0de8, 0x0df0, 0x0df8, 0x0e00,
|
||||
0x0e04, 0x0e0c, 0x0e14, 0x0e1c,
|
||||
0x0e24, 0x0e28, 0x0e30, 0x0e38,
|
||||
0x0e40, 0x0e48, 0x0e50, 0x0e54,
|
||||
0x0e5c, 0x0e64, 0x0e6c, 0x0e74,
|
||||
0x0e7c, 0x0e80, 0x0e88, 0x0e90,
|
||||
0x0e98, 0x0ea0, 0x0ea8, 0x0eac,
|
||||
0x0eb4, 0x0ebc, 0x0ec4, 0x0ecc,
|
||||
0x0ed4, 0x0ed8, 0x0ee0, 0x0ee8,
|
||||
0x0ef0, 0x0ef8, 0x1000, 0x1004,
|
||||
0x100c, 0x1014, 0x1018, 0x1020,
|
||||
0x1028, 0x1030, 0x1034, 0x103c,
|
||||
0x1044, 0x104c, 0x1050, 0x1058,
|
||||
0x1060, 0x1064, 0x106c, 0x1074,
|
||||
0x107c, 0x1080, 0x1088, 0x1090,
|
||||
0x1098, 0x109c, 0x10a4, 0x10ac,
|
||||
0x10b0, 0x10b8, 0x10c0, 0x10c8,
|
||||
0x10cc, 0x10d4, 0x10dc, 0x10e4,
|
||||
0x10e8, 0x10f0, 0x10f8, 0x1100,
|
||||
0x1104, 0x110c, 0x1110, 0x1118,
|
||||
0x1120, 0x1124, 0x112c, 0x1134,
|
||||
0x1138, 0x1140, 0x1148, 0x114c,
|
||||
0x1154, 0x1158, 0x1160, 0x1168,
|
||||
0x116c, 0x1174, 0x117c, 0x1180,
|
||||
0x1188, 0x1190, 0x1194, 0x119c,
|
||||
0x11a4, 0x11a8, 0x11b0, 0x11b4,
|
||||
0x11bc, 0x11c4, 0x11c8, 0x11d0,
|
||||
0x11d8, 0x11dc, 0x11e4, 0x11ec,
|
||||
0x11f0, 0x11f8, 0x1200, 0x1204,
|
||||
0x120c, 0x1210, 0x1218, 0x121c,
|
||||
0x1224, 0x1228, 0x1230, 0x1238,
|
||||
0x123c, 0x1244, 0x1248, 0x1250,
|
||||
0x1254, 0x125c, 0x1260, 0x1268,
|
||||
0x1270, 0x1274, 0x127c, 0x1280,
|
||||
0x1288, 0x128c, 0x1294, 0x129c,
|
||||
0x12a0, 0x12a8, 0x12ac, 0x12b4,
|
||||
0x12b8, 0x12c0, 0x12c4, 0x12cc,
|
||||
0x12d4, 0x12d8, 0x12e0, 0x12e4,
|
||||
0x12ec, 0x12f0, 0x12f8, 0x1400,
|
||||
0x1404, 0x1408, 0x1410, 0x1414,
|
||||
0x141c, 0x1420, 0x1428, 0x142c,
|
||||
0x1434, 0x1438, 0x1440, 0x1444,
|
||||
0x1448, 0x1450, 0x1454, 0x145c,
|
||||
0x1460, 0x1468, 0x146c, 0x1474,
|
||||
0x1478, 0x1480, 0x1484, 0x1488,
|
||||
0x1490, 0x1494, 0x149c, 0x14a0,
|
||||
0x14a8, 0x14ac, 0x14b4, 0x14b8,
|
||||
0x14c0, 0x14c4, 0x14c8, 0x14d0,
|
||||
0x14d4, 0x14dc, 0x14e0, 0x14e8,
|
||||
0x14ec, 0x14f4, 0x14f8, 0x1500,
|
||||
0x1504, 0x1508, 0x1510, 0x1514,
|
||||
0x1518, 0x1520, 0x1524, 0x1528,
|
||||
0x1530, 0x1534, 0x1538, 0x1540,
|
||||
0x1544, 0x154c, 0x1550, 0x1554,
|
||||
0x155c, 0x1560, 0x1564, 0x156c,
|
||||
0x1570, 0x1574, 0x157c, 0x1580,
|
||||
0x1588, 0x158c, 0x1590, 0x1598,
|
||||
0x159c, 0x15a0, 0x15a8, 0x15ac,
|
||||
0x15b0, 0x15b8, 0x15bc, 0x15c4,
|
||||
0x15c8, 0x15cc, 0x15d4, 0x15d8,
|
||||
0x15dc, 0x15e4, 0x15e8, 0x15ec,
|
||||
0x15f4, 0x15f8, 0x1600, 0x1604,
|
||||
0x1608, 0x160c, 0x1614, 0x1618,
|
||||
0x161c, 0x1620, 0x1628, 0x162c,
|
||||
0x1630, 0x1638, 0x163c, 0x1640,
|
||||
0x1644, 0x164c, 0x1650, 0x1654,
|
||||
0x165c, 0x1660, 0x1664, 0x1668,
|
||||
0x1670, 0x1674, 0x1678, 0x1680,
|
||||
0x1684, 0x1688, 0x168c, 0x1694,
|
||||
0x1698, 0x169c, 0x16a0, 0x16a8,
|
||||
0x16ac, 0x16b0, 0x16b8, 0x16bc,
|
||||
0x16c0, 0x16c4, 0x16cc, 0x16d0,
|
||||
0x16d4, 0x16dc, 0x16e0, 0x16e4,
|
||||
0x16e8, 0x16f0, 0x16f4, 0x16f8,
|
||||
};
|
||||
|
||||
static u_int
|
||||
bell_pitchtokey(pitch)
|
||||
u_int pitch;
|
||||
{
|
||||
int i, oct;
|
||||
u_int key;
|
||||
|
||||
i = 16 * pitch / 440;
|
||||
for (oct = -1; i > 0; i >>= 1, oct++)
|
||||
;
|
||||
|
||||
i = (pitch * 16 - (440 * (1 << oct))) / (1 << oct);
|
||||
key = (oct << 12) + note[i];
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
/*
|
||||
* The next table is a little trikcy table of volume factors.
|
||||
* Its values have been calculated as table[i] = -15 * log10(i/100)
|
||||
* with an obvious exception for i = 0; This log-table converts a linear
|
||||
* volume-scaling (0...100) to a logarithmic scaling as present in the
|
||||
* OPM chips. so: Volume 50% = 6 db.
|
||||
*/
|
||||
|
||||
static u_char vol_table[] = {
|
||||
0x7f, 0x35, 0x2d, 0x28, 0x25, 0x22, 0x20, 0x1e,
|
||||
0x1d, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, 0x15,
|
||||
0x15, 0x14, 0x13, 0x13, 0x12, 0x12, 0x11, 0x11,
|
||||
0x10, 0x10, 0x0f, 0x0f, 0x0e, 0x0e, 0x0d, 0x0d,
|
||||
0x0d, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0a,
|
||||
0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x08, 0x08,
|
||||
0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x06,
|
||||
0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05,
|
||||
0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03,
|
||||
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02,
|
||||
0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
void
|
||||
bell_on(sc)
|
||||
register struct bell_softc *sc;
|
||||
{
|
||||
int sps;
|
||||
|
||||
sps = spltty();
|
||||
opm_set_volume(sc->ch, vol_table[sc->volume]);
|
||||
opm_set_key(sc->ch, sc->key);
|
||||
splx(sps);
|
||||
|
||||
opm_key_on(sc->ch);
|
||||
sc->sc_flags |= BELLF_ON;
|
||||
}
|
||||
|
||||
void
|
||||
bell_off(sc)
|
||||
register struct bell_softc *sc;
|
||||
{
|
||||
if (sc->sc_flags & BELLF_ON) {
|
||||
opm_key_off(sc->ch);
|
||||
sc->sc_flags &= ~BELLF_ON;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
opm_bell()
|
||||
{
|
||||
register struct bell_softc *sc = &bell_softc[0];
|
||||
register int ticks;
|
||||
int sps;
|
||||
|
||||
if (sc->msec != 0) {
|
||||
if (sc->sc_flags & BELLF_OUT) {
|
||||
bell_timeout();
|
||||
} else if (sc->sc_flags & BELLF_ON)
|
||||
return;
|
||||
|
||||
ticks = bellmstohz(sc->msec);
|
||||
|
||||
bell_on(sc);
|
||||
sc->sc_flags |= BELLF_OUT;
|
||||
|
||||
timeout(bell_timeout, (caddr_t)NULL, ticks);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bell_timeout()
|
||||
{
|
||||
struct bell_softc *sc = &bell_softc[0];
|
||||
|
||||
sc->sc_flags &= ~BELLF_OUT;
|
||||
bell_off(sc);
|
||||
untimeout(bell_timeout, (caddr_t)NULL);
|
||||
}
|
||||
|
||||
void
|
||||
opm_bell_on()
|
||||
{
|
||||
register struct bell_softc *sc = &bell_softc[0];
|
||||
|
||||
if (sc->sc_flags & BELLF_OUT)
|
||||
bell_timeout();
|
||||
if (sc->sc_flags & BELLF_ON)
|
||||
return;
|
||||
|
||||
bell_on(sc);
|
||||
}
|
||||
|
||||
void
|
||||
opm_bell_off()
|
||||
{
|
||||
register struct bell_softc *sc = &bell_softc[0];
|
||||
|
||||
if (sc->sc_flags & BELLF_ON)
|
||||
bell_off(sc);
|
||||
}
|
||||
|
||||
int
|
||||
opm_bell_setup(data)
|
||||
struct bell_info *data;
|
||||
{
|
||||
register struct bell_softc *sc = &bell_softc[0];
|
||||
|
||||
/* bounds check */
|
||||
if (data->pitch > MAXBPITCH || data->pitch < MINBPITCH ||
|
||||
data->volume > MAXBVOLUME || data->msec > MAXBTIME) {
|
||||
return EINVAL;
|
||||
} else {
|
||||
sc->volume = data->volume;
|
||||
sc->pitch = data->pitch;
|
||||
sc->msec = data->msec;
|
||||
|
||||
sc->key = bell_pitchtokey(data->pitch);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bellmstohz(m)
|
||||
int m;
|
||||
{
|
||||
extern int hz;
|
||||
register int h = m;
|
||||
|
||||
if (h > 0) {
|
||||
h = h * hz / 1000;
|
||||
if (h == 0)
|
||||
h = 1000 / hz;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,43 @@
|
|||
/* $NetBSD: opmbellvar.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Takuya Harakawa.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Minoura Makoto.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Initial Voice Parameter */
|
||||
|
||||
struct opm_voice bell_voice = {
|
||||
/* AR DR SR RR SL OL KS ML DT1 DT2 AME */
|
||||
{ 31, 0, 0, 0, 0, 39, 1, 1, 0, 0, 0, },
|
||||
{ 19, 11, 0, 11, 4, 37, 0, 2, 0, 0, 0, },
|
||||
{ 31, 15, 0, 9, 0, 55, 1, 4, 0, 0, 0, },
|
||||
{ 19, 15, 0, 9, 0, 0, 1, 1, 0, 0, 0, },
|
||||
/* CON FL OP */
|
||||
3, 7, 15
|
||||
};
|
|
@ -0,0 +1,75 @@
|
|||
/* $NetBSD: opmreg.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Masanobu Saitoh, Takuya Harakawa.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Masanobu Saitoh.
|
||||
* 4. Neither the name of the University nor of the Laboratory may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#ifndef _OPMREG_H_
|
||||
#define _OPMREG_H_
|
||||
/*
|
||||
* OPM voice structure
|
||||
*/
|
||||
struct opm_operator {
|
||||
u_char ar;
|
||||
u_char d1r;
|
||||
u_char d2r;
|
||||
u_char rr;
|
||||
u_char d1l;
|
||||
u_char tl;
|
||||
u_char ks;
|
||||
u_char mul;
|
||||
u_char dt1;
|
||||
u_char dt2;
|
||||
u_char ame;
|
||||
};
|
||||
|
||||
struct opm_voice {
|
||||
struct opm_operator m1;
|
||||
struct opm_operator c1;
|
||||
struct opm_operator m2;
|
||||
struct opm_operator c2;
|
||||
u_char con; /* connection */
|
||||
u_char fb; /* feedback level */
|
||||
u_char sm; /* slot mask */
|
||||
};
|
||||
|
||||
/* XXX */
|
||||
|
||||
#define OPM1B_CT1MSK (0x80)
|
||||
#define OPM1B_CT2MSK (0x40)
|
||||
|
||||
#define FDCSTBY (0x00)
|
||||
#define FDCRDY (0x40)
|
||||
|
||||
void adpcm_chgclk __P((u_char));
|
||||
void fdc_force_ready __P((u_char));
|
||||
|
||||
#endif /* !_OPMREG_H_ */
|
|
@ -0,0 +1,522 @@
|
|||
/* $NetBSD: par.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990 The Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)ppi.c 7.3 (Berkeley) 12/16/90
|
||||
*/
|
||||
|
||||
/*
|
||||
* parallel port interface
|
||||
*/
|
||||
|
||||
#include "par.h"
|
||||
#if NPAR > 0
|
||||
|
||||
#if NPAR > 1
|
||||
#undef NPAR
|
||||
#define NPAR 1
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
#include <x68k/dev/parioctl.h>
|
||||
|
||||
void partimo();
|
||||
void parstart();
|
||||
void parintr();
|
||||
|
||||
struct par_softc {
|
||||
struct device sc_dev;
|
||||
int sc_flags;
|
||||
struct parparam sc_param;
|
||||
#define sc_burst sc_param.burst
|
||||
#define sc_timo sc_param.timo
|
||||
#define sc_delay sc_param.delay
|
||||
} ;
|
||||
|
||||
/* sc_flags values */
|
||||
#define PARF_ALIVE 0x01
|
||||
#define PARF_OPEN 0x02
|
||||
#define PARF_UIO 0x04
|
||||
#define PARF_TIMO 0x08
|
||||
#define PARF_DELAY 0x10
|
||||
#define PARF_OREAD 0x40 /* no support */
|
||||
#define PARF_OWRITE 0x80
|
||||
|
||||
#define UNIT(x) minor(x)
|
||||
|
||||
#ifdef DEBUG
|
||||
#define PDB_FOLLOW 0x01
|
||||
#define PDB_IO 0x02
|
||||
#define PDB_INTERRUPT 0x04
|
||||
#define PDB_NOCHECK 0x80
|
||||
#if 0
|
||||
int pardebug = PDB_FOLLOW | PDB_IO | PDB_INTERRUPT;
|
||||
#else
|
||||
int pardebug = 0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define PRTI_EN 0x01
|
||||
#define PRT_INT 0x20
|
||||
|
||||
int parmatch __P((struct device *, struct cfdata *, void *));
|
||||
void parattach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach par_ca = {
|
||||
sizeof(struct par_softc), (void *)parmatch, parattach
|
||||
};
|
||||
|
||||
struct cfdriver par_cd = {
|
||||
NULL, "par", DV_DULL
|
||||
};
|
||||
|
||||
int
|
||||
parmatch(pdp, cfp, aux)
|
||||
struct device *pdp;
|
||||
struct cfdata *cfp;
|
||||
void *aux;
|
||||
{
|
||||
/* X680x0 has only one parallel port */
|
||||
if (strcmp(aux, "par") || cfp->cf_unit > 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
parattach(pdp, dp, aux)
|
||||
struct device *pdp, *dp;
|
||||
void *aux;
|
||||
{
|
||||
register struct par_softc *sc = (struct par_softc *)dp;
|
||||
|
||||
sc->sc_flags = PARF_ALIVE;
|
||||
printf(": parallel port (write only, interrupt)\n", dp->dv_unit);
|
||||
ioctlr.intr &= (~PRTI_EN);
|
||||
}
|
||||
|
||||
paropen(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
register int unit = UNIT(dev);
|
||||
register struct par_softc *sc = par_cd.cd_devs[unit];
|
||||
int s;
|
||||
char mask;
|
||||
|
||||
if (unit >= NPAR || !(sc->sc_flags & PARF_ALIVE))
|
||||
return(ENXIO);
|
||||
if (sc->sc_flags & PARF_OPEN)
|
||||
return(EBUSY);
|
||||
/* X680x0 can't read */
|
||||
if ((flags & FREAD) == FREAD)
|
||||
return (EINVAL);
|
||||
|
||||
sc->sc_flags |= PARF_OPEN;
|
||||
|
||||
sc->sc_flags |= PARF_OWRITE;
|
||||
|
||||
sc->sc_burst = PAR_BURST;
|
||||
sc->sc_timo = parmstohz(PAR_TIMO);
|
||||
sc->sc_delay = parmstohz(PAR_DELAY);
|
||||
return(0);
|
||||
}
|
||||
|
||||
parclose(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
int unit = UNIT(dev);
|
||||
int s;
|
||||
struct par_softc *sc = par_cd.cd_devs[unit];
|
||||
|
||||
sc->sc_flags &= ~(PARF_OPEN|PARF_OWRITE);
|
||||
|
||||
/* don't allow interrupts any longer */
|
||||
s = spl1();
|
||||
ioctlr.intr &= (~PRTI_EN);
|
||||
splx(s);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void
|
||||
parstart(unit)
|
||||
int unit;
|
||||
{
|
||||
struct par_softc *sc = par_cd.cd_devs[unit];
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_FOLLOW)
|
||||
printf("parstart(%x)\n", unit);
|
||||
#endif
|
||||
sc->sc_flags &= ~PARF_DELAY;
|
||||
wakeup(sc);
|
||||
}
|
||||
|
||||
void
|
||||
partimo(unit)
|
||||
int unit;
|
||||
{
|
||||
struct par_softc *sc = par_cd.cd_devs[unit];
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_FOLLOW)
|
||||
printf("partimo(%x)\n", unit);
|
||||
#endif
|
||||
sc->sc_flags &= ~(PARF_UIO|PARF_TIMO);
|
||||
wakeup(sc);
|
||||
}
|
||||
|
||||
parwrite(dev, uio)
|
||||
dev_t dev;
|
||||
struct uio *uio;
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_FOLLOW)
|
||||
printf("parwrite(%x, %x)\n", dev, uio);
|
||||
#endif
|
||||
return (parrw(dev, uio));
|
||||
}
|
||||
|
||||
parrw(dev, uio)
|
||||
dev_t dev;
|
||||
register struct uio *uio;
|
||||
{
|
||||
int unit = UNIT(dev);
|
||||
register struct par_softc *sc = par_cd.cd_devs[unit];
|
||||
register int s, len, cnt;
|
||||
register char *cp;
|
||||
int error = 0, gotdata = 0;
|
||||
int buflen;
|
||||
char *buf;
|
||||
|
||||
if (!!(sc->sc_flags & PARF_OREAD) ^ (uio->uio_rw == UIO_READ))
|
||||
return EINVAL;
|
||||
|
||||
if (uio->uio_resid == 0)
|
||||
return(0);
|
||||
|
||||
buflen = min(sc->sc_burst, uio->uio_resid);
|
||||
buf = (char *)malloc(buflen, M_DEVBUF, M_WAITOK);
|
||||
sc->sc_flags |= PARF_UIO;
|
||||
if (sc->sc_timo > 0) {
|
||||
sc->sc_flags |= PARF_TIMO;
|
||||
timeout(partimo, (void *) unit, sc->sc_timo);
|
||||
}
|
||||
while (uio->uio_resid > 0) {
|
||||
len = min(buflen, uio->uio_resid);
|
||||
cp = buf;
|
||||
if (uio->uio_rw == UIO_WRITE) {
|
||||
error = uiomove(cp, len, uio);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
again:
|
||||
s = spl1();
|
||||
/*
|
||||
* Check if we timed out during sleep or uiomove
|
||||
*/
|
||||
(void) splsoftclock();
|
||||
if ((sc->sc_flags & PARF_UIO) == 0) {
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_IO)
|
||||
printf("parrw: uiomove/sleep timo, flags %x\n",
|
||||
sc->sc_flags);
|
||||
#endif
|
||||
if (sc->sc_flags & PARF_TIMO) {
|
||||
untimeout(partimo, (void *) unit);
|
||||
sc->sc_flags &= ~PARF_TIMO;
|
||||
}
|
||||
splx(s);
|
||||
break;
|
||||
}
|
||||
splx(s);
|
||||
/*
|
||||
* Perform the operation
|
||||
*/
|
||||
cnt = parsend (cp, len);
|
||||
if (cnt < 0) {
|
||||
error = -cnt;
|
||||
break;
|
||||
}
|
||||
|
||||
s = splsoftclock();
|
||||
/*
|
||||
* Operation timeout (or non-blocking), quit now.
|
||||
*/
|
||||
if ((sc->sc_flags & PARF_UIO) == 0) {
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_IO)
|
||||
printf("parrw: timeout/done\n");
|
||||
#endif
|
||||
splx(s);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Implement inter-read delay
|
||||
*/
|
||||
if (sc->sc_delay > 0) {
|
||||
sc->sc_flags |= PARF_DELAY;
|
||||
timeout(parstart, (void *) unit, sc->sc_delay);
|
||||
error = tsleep(sc, PCATCH|PZERO-1, "par-cdelay", 0);
|
||||
if (error) {
|
||||
splx(s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
splx(s);
|
||||
/*
|
||||
* Must not call uiomove again til we've used all data
|
||||
* that we already grabbed.
|
||||
*/
|
||||
if (uio->uio_rw == UIO_WRITE && cnt != len) {
|
||||
cp += cnt;
|
||||
len -= cnt;
|
||||
cnt = 0;
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
s = splsoftclock();
|
||||
if (sc->sc_flags & PARF_TIMO) {
|
||||
untimeout(partimo, (void *) unit);
|
||||
sc->sc_flags &= ~PARF_TIMO;
|
||||
}
|
||||
if (sc->sc_flags & PARF_DELAY) {
|
||||
untimeout(parstart, (void *) unit);
|
||||
sc->sc_flags &= ~PARF_DELAY;
|
||||
}
|
||||
splx(s);
|
||||
/*
|
||||
* Adjust for those chars that we uiomove'ed but never wrote
|
||||
*/
|
||||
if (uio->uio_rw == UIO_WRITE && cnt != len) {
|
||||
uio->uio_resid += (len - cnt);
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_IO)
|
||||
printf("parrw: short write, adjust by %d\n",
|
||||
len-cnt);
|
||||
#endif
|
||||
}
|
||||
free(buf, M_DEVBUF);
|
||||
#ifdef DEBUG
|
||||
if (pardebug & (PDB_FOLLOW|PDB_IO))
|
||||
printf("parrw: return %d, resid %d\n", error, uio->uio_resid);
|
||||
#endif
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
parioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
struct par_softc *sc = par_cd.cd_devs[UNIT(dev)];
|
||||
struct parparam *pp, *upp;
|
||||
int error = 0;
|
||||
|
||||
switch (cmd) {
|
||||
case PARIOCGPARAM:
|
||||
pp = &sc->sc_param;
|
||||
upp = (struct parparam *)data;
|
||||
upp->burst = pp->burst;
|
||||
upp->timo = parhztoms(pp->timo);
|
||||
upp->delay = parhztoms(pp->delay);
|
||||
break;
|
||||
|
||||
case PARIOCSPARAM:
|
||||
pp = &sc->sc_param;
|
||||
upp = (struct parparam *)data;
|
||||
if (upp->burst < PAR_BURST_MIN || upp->burst > PAR_BURST_MAX ||
|
||||
upp->delay < PAR_DELAY_MIN || upp->delay > PAR_DELAY_MAX)
|
||||
return(EINVAL);
|
||||
pp->burst = upp->burst;
|
||||
pp->timo = parmstohz(upp->timo);
|
||||
pp->delay = parmstohz(upp->delay);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(EINVAL);
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
parhztoms(h)
|
||||
int h;
|
||||
{
|
||||
extern int hz;
|
||||
register int m = h;
|
||||
|
||||
if (m > 0)
|
||||
m = m * 1000 / hz;
|
||||
return(m);
|
||||
}
|
||||
|
||||
int
|
||||
parmstohz(m)
|
||||
int m;
|
||||
{
|
||||
extern int hz;
|
||||
register int h = m;
|
||||
|
||||
if (h > 0) {
|
||||
h = h * hz / 1000;
|
||||
if (h == 0)
|
||||
h = 1000 / hz;
|
||||
}
|
||||
return(h);
|
||||
}
|
||||
|
||||
/* stuff below here if for interrupt driven output of data thru
|
||||
the parallel port. */
|
||||
|
||||
int partimeout_pending;
|
||||
int parsend_pending;
|
||||
|
||||
void
|
||||
parintr (arg)
|
||||
void *arg;
|
||||
{
|
||||
int s, mask;
|
||||
|
||||
mask = (int)arg;
|
||||
s = splclock();
|
||||
|
||||
ioctlr.intr &= (~PRTI_EN);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_INTERRUPT)
|
||||
printf ("parintr %d(%s)\n", mask, mask ? "FLG" : "tout");
|
||||
#endif
|
||||
/* if invoked from timeout handler, mask will be 0,
|
||||
* if from interrupt, it will contain the cia-icr mask,
|
||||
* which is != 0
|
||||
*/
|
||||
if (mask) {
|
||||
if (partimeout_pending)
|
||||
untimeout (parintr, 0);
|
||||
if (parsend_pending)
|
||||
parsend_pending = 0;
|
||||
}
|
||||
|
||||
/* either way, there won't be a timeout pending any longer */
|
||||
partimeout_pending = 0;
|
||||
|
||||
wakeup(parintr);
|
||||
splx (s);
|
||||
}
|
||||
|
||||
int
|
||||
parsendch (ch)
|
||||
u_char ch;
|
||||
{
|
||||
int error = 0;
|
||||
int s;
|
||||
|
||||
/* if either offline, busy or out of paper, wait for that
|
||||
condition to clear */
|
||||
s = spl1();
|
||||
while (!error
|
||||
&& (parsend_pending
|
||||
|| !(ioctlr.intr & PRT_INT)))
|
||||
{
|
||||
extern int hz;
|
||||
|
||||
/* wait a second, and try again */
|
||||
timeout (parintr, 0, hz);
|
||||
partimeout_pending = 1;
|
||||
/* this is essentially a flipflop to have us wait for the
|
||||
first character being transmitted when trying to transmit
|
||||
the second, etc. */
|
||||
parsend_pending = 0;
|
||||
/* it's quite important that a parallel putc can be
|
||||
interrupted, given the possibility to lock a printer
|
||||
in an offline condition.. */
|
||||
if (error = tsleep (parintr, PCATCH|PZERO-1, "parsendch", 0)) {
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_INTERRUPT)
|
||||
printf ("parsendch interrupted, error = %d\n", error);
|
||||
#endif
|
||||
if (partimeout_pending)
|
||||
untimeout (parintr, 0);
|
||||
|
||||
partimeout_pending = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (! error) {
|
||||
#ifdef DEBUG
|
||||
if (pardebug & PDB_INTERRUPT)
|
||||
printf ("#%d", ch);
|
||||
#endif
|
||||
printer.data = ch;
|
||||
DELAY(1); /* (DELAY(1) == 1us) > 0.5us */
|
||||
printer.strobe = 0x00;
|
||||
ioctlr.intr |= PRTI_EN;
|
||||
DELAY(1);
|
||||
printer.strobe = 0x01;
|
||||
parsend_pending = 1;
|
||||
}
|
||||
|
||||
splx (s);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
parsend (buf, len)
|
||||
u_char *buf;
|
||||
int len;
|
||||
{
|
||||
int err, orig_len = len;
|
||||
|
||||
for (; len; len--, buf++)
|
||||
if (err = parsendch (*buf))
|
||||
return err < 0 ? -EINTR : -err;
|
||||
|
||||
/* either all or nothing.. */
|
||||
return orig_len;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: @(#)ppiioctl.h 7.2 (Berkeley) 12/16/90
|
||||
* $Id: parioctl.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*/
|
||||
|
||||
#ifndef _IOCTL_
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
struct parparam {
|
||||
int burst; /* chars to send/recv in one call */
|
||||
int timo; /* timeout: -1 blocking, 0 non-blocking, >0 msec */
|
||||
int delay; /* delay between polls (msec) */
|
||||
};
|
||||
|
||||
#define PAR_BLOCK -1
|
||||
#define PAR_NOBLOCK 0
|
||||
|
||||
/* default values */
|
||||
#define PAR_BURST 1024
|
||||
#define PAR_TIMO PAR_BLOCK
|
||||
#define PAR_DELAY 10
|
||||
|
||||
/* limits */
|
||||
#define PAR_BURST_MIN 1
|
||||
#define PAR_BURST_MAX 1024
|
||||
#define PAR_DELAY_MIN 0
|
||||
#define PAR_DELAY_MAX 30000
|
||||
|
||||
#define PARIOCSPARAM _IOW('P', 0x1, struct parparam)
|
||||
#define PARIOCGPARAM _IOR('P', 0x2, struct parparam)
|
|
@ -0,0 +1,286 @@
|
|||
/* $NetBSD: pow.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 MINOURA Makoto.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Minoura Makoto.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Power switch device driver.
|
||||
* Useful for
|
||||
* 1. accessing boot information.
|
||||
* 2. looking at the front or external power switch.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
#include <machine/powioctl.h>
|
||||
#include <x68k/dev/powvar.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
#include "pow.h"
|
||||
|
||||
#define sramtop (IODEVbase->io_sram)
|
||||
#define rtc (IODEVbase->io_rtc)
|
||||
|
||||
static int powinit ();
|
||||
|
||||
struct pow_softc pows[NPOW];
|
||||
|
||||
/* ARGSUSED */
|
||||
powattach(num)
|
||||
int num;
|
||||
{
|
||||
int minor;
|
||||
int sw;
|
||||
|
||||
sw = ~mfp.gpip & 7;
|
||||
|
||||
mfp.ierb &= ~7; /* disable mfp power switch interrupt */
|
||||
mfp.aer &= ~7;
|
||||
|
||||
for (minor = 0; minor < num; minor++) {
|
||||
if (minor == 0) {
|
||||
pows[minor].status = POW_FREE;
|
||||
} else {
|
||||
pows[minor].status = POW_ANY;
|
||||
}
|
||||
pows[minor].sw = sw;
|
||||
|
||||
if (sw) {
|
||||
mfp.aer |= sw;
|
||||
mfp.ierb |= sw;
|
||||
}
|
||||
|
||||
printf ("pow%d: started by ", minor);
|
||||
if ((sw & POW_ALARMSW) && sramtop[0x26] == 0)
|
||||
printf ("RTC alarm.\n");
|
||||
else if (sw & POW_EXTERNALSW)
|
||||
printf ("external power switch.\n");
|
||||
else if (sw & POW_FRONTSW)
|
||||
printf ("front power switch.\n");
|
||||
else
|
||||
printf ("???.\n");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
powopen(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
struct pow_softc *sc = &pows[minor(dev)];
|
||||
|
||||
if (minor(dev) >= NPOW)
|
||||
return EXDEV;
|
||||
|
||||
if (sc->status == POW_BUSY)
|
||||
return EBUSY;
|
||||
|
||||
sc->pid = 0;
|
||||
if (sc->status == POW_FREE)
|
||||
sc->status = POW_BUSY;
|
||||
|
||||
sc->rw = (flags & (FREAD|FWRITE));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
powclose (dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
struct pow_softc *sc = &pows[minor(dev)];
|
||||
|
||||
if (sc->status == POW_BUSY)
|
||||
sc->status = POW_FREE;
|
||||
sc->pid = 0;
|
||||
}
|
||||
|
||||
#define SRAMINT(offset) (*((int*) (&sramtop[offset])))
|
||||
#define RTCWAIT DELAY(100)
|
||||
|
||||
static int
|
||||
setalarm (bp)
|
||||
struct x68k_alarminfo *bp;
|
||||
{
|
||||
int s = splclock ();
|
||||
int ontime;
|
||||
|
||||
sysport.sramwp = 0x31;
|
||||
if (bp->al_enable) {
|
||||
SRAMINT (0x1e) = bp->al_dowhat;
|
||||
SRAMINT (0x22) = bp->al_ontime;
|
||||
SRAMINT (0x14) = (bp->al_offtime / 60) - 1;
|
||||
sramtop[0x26] = 0;
|
||||
} else {
|
||||
sramtop[0x26] = 7;
|
||||
}
|
||||
sysport.sramwp = 0;
|
||||
|
||||
rtc.bank0.mode = 9;
|
||||
RTCWAIT;
|
||||
rtc.bank1.reset = 5;
|
||||
RTCWAIT;
|
||||
|
||||
if (bp->al_enable) {
|
||||
ontime = bp->al_ontime;
|
||||
if ((ontime & 0x0f) <= 9)
|
||||
rtc.bank1.al_min = ontime & 0x0f;
|
||||
RTCWAIT;
|
||||
ontime >>= 4;
|
||||
if ((ontime & 0x0f) <= 6)
|
||||
rtc.bank1.al_min10 = ontime & 0x0f;
|
||||
RTCWAIT;
|
||||
ontime >>= 4;
|
||||
if ((ontime & 0x0f) <= 9)
|
||||
rtc.bank1.al_hour = ontime & 0x0f;
|
||||
RTCWAIT;
|
||||
ontime >>= 4;
|
||||
if ((ontime & 0x0f) <= 2)
|
||||
rtc.bank1.al_hour10 = ontime & 0x0f;
|
||||
RTCWAIT;
|
||||
ontime >>= 4;
|
||||
if ((ontime & 0x0f) <= 9)
|
||||
rtc.bank1.al_day = ontime & 0x0f;
|
||||
RTCWAIT;
|
||||
ontime >>= 4;
|
||||
if ((ontime & 0x0f) <= 3)
|
||||
rtc.bank1.al_day10 = ontime & 0x0f;
|
||||
RTCWAIT;
|
||||
ontime >>= 4;
|
||||
if ((ontime & 0x0f) <= 6)
|
||||
rtc.bank1.al_week = ontime & 0x0f;
|
||||
RTCWAIT;
|
||||
rtc.bank1.clkout = 0;
|
||||
RTCWAIT;
|
||||
rtc.bank1.mode = 0x0c;
|
||||
} else {
|
||||
rtc.bank1.clkout = 7;
|
||||
RTCWAIT;
|
||||
rtc.bank1.mode = 0x08;
|
||||
}
|
||||
|
||||
splx (s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
powioctl (dev, cmd, addr, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t addr;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
struct pow_softc *sc = &pows[minor(dev)];
|
||||
|
||||
switch (cmd) {
|
||||
case POWIOCGPOWERINFO:
|
||||
{
|
||||
struct x68k_powerinfo *bp = (struct x68k_powerinfo*) addr;
|
||||
if (!(sc->rw & FREAD))
|
||||
return EBADF;
|
||||
bp->pow_switch_boottime = sc->sw;
|
||||
bp->pow_switch_current = ~mfp.gpip & 7;
|
||||
bp->pow_boottime = boottime.tv_sec;
|
||||
bp->pow_bootcount = SRAMINT (0x44);
|
||||
bp->pow_usedtotal = SRAMINT (0x40) * 60;
|
||||
}
|
||||
break;
|
||||
|
||||
case POWIOCGALARMINFO:
|
||||
{
|
||||
struct x68k_alarminfo *bp = (struct x68k_alarminfo*) addr;
|
||||
if (!(sc->rw & FREAD))
|
||||
return EBADF;
|
||||
bp->al_enable = (sramtop[0x26] == 0);
|
||||
bp->al_ontime = SRAMINT (0x22);
|
||||
bp->al_dowhat = SRAMINT (0x1e);
|
||||
bp->al_offtime = (SRAMINT (0x14) + 1) * 60;
|
||||
}
|
||||
break;
|
||||
|
||||
case POWIOCSALARMINFO:
|
||||
if (!(sc->rw & FWRITE))
|
||||
return EBADF;
|
||||
return setalarm ((struct x68k_alarminfo*) addr);
|
||||
|
||||
case POWIOCSSIGNAL:
|
||||
if (minor(dev) != 0)
|
||||
return EOPNOTSUPP;
|
||||
if (!(sc->rw & FWRITE))
|
||||
return EBADF;
|
||||
{
|
||||
int signum = *(int*) addr;
|
||||
if (signum <= 0 || signum > 31)
|
||||
return EINVAL;
|
||||
|
||||
sc->signum = signum;
|
||||
sc->proc = p;
|
||||
sc->pid = p->p_pid;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
powintr ()
|
||||
{
|
||||
int sw;
|
||||
int s;
|
||||
|
||||
s = spl6 ();
|
||||
|
||||
sw = ~mfp.gpip & 6;
|
||||
mfp.aer &= ~sw;
|
||||
mfp.ierb |= sw;
|
||||
|
||||
if (pows[0].status == POW_BUSY && pows[0].pid != 0)
|
||||
psignal (pows[0].proc, pows[0].signum);
|
||||
|
||||
splx (s);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 1995 MINOURA Makoto.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Minoura Makoto.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
enum pow_status {
|
||||
POW_FREE,
|
||||
POW_BUSY,
|
||||
POW_ANY,
|
||||
};
|
||||
|
||||
struct pow_softc {
|
||||
short status;
|
||||
short rw;
|
||||
int sw;
|
||||
pid_t pid;
|
||||
struct proc *proc;
|
||||
int signum;
|
||||
};
|
|
@ -0,0 +1,202 @@
|
|||
/* $NetBSD: rtclock.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1993, 1994 Masaru Oki
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Masaru Oki.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* X680x0 internal real time clock interface
|
||||
* alarm is not supported.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include <x68k/dev/rtclock_var.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
|
||||
static u_long rtgettod __P((void));
|
||||
static int rtsettod __P((long));
|
||||
|
||||
/*
|
||||
* x68k/clock.c calls thru this vector, if it is set, to read
|
||||
* the realtime clock.
|
||||
*/
|
||||
u_long (*gettod) __P((void));
|
||||
int (*settod)();
|
||||
|
||||
static volatile union rtc *rtc_addr = 0;
|
||||
|
||||
int
|
||||
rtclockinit()
|
||||
{
|
||||
rtc_addr = &IODEVbase->io_rtc;
|
||||
|
||||
if (rtgettod()) {
|
||||
gettod = rtgettod;
|
||||
settod = rtsettod;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int month_days[12] = {
|
||||
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
|
||||
};
|
||||
|
||||
static u_long
|
||||
rtgettod()
|
||||
{
|
||||
register int i;
|
||||
register u_long tmp;
|
||||
int year, month, day, hour, min, sec;
|
||||
|
||||
/* hold clock */
|
||||
RTC_WRITE(rtc_addr, mode, RTC_HOLD_CLOCK);
|
||||
|
||||
/* read it */
|
||||
sec = RTC_REG(sec10) * 10 + RTC_REG(sec);
|
||||
min = RTC_REG(min10) * 10 + RTC_REG(min);
|
||||
hour = RTC_REG(hour10) * 10 + RTC_REG(hour);
|
||||
day = RTC_REG(day10) * 10 + RTC_REG(day);
|
||||
month = RTC_REG(mon10) * 10 + RTC_REG(mon);
|
||||
year = RTC_REG(year10) * 10 + RTC_REG(year) + 1980;
|
||||
|
||||
/* let it run again.. */
|
||||
RTC_WRITE(rtc_addr, mode, RTC_FREE_CLOCK);
|
||||
|
||||
range_test(hour, 0, 23);
|
||||
range_test(day, 1, 31);
|
||||
range_test(month, 1, 12);
|
||||
range_test(year, STARTOFTIME, 2000);
|
||||
|
||||
tmp = 0;
|
||||
|
||||
for (i = STARTOFTIME; i < year; i++)
|
||||
tmp += days_in_year(i);
|
||||
if (leapyear(year) && month > FEBRUARY)
|
||||
tmp++;
|
||||
|
||||
for (i = 1; i < month; i++)
|
||||
tmp += days_in_month(i);
|
||||
|
||||
tmp += (day - 1);
|
||||
|
||||
tmp = ((tmp * 24 + hour) * 60 + min + TIMEZONE) * 60 + sec;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static int
|
||||
rtsettod (tim)
|
||||
long tim;
|
||||
{
|
||||
/*
|
||||
* I don't know if setting the clock is analogous
|
||||
* to reading it, I don't have demo-code for setting.
|
||||
* just give it a try..
|
||||
*/
|
||||
register int i;
|
||||
register long hms, day;
|
||||
u_char sec1, sec2;
|
||||
u_char min1, min2;
|
||||
u_char hour1, hour2;
|
||||
u_char day1, day2;
|
||||
u_char mon1, mon2;
|
||||
u_char year1, year2;
|
||||
|
||||
/*
|
||||
* there seem to be problems with the bitfield addressing
|
||||
* currently used..
|
||||
*/
|
||||
if (!rtc_addr)
|
||||
return 0;
|
||||
|
||||
tim -= (TIMEZONE * 60);
|
||||
|
||||
/* prepare values to be written to clock */
|
||||
day = tim / SECDAY;
|
||||
hms = tim % SECDAY;
|
||||
|
||||
hour2 = hms / 3600;
|
||||
hour1 = hour2 / 10;
|
||||
hour2 %= 10;
|
||||
|
||||
min2 = (hms % 3600) / 60;
|
||||
min1 = min2 / 10;
|
||||
min2 %= 10;
|
||||
|
||||
sec2 = (hms % 3600) % 60;
|
||||
sec1 = sec2 / 10;
|
||||
sec2 %= 10;
|
||||
|
||||
/* Number of years in days */
|
||||
for (i = STARTOFTIME - 1980; day >= days_in_year(i); i++)
|
||||
day -= days_in_year(i);
|
||||
year1 = i / 10;
|
||||
year2 = i % 10;
|
||||
|
||||
/* Number of months in days left */
|
||||
if (leapyear(i))
|
||||
days_in_month(FEBRUARY) = 29;
|
||||
for (i = 1; day >= days_in_month(i); i++)
|
||||
day -= days_in_month(i);
|
||||
days_in_month(FEBRUARY) = 28;
|
||||
|
||||
mon1 = i / 10;
|
||||
mon2 = i % 10;
|
||||
|
||||
/* Days are what is left over (+1) from all that. */
|
||||
day ++;
|
||||
day1 = day / 10;
|
||||
day2 = day % 10;
|
||||
|
||||
RTC_WRITE(rtc_addr, mode, RTC_HOLD_CLOCK);
|
||||
RTC_WRITE(rtc_addr, sec10, sec1);
|
||||
RTC_WRITE(rtc_addr, sec, sec2);
|
||||
RTC_WRITE(rtc_addr, min10, min1);
|
||||
RTC_WRITE(rtc_addr, min, min2);
|
||||
RTC_WRITE(rtc_addr, hour10, hour1);
|
||||
RTC_WRITE(rtc_addr, hour, hour2);
|
||||
RTC_WRITE(rtc_addr, day10, day1);
|
||||
RTC_WRITE(rtc_addr, day, day2);
|
||||
RTC_WRITE(rtc_addr, mon10, mon1);
|
||||
RTC_WRITE(rtc_addr, mon, mon2);
|
||||
RTC_WRITE(rtc_addr, year10, year1);
|
||||
RTC_WRITE(rtc_addr, year, year2);
|
||||
RTC_WRITE(rtc_addr, mode, RTC_FREE_CLOCK);
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/* $NetBSD: rtclock_var.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1993, 1994 Masaru Oki
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Masaru Oki.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _RTCLOCKVAR_H_
|
||||
#define _RTCLOCKVAR_H_
|
||||
|
||||
/*
|
||||
* commands written to mode, HOLD before reading the clock,
|
||||
* FREE after done reading.
|
||||
*/
|
||||
|
||||
#define RTC_HOLD_CLOCK 0
|
||||
#define RTC_FREE_CLOCK 8
|
||||
|
||||
#define RTC_REG(x) (rtc_addr->bank0.x & 0x0f)
|
||||
#define RTC_WRITE(r,x,v) (r)->bank0.x = (v)
|
||||
|
||||
#define FEBRUARY 2
|
||||
#define STARTOFTIME 1970
|
||||
#define SECDAY 86400L
|
||||
#define SECYR (SECDAY * 365)
|
||||
|
||||
#define leapyear(year) ((year) % 4 == 0)
|
||||
#define range_test(n, l, h) if ((n) < (l) || (n) > (h)) return(0)
|
||||
#define days_in_year(a) (leapyear(a) ? 366 : 365)
|
||||
#define days_in_month(a) (month_days[(a) - 1])
|
||||
|
||||
#endif /* _RTCLOCKVAR_H_ */
|
|
@ -0,0 +1,14 @@
|
|||
/* $NetBSD: sdb.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Masaru Oki
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
struct x68k_diskblock {
|
||||
unsigned char db_idname[8]; /* identifier name 'X68SCSI1' */
|
||||
unsigned short db_blocklen; /* logical block length (bytes) */
|
||||
unsigned long db_logicalblocks; /* logical block size */
|
||||
unsigned char db_extflag; /* 1, if 10bytes scsi transfer enable */
|
||||
unsigned char db_removable; /* 1, if removal */
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,164 @@
|
|||
/* $NetBSD: sram.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Kazuhisa Shimizu.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Kazuhisa Shimizu.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/sram.h>
|
||||
#include <x68k/dev/sramvar.h>
|
||||
#include <x68k/x68k/iodevice.h>
|
||||
#include "sram.h"
|
||||
|
||||
struct sram_softc sram_softc;
|
||||
|
||||
#ifdef DEBUG
|
||||
#define SRAM_DEBUG_OPEN 0x01
|
||||
#define SRAM_DEBUG_CLOSE 0x02
|
||||
#define SRAM_DEBUG_IOCTL 0x03
|
||||
int sramdebug = SRAM_DEBUG_IOCTL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* functions for probeing.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
sramattach(num)
|
||||
int num;
|
||||
{
|
||||
sram_softc.flags = 0;
|
||||
printf("sram0: 16k bytes accessible\n");
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* functions made available by conf.c
|
||||
*/
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
sramopen(dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
struct sram_softc *su = &sram_softc;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (sramdebug & SRAM_DEBUG_OPEN)
|
||||
printf ("Sram open\n");
|
||||
#endif
|
||||
|
||||
if (minor(dev) >= 1)
|
||||
return EXDEV;
|
||||
|
||||
if (su->flags & SRF_OPEN) {
|
||||
return (EBUSY);
|
||||
}
|
||||
|
||||
su->flags |= SRF_OPEN;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
sramclose (dev, flags)
|
||||
dev_t dev;
|
||||
int flags;
|
||||
{
|
||||
struct sram_softc *su = &sram_softc;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (sramdebug & SRAM_DEBUG_CLOSE)
|
||||
printf ("Sram close\n");
|
||||
#endif
|
||||
|
||||
if (su->flags & SRF_OPEN) {
|
||||
su->flags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
sramioctl (dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
u_long cmd;
|
||||
caddr_t data;
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
struct sram_softc *su = &sram_softc;
|
||||
int error = 0;
|
||||
struct sram_io *sram_io;
|
||||
register char *sramtop = IODEVbase->io_sram;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (sramdebug & SRAM_DEBUG_IOCTL)
|
||||
printf ("Sram ioctl cmd=%x\n",cmd);
|
||||
#endif
|
||||
sram_io = (struct sram_io *)data;
|
||||
|
||||
switch (cmd) {
|
||||
case SIOGSRAM:
|
||||
#ifdef DEBUG
|
||||
if (sramdebug & SRAM_DEBUG_IOCTL)
|
||||
printf ("Sram ioctl SIOGSRAM address=%x\n",data);
|
||||
printf ("Sram ioctl SIOGSRAM offset=%x\n",sram_io->offset);
|
||||
#endif
|
||||
if (sram_io == NULL ||
|
||||
sram_io->offset + SRAM_IO_SIZE > SRAM_SIZE)
|
||||
return(EFAULT);
|
||||
bcopy(sramtop + sram_io->offset, &(sram_io->sram), SRAM_IO_SIZE);
|
||||
break;
|
||||
case SIOPSRAM:
|
||||
#ifdef DEBUG
|
||||
if (sramdebug & SRAM_DEBUG_IOCTL)
|
||||
printf ("Sram ioctl SIOSSRAM address=%x\n",data);
|
||||
printf ("Sram ioctl SIOSSRAM offset=%x\n",sram_io->offset);
|
||||
#endif
|
||||
if (sram_io == NULL ||
|
||||
sram_io->offset + SRAM_IO_SIZE > SRAM_SIZE)
|
||||
return(EFAULT);
|
||||
sysport.sramwp = 0x31;
|
||||
bcopy(&(sram_io->sram), sramtop + sram_io->offset,SRAM_IO_SIZE);
|
||||
sysport.sramwp = 0x00;
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
return(error);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* $NetBSD: sramvar.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Kazuhisa Shimizu.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Kazuhisa Shimizu.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
struct sram_softc {
|
||||
int flags;
|
||||
};
|
||||
|
||||
enum sram_unit_flag_bits {
|
||||
SRB_OPEN
|
||||
};
|
||||
|
||||
enum sram_unit_flags {
|
||||
SRF_OPEN = 1<<SRB_OPEN
|
||||
};
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)zsvar.h 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* $Id: zsvar.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Software state, per zs channel.
|
||||
*
|
||||
* The zs chip has insufficient buffering, so we provide a software
|
||||
* buffer using a two-level interrupt scheme. The hardware (high priority)
|
||||
* interrupt simply grabs the `cause' of the interrupt and stuffs it into
|
||||
* a ring buffer. It then schedules a software interrupt; the latter
|
||||
* empties the ring as fast as it can, hoping to avoid overflow.
|
||||
*
|
||||
* Interrupts can happen because of:
|
||||
* - received data;
|
||||
* - transmit pseudo-DMA done; and
|
||||
* - status change.
|
||||
* These are all stored together in the (single) ring. The size of the
|
||||
* ring is a power of two, to make % operations fast. Since we need two
|
||||
* bits to distinguish the interrupt type, and up to 16 for the received
|
||||
* data plus RR1 status, we use 32 bits per ring entry.
|
||||
*
|
||||
* When the value is a character + RR1 status, the character is in the
|
||||
* upper 8 bits of the RR1 status.
|
||||
*/
|
||||
#define ZLRB_RING_SIZE 16384 /* ZS line ring buffer size */
|
||||
#define ZLRB_RING_MASK 16383 /* mask for same */
|
||||
|
||||
/* 0 is reserved (means "no interrupt") */
|
||||
#define ZRING_RINT 1 /* receive data interrupt */
|
||||
#define ZRING_XINT 2 /* transmit done interrupt */
|
||||
#define ZRING_SINT 3 /* status change interrupt */
|
||||
|
||||
#define ZRING_TYPE(x) ((x) & 3)
|
||||
#define ZRING_VALUE(x) ((x) >> 8)
|
||||
#define ZRING_MAKE(t, v) ((t) | (v) << 8)
|
||||
|
||||
struct zs_chanstate {
|
||||
struct zs_chanstate *cs_next; /* linked list for zshard() */
|
||||
volatile struct zschan *cs_zc; /* points to hardware regs */
|
||||
int cs_unit; /* unit number */
|
||||
struct tty *cs_ttyp; /* ### */
|
||||
|
||||
/*
|
||||
* We must keep a copy of the write registers as they are
|
||||
* mostly write-only and we sometimes need to set and clear
|
||||
* individual bits (e.g., in WR3). Not all of these are
|
||||
* needed but 16 bytes is cheap and this makes the addressing
|
||||
* simpler. Unfortunately, we can only write to some registers
|
||||
* when the chip is not actually transmitting, so whenever
|
||||
* we are expecting a `transmit done' interrupt the preg array
|
||||
* is allowed to `get ahead' of the current values. In a
|
||||
* few places we must change the current value of a register,
|
||||
* rather than (or in addition to) the pending value; for these
|
||||
* cs_creg[] contains the current value.
|
||||
*/
|
||||
u_char cs_creg[16]; /* current values */
|
||||
u_char cs_preg[16]; /* pending values */
|
||||
u_char cs_heldchange; /* change pending (creg != preg) */
|
||||
u_char cs_rr0; /* last rr0 processed */
|
||||
|
||||
/* pure software data, per channel */
|
||||
char cs_softcar; /* software carrier */
|
||||
char cs_conk; /* is console keyboard, decode L1-A */
|
||||
char cs_brkabort; /* abort (as if via L1-A) on BREAK */
|
||||
char cs_kgdb; /* enter debugger on frame char */
|
||||
char cs_consio; /* port does /dev/console I/O */
|
||||
char cs_xxx; /* (spare) */
|
||||
int cs_speed; /* default baud rate (from ROM) */
|
||||
|
||||
/*
|
||||
* The transmit byte count and address are used for pseudo-DMA
|
||||
* output in the hardware interrupt code. PDMA can be suspended
|
||||
* to get pending changes done; heldtbc is used for this. It can
|
||||
* also be stopped for ^S; this sets TS_TTSTOP in tp->t_state.
|
||||
*/
|
||||
int cs_tbc; /* transmit byte count */
|
||||
caddr_t cs_tba; /* transmit buffer address */
|
||||
int cs_heldtbc; /* held tbc while xmission stopped */
|
||||
|
||||
/*
|
||||
* Printing an overrun error message often takes long enough to
|
||||
* cause another overrun, so we only print one per second.
|
||||
*/
|
||||
long cs_rotime; /* time of last ring overrun */
|
||||
long cs_fotime; /* time of last fifo overrun */
|
||||
|
||||
/*
|
||||
* The ring buffer.
|
||||
*/
|
||||
u_int cs_rbget; /* ring buffer `get' index */
|
||||
volatile u_int cs_rbput; /* ring buffer `put' index */
|
||||
int cs_rbuf[ZLRB_RING_SIZE];/* type, value pairs */
|
||||
};
|
||||
|
||||
/*
|
||||
* N.B.: the keyboard is channel 1, the mouse channel 0; ttyb is 1, ttya
|
||||
* is 0. In other words, the things are BACKWARDS.
|
||||
*/
|
||||
#define ZS_CHAN_A 1
|
||||
#define ZS_CHAN_B 0
|
||||
|
||||
/*
|
||||
* Macros to read and write individual registers (except 0) in a channel.
|
||||
* The ZS chip requires a 1.6 uSec. recovery time between accesses.
|
||||
*/
|
||||
#define ZS_READ(c, r) zs_read(c, r)
|
||||
#define ZS_WRITE(c, r, v) zs_write(c, r, v)
|
||||
#define ZS_DELAY() DELAY(2)/*asm("nop")*/
|
|
@ -0,0 +1,39 @@
|
|||
# $NetBSD: Makefile,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
|
||||
#G=-g
|
||||
#M=-m68020 -fall-bsr
|
||||
CFLAGS=-O2 -fomit-frame-pointer -Wall $M $G
|
||||
|
||||
all: fdboot
|
||||
|
||||
fdboot: fdboot.o bootufs.o
|
||||
@echo loading fdboot
|
||||
@ld -n -Bstatic -Ttext 0x3f0000 -o fdboot.x fdboot.o bootufs.o -lc
|
||||
@cp fdboot.x s.x
|
||||
@strip s.x
|
||||
@dd bs=1 skip=32 count=8192 if=s.x of=fdboot 2> /dev/null
|
||||
@rm s.x
|
||||
@size fdboot.x
|
||||
|
||||
bootufs.o: bootufs.c fdboot.h
|
||||
$(CC) -o $@ -c -I . $< $(CFLAGS)
|
||||
|
||||
fdboot.o : fdboot.s
|
||||
$(CC) -o $@ -c $<
|
||||
|
||||
.ifndef ID
|
||||
installboot: fdboot
|
||||
@echo setenv ID before doing that.
|
||||
@false
|
||||
.else
|
||||
installboot: fdboot
|
||||
./writefdboot fdboot /dev/rfd${ID}a
|
||||
.endif
|
||||
|
||||
install: fdboot
|
||||
install -c -o bin -g bin -m 444 fdboot ${DESTDIR}/usr/mdec
|
||||
|
||||
clean::
|
||||
rm -f fdboot fdboot.o bootufs.o fdboot.x
|
||||
|
||||
.include <bsd.prog.mk>
|
|
@ -0,0 +1,33 @@
|
|||
この fdboot は:
|
||||
|
||||
NetBSD/X68k をフロッピーから立ち上げるためのものです。
|
||||
|
||||
この fdboot は、chapuni氏作の sdboot の SCSI アクセス部分を
|
||||
フロッピー用に書き換えて、disklabel とぶつからない
|
||||
(ように見える)領域を使うようにしただけのものです。
|
||||
|
||||
1024bytes/sector を仮定しています。美しくないですね。
|
||||
|
||||
ま、とりあえず動いているみたいですが、どなたかちゃんと
|
||||
書き直してくれませんか?
|
||||
|
||||
なお、私の行った変更については、パブリックドメインとします。
|
||||
|
||||
|
||||
install:
|
||||
|
||||
1. make します
|
||||
% make
|
||||
|
||||
2. フロッピーに書き込みます
|
||||
# ./writefdboot fdboot /dev/rfd0a
|
||||
~
|
||||
0 の部分をインストール先のドライブによって変更してください。
|
||||
|
||||
|
||||
使いかたなど:
|
||||
|
||||
sdboot と全く同じです。README.sdboot などを参照してください。
|
||||
|
||||
|
||||
---written by Yasha (ITOH Yasufumi)
|
|
@ -0,0 +1,655 @@
|
|||
/* $NetBSD: bootufs.c,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994 Takumi Nakamura.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Takumi Nakamura.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* file: bootufs.c
|
||||
*
|
||||
* author: chapuni(GBA02750@niftyserve.or.jp)
|
||||
*
|
||||
* 参考にしたもの: UNIX C PROGRAMMING (NUTSHELL)
|
||||
* (俗に言うライオン本)
|
||||
*
|
||||
* これからの野望;
|
||||
* ・意味もなくグラフィカルにしてみよう。
|
||||
* ・ufs アクセスモジュールは、/sys/lib/libsa のものが
|
||||
* 使えるハズなので、ぜひともそれを使うようにしよう。
|
||||
* ・将来きっと FD DRIVER が出来上がるハズなので、それに
|
||||
* いち早く対応しよう。
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <ufs/ufs/quota.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
#include <ufs/ufs/inode.h>
|
||||
#include <ufs/ufs/dir.h>
|
||||
#include <a.out.h>
|
||||
|
||||
#include "fdboot.h"
|
||||
#include "../x68k/iodevice.h"
|
||||
|
||||
#define alloca __builtin_alloca
|
||||
#define memcpy __builtin_memcpy
|
||||
|
||||
static inline void
|
||||
bcopy (s, d, len)
|
||||
const char *s;
|
||||
char *d;
|
||||
long len;
|
||||
{
|
||||
while (len--)
|
||||
*d++ = *s++;
|
||||
}
|
||||
|
||||
static inline int
|
||||
strcmp (a, b)
|
||||
const char *a;
|
||||
const char *b;
|
||||
{
|
||||
while (*a && *b && *a == *b)
|
||||
a++, b++;
|
||||
return (*a != *b);
|
||||
}
|
||||
|
||||
static inline int
|
||||
memcmp (a, b, n)
|
||||
const char *a;
|
||||
const char *b;
|
||||
int n;
|
||||
{
|
||||
while (*a == *b && --n)
|
||||
a++, b++;
|
||||
return (*a != *b);
|
||||
}
|
||||
|
||||
static inline void
|
||||
memset(p, v, len)
|
||||
void *p;
|
||||
long v;
|
||||
long len;
|
||||
{
|
||||
while (len--)
|
||||
*(char *)p++ = v;
|
||||
}
|
||||
|
||||
/* for debug */
|
||||
#ifdef DEBUG
|
||||
extern int printf __P((const char *, ...));
|
||||
#endif
|
||||
|
||||
#define IODEVbase ((volatile struct IODEVICE *)PHYS_IODEV)
|
||||
|
||||
union {
|
||||
struct fs superblk; /* ホンモノ */
|
||||
unsigned char buf[SBSIZE]; /* サイズ合わせ */
|
||||
} superblk_buf;
|
||||
|
||||
#define sblock superblk_buf.superblk
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* ディレクトリエントリをため込むバッファ
|
||||
*
|
||||
*/
|
||||
|
||||
#define N_VMUNIX 24
|
||||
|
||||
struct {
|
||||
ino_t ino; /* inode */
|
||||
char name[60];
|
||||
} vmunix_dirent[N_VMUNIX];
|
||||
|
||||
char *lowram;
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* ブロックの連続読みを試みる。
|
||||
* length = 0 のときは、単にバッファをフラッシュする
|
||||
* だけとなる。
|
||||
*
|
||||
*/
|
||||
|
||||
void *s_buf;
|
||||
int s_pos;
|
||||
size_t s_len;
|
||||
|
||||
int
|
||||
raw_read_queue(buf, pos, len)
|
||||
void *buf;
|
||||
int pos;
|
||||
size_t len;
|
||||
{
|
||||
int r = 0;
|
||||
/* さいしょは何もしない */
|
||||
if (s_len == 0) {
|
||||
s_buf = buf;
|
||||
s_pos = pos;
|
||||
s_len = len;
|
||||
return r;
|
||||
}
|
||||
/* 前のセクタと連続しているとき */
|
||||
if (len > 0 && s_pos + btodb(s_len) == pos) {
|
||||
s_len += len;
|
||||
return r;
|
||||
}
|
||||
/* これまで溜っていたものを読む */
|
||||
r = RAW_READ(s_buf, s_pos, s_len);
|
||||
s_buf = buf;
|
||||
s_pos = pos;
|
||||
s_len = len;
|
||||
return r;
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* スーパーブロックを読みこむ
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
get_superblk()
|
||||
{
|
||||
RAW_READ(&superblk_buf.buf, dbtob(SBLOCK), SBSIZE);
|
||||
#ifdef DEBUG
|
||||
printf("fs_magic=%08lx\n", sblock.fs_magic);
|
||||
printf("fs_ipg=%08lx\n", sblock.fs_ipg);
|
||||
printf("fs_ncg=%08lx\n", sblock.fs_ncg);
|
||||
printf("fs_bsize=%08lx\n", sblock.fs_bsize);
|
||||
printf("fs_fsize=%08lx\n", sblock.fs_fsize);
|
||||
printf("INOPB=%08lx\n", INOPB(&sblock));
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* inode を取ってくる
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
get_inode(ino, pino)
|
||||
ino_t ino;
|
||||
struct dinode *pino;
|
||||
{
|
||||
struct dinode *buf = alloca(sblock.fs_bsize);
|
||||
RAW_READ(buf,
|
||||
dbtob(fsbtodb(&sblock, ino_to_fsba(&sblock, ino))),
|
||||
sblock.fs_bsize);
|
||||
*pino = buf[ino_to_fsbo(&sblock, ino)];
|
||||
#ifdef DEBUG
|
||||
printf("%d)permission=%06ho\n", ino, pino->di_mode);
|
||||
printf("%d)nlink=%4d\n", ino, pino->di_nlink);
|
||||
printf("%d)uid=%4d\n", ino, pino->di_uid);
|
||||
printf("%d)gid=%4d\n", ino, pino->di_gid);
|
||||
printf("%d)size=%ld\n", ino, pino->di_size);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* inode の指しているブロックを取ってくる
|
||||
*
|
||||
* NutShell ライオン本よりのパクり
|
||||
*
|
||||
* buf にはデータを読んでくるアドレスをセットして
|
||||
* おいてほしいなあ。できればブロックを切りあげて
|
||||
*
|
||||
*/
|
||||
|
||||
int
|
||||
read_indirect(blkno, level, buf, count)
|
||||
ino_t blkno;
|
||||
int level;
|
||||
void **buf;
|
||||
int count;
|
||||
{
|
||||
daddr_t idblk[MAXBSIZE / sizeof(daddr_t)];
|
||||
int i;
|
||||
|
||||
RAW_READ(idblk,
|
||||
dbtob(fsbtodb(&sblock, blkno)),
|
||||
sblock.fs_bsize);
|
||||
|
||||
for (i = 0; i < NINDIR(&sblock) && count > 0; i++) {
|
||||
if (level) {
|
||||
/* さらに間接ブロックを読ませる */
|
||||
count = read_indirect(idblk[i], level - 1, buf, count);
|
||||
} else {
|
||||
/* データを読む */
|
||||
#ifdef DEBUG
|
||||
printf("%d%4d\n", level, idblk[i]);
|
||||
#endif
|
||||
raw_read_queue(*buf,
|
||||
dbtob(fsbtodb(&sblock, idblk[i])),
|
||||
sblock.fs_bsize);
|
||||
*buf += sblock.fs_bsize;
|
||||
count -= sblock.fs_bsize;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
* なぜか、ANSI C 形式でないと動かない(?)
|
||||
*/
|
||||
void
|
||||
read_blocks(struct dinode *dp, void *buf, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (dp->di_size < count)
|
||||
count = dp->di_size;
|
||||
|
||||
s_len = 0;
|
||||
|
||||
/* direct block を読む */
|
||||
for (i = 0; i < NDADDR && count > 0; i++) {
|
||||
#ifdef DEBUG
|
||||
printf(" %4d\n", dp->di_db[i]);
|
||||
#endif
|
||||
raw_read_queue(buf,
|
||||
dbtob(fsbtodb(&sblock, dp->di_db[i])),
|
||||
sblock.fs_bsize);
|
||||
buf += sblock.fs_bsize;
|
||||
count -= sblock.fs_bsize;
|
||||
}
|
||||
|
||||
/* indirect block を読む */
|
||||
for (i = 0; i < NIADDR && count > 0; i++) {
|
||||
count = read_indirect(dp->di_ib[i], i, &buf, count);
|
||||
}
|
||||
/* バッファのフラッシュ */
|
||||
raw_read_queue(NULL, 0, 0);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* 指定されたファイルの inode を求める
|
||||
*
|
||||
*/
|
||||
|
||||
ino_t
|
||||
search_file(dirino, filename)
|
||||
ino_t dirino; /* ディレクトリの位置 */
|
||||
const char *filename; /* ファイル名 */
|
||||
{
|
||||
void *dirp;
|
||||
struct dinode dinode;
|
||||
struct direct *dir;
|
||||
|
||||
get_inode(dirino, &dinode);
|
||||
dirp = alloca((dinode.di_size + MAXBSIZE - 1) & -MAXBSIZE);
|
||||
read_blocks(&dinode, dirp, dinode.di_size);
|
||||
|
||||
while (dir = dirp, dir->d_ino != 0) {
|
||||
if (!strcmp(dir->d_name, filename))
|
||||
return dir->d_ino;
|
||||
dirp += dir->d_reclen;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* 指定されたファイルを読み込んでくる
|
||||
*
|
||||
*/
|
||||
|
||||
unsigned
|
||||
load(buf, dirino, filename)
|
||||
void *buf; /* 読み込み先 */
|
||||
ino_t dirino; /* 該当ディレクトリの inode 番号 */
|
||||
const char *filename; /* ファイル名 */
|
||||
{
|
||||
struct dinode dinode;
|
||||
|
||||
get_inode(search_file(dirino, filename), &dinode);
|
||||
read_blocks(&dinode, buf, dinode.di_size);
|
||||
return dinode.di_size;
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* for test
|
||||
*
|
||||
* 今のところ、vmunix はシンボリックリンクは許されて
|
||||
* いないが、将来的にはどうにかなるかもしれん
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
debug_print(s)
|
||||
unsigned char *s;
|
||||
{
|
||||
unsigned c;
|
||||
while ((c = *s++)) {
|
||||
if (c >= 0x80)
|
||||
c = JISSFT((0x0100 * c + *s++) & 0x7F7F);
|
||||
B_PUTC(c);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
debug_print_hex(x, l)
|
||||
unsigned x; /* 表示する数字 */
|
||||
int l; /* 表示する桁数 */
|
||||
{
|
||||
if (l >= 0) {
|
||||
debug_print_hex(x >> 4, l - 1);
|
||||
x &= 0x0F;
|
||||
if (x > 9)
|
||||
x += 7;
|
||||
B_PUTC('0' + x);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* vmunix.* netbsd.* のリストをつくり出す
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
pickup_list(dirino)
|
||||
ino_t dirino;
|
||||
{
|
||||
void *dirp;
|
||||
struct dinode dinode;
|
||||
struct direct *dir;
|
||||
int n = 0;
|
||||
|
||||
get_inode(dirino, &dinode);
|
||||
dirp = alloca((dinode.di_size + MAXBSIZE - 1) & -MAXBSIZE);
|
||||
read_blocks(&dinode, dirp, dinode.di_size);
|
||||
|
||||
while (dir = dirp, dir->d_ino != 0) {
|
||||
if (!memcmp(dir->d_name, "vmunix", 6)
|
||||
|| !memcmp(dir->d_name, "netbsd", 6)) {
|
||||
vmunix_dirent[n].ino = dir->d_ino;
|
||||
memcpy(vmunix_dirent[n].name, dir->d_name, 60);
|
||||
if (++n >= N_VMUNIX)
|
||||
return;
|
||||
}
|
||||
dirp += dir->d_reclen;
|
||||
}
|
||||
while (n < N_VMUNIX)
|
||||
vmunix_dirent[n++].ino = 0;
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* vmunix_dirent[] のレコードを表示する
|
||||
*
|
||||
*/
|
||||
|
||||
void
|
||||
print_list(n, active, bootflags)
|
||||
int n;
|
||||
int active;
|
||||
unsigned bootflags;
|
||||
{
|
||||
if (!vmunix_dirent[n].ino)
|
||||
return;
|
||||
B_LOCATE(0, 4 + n);
|
||||
B_PRINT(active && (bootflags & RB_SINGLE)
|
||||
? "SINGLE "
|
||||
: " ");
|
||||
debug_print_hex(vmunix_dirent[n].ino, 8);
|
||||
B_PRINT(" ");
|
||||
if (active)
|
||||
B_COLOR(0x0F);
|
||||
B_PRINT(vmunix_dirent[n].name);
|
||||
B_COLOR(0x03);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* まじかよ?
|
||||
*
|
||||
* すべての IPL モジュールを読み込んできたあとは、
|
||||
* ここに飛んでくる。「コアの転送」が終了するまでは、
|
||||
* x68k IOCS は生きています。割り込みをマスクするまでは
|
||||
* 大丈夫でしょう。
|
||||
*
|
||||
*/
|
||||
|
||||
volatile void
|
||||
bootufs()
|
||||
{
|
||||
unsigned long bootflags;
|
||||
unsigned long esym;
|
||||
int i;
|
||||
char *addr;
|
||||
/* これは 0x100000 から存在しているもの */
|
||||
extern struct exec header;
|
||||
extern char image[];
|
||||
#if 0
|
||||
/* for debug; 起動時のレジスタが入っている */
|
||||
extern long tmpbuf[16];
|
||||
#endif
|
||||
|
||||
#if 0 /* sdboot */
|
||||
extern long ID;
|
||||
#else
|
||||
extern long FDMODE;
|
||||
#endif
|
||||
|
||||
unsigned short SFT;
|
||||
|
||||
/* これはコピー品 */
|
||||
struct exec localheader;
|
||||
|
||||
/* MPU チェック */
|
||||
#if 0
|
||||
sys_stat = SYS_STAT(0);
|
||||
if ((sys_stat & 255) == 0 ||
|
||||
(getcpu() != 4 && !(sys_stat & (1 << 14)))) {
|
||||
debug_print("MMU がないため、NetBSD を起動できません。\r\n");
|
||||
debug_print("リセットしてください。\r\n");
|
||||
for(;;);
|
||||
}
|
||||
#endif
|
||||
|
||||
debug_print("\r\n");
|
||||
|
||||
/* bootflags をセット */
|
||||
bootflags = RB_AUTOBOOT;
|
||||
|
||||
/* シフトキーが押されていたら */
|
||||
SFT = B_SFTSNS();
|
||||
if (SFT & 0x01)
|
||||
bootflags |= RB_SINGLE;
|
||||
|
||||
#if 0
|
||||
/* for debug; レジスタの状態をプリントする */
|
||||
for (i = 0; i < 16; i++) {
|
||||
debug_print_hex(tmpbuf[i], 8);
|
||||
debug_print("\r\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* vmunix を読み込んでくる */
|
||||
get_superblk();
|
||||
if (sblock.fs_magic != FS_MAGIC) {
|
||||
debug_print("fdboot: bogus super block;"
|
||||
" ルートファイルシステムが壊れています!\r\n");
|
||||
debug_print("リセットしてください。\r\n");
|
||||
for (;;);
|
||||
}
|
||||
|
||||
if (bootflags == RB_AUTOBOOT) {
|
||||
debug_print("loading netbsd...");
|
||||
esym = load(&header, ROOTINO, "netbsd");
|
||||
|
||||
SFT = B_SFTSNS();
|
||||
if (SFT & 0x0001)
|
||||
bootflags |= RB_SINGLE;
|
||||
}
|
||||
|
||||
if (bootflags != RB_AUTOBOOT) {
|
||||
int x = 0;
|
||||
struct dinode dinode;
|
||||
|
||||
B_CLR_ST(2);
|
||||
debug_print("....どのカーネルを読み込みますか?\r\n"
|
||||
"SHIFT で RB_SINGLE がトグルします。\r\n");
|
||||
|
||||
/* ルートディレクトリを解析する */
|
||||
pickup_list(ROOTINO);
|
||||
|
||||
/* 表示する */
|
||||
for (i = 0; i < N_VMUNIX; i++) {
|
||||
if (!memcmp(vmunix_dirent[i].name, "netbsd", 7)) {
|
||||
print_list(x, 0, bootflags);
|
||||
x = i;
|
||||
}
|
||||
print_list(i, i == x, bootflags);
|
||||
}
|
||||
|
||||
while (B_SFTSNS() & 0x0001);
|
||||
|
||||
/* 入力待ちループする */
|
||||
for (;;) {
|
||||
switch ((B_KEYINP() >> 8) & 0xFF) {
|
||||
case 0x3C: /* UP */
|
||||
if (x > 0) {
|
||||
print_list(--x, 1, bootflags);
|
||||
print_list(x + 1, 0, bootflags);
|
||||
}
|
||||
break;
|
||||
case 0x3E: /* DOWN */
|
||||
if (x < N_VMUNIX - 1
|
||||
&& vmunix_dirent[x + 1].ino) {
|
||||
print_list(++x, 1, bootflags);
|
||||
print_list(x - 1, 0, bootflags);
|
||||
}
|
||||
break;
|
||||
case 0x70: /* SHIFT */
|
||||
bootflags ^= RB_SINGLE;
|
||||
print_list(x, 1, bootflags);
|
||||
break;
|
||||
case 0x1D: /* CR */
|
||||
case 0x4E: /* ENTER */
|
||||
goto exit_loop;
|
||||
}
|
||||
}
|
||||
exit_loop:
|
||||
B_CLR_ST(2);
|
||||
B_PRINT("loading ");
|
||||
B_PRINT(vmunix_dirent[x].name);
|
||||
B_PRINT("...");
|
||||
get_inode(vmunix_dirent[x].ino, &dinode);
|
||||
read_blocks(&dinode, &header, dinode.di_size);
|
||||
esym = dinode.di_size;
|
||||
}
|
||||
debug_print("done.\r\n");
|
||||
|
||||
/* 「ひらがな」で、ddb を起こす */
|
||||
SFT = B_SFTSNS();
|
||||
if (SFT & 0x2000)
|
||||
bootflags |= RB_KDB;
|
||||
|
||||
/* esym == 32 + tsize + dsize + ssize + strsize */
|
||||
|
||||
/* ヘッダをコピーする */
|
||||
localheader = header;
|
||||
#define x localheader
|
||||
|
||||
esym -= sizeof(header) + localheader.a_text + localheader.a_data;
|
||||
/* esym == ssize + strsize */
|
||||
|
||||
/* 本体をコアへ load する */
|
||||
if (N_GETMID(localheader) == MID_M68K
|
||||
&& N_GETMAGIC(localheader) == NMAGIC) {
|
||||
|
||||
/*
|
||||
* ここから先は割り込み禁止である。
|
||||
* 気をつけてくれ。
|
||||
*/
|
||||
asm volatile ("oriw #0x0700,sr");
|
||||
|
||||
addr = lowram;
|
||||
memcpy(addr, image, x.a_text);
|
||||
addr += (x.a_text + __LDPGSZ - 1) & ~(__LDPGSZ - 1);
|
||||
memcpy(addr, image + x.a_text, x.a_data);
|
||||
addr += x.a_data;
|
||||
memset(addr, 0x00, x.a_bss);
|
||||
addr += x.a_bss;
|
||||
/*ssym = addr;*/
|
||||
bcopy(&x.a_syms, addr, sizeof(x.a_syms));
|
||||
addr += sizeof(x.a_syms);
|
||||
bcopy(image + x.a_text + x.a_data, addr, x.a_syms);
|
||||
addr += x.a_syms;
|
||||
i = *(int *)(image + x.a_text + x.a_data + x.a_syms);
|
||||
bcopy(image + x.a_text + x.a_data + x.a_syms, addr, sizeof(int));
|
||||
if (i) {
|
||||
i -= sizeof(int);
|
||||
addr += sizeof(int);
|
||||
bcopy(image + x.a_text + x.a_data + x.a_syms + sizeof(int), addr, i);
|
||||
addr += i;
|
||||
}
|
||||
#define round_to_size(x) \
|
||||
(((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
|
||||
esym = (unsigned long)round_to_size(addr - lowram);
|
||||
#undef round_to_size
|
||||
memset(esym, 0, 0x003e8000 - (int)esym /* XXX */);
|
||||
|
||||
IODEVbase->io_mfp.iera = 0;
|
||||
IODEVbase->io_mfp.ierb = 0;
|
||||
IODEVbase->io_mfp.rsr = 0;
|
||||
/* IODEVbase->io_sysport.keyctrl = 0;*/
|
||||
|
||||
/* 実行 */
|
||||
#if 0 /* sdboot */
|
||||
asm volatile ("movl %0,d6" : : "g" (MAKEBOOTDEV(4, 0, 0, ID & 7, 0)) : "d6");
|
||||
#else
|
||||
asm volatile ("movl %0,d6" : : "g" (MAKEBOOTDEV(2, 0, 0, (FDMODE >> 8) & 3, 0)) : "d6");
|
||||
#endif
|
||||
asm volatile ("movl %0,d7" : : "g" (bootflags) : "d7");
|
||||
|
||||
/* すまぬ */
|
||||
(*(void volatile (*)(long, long, long))localheader.a_entry)
|
||||
(0, *(long *)0xED0008, esym);
|
||||
} else {
|
||||
debug_print("fdboot: improper file format: 実行不可能です。\r\n");
|
||||
debug_print("リセットしてください。\r\n");
|
||||
for (;;);
|
||||
}
|
||||
}
|
||||
|
||||
/* eof */
|
|
@ -0,0 +1,11 @@
|
|||
/***************************************************************
|
||||
*
|
||||
* file: bootufs.h
|
||||
*
|
||||
* author: chapuni(GBA02750@niftyserve.or.jp)
|
||||
*
|
||||
*/
|
||||
|
||||
extern void test();
|
||||
|
||||
/* eof */
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
/***************************************************************
|
||||
*
|
||||
* file: boot.h
|
||||
*
|
||||
* author: chapuni(GBA02750@niftyserve.or.jp)
|
||||
*
|
||||
*/
|
||||
|
||||
extern int RAW_READ __P((void *buf, int pos, size_t length));
|
||||
extern unsigned B_KEYINP __P((void));
|
||||
extern void B_CLR_ST __P((unsigned x));
|
||||
extern void B_PUTC __P((unsigned c));
|
||||
extern void B_PRINT __P((unsigned char *p));
|
||||
extern unsigned B_COLOR __P((unsigned w));
|
||||
extern unsigned B_LOCATE __P((unsigned x, unsigned y));
|
||||
extern unsigned JISSFT __P((unsigned c));
|
||||
extern unsigned short B_SFTSNS __P((void));
|
||||
extern int SYS_STAT __P((int flags));
|
||||
extern int getcpu __P((void));
|
||||
|
||||
/* eof */
|
|
@ -0,0 +1,245 @@
|
|||
| file: boot.s
|
||||
| author: chapuni(GBA02750@niftyserve.or.jp)
|
||||
|.offset $100000
|
||||
|_header:: ds.l 8
|
||||
|_image::
|
||||
|
||||
.global _header
|
||||
.global _image
|
||||
|
||||
_header=0x100000 | まずは、このアドレスに
|
||||
_image=_header+(8*4) | コアをロードします。
|
||||
|
||||
.global _bootufs
|
||||
.text
|
||||
top:
|
||||
jra entry0:S
|
||||
.ascii "SHARP/"
|
||||
.ascii "X68030"
|
||||
.word 0x8199,0x94e6,0x82ea,0x82bd
|
||||
.word 0x8e9e,0x82c9,0x82cd,0x8cbb
|
||||
.word 0x8ec0,0x93a6,0x94f0,0x8149
|
||||
entry0: jra entry
|
||||
| 0x2a
|
||||
.space 0x200-0x2a
|
||||
|
||||
| 2400(もしくは$3F0000)
|
||||
| d4 にはすでに SCSI ID が入っている
|
||||
| ここから jmp まではリロケータブルに書かねばならない。
|
||||
entry:
|
||||
lea _edata:l,a0 | clear out BSS
|
||||
movl #_end-4,d0 | (must be <= 256 kB)
|
||||
subl #_edata,d0
|
||||
lsrl #2,d0
|
||||
1: clrl a0@+
|
||||
dbra d0,1b
|
||||
|
||||
lea top:l,a1 | 0x3F0000 にスタックポインタを
|
||||
lea a1@,sp | 設定する。だから :l が付いてないとダメ
|
||||
|| moveq #1,d5 | 512bytes/sec
|
||||
|| moveq #8192/512,d3 | 読み込める最大サイズ
|
||||
|| moveq #0x40,d2 | いわゆる決め打ち(sd*a のみ)
|
||||
|| moveq #0x21,d1 | read
|
||||
|| moveq #0xFFFFFFF5,d0 | SCSI
|
||||
|| trap #15
|
||||
|| movel d4,_ID:l
|
||||
moveq #0xFFFFFF8E,d0 | __BOOTINF
|
||||
trap #15
|
||||
lslw #8,d0
|
||||
moveq #0x70,d1
|
||||
orw d0,d1 | PDA*256 + MODE
|
||||
movel d1,_FDMODE:l
|
||||
movel #0x03000001,d2 | read position
|
||||
movel #8192,d3 | read bytes
|
||||
moveq #0x46,d0 | __B_READ
|
||||
trap #15
|
||||
|
||||
| テキストパレットの初期化
|
||||
moveq #7,d3
|
||||
moveq #0,d1
|
||||
initpalet:
|
||||
moveq #0,d2
|
||||
moveq #0x14,d0 |TPALET2
|
||||
trap #15
|
||||
addqw #1,d1
|
||||
movel #0xFFFF,d2
|
||||
moveq #0x14,d0 |TPALET2
|
||||
trap #15
|
||||
addqw #1,d1
|
||||
dbra d3,initpalet
|
||||
|
||||
jmp _bootufs:l | 0x3Fxxxx に飛んでゆく
|
||||
|
||||
| int RAW_READ(void *buf, int pos, size_t length);
|
||||
| .offset 16
|
||||
|raw_read_buf: ds.l 1
|
||||
|raw_read_pos: ds.l 1
|
||||
|raw_read_len: ds.l 1
|
||||
| .text
|
||||
raw_read_buf= 4+(4*11)
|
||||
raw_read_pos= raw_read_buf+4
|
||||
raw_read_len= raw_read_buf+8
|
||||
|
||||
.global _RAW_READ
|
||||
_RAW_READ:
|
||||
|| moveml a2-a6/d2-d7,sp@-
|
||||
|| movel _ID:l,d4
|
||||
|| moveq #1,d5 | 512bytes/sec
|
||||
|| movel sp@(raw_read_buf),a1
|
||||
|| movel sp@(raw_read_pos),d2
|
||||
|| movel sp@(raw_read_len),d3
|
||||
|| addl #511,d3
|
||||
|| moveq #9,d1
|
||||
|| lsrl d1,d2
|
||||
|| lsrl d1,d3
|
||||
|| addl #0x40,d2
|
||||
|| moveq #0x21,d1
|
||||
|| moveq #0xF5-0x100,d0
|
||||
|| trap #15
|
||||
|| moveml sp@+,a2-a6/d2-d7
|
||||
|| rts
|
||||
moveml a2-a6/d2-d7,sp@-
|
||||
movel sp@(raw_read_pos),d4
|
||||
movel sp@(raw_read_len),d3
|
||||
movel sp@(raw_read_buf),a1
|
||||
|
||||
moveq #10,d1
|
||||
lsrl d1,d4 | / 1024
|
||||
bcs read_half
|
||||
|
||||
| d4: pos (in sector)
|
||||
|
||||
| convert to seek position
|
||||
movel #0x03000001,d2
|
||||
moveb d4,d0
|
||||
andb #7,d0
|
||||
addb d0,d2
|
||||
movel d4,d0
|
||||
lsrl #4,d0
|
||||
bcc 1f
|
||||
bset #8,d2
|
||||
1: lsll #8,d0
|
||||
lsll #8,d0
|
||||
orl d0,d2
|
||||
|
||||
| read
|
||||
movel _FDMODE:l,d1 | PDA*256 + MODE
|
||||
moveq #0x46,d0 | __B_READ
|
||||
trap #15
|
||||
|
||||
moveml sp@+,a2-a6/d2-d7
|
||||
moveq #0,d0 | XXX
|
||||
rts
|
||||
|
||||
read_half:
|
||||
lea half_msg,a1
|
||||
moveq #0x21,d0 | __B_PRINT
|
||||
trap #15
|
||||
moveq #0xFFFFFFFE,d0 | __IPLERR
|
||||
trap #15
|
||||
|
||||
half_msg:
|
||||
.ascii "read half of block\r\n\0"
|
||||
.even
|
||||
|
||||
.global _JISSFT
|
||||
_JISSFT:
|
||||
movel sp@(4),d1
|
||||
moveq #0xFFFFFFA1,d0
|
||||
trap #15
|
||||
rts
|
||||
|
||||
.global _B_SFTSNS
|
||||
_B_SFTSNS:
|
||||
moveq #0x02,d0
|
||||
trap #15
|
||||
rts
|
||||
|
||||
.global _B_KEYINP
|
||||
_B_KEYINP:
|
||||
moveq #0x00,d0
|
||||
trap #15
|
||||
rts
|
||||
|
||||
.global _B_PUTC
|
||||
_B_PUTC:
|
||||
movel sp@(4),d1
|
||||
moveq #0x20,d0
|
||||
trap #15
|
||||
rts
|
||||
|
||||
.global _B_PRINT
|
||||
_B_PRINT:
|
||||
movel sp@(4),a1
|
||||
moveq #0x21,d0
|
||||
trap #15
|
||||
rts
|
||||
|
||||
.global _B_COLOR
|
||||
_B_COLOR:
|
||||
movel sp@(4),d1
|
||||
moveq #0x22,d0
|
||||
trap #15
|
||||
rts
|
||||
|
||||
.global _B_LOCATE
|
||||
_B_LOCATE:
|
||||
movel d2,sp@-
|
||||
movel sp@(8),d1
|
||||
movel sp@(12),d2
|
||||
moveq #0x23,d0
|
||||
trap #15
|
||||
movel sp@+,d2
|
||||
rts
|
||||
|
||||
.global _B_CLR_ST
|
||||
_B_CLR_ST:
|
||||
movel sp@(4),d1
|
||||
moveq #0x2A,d0
|
||||
trap #15
|
||||
rts
|
||||
|
||||
|IOCS SYS_STAT $AC
|
||||
|
|
||||
|入力 d1.l=0 のとき d0.l に以下の値
|
||||
| bit0~7 0:68000, 1:68010, 2:68020, 3:68030
|
||||
| bit14 0:MMUなし, 1:MMUあり
|
||||
| bit15 0:FPCPなし, 1:FPCPあり
|
||||
| bit16~31 クロックスピード
|
||||
|
|
||||
| X68000 の IOCS には $AC はないのでエラーになりますが、Xellent30 の場合は
|
||||
|起動時に SRAM で組み込んでくれます。
|
||||
.global _SYS_STAT
|
||||
_SYS_STAT:
|
||||
movel sp@(4),d1
|
||||
moveq #0xAC-0x100,d0
|
||||
trap #15
|
||||
rts
|
||||
|
||||
.global _getcpu
|
||||
_getcpu:
|
||||
movl #0x200,d0 | data freeze bit
|
||||
movc d0,cacr | only exists on 68030
|
||||
movc cacr,d0 | read it back
|
||||
tstl d0 | zero?
|
||||
jeq Lnot68030 | yes, we have 68020/68040
|
||||
movq #3,d0 | 68030
|
||||
rts
|
||||
Lnot68030:
|
||||
bset #31,d0 | data cache enable bit
|
||||
movc d0,cacr | only exists on 68040
|
||||
movc cacr,d0 | read it back
|
||||
tstl d0 | zero?
|
||||
beq Lis68020 | yes, we have 68020
|
||||
moveq #0,d0 | now turn it back off
|
||||
movec d0,cacr | before we access any data
|
||||
movq #4,d0 | 68040
|
||||
rts
|
||||
Lis68020:
|
||||
movq #2,d0 | 68020
|
||||
rts
|
||||
|
||||
|| .comm _ID,4
|
||||
.comm _FDMODE,4
|
||||
|
||||
.end
|
|
@ -0,0 +1,14 @@
|
|||
add following to /etc/disktab
|
||||
|
||||
floppy1232|1024byte sector format for 2HD floppy:\
|
||||
:ty=floppy:se#512:nt#2:rm#360:ns#16:nc#77:\
|
||||
:ts=3500:\
|
||||
:pa#2464:oa#0:ba#8192:fa#1024:ta=4.2BSD:\
|
||||
:pb#0:ob#0:\
|
||||
:pc#2464:oc#0:
|
||||
|
||||
|
||||
then,
|
||||
|
||||
# disklabel -w -r fd?a floppy1232
|
||||
# newfs -i 32768 -c 77 /dev/rfd?a
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# usage: writeboot <boot_file> <boot_device(raw)>
|
||||
#
|
||||
|
||||
temp=/tmp/writeboot$$
|
||||
|
||||
case "$#" in
|
||||
2) ;;
|
||||
*) echo "usage: `basename $0` fdboot /dev/rfd?a" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
trap "rm -f $temp; exit 1" 1 2 3 15
|
||||
rm -f $temp
|
||||
( dd if=$1 bs=64 count=1
|
||||
dd if=$2 bs=1024 count=1 | dd bs=64 skip=1 count=7
|
||||
dd if=$1 bs=256 skip=2 ) > $temp
|
||||
|
||||
cat $temp /dev/zero | dd bs=1024 count=4 of=$2
|
||||
rm -f $temp
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: ansi.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/* Just use the common m68k definition */
|
||||
#include <m68k/ansi.h>
|
|
@ -0,0 +1,49 @@
|
|||
/* $NetBSD: aout_machdep.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Christopher G. Demetriou
|
||||
* 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.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_EXEC_H_
|
||||
#define _MACHINE_EXEC_H_
|
||||
|
||||
#define __LDPGSZ 8192
|
||||
|
||||
/* Relocation format. */
|
||||
struct relocation_info_m68k {
|
||||
int r_address; /* offset in text or data segment */
|
||||
unsigned int r_symbolnum : 24, /* ordinal number of add symbol */
|
||||
r_pcrel : 1, /* 1 if value should be pc-relative */
|
||||
r_length : 2, /* log base 2 of value's width */
|
||||
r_extern : 1, /* 1 if need to add symbol to value */
|
||||
r_baserel : 1, /* linkage table relative */
|
||||
r_jmptable : 1, /* relocate to jump table */
|
||||
r_relative : 1, /* load address relative */
|
||||
r_copy : 1; /* run time copy */
|
||||
};
|
||||
#define relocation_info relocation_info_m68k
|
||||
|
||||
#endif /* _MACHINE_EXEC_H_ */
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: asm.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
#include <m68k/asm.h>
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Copyright (c) 1991-1993 Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the Computer Systems
|
||||
* Engineering Group at Lawrence Berkeley Laboratory.
|
||||
* 4. Neither the name of the University nor of the Laboratory may be used
|
||||
* to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BSD_AUDIOIO_H_
|
||||
#define _BSD_AUDIOIO_H_
|
||||
|
||||
/*
|
||||
* Audio device
|
||||
*/
|
||||
struct audio_prinfo {
|
||||
u_int sample_rate;
|
||||
u_int channels;
|
||||
u_int precision;
|
||||
u_int encoding;
|
||||
u_int gain;
|
||||
u_int port;
|
||||
u_long seek; /* BSD extension */
|
||||
u_int ispare[3];
|
||||
/* Current state of device: */
|
||||
u_int samples; /* number of samples */
|
||||
u_int eof; /* End Of File (zero-size writes) counter */
|
||||
u_char pause; /* non-zero if paused, zero to resume */
|
||||
u_char error; /* non-zero if underflow/overflow ocurred */
|
||||
u_char waiting; /* non-zero if another process hangs in open */
|
||||
u_char cspare[3];
|
||||
u_char open; /* non-zero if currently open */
|
||||
u_char active; /* non-zero if I/O is currently active */
|
||||
};
|
||||
typedef struct audio_prinfo audio_prinfo_t;
|
||||
|
||||
struct audio_info {
|
||||
struct audio_prinfo play; /* Info for play (output) side */
|
||||
struct audio_prinfo record; /* Info for record (input) side */
|
||||
u_int monitor_gain;
|
||||
/* BSD extensions */
|
||||
u_int blocksize; /* input blocking threshold */
|
||||
u_int hiwat; /* output high water mark */
|
||||
u_int lowat; /* output low water mark */
|
||||
u_int backlog; /* samples of output backlog to gen. */
|
||||
u_int mode;
|
||||
#define AUMODE_PLAY 0
|
||||
#define AUMODE_RECORD 1
|
||||
#define AUMODE_PLAY_ALL 0x04 /* play all samples--no real-time correction */
|
||||
};
|
||||
typedef struct audio_info audio_info_t;
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define AUDIO_INITINFO(p)\
|
||||
{ register int n = sizeof(struct audio_info); \
|
||||
register u_char *q = (u_char *) p; \
|
||||
while (n-- > 0) *q++ = 0xff; }
|
||||
|
||||
#else
|
||||
#define AUDIO_INITINFO(p)\
|
||||
(void)memset((void *)(p), 0xff, sizeof(struct audio_info))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* /dev/audio ioctls. needs comments!
|
||||
*/
|
||||
#define AUDIO_MIN_GAIN (0)
|
||||
#define AUDIO_MAX_GAIN (255)
|
||||
|
||||
#define AUDIO_ENCODING_ULAW (1)
|
||||
#define AUDIO_ENCODING_ALAW (2)
|
||||
#define AUDIO_ENCODING_LINEAR (3)
|
||||
#define AUDIO_ENCODING_ADPCM (4)
|
||||
|
||||
#define AUDIO_GETINFO _IOR('A', 21, struct audio_info)
|
||||
#define AUDIO_SETINFO _IOWR('A', 22, struct audio_info)
|
||||
#define AUDIO_DRAIN _IO('A', 23)
|
||||
#define AUDIO_FLUSH _IO('A', 24)
|
||||
#define AUDIO_WSEEK _IOR('A', 25, u_long)
|
||||
#define AUDIO_RERROR _IOR('A', 26, int)
|
||||
#define AUDIO_GETMAP _IOR('A', 27, struct mapreg)
|
||||
#define AUDIO_SETMAP _IOW('A', 28, struct mapreg)
|
||||
|
||||
#define AUDIO_SPEAKER 1
|
||||
#define AUDIO_HEADPHONE 2
|
||||
|
||||
#endif /* _BSD_AUDIOIO_H_ */
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: cdefs.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
#ifndef _MACHINE_CDEFS_H_
|
||||
#define _MACHINE_CDEFS_H_
|
||||
|
||||
#include <m68k/cdefs.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,245 @@
|
|||
/* $NetBSD: cpu.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: cpu.h 1.16 91/03/25$
|
||||
*
|
||||
* @(#)cpu.h 8.4 (Berkeley) 1/5/94
|
||||
*/
|
||||
|
||||
#ifndef _X68K_CPU_H_
|
||||
#define _X68K_CPU_H_
|
||||
|
||||
/*
|
||||
* Exported definitions unique to x68k/68k cpu support.
|
||||
*/
|
||||
|
||||
/*
|
||||
* definitions of cpu-dependent requirements
|
||||
* referenced in generic code
|
||||
*/
|
||||
#define cpu_swapin(p) /* nothing */
|
||||
#define cpu_wait(p) /* nothing */
|
||||
#define cpu_swapout(p) /* nothing */
|
||||
|
||||
/*
|
||||
* Arguments to hardclock and gatherstats encapsulate the previous
|
||||
* machine state in an opaque clockframe. One the x68k, we use
|
||||
* what the hardware pushes on an interrupt (frame format 0).
|
||||
*/
|
||||
struct clockframe {
|
||||
u_short sr; /* sr at time of interrupt */
|
||||
u_long pc; /* pc at time of interrupt */
|
||||
u_short vo; /* vector offset (4-word frame) */
|
||||
};
|
||||
|
||||
#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
|
||||
#define CLKF_BASEPRI(framep) (((framep)->sr & PSL_IPL) == 0)
|
||||
#define CLKF_PC(framep) ((framep)->pc)
|
||||
#if 0
|
||||
/* We would like to do it this way... */
|
||||
#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
|
||||
#else
|
||||
/* but until we start using PSL_M, we have to do this instead */
|
||||
#define CLKF_INTR(framep) (0) /* XXX */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Preempt the current process if in interrupt from user mode,
|
||||
* or after the current trap/syscall if in system mode.
|
||||
*/
|
||||
#define need_resched() { want_resched++; aston(); }
|
||||
|
||||
/*
|
||||
* Give a profiling tick to the current process when the user profiling
|
||||
* buffer pages are invalid. On the x68k, request an ast to send us
|
||||
* through trap, marking the proc as needing a profiling tick.
|
||||
*/
|
||||
#define need_proftick(p) { (p)->p_flag |= P_OWEUPC; aston(); }
|
||||
|
||||
/*
|
||||
* Notify the current process (p) that it has a signal pending,
|
||||
* process as soon as possible.
|
||||
*/
|
||||
#define signotify(p) aston()
|
||||
|
||||
#define aston() (astpending++)
|
||||
|
||||
int astpending; /* need to trap before returning to user mode */
|
||||
int want_resched; /* resched() was called */
|
||||
|
||||
|
||||
/*
|
||||
* simulated software interrupt register
|
||||
*/
|
||||
extern unsigned char ssir;
|
||||
|
||||
#define SIR_NET 0x1
|
||||
#define SIR_CLOCK 0x2
|
||||
#define SIR_SERIAL 0x4
|
||||
#define SIR_KBD 0x8
|
||||
|
||||
#define siroff(x) ssir &= ~(x)
|
||||
#define setsoftnet() ssir |= SIR_NET
|
||||
#define setsoftclock() ssir |= SIR_CLOCK
|
||||
#define setsoftserial() ssir |= SIR_SERIAL
|
||||
#define setsoftkbd() ssir |= SIR_KBD
|
||||
|
||||
/*
|
||||
* CTL_MACHDEP definitions.
|
||||
*/
|
||||
#define CPU_CONSDEV 1 /* dev_t: console terminal device */
|
||||
#define CPU_MAXID 2 /* number of valid machdep ids */
|
||||
|
||||
#define CTL_MACHDEP_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
{ "console_device", CTLTYPE_STRUCT }, \
|
||||
}
|
||||
|
||||
/*
|
||||
* The rest of this should probably be moved to ../x68k/x68kcpu.h,
|
||||
* although some of it could probably be put into generic 68k headers.
|
||||
*/
|
||||
|
||||
/* values for machineid */
|
||||
|
||||
/* values for mmutype (assigned for quick testing) */
|
||||
#define MMU_68040 -2 /* 68040 on-chip MMU */
|
||||
#define MMU_68030 -1 /* 68030 on-chip subset of 68851 */
|
||||
#define MMU_68851 1 /* Motorola 68851 */
|
||||
|
||||
/* values for ectype */
|
||||
#define EC_PHYS -1 /* external physical address cache */
|
||||
#define EC_NONE 0 /* no external cache */
|
||||
#define EC_VIRT 1 /* external virtual address cache */
|
||||
|
||||
/* values for cpuspeed (not really related to clock speed due to caches) */
|
||||
#define MHZ_8 1
|
||||
#define MHZ_16 2
|
||||
#define MHZ_25 3
|
||||
#define MHZ_33 4
|
||||
#define MHZ_50 6
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern int machineid, mmutype;
|
||||
extern char *intiolimit;
|
||||
#endif
|
||||
|
||||
/* physical memory sections */
|
||||
#define INTIOBASE (0x00C00000)
|
||||
#define INTIOTOP (0x01000000)
|
||||
|
||||
/*
|
||||
* Internal IO space:
|
||||
*
|
||||
* Ranges from 0xC00000 to 0x1000000 (IIOMAPSIZE).
|
||||
*
|
||||
* Internal IO space is mapped in the kernel from ``IODEVbase'' to
|
||||
* ``intiolimit'' (defined in locore.s). Since it is always mapped,
|
||||
* conversion between physical and kernel virtual addresses is easy.
|
||||
*/
|
||||
#define IIOPOFF(pa) ((int)(pa)-INTIOBASE)
|
||||
#define IIOMAPSIZE btoc(INTIOTOP-INTIOBASE) /* 4mb */
|
||||
|
||||
/*
|
||||
* External IO space:
|
||||
*/
|
||||
|
||||
/*
|
||||
* 68851 and 68030 MMU
|
||||
*/
|
||||
#define PMMU_LVLMASK 0x0007
|
||||
#define PMMU_INV 0x0400
|
||||
#define PMMU_WP 0x0800
|
||||
#define PMMU_ALV 0x1000
|
||||
#define PMMU_SO 0x2000
|
||||
#define PMMU_LV 0x4000
|
||||
#define PMMU_BE 0x8000
|
||||
#define PMMU_FAULT (PMMU_WP|PMMU_INV)
|
||||
|
||||
/*
|
||||
* 68040 MMU
|
||||
*/
|
||||
#define MMU4_RES 0x001
|
||||
#define MMU4_TTR 0x002
|
||||
#define MMU4_WP 0x004
|
||||
#define MMU4_MOD 0x010
|
||||
#define MMU4_CMMASK 0x060
|
||||
#define MMU4_SUP 0x080
|
||||
#define MMU4_U0 0x100
|
||||
#define MMU4_U1 0x200
|
||||
#define MMU4_GLB 0x400
|
||||
#define MMU4_BE 0x800
|
||||
|
||||
/* 680X0 function codes */
|
||||
#define FC_USERD 1 /* user data space */
|
||||
#define FC_USERP 2 /* user program space */
|
||||
#define FC_SUPERD 5 /* supervisor data space */
|
||||
#define FC_SUPERP 6 /* supervisor program space */
|
||||
#define FC_CPU 7 /* CPU space */
|
||||
|
||||
/* fields in the 68020 cache control register */
|
||||
#define IC_ENABLE 0x0001 /* enable instruction cache */
|
||||
#define IC_FREEZE 0x0002 /* freeze instruction cache */
|
||||
#define IC_CE 0x0004 /* clear instruction cache entry */
|
||||
#define IC_CLR 0x0008 /* clear entire instruction cache */
|
||||
|
||||
/* additional fields in the 68030 cache control register */
|
||||
#define IC_BE 0x0010 /* instruction burst enable */
|
||||
#define DC_ENABLE 0x0100 /* data cache enable */
|
||||
#define DC_FREEZE 0x0200 /* data cache freeze */
|
||||
#define DC_CE 0x0400 /* clear data cache entry */
|
||||
#define DC_CLR 0x0800 /* clear entire data cache */
|
||||
#define DC_BE 0x1000 /* data burst enable */
|
||||
#define DC_WA 0x2000 /* write allocate */
|
||||
|
||||
#define CACHE_ON (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
|
||||
#define CACHE_OFF (DC_CLR|IC_CLR)
|
||||
#define CACHE_CLR (CACHE_ON)
|
||||
#define IC_CLEAR (DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
|
||||
#define DC_CLEAR (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE)
|
||||
|
||||
/* 68040 cache control register */
|
||||
#define IC4_ENABLE 0x8000 /* instruction cache enable bit */
|
||||
#define DC4_ENABLE 0x80000000 /* data cache enable bit */
|
||||
|
||||
#define CACHE4_ON (IC4_ENABLE|DC4_ENABLE)
|
||||
#define CACHE4_OFF (0)
|
||||
|
||||
#endif /* _X68K_CPU_H_ */
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: cpufunc.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Functions to provide access to special cpu instructions.
|
||||
*/
|
||||
#ifndef _MACHINE_CPUFUNC_H_
|
||||
#define _MACHINE_CPUFUNC_H_
|
||||
#endif /* !_MACHINE_CPUFUNC_H_ */
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: db_machdep.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/* Just use the common m68k definition */
|
||||
#include <m68k/db_machdep.h>
|
|
@ -0,0 +1,60 @@
|
|||
/* $NetBSD: disklabel.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Masaru Oki
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Masaru Oki.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_DISKLABEL_H_
|
||||
#define _MACHINE_DISKLABEL_H_
|
||||
|
||||
#define LABELSECTOR 0 /* sector containing label */
|
||||
#define LABELOFFSET 64 /* offset of label in sector */
|
||||
#define MAXPARTITIONS 8 /* number of partitions */
|
||||
#define RAW_PART 2 /* raw partition: xx?c */
|
||||
|
||||
/* DOS partition table -- located in boot block */
|
||||
|
||||
#define DOSBBSECTOR 0
|
||||
#define DOSPARTOFF 4
|
||||
#define NDOSPART 8
|
||||
|
||||
struct dos_partition {
|
||||
unsigned char dp_typname[8]; /* partition name */
|
||||
unsigned int dp_flag:8; /* state of partition */
|
||||
unsigned int dp_start:24; /* start position (1024bytes/block) */
|
||||
unsigned long dp_size; /* partition size (1024bytes/block) */
|
||||
} dos_partitions[NDOSPART];
|
||||
|
||||
#include <sys/dkbad.h>
|
||||
struct cpu_disklabel {
|
||||
struct dos_partition dosparts[NDOSPART];
|
||||
struct dkbad bad;
|
||||
};
|
||||
|
||||
#endif /* _MACHINE_DISKLABEL_H_ */
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: endian.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/* Just use the common m68k definition */
|
||||
#include <m68k/endian.h>
|
|
@ -0,0 +1,49 @@
|
|||
/* $NetBSD: exec.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Christopher G. Demetriou
|
||||
* 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.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_EXEC_H_
|
||||
#define _MACHINE_EXEC_H_
|
||||
|
||||
#define __LDPGSZ 8192
|
||||
|
||||
/* Relocation format. */
|
||||
struct relocation_info_m68k {
|
||||
int r_address; /* offset in text or data segment */
|
||||
unsigned int r_symbolnum : 24, /* ordinal number of add symbol */
|
||||
r_pcrel : 1, /* 1 if value should be pc-relative */
|
||||
r_length : 2, /* log base 2 of value's width */
|
||||
r_extern : 1, /* 1 if need to add symbol to value */
|
||||
r_baserel : 1, /* linkage table relative */
|
||||
r_jmptable : 1, /* relocate to jump table */
|
||||
r_relative : 1, /* load address relative */
|
||||
r_copy : 1; /* run time copy */
|
||||
};
|
||||
#define relocation_info relocation_info_m68k
|
||||
|
||||
#endif /* _MACHINE_EXEC_H_ */
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: float.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
#ifndef _MACHINE_FLOAT_H_
|
||||
#define _MACHINE_FLOAT_H_
|
||||
|
||||
#include <m68k/float.h>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,3 @@
|
|||
/* $NetBSD: frame.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
#include <m68k/frame.h>
|
|
@ -0,0 +1,4 @@
|
|||
/* $NetBSD: ieeefp.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/* Just use the common m68k definition */
|
||||
#include <m68k/ieeefp.h>
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)kbd.h 8.1 (Berkeley) 6/11/93
|
||||
*
|
||||
* from: Header: kbd.h,v 1.5 92/11/26 01:15:33 torek Exp (LBL)
|
||||
* $Id: kbd.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Keyboard `registers'. (This should be called kbd_reg.h but we need to
|
||||
* be compatible.)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Control codes sent from type 2, 3, and 4 keyboards.
|
||||
*
|
||||
* Note that KBD_RESET is followed by a keyboard ID, while KBD_IDLE is not.
|
||||
* KBD_IDLE does not take the place of any `up' transitions (it merely occurs
|
||||
* after them).
|
||||
*/
|
||||
#define KBD_RESET 0xff /* keyboard `reset' response */
|
||||
#define KBD_IDLE 0x7f /* keyboard `all keys are up' code */
|
||||
|
||||
/* Keyboard IDs */
|
||||
#define KB_SUN2 2 /* type 2 keyboard */
|
||||
#define KB_SUN3 3 /* type 3 keyboard */
|
||||
#define KB_SUN4 4 /* type 4 keyboard */
|
||||
|
||||
/* Key codes are in 0x00..0x7e; KBD_UP is set if the key goes up */
|
||||
#define KBD_KEYMASK 0x7f /* keyboard key mask */
|
||||
#define KBD_UP 0x80 /* keyboard `up' transition */
|
||||
|
||||
/* Keyboard codes needed to recognize the L1-A sequence */
|
||||
#define KBD_L1 1 /* keyboard code for `L1' key */
|
||||
#define KBD_A 77 /* keyboard code for `A' key */
|
||||
|
||||
/* Control codes sent to the various keyboards */
|
||||
#define KBD_CMD_RESET 1 /* reset keyboard */
|
||||
#define KBD_CMD_BELL 2 /* turn bell on */
|
||||
#define KBD_CMD_NOBELL 3 /* turn bell off */
|
||||
#define KBD_CMD_CLICK 10 /* turn keyclick on */
|
||||
#define KBD_CMD_NOCLICK 11 /* turn keyclick off */
|
|
@ -0,0 +1,132 @@
|
|||
/* $NetBSD: kbio.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)kbio.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following is a minimal emulation of Sun's `kio' structures
|
||||
* and related operations necessary to make X11 happy (i.e., make it
|
||||
* compile, and make old X11 binaries run).
|
||||
*/
|
||||
|
||||
/*
|
||||
* The kiockey structure apparently gets and/or sets keyboard mappings.
|
||||
* It seems to be kind of useless, but X11 uses it (according to the
|
||||
* comments) to figure out when a Sun 386i has a type-4 keyboard but
|
||||
* claims to have a type-3 keyboard. We need just enough to cause the
|
||||
* appropriate ioctl to return the appropriate magic value.
|
||||
*
|
||||
* KIOCGETKEY fills in kio_entry from kio_station. Not sure what tablemask
|
||||
* is for; X sets it before the call, so it is not an output, but we do not
|
||||
* care anyway. KIOCSDIRECT is supposed to tell the kernel whether to send
|
||||
* keys to the console or to X; we just send them to X whenever the keyboard
|
||||
* is open at all. (XXX may need to change this later)
|
||||
*
|
||||
* Keyboard commands and types are defined in kbd.h as they are actually
|
||||
* real hardware commands and type numbers.
|
||||
*/
|
||||
struct okiockey { /* Out-dated key translation structure */
|
||||
int kio_tablemask; /* whatever */
|
||||
u_char kio_station; /* key number */
|
||||
u_char kio_entry; /* HOLE if not present */
|
||||
char kio_text[10]; /* the silly escape sequences (unsupported) */
|
||||
};
|
||||
|
||||
struct kiockey {
|
||||
int kio_tablemask; /* whatever */
|
||||
u_char kio_station; /* key number */
|
||||
u_short kio_entry; /* HOLE if not present */
|
||||
char kio_text[10]; /* the silly escape sequences (unsupported) */
|
||||
};
|
||||
|
||||
/* Same as bell_info */
|
||||
struct kbiocbell {
|
||||
int volume;
|
||||
int pitch;
|
||||
int msec;
|
||||
};
|
||||
|
||||
/*
|
||||
* Keyboard LED masks (used to set LED's)
|
||||
*/
|
||||
#define LED_ZENKAKU 0x40
|
||||
#define LED_HIRAGANA 0x20
|
||||
#define LED_INSERT 0x10
|
||||
#define LED_CAPS_LOCK 0x08
|
||||
#define LED_CODE_INPUT 0x04
|
||||
#define LED_ROMAJI 0x02
|
||||
#define LED_KANA_LOCK 0x01
|
||||
|
||||
/*
|
||||
* Values for kio_tablemask. These determine which table to read/modify
|
||||
* in KIOC[SG]KEY ioctls. Currently, we only have "non-shift" and "shift"
|
||||
* tables.
|
||||
*/
|
||||
#define KIOC_NOMASK 0x0
|
||||
#define KIOC_CAPSMASK 0x1
|
||||
#define KIOC_SHIFTMASK 0xe
|
||||
#define KIOC_CTRLMASK 0x30
|
||||
#define KIOC_ALTGMASK 0x200
|
||||
#define KIOC_NUMLMASK 0x800
|
||||
|
||||
#define HOLE 0x302 /* value for kio_entry to say `really type 3' */
|
||||
|
||||
#define KIOCTRANS _IOW('k', 0, int) /* set translation mode */
|
||||
/* (we only accept TR_UNTRANS_EVENT) */
|
||||
#define KIOCGETKEY _IOWR('k', 2, struct okiockey) /* fill in kio_entry */
|
||||
#define KIOCGTRANS _IOR('k', 5, int) /* get translation mode */
|
||||
#define KIOCCMD _IOW('k', 8, int) /* X uses this to ring bell */
|
||||
#define KIOCTYPE _IOR('k', 9, int) /* get keyboard type */
|
||||
#define KIOCSDIRECT _IOW('k', 10, int) /* keys to console? */
|
||||
#define KIOCSKEY _IOW('k', 12, struct kiockey) /* set xlat mode */
|
||||
#define KIOCGKEY _IOWR('k', 13, struct kiockey) /* get xlat mode */
|
||||
#define KIOCLAYOUT _IOR('k', 20, int) /* get keyboard layout */
|
||||
#define KIOCSLED _IOW('k', 14, char) /* set LED state */
|
||||
#define KIOCGLED _IOR('k', 15, char) /* get LED state */
|
||||
#define KIOCSBELL _IOW('k', 16, struct kbiocbell) /* set bell parameter */
|
||||
|
||||
#define TR_NONE 0 /* X compat, unsupported */
|
||||
#define TR_ASCII 1 /* X compat, unsupported */
|
||||
#define TR_EVENT 2 /* X compat, unsupported */
|
||||
#define TR_UNTRANS_EVENT 3
|
|
@ -0,0 +1,8 @@
|
|||
/* $NetBSD: limits.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/* Just use the common m68k definition */
|
||||
#include <m68k/limits.h>
|
||||
|
||||
#ifdef KERNEL
|
||||
#define CLOCKS_PER_SEC 100
|
||||
#endif
|
|
@ -0,0 +1,58 @@
|
|||
/* $NetBSD: mtpr.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah Hdr: mtpr.h 1.1 90/07/09
|
||||
*
|
||||
* @(#)mtpr.h 7.2 (Berkeley) 11/3/90
|
||||
*/
|
||||
|
||||
/*
|
||||
* simulated software interrupt register
|
||||
*/
|
||||
|
||||
extern unsigned char ssir;
|
||||
|
||||
#define SIR_NET 0x1
|
||||
#define SIR_CLOCK 0x2
|
||||
#define SIR_SERIAL 0x4
|
||||
|
||||
#define siroff(x) ssir &= ~(x)
|
||||
#define setsoftnet() ssir |= SIR_NET
|
||||
#define setsoftclock() ssir |= SIR_CLOCK
|
||||
#define setsoftserial() ssir |= SIR_SERIAL
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* $Id: opmbellio.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
|
||||
*/
|
||||
|
||||
#ifndef _IOCTL_
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <x68k/dev/opmreg.h>
|
||||
|
||||
struct bell_info {
|
||||
int volume;
|
||||
int pitch;
|
||||
int msec;
|
||||
};
|
||||
|
||||
/* default values */
|
||||
#define BELL_VOLUME 100 /* percentage */
|
||||
#define BELL_PITCH 440
|
||||
#define BELL_DURATION 100
|
||||
#define BELL_CHANNEL 7
|
||||
|
||||
/* limits */
|
||||
#define MAXBVOLUME 100 /* 100 percent */
|
||||
#define MAXBPITCH 4698
|
||||
#define MINBPITCH 20
|
||||
#define MAXBTIME 5000 /* 5 seconds */
|
||||
|
||||
#define BELLIOCSPARAM _IOW('B', 0x1, struct bell_info)
|
||||
#define BELLIOCGPARAM _IOR('B', 0x2, struct bell_info)
|
||||
#define BELLIOCSVOICE _IOW('B', 0x3, struct opm_voice)
|
||||
#define BELLIOCGVOICE _IOR('B', 0x4, struct opm_voice)
|
|
@ -0,0 +1,203 @@
|
|||
/* $NetBSD: param.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: machparam.h 1.16 92/12/20$
|
||||
*
|
||||
* @(#)param.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine dependent constants for x68k
|
||||
*/
|
||||
#define _MACHINE x68k
|
||||
#define MACHINE "x68k"
|
||||
#define _MACHINE_ARCH m68k
|
||||
#define MACHINE_ARCH "m68k"
|
||||
#define MID_MACHINE MID_M68K
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value for all
|
||||
* data types (int, long, ...). The result is u_int and must be cast to
|
||||
* any desired pointer type.
|
||||
*/
|
||||
#define ALIGNBYTES (sizeof(int) - 1)
|
||||
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
|
||||
|
||||
#define PGSHIFT 12 /* LOG2(NBPG) */
|
||||
#define NBPG (1 << PGSHIFT) /* bytes/page */
|
||||
#define PGOFSET (NBPG-1) /* byte offset into page */
|
||||
#define NPTEPG (NBPG/(sizeof (pt_entry_t)))
|
||||
|
||||
#define SEGSHIFT 22 /* LOG2(NBSEG) */
|
||||
#define NBSEG (1 << SEGSHIFT) /* bytes/segment */
|
||||
#define SEGOFSET (NBSEG-1) /* byte offset into segment */
|
||||
|
||||
#define KERNBASE 0x00000000 /* start of kernel virtual */
|
||||
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
|
||||
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#define DEV_BSIZE (1 << DEV_BSHIFT)
|
||||
#define BLKDEV_IOSIZE 2048
|
||||
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
|
||||
|
||||
#define CLSIZELOG2 0
|
||||
#define CLSIZE (1 << CLSIZELOG2)
|
||||
|
||||
/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
|
||||
#define SSIZE 1 /* initial stack size/NBPG */
|
||||
#define SINCR 1 /* increment of stack/NBPG */
|
||||
#define UPAGES 3 /* pages of u-area */
|
||||
#define USPACE (UPAGES * NBPG) /* total size of u-area */
|
||||
|
||||
/*
|
||||
* Constants related to network buffer management.
|
||||
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
|
||||
* on machines that exchange pages of input or output buffers with mbuf
|
||||
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
|
||||
* of the hardware page size.
|
||||
*/
|
||||
#define MSIZE 128 /* size of an mbuf */
|
||||
#define MCLSHIFT 11
|
||||
#define MCLBYTES (1 << MCLSHIFT) /* large enough for ether MTU */
|
||||
#define MCLOFSET (MCLBYTES - 1)
|
||||
|
||||
#ifndef NMBCLUSTERS
|
||||
#ifdef GATEWAY
|
||||
#define NMBCLUSTERS 512 /* map size, max cluster allocation */
|
||||
#else
|
||||
#define NMBCLUSTERS 256 /* map size, max cluster allocation */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Size of kernel malloc arena in CLBYTES-sized logical pages
|
||||
*/
|
||||
#ifndef NKMEMCLUSTERS
|
||||
#define NKMEMCLUSTERS (2048 * 1024 / CLBYTES)
|
||||
#endif
|
||||
|
||||
/* pages ("clicks") to disk blocks */
|
||||
#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT))
|
||||
#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT))
|
||||
|
||||
/* pages to bytes */
|
||||
#define ctob(x) ((x) << PGSHIFT)
|
||||
#define btoc(x) (((x) + PGOFSET) >> PGSHIFT)
|
||||
|
||||
/* bytes to disk blocks */
|
||||
#define dbtob(x) ((x) << DEV_BSHIFT)
|
||||
#define btodb(x) ((x) >> DEV_BSHIFT)
|
||||
|
||||
/*
|
||||
* Map a ``block device block'' to a file system block.
|
||||
* This should be device dependent, and should use the bsize
|
||||
* field from the disk label.
|
||||
* For now though just use DEV_BSIZE.
|
||||
*/
|
||||
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE / DEV_BSIZE))
|
||||
|
||||
/*
|
||||
* Mach derived conversion macros
|
||||
*/
|
||||
#define x68k_round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
|
||||
#define x68k_trunc_page(x) ((unsigned)(x) & ~PGOFSET)
|
||||
#define x68k_btop(x) ((unsigned)(x) >> PGSHIFT)
|
||||
#define x68k_ptob(x) ((unsigned)(x) << PGSHIFT)
|
||||
|
||||
/*
|
||||
* spl functions; all but spl0 are done in-line
|
||||
*/
|
||||
#include <machine/psl.h>
|
||||
|
||||
#define _spl(s) \
|
||||
({ \
|
||||
register int _spl_r; \
|
||||
\
|
||||
__asm __volatile ("clrl %0; movew sr,%0; movew %1,sr" : \
|
||||
"&=d" (_spl_r) : "di" (s)); \
|
||||
_spl_r; \
|
||||
})
|
||||
|
||||
/* spl0 requires checking for software interrupts */
|
||||
#define spl1() _spl(PSL_S|PSL_IPL1)
|
||||
#define spl2() _spl(PSL_S|PSL_IPL2)
|
||||
#define spl3() _spl(PSL_S|PSL_IPL3)
|
||||
#define spl4() _spl(PSL_S|PSL_IPL4)
|
||||
#define spl5() _spl(PSL_S|PSL_IPL5)
|
||||
#define spl6() _spl(PSL_S|PSL_IPL6)
|
||||
#define spl7() _spl(PSL_S|PSL_IPL7)
|
||||
|
||||
#define splnone() spl0()
|
||||
#define splsoftclock() spl1() /* disallow softclock */
|
||||
#define splsoftnet() spl1() /* disallow softnet */
|
||||
#define splnet() spl4() /* disallow network */
|
||||
#define splbio() spl3() /* disallow block I/O */
|
||||
#define splimp() spl4() /* disallow imput */
|
||||
#define spltty() spl4() /* disallow tty interrupts */
|
||||
#define splzs() spl6() /* disallow serial interrupts */
|
||||
#define splclock() spl6() /* disallow clock interrupt */
|
||||
#define splstatclock() spl6() /* disallow clock interrupt */
|
||||
#define splvm() spl4() /* disallow virtual memory operations */
|
||||
#define splhigh() spl7() /* disallow everything */
|
||||
#define splsched() spl7() /* disallow scheduling */
|
||||
|
||||
/* watch out for side effects */
|
||||
#define splx(s) (s & PSL_IPL ? _spl(s) : spl0())
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifndef _LOCORE
|
||||
int cpuspeed;
|
||||
#define delay(n) do { register int N = cpuspeed * (n); while (--N > 0); } while(0)
|
||||
#define DELAY(n) delay(n)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef COMPAT_HPUX
|
||||
/*
|
||||
* Constants/macros for HPUX multiple mapping of user address space.
|
||||
* Pages in the first 256Mb are mapped in at every 256Mb segment.
|
||||
*/
|
||||
#define HPMMMASK 0xF0000000
|
||||
#define ISHPMMADDR(v) \
|
||||
((curproc->p_md.md_flags & MDP_HPUXMMAP) && \
|
||||
((unsigned)(v) & HPMMMASK) && \
|
||||
((unsigned)(v) & HPMMMASK) != HPMMMASK)
|
||||
#define HPMMBASEADDR(v) \
|
||||
((unsigned)(v) & ~HPMMMASK)
|
||||
#endif
|
|
@ -0,0 +1,67 @@
|
|||
/* $NetBSD: pcb.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1982, 1986, 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* from: Utah $Hdr: pcb.h 1.14 91/03/25$
|
||||
*
|
||||
* @(#)pcb.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <machine/frame.h>
|
||||
|
||||
/*
|
||||
* X68K process control block
|
||||
*/
|
||||
struct pcb {
|
||||
short pcb_flags; /* misc. process flags */
|
||||
short pcb_ps; /* processor status word */
|
||||
int pcb_ustp; /* user segment table pointer */
|
||||
int pcb_usp; /* user stack pointer */
|
||||
int pcb_regs[12]; /* D2-D7, A2-A7 */
|
||||
caddr_t pcb_onfault; /* for copyin/out faults */
|
||||
struct fpframe pcb_fpregs; /* 68881/2 context save area */
|
||||
};
|
||||
|
||||
/*
|
||||
* The pcb is augmented with machine-dependent additional data for
|
||||
* core dumps. For the hp300, this includes an HP-UX exec header
|
||||
* which is dumped for HP-UX processes.
|
||||
*/
|
||||
struct md_coredump {
|
||||
int md_exec[16]; /* exec structure for HP-UX core dumps */
|
||||
};
|
|
@ -0,0 +1,36 @@
|
|||
/* $NetBSD: pci_machdep.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Chris G. Demetriou
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and
|
||||
* its documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* Machine-specific definitions for PCI autoconfiguration.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Configuration tag.
|
||||
*/
|
||||
typedef u_long pci_tag_t;
|
|
@ -0,0 +1,158 @@
|
|||
/* $NetBSD: pmap.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987 Carnegie-Mellon University
|
||||
* Copyright (c) 1991, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department.
|
||||
*
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)pmap.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _X68K_PMAP_H_
|
||||
#define _X68K_PMAP_H_
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/pte.h>
|
||||
|
||||
#if defined(M68040)
|
||||
#define X68K_SEG_SIZE (mmutype == MMU_68040 ? 0x40000 : NBSEG)
|
||||
#else
|
||||
#define X68K_SEG_SIZE NBSEG
|
||||
#endif
|
||||
|
||||
#define x68k_trunc_seg(x) (((unsigned)(x)) & ~(X68K_SEG_SIZE-1))
|
||||
#define x68k_round_seg(x) x68k_trunc_seg((unsigned)(x) + X68K_SEG_SIZE-1)
|
||||
|
||||
/*
|
||||
* Pmap stuff
|
||||
*/
|
||||
struct pmap {
|
||||
pt_entry_t *pm_ptab; /* KVA of page table */
|
||||
st_entry_t *pm_stab; /* KVA of segment table */
|
||||
int pm_stchanged; /* ST changed */
|
||||
int pm_stfree; /* 040: free lev2 blocks */
|
||||
st_entry_t *pm_stpa; /* 040: ST phys addr */
|
||||
short pm_sref; /* segment table ref count */
|
||||
short pm_count; /* pmap reference count */
|
||||
simple_lock_data_t pm_lock; /* lock on pmap */
|
||||
struct pmap_statistics pm_stats; /* pmap statistics */
|
||||
long pm_ptpages; /* more stats: PT pages */
|
||||
};
|
||||
|
||||
typedef struct pmap *pmap_t;
|
||||
|
||||
/*
|
||||
* On the 040 we keep track of which level 2 blocks are already in use
|
||||
* with the pm_stfree mask. Bits are arranged from LSB (block 0) to MSB
|
||||
* (block 31). For convenience, the level 1 table is considered to be
|
||||
* block 0.
|
||||
*
|
||||
* MAX[KU]L2SIZE control how many pages of level 2 descriptors are allowed.
|
||||
* for the kernel and users. 8 implies only the initial "segment table"
|
||||
* page is used. WARNING: don't change MAXUL2SIZE unless you can allocate
|
||||
* physically contiguous pages for the ST in pmap.c!
|
||||
*/
|
||||
#define MAXKL2SIZE 32
|
||||
#define MAXUL2SIZE 8
|
||||
#define l2tobm(n) (1 << (n))
|
||||
#define bmtol2(n) (ffs(n) - 1)
|
||||
|
||||
/*
|
||||
* Macros for speed
|
||||
*/
|
||||
#define PMAP_ACTIVATE(pmapp, pcbp, iscurproc) \
|
||||
if ((pmapp)->pm_stchanged) { \
|
||||
(pcbp)->pcb_ustp = x68k_btop((vm_offset_t)(pmapp)->pm_stpa); \
|
||||
if (iscurproc) \
|
||||
loadustp((pcbp)->pcb_ustp); \
|
||||
(pmapp)->pm_stchanged = FALSE; \
|
||||
}
|
||||
#define PMAP_DEACTIVATE(pmapp, pcbp)
|
||||
|
||||
/*
|
||||
* For each vm_page_t, there is a list of all currently valid virtual
|
||||
* mappings of that page. An entry is a pv_entry, the list is pv_table.
|
||||
*/
|
||||
struct pv_entry {
|
||||
struct pv_entry *pv_next; /* next pv_entry */
|
||||
struct pmap *pv_pmap; /* pmap where mapping lies */
|
||||
vm_offset_t pv_va; /* virtual address for mapping */
|
||||
st_entry_t *pv_ptste; /* non-zero if VA maps a PT page */
|
||||
struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */
|
||||
int pv_flags; /* flags */
|
||||
};
|
||||
|
||||
#define PV_CI 0x01 /* header: all entries are cache inhibited */
|
||||
#define PV_PTPAGE 0x02 /* header: entry maps a page table page */
|
||||
|
||||
struct pv_page;
|
||||
|
||||
struct pv_page_info {
|
||||
TAILQ_ENTRY(pv_page) pgi_list;
|
||||
struct pv_entry *pgi_freelist;
|
||||
int pgi_nfree;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is basically:
|
||||
* ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry))
|
||||
*/
|
||||
#define NPVPPG 170
|
||||
|
||||
struct pv_page {
|
||||
struct pv_page_info pvp_pgi;
|
||||
struct pv_entry pvp_pv[NPVPPG];
|
||||
};
|
||||
|
||||
extern struct pmap kernel_pmap_store;
|
||||
|
||||
#define pmap_kernel() (&kernel_pmap_store)
|
||||
#define active_pmap(pm) \
|
||||
((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
|
||||
|
||||
extern struct pv_entry *pv_table; /* array of entries, one per page */
|
||||
|
||||
#ifndef MACHINE_NONCONTIG
|
||||
#define pmap_page_index(pa) atop(pa - vm_first_phys)
|
||||
#endif
|
||||
#define pa_to_pvh(pa) (&pv_table[pmap_page_index(pa)])
|
||||
|
||||
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
|
||||
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
|
||||
|
||||
extern pt_entry_t *Sysmap;
|
||||
extern char *vmmap; /* map for mem, dumps, etc. */
|
||||
|
||||
#endif /* !_X68K_PMAP_H_ */
|
|
@ -0,0 +1,61 @@
|
|||
/* $NetBSD: powioctl.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 MINOURA Makoto.
|
||||
* 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.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Minoura Makoto.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Power switch device driver. */
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
enum x68k_powerswitch {
|
||||
POW_ALARMSW = 1,
|
||||
POW_EXTERNALSW = 2,
|
||||
POW_FRONTSW = 4,
|
||||
};
|
||||
|
||||
struct x68k_powerinfo {
|
||||
int pow_switch_boottime;
|
||||
int pow_switch_current;
|
||||
time_t pow_boottime;
|
||||
unsigned int pow_bootcount;
|
||||
time_t pow_usedtotal;
|
||||
};
|
||||
|
||||
struct x68k_alarminfo {
|
||||
int al_enable;
|
||||
unsigned int al_ontime;
|
||||
int al_dowhat;
|
||||
time_t al_offtime;
|
||||
};
|
||||
|
||||
#define POWIOCGPOWERINFO _IOR('p', 0, struct x68k_powerinfo)
|
||||
#define POWIOCGALARMINFO _IOR('p', 1, struct x68k_alarminfo)
|
||||
#define POWIOCSALARMINFO _IOW('p', 2, struct x68k_alarminfo)
|
||||
#define POWIOCSSIGNAL _IOW('p', 3, int)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue