1 Commits

Author SHA1 Message Date
Sergey
7e4b86d135 Branch "sdram" imported from GoogleCode. 2015-03-21 14:08:32 -07:00
2593 changed files with 86158 additions and 400025 deletions

7
.gitignore vendored
View File

@@ -24,10 +24,7 @@
*.dis
*.0
*.img
sdcard.rd
.profile
Makefile.user
#misc
*.log
*.txt

27
LICENSE
View File

@@ -1,27 +0,0 @@
Copyright (c) 2014, RetroBSD
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* 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.
* Neither the name of the {organization} 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 COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.

183
Makefile
View File

@@ -8,13 +8,31 @@
# The `make' will compile everything, including a kernel, utilities
# and a root filesystem image.
#
# Supported boards
#
MAX32 = pic32/max32
UBW32 = pic32/ubw32
UBW32UART = pic32/ubw32-uart
UBW32UARTSDRSW = pic32/ubw32-uart-sdramswap
MAXIMITE = pic32/maximite
EXPLORER16 = pic32/explorer16
STARTERKIT = pic32/starter-kit
DUINOMITE = pic32/duinomite
PINGUINO = pic32/pinguino-micro
DIP = pic32/dip
BAREMETAL = pic32/baremetal
RETROONE = pic32/retroone
# Select target board
TARGET ?= $(UBW32UARTSDRSW)
# Filesystem and swap sizes.
FS_MBYTES = 100
U_MBYTES = 100
SWAP_MBYTES = 2
FS_KBYTES = 16384
SWAP_KBYTES = 2048
# Set this to the device name for your SD card. With this
# enabled you can use "make installfs" to copy the sdcard.img
# enabled you can use "make installfs" to copy the filesys.img
# to the SD card.
#SDCARD = /dev/sdb
@@ -27,65 +45,136 @@ DEFS =
FSUTIL = tools/fsutil/fsutil
-include Makefile.user
#
# Filesystem contents.
#
BIN_FILES := $(wildcard bin/*)
SBIN_FILES := $(wildcard sbin/*)
GAMES_FILES := $(shell find games -type f ! -path '*/.*')
LIB_FILES := $(wildcard lib/*)
LIBEXEC_FILES := $(wildcard libexec/*)
ETC_FILES = etc/rc etc/rc.local etc/ttys etc/gettytab etc/group \
etc/passwd etc/shadow etc/fstab etc/motd etc/shells \
etc/termcap
INC_FILES = include/stdio.h include/syscall.h include/sys/types.h \
include/sys/select.h
SHARE_FILES = share/re.help share/example/Makefile \
share/example/ashello.S share/example/chello.c \
share/example/blkjack.bas share/example/hilow.bas \
share/example/stars.bas share/example/prime.scm \
share/example/fact.fth share/example/echo.S
ALLFILES = $(SBIN_FILES) $(ETC_FILES) $(BIN_FILES) $(LIB_FILES) $(LIBEXEC_FILES) \
$(INC_FILES) $(SHARE_FILES) $(GAMES_FILES) \
var/log/messages var/log/wtmp .profile
ALLDIRS = sbin/ bin/ dev/ etc/ tmp/ lib/ libexec/ share/ share/example/ \
share/misc/ var/ var/run/ var/log/ u/ include/ include/sys/ \
games/ games/lib/
BDEVS = dev/sd0!b0:0 dev/sd1!b0:1 dev/sw0!b1:0
CDEVS = dev/console!c0:0 \
dev/mem!c1:0 dev/kmem!c1:1 dev/null!c1:2 dev/zero!c1:3 \
dev/tty!c2:0 \
dev/rsd0!c3:0 dev/rsd1!c3:1 dev/swap!c3:0 \
dev/klog!c4:0 \
dev/stdin!c5:0 dev/stdout!c5:1 dev/stderr!c5:2 \
dev/rsw0!c6:0 \
dev/porta!c7:0 dev/portb!c7:1 dev/portc!c7:2 \
dev/portd!c7:3 dev/porte!c7:4 dev/portf!c7:5 dev/portg!c7:6 \
dev/confa!c7:64 dev/confb!c7:65 dev/confc!c7:66 \
dev/confd!c7:67 dev/confe!c7:68 dev/conff!c7:69 dev/confg!c7:70 \
dev/spi1!c9:0 dev/spi2!c9:1 dev/spi3!c9:2 dev/spi4!c9:3 \
dev/glcd0!c10:0
FDDEVS = dev/fd/ dev/fd/0!c5:0 dev/fd/1!c5:1 dev/fd/2!c5:2 \
dev/fd/3!c5:3 dev/fd/4!c5:4 dev/fd/5!c5:5 dev/fd/6!c5:6 \
dev/fd/7!c5:7 dev/fd/8!c5:8 dev/fd/9!c5:9 dev/fd/10!c5:10 \
dev/fd/11!c5:11 dev/fd/12!c5:12 dev/fd/13!c5:13 \
dev/fd/14!c5:14 dev/fd/15!c5:15 dev/fd/16!c5:16 \
dev/fd/17!c5:17 dev/fd/18!c5:18 dev/fd/19!c5:19 \
dev/fd/20!c5:20 dev/fd/21!c5:21 dev/fd/22!c5:22 \
dev/fd/23!c5:23 dev/fd/24!c5:24 dev/fd/25!c5:25 \
dev/fd/26!c5:26 dev/fd/27!c5:27 dev/fd/28!c5:28 \
dev/fd/29!c5:29
ADCDEVS = dev/adc0!c8:0 dev/adc1!c8:1 dev/adc2!c8:2 dev/adc3!c8:3 \
dev/adc4!c8:4 dev/adc5!c8:5 dev/adc6!c8:6 dev/adc7!c8:7 \
dev/adc8!c8:8 dev/adc9!c8:9 dev/adc10!c8:10 dev/adc11!c8:11 \
dev/adc12!c8:12 dev/adc13!c8:13 dev/adc14!c8:14 dev/adc15!c8:15
OCDEVS = dev/oc0!c11:0 dev/oc1!c11:1 dev/oc2!c11:2 dev/oc3!c11:3 dev/oc4!c11:4
TOPSRC = $(shell pwd)
CONFIG = $(TOPSRC)/tools/configsys/config
all:
$(MAKE) -C tools
$(MAKE) -C lib
$(MAKE) -C src install
$(MAKE) kernel
all: build kernel
$(MAKE) fs
kernel: $(CONFIG)
$(MAKE) -C sys/pic32 all
fs: filesys.img user.img
fs: sdcard.img
kernel:
$(MAKE) -C sys/$(TARGET)
.PHONY: sdcard.img
sdcard.img: $(FSUTIL) rootfs.manifest userfs.manifest
build:
$(MAKE) -C tools
$(MAKE) -C src install
filesys.img: $(FSUTIL) $(ALLFILES)
rm -f $@
$(FSUTIL) --repartition=fs=$(FS_MBYTES)M:swap=$(SWAP_MBYTES)M:fs=$(U_MBYTES)M $@
$(FSUTIL) --new --partition=1 --manifest=rootfs.manifest $@ .
# In case you need a separate /u partition,
# uncomment the following line.
# $(FSUTIL) --new --partition=3 --manifest=userfs.manifest $@ u
$(FSUTIL) -n$(FS_KBYTES) -s$(SWAP_KBYTES) $@
$(FSUTIL) -a $@ $(ALLDIRS) $(ALLFILES)
$(FSUTIL) -a $@ $(CDEVS)
$(FSUTIL) -a $@ $(BDEVS)
$(FSUTIL) -a $@ $(ADCDEVS)
$(FSUTIL) -a $@ $(OCDEVS)
# $(FSUTIL) -a $@ $(FDDEVS)
user.img: $(FSUTIL)
rm -f $@
$(FSUTIL) -n$(FS_KBYTES) $@
$(FSUTIL):
cd tools/fsutil; $(MAKE)
$(CONFIG):
make -C tools/configsys
clean:
rm -f *~
for dir in tools lib src sys/pic32; do $(MAKE) -C $$dir -k clean; done
for dir in tools src sys/pic32; do $(MAKE) -C $$dir -k clean; done
cleanall: clean
$(MAKE) -C lib clean
rm -f sys/pic32/*/unix.hex bin/* sbin/* libexec/*
rm -f games/[a-k]* games/[m-z]* share/man/cat*/*
rm -f games/lib/adventure.dat games/lib/cfscores
rm -f share/re.help share/emg.keys share/misc/more.help
rm -f etc/termcap etc/remote etc/phones
rm -f tools/configsys/.depend
rm -f var/log/aculog sdcard.img
rm -rf var/lock share/unixbench
rm -f sys/pic32/*/unix.hex bin/* sbin/* lib/* games/[a-k]* games/[m-z]* libexec/* share/man/cat*/*
rm -f games/lib/adventure.dat
rm -f games/lib/cfscores
rm -f share/re.help
rm -f share/misc/more.help
rm -f etc/termcap
installfs:
# TODO
buildlib:
@echo installing /usr/include
# cd include; $(MAKE) DESTDIR=$(DESTDIR) install
@echo
@echo compiling libc.a
cd lib/libc; $(MAKE) $(LIBCDEFS)
@echo installing /lib/libc.a
cd lib/libc; $(MAKE) DESTDIR=$(DESTDIR) install
@echo
@echo compiling C compiler
cd lib; $(MAKE) ccom cpp c2
@echo installing C compiler
cd lib/ccom; $(MAKE) DESTDIR=$(DESTDIR) install
cd lib/cpp; $(MAKE) DESTDIR=$(DESTDIR) install
cd lib/c2; $(MAKE) DESTDIR=$(DESTDIR) install
cd lib; $(MAKE) clean
@echo
@echo re-compiling libc.a
cd lib/libc; $(MAKE) $(LIBCDEFS)
@echo re-installing /lib/libc.a
cd lib/libc; $(MAKE) DESTDIR=$(DESTDIR) install
@echo
@echo re-compiling C compiler
cd lib; $(MAKE) ccom cpp c2
@echo re-installing C compiler
cd lib/ccom; $(MAKE) DESTDIR=$(DESTDIR) install
cd lib/cpp; $(MAKE) DESTDIR=$(DESTDIR) install
cd lib/c2; $(MAKE) DESTDIR=$(DESTDIR) install
@echo
installfs: filesys.img
ifdef SDCARD
@[ -f sdcard.img ] || $(MAKE) sdcard.img
sudo dd bs=32k if=sdcard.img of=$(SDCARD)
sudo dd bs=16k if=filesys.img of=$(SDCARD)
else
@echo "Error: No SDCARD defined."
endif
# TODO: make it relative to Target
installflash:
sudo pic32prog sys/pic32/fubarino/unix.hex
# TODO: make it relative to Target
installboot:
sudo pic32prog sys/pic32/fubarino/bootloader.hex

129
README Normal file
View File

@@ -0,0 +1,129 @@
This is the RetroBSD source directory.
Source Roadmap
~~~~~~~~~~~~~~
bin User commands.
etc Template files for /etc.
include System include files.
lib System libraries.
libexec System binaries.
sbin System administration commands.
share Shared resources.
sys Kernel sources.
tools Build tools and simulators.
Supported hardware
~~~~~~~~~~~~~~~~~~
* chipKIT Max32 board.
* Sparkfun UBW32 board.
* Maximite computer.
* Microchip Explorer 16 board, with PIC32 CAN-USB plug-in module and SD & MMC pictail.
* Microchip PIC32 USB or Ethernet Starter Kit, with I/O Expansion board and SD & MMC pictail.
* Olimex Duinomite, Duinomite-Mini and Duinomite-Mega boards.
* Olimex Pinguino-Micro board with PIC32MX795F512H microcontroller.
* eflightworks DIP board.
Build
~~~~~
By default, the system is configured for the Max32 board.
To select another target board, edit a top-level Makefile
and change a TARGET value under section "Select target board":
TARGET = $(UBW32) # for the UBW32 board with USB console
TARGET = $(UBW32UART) # for the UBW32 board with UART console
TARGET = $(MAXIMITE) # for the Maximite board
TARGET = $(EXPLORER16) # for the Explorer 16 board
TARGET = $(STARTERKIT) # for the PIC32 USB or Ethernet Starter Kit
TARGET = $(MAX32) # default
TARGET = $(DUINOMITE) # for the Duinomite board
TARGET = $(PINGUINO) # for the Pinguino-Micro board
TARGET = $(DIP) # for the DIP board
You can also change a desired filesystem size and swap area size,
as required. Default is:
FS_KBYTES = 16384
SWAP_KBYTES = 2048
To compile the kernel and build a filesystem image, run:
make
A resulting root filesystem image is in file `filesys.img`.
A kernel is in file `unix.hex` in your target board subdirectory.
Filesystem image
~~~~~~~~~~~~~~~~
You need to put a filesystem image on a SD card. On Windows, use
Win32DiskImager utility (https://launchpad.net/win32-image-writer/+download).
On Linux, run:
sudo dd if=filesys.img of=/dev/XYZ
Here `XYZ` is a device name of SD card, as recognized by Linux (sdb in my case).
Install kernel
~~~~~~~~~~~~~~
Kernel image should be written to PIC32 flash memory. The procedure depends
on a board used.
Max32 board:
cd sys/pic32/ubw32
AVRTOOLS=/Applications/Mpide.app/Contents/Resources/Java/hardware/tools
$AVRTOOLS/bin/avrdude -C$AVRTOOLS/etc/avrdude.conf -c stk500v2 -p pic32 \
-P /dev/tty.usbserial-* -b 115200 -v -U flash:w:unix.hex:i
Here you need to change AVRTOOLS path and tty name according to your system.
UBW32 board:
Use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
pic32prog sys/pic32/ubw32/unix.hex
Maximite:
Use the bootload program for Windows, available for download by link:
http://geoffg.net/Downloads/Maximite/Maximite_Update_V2.7B.zip
Explorer 16 board:
There is an auxiliary PIC18 chip on the Explorer 16 board, which can be
used as a built-in programmer device. You will need a PICkit 2 adapter
to install a needed firmware, as described in article:
http://www.paintyourdragon.com/?p=51
(section "Hack #2: Lose the PICkit 2, Save $35").
This should be done only once.
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
pic32prog sys/pic32/explorer16/unix.hex
PIC32 Starter Kit:
Use PICkit 2 adapter and software to install a boot loader from
file `sys/pic32/starter-kit/boot.hex`. This should be done only once.
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
pic32prog sys/pic32/starter-kit/unix.hex
Simulator
~~~~~~~~~
You can use a MIPS32 simulator to develop a debug a RetroBSD software,
without a need for hardware board. By default, a simulator is configured
to imitate a Max32 board. To build it:
cd tools/virtualmips
make
Run it:
./pic32
Configuration of simulated board is stored in file `pic32_max32.conf`.

142
README.md
View File

@@ -1,142 +0,0 @@
# This is the RetroBSD source directory.
## Source Roadmap
bin User commands.
etc Template files for /etc.
include System include files.
lib System libraries.
libexec System binaries.
sbin System administration commands.
share Shared resources.
sys Kernel sources.
tools Build tools and simulators.
## Supported hardware
* Fubarino SD board.
* Olimex Duinomite, Duinomite-Mini, Duinomite-Mega and Duinomite-eMega boards.
* Olimex Pinguino-Micro board with PIC32MX795F512H microcontroller.
* Maximite and Colour Maximite computers.
* Majenko SDXL board.
* 4D Systems Picadillo-35T board.
* MikroElektronika MultiMedia Board for PIC32MX7.
* chipKIT Max32 board with SD card shield.
* chipKIT WF32 board with 2.4" LCD TFT display shield.
* Sparkfun UBW32 board with SD card slot.
* Microchip Explorer 16 board, with PIC32 CAN-USB plug-in module and SD & MMC pictail.
* Microchip PIC32 USB or Ethernet Starter Kit, with I/O Expansion board and SD & MMC pictail.
## Build
To compile everything from sources, you'll need some packages installed, namely:
Berkeley YACC, GNU bison, flex, groff, ELF library and FUSE library.
Under Ubuntu, for example, you can do it by command:
```shell
$ sudo apt-get install bison byacc flex groff-base libelf-dev
```
You can change a desired filesystem size and swap area size, as required.
Default is:
```Makefile
FS_MBYTES = 100
SWAP_MBYTES = 2
```
To compile the kernel and build a filesystem image, run:
```shell
$ make
```
A resulting root filesystem image is in file `sdcard.img`.
A kernel is in file `unix.hex` in your target board subdirectory.
### Filesystem image
You need to put a filesystem image on a SD card. On Windows, use
Win32DiskImager utility (https://launchpad.net/win32-image-writer/+download).
On Linux, run:
```shell
$ sudo dd if=sdcard.img of=/dev/XYZ
```
Here `XYZ` is a device name of SD card, as recognized by Linux (sdb in my case).
### Install kernel
Kernel image should be written to PIC32 flash memory. The procedure depends
on a board used.
#### Max32 board:
Use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
```shell
$ pic32prog -d /dev/ttyUSB0 sys/pic32/max32/unix.hex
```
Here you need to change AVRTOOLS path and tty name according to your system.
#### UBW32 board:
Use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
```shell
$ pic32prog sys/pic32/ubw32/unix.hex
```
#### Maximite:
Use the bootload program for Windows, available for download by link:
http://geoffg.net/Downloads/Maximite/Maximite_Update_V2.7B.zip
#### Explorer 16 board:
There is an auxiliary PIC18 chip on the Explorer 16 board, which can be
used as a built-in programmer device. You will need a PICkit 2 adapter
to install a needed firmware, as described in article:
http://www.paintyourdragon.com/?p=51
(section "Hack #2: Lose the PICkit 2, Save $35").
This should be done only once.
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
``` shell
$ pic32prog sys/pic32/explorer16/unix.hex
```
#### PIC32 Starter Kit:
Use PICkit 2 adapter and software to install a boot loader from
file `sys/pic32/starter-kit/boot.hex`. This should be done only once.
Then, you can use a pic32prog utility (http://code.google.com/p/pic32prog/)
and a USB cable to install a kernel:
```shell
$ pic32prog sys/pic32/starter-kit/unix.hex
```
## Simulator
You can use a MIPS32 simulator to develop a debug a RetroBSD software,
without a need for hardware board. By default, a simulator is configured
to imitate a Max32 board. To build it:
```shell
$ cd tools/virtualmips
$ make
```
Run it:
```shell
$ ./pic32
```
Configuration of simulated board is stored in file `pic32_max32.conf`.

1
bin/.gitignore vendored
View File

@@ -1 +0,0 @@
*

View File

@@ -1,7 +1,7 @@
DESTDIR = /usr/local/retrobsd
MACHINE = mips
CC = gcc -m32
CC = gcc
AS = $(CC) -x assembler-with-cpp
LD = ld
@@ -18,14 +18,6 @@ TAGSFILE = tags
MANROFF = nroff -man -h
ELF2AOUT = cp
CFLAGS = -O -DCROSS
CFLAGS = -O -DCROSS -I/usr/include -I$(TOPSRC)/include
LDFLAGS =
LIBS =
# Add system include path
ifeq (,$(wildcard /usr/include/i386-linux-gnu))
CFLAGS += -I/usr/include
else
CFLAGS += -I/usr/include/i386-linux-gnu
endif
CFLAGS += -I$(TOPSRC)/include

5
etc/.gitignore vendored
View File

@@ -1,5 +0,0 @@
localtime
phones
remote
termcap
termcap.full

View File

@@ -4,14 +4,46 @@
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# @(#)MAKEDEV 4.27.6 (2.11BSD) 1999/2/19
#
# Device "make" file. Valid arguments:
# std standard devices
# local configuration specific devices
# fd file descriptor driver
# Tapes:
# ht* unibus tu77 & te16
# tm* unibus tm11 & te10 emulations (e.g. Emulex tc-11)
# ts* unibus ts11
# tu* tmscp (tk50/tu81)
# Disks:
# sd* flash cards SecureDigital
# br* unibus Eaton br1538 or br1711
# hk* unibus rk06 and rk07
# ra* unibus uda50 w/ ra??
# rk* unibus rk05
# rl* unibus rl01/rl02
# rx* unibus rx02
# si* unibus cdc 9766 w/ si 9500
# xp* unibus rm02/03/05, rp04/05/06, diva, eagle, cdc9766, fuji 160.
# Terminal multiplexors:
# dl* dl-11 units other than the console
# dz* unibus dz11 and dz32
# dh* unibus dh11 and emulations (e.g. Able dmax, Emulex cs-11)
# dmf* unibus dmf32
# dhu* unibus dhu11
# dmz* unibus dmz32
# dhv* qbus dhv11
# Pseudo terminals:
# pty* set of 16 master and slave pseudo terminals
# Printers:
# lp* unibus lp11 parallel interface
# va* unibus varian parallel interface
# vp* unibus versatec parallel interface
# Call units:
# Special purpose devices:
# dr* unibus dr11
# ram* memory disk
# dn* dn11 dialer
# ingreslock Ingres lock driver.
PATH=/etc:/sbin:/usr/sbin:/bin:/usr/bin
umask 77
@@ -21,12 +53,15 @@ case $i in
std)
mknod console c 0 0
mknod mem c 1 0 ; chmod 640 mem ; chgrp kmem mem
# mknod kUmem c 1 3 ; chmod 600 kUmem ;: untested
mknod kmem c 1 1 ; chmod 640 kmem ; chgrp kmem kmem
mknod mem c 1 0 ; chmod 640 mem ; chgrp kmem mem
mknod null c 1 2 ; chmod 666 null
mknod zero c 1 3 ; chmod 444 zero
mknod tty c 2 0 ; chmod 666 tty
mknod klog c 3 0 ; chmod 600 klog
mknod tty c 9 0 ; chmod 666 tty
mknod klog c 22 0 ; chmod 600 klog
mknod errlog c 22 1 ; chmod 600 errlog
mknod acctlog c 22 2 ; chmod 600 acctlog
;;
fd)
@@ -35,105 +70,304 @@ fd)
rm -f stdin stdout stderr
mkdir fd
chmod 755 fd
mknod stdin c 4 0
mknod stdout c 4 1
mknod stderr c 4 2
mknod stdin c 26 0
mknod stdout c 26 1
mknod stderr c 26 2
eval `echo "" | awk '{ for (i = 0; i < 32; i++)
printf("mknod fd/%d c 4 %d; ",i,i); }'`
printf("mknod fd/%d c 26 %d; ",i,i); }'`
;;
rd)
ht*|tm*|ts*|tu*)
umask 0 ; ctlr=`expr $i : '..\(.*\)'`
ctlr=`expr $ctlr '*' 64`
case $i in
ht*) blk=0; chr=6;;
tm*) blk=1; chr=7;;
ts*) blk=2; chr=8;;
tu*) blk=12; chr=23;;
esac
# Maximum of 4 controllers in a system
case $ctlr in
0|64|128|192)
# Maximum of 4 units per controller
# for unit in 0 1 2 3
for unit in 0 1
do
zero=`expr $ctlr + $unit + 0`
four=`expr $zero + 4` ; eight=`expr $zero + 8`
twelve=`expr $zero + 12`
sixteen=`expr $zero + 16`
twenty=`expr $zero + 20`
twentyfour=`expr $zero + 24`
twentyeight=`expr $zero + 28`
mknod mt$zero b $blk $zero
mknod mt$four b $blk $four
mknod mt$eight b $blk $eight
mknod mt$twelve b $blk $twelve
mknod nmt$zero b $blk $four ;: v7 compatibility
mknod nmt$eight b $blk $twelve ;: ditto
mknod nrmt$zero c $chr $four ;: ditto
mknod nrmt$eight c $chr $twelve ;: ditto
mknod rmt$zero c $chr $zero
mknod rmt$four c $chr $four
mknod rmt$eight c $chr $eight
mknod rmt$twelve c $chr $twelve
if [ `expr $i : '\(..\)'` = tu ]
then
mknod mt$sixteen b $blk $sixteen
mknod mt$twenty b $blk $twenty
mknod mt$twentyfour b $blk $twentyfour
mknod mt$twentyeight b $blk $twentyeight
mknod nmt$sixteen b $blk $twenty ;: v7 compatibility
mknod nmt$twentyfour b $blk $twentyeight ;: ditto
mknod nrmt$sixteen c $chr $twenty ;: ditto
mknod nrmt$twentyfour c $chr $twentyeight ;: ditto
mknod rmt$sixteen c $chr $sixteen
mknod rmt$twenty c $chr $twenty
mknod rmt$twentyfour c $chr $twentyfour
mknod rmt$twentyeight c $chr $twentyeight
fi
if [ `expr $i : '\(..\)'` = ut ]
then
mknod mt$twenty b $blk $twenty
mknod rmt$twenty c $chr $twenty
fi
done
;;
*)
echo bad controller for tape in: $1
;;
esac
umask 77
;;
rk*)
# The 2.11BSD rk driver doesn't support partitions. We create
# a single block and charater inode pair for each unit and
# call it rkNh.
umask 2 ; unit=`expr $i : '..\(.*\)'`
case $i in
rk*) name=rk; blk=6; chr=15;;
esac
mknod ${name}${unit}h b ${blk} ${unit}
mknod r${name}${unit}h c ${chr} ${unit}
chgrp operator ${name}${unit}h r${name}${unit}h
chmod 640 ${name}${unit}h r${name}${unit}h
;;
rx*)
umask 2
rm -f rd[0123] rd[0123][abcd]
mknod rd0 b 0 0
mknod rd0a b 0 1
mknod rd0b b 0 2
mknod rd0c b 0 2
mknod rd0d b 0 2
mknod rd1 b 1 0
mknod rd1a b 1 1
mknod rd1b b 1 2
mknod rd1c b 1 2
mknod rd1d b 1 2
mknod rd2 b 2 0
mknod rd2a b 2 1
mknod rd2b b 2 2
mknod rd2c b 2 2
mknod rd2d b 2 2
mknod rd3 b 3 0
mknod rd3a b 3 1
mknod rd3b b 3 2
mknod rd3c b 3 2
mknod rd3d b 3 2
chgrp operator rd[0123]
chgrp operator rd[0123][abcd]
chmod 640 rd[0123][abcd]
chmod 640 rd[0123]
name=rx; blk=8; chr=17
mknod ${name}0a b ${blk} 0
mknod ${name}1a b ${blk} 1
mknod ${name}0b b ${blk} 2
mknod ${name}1b b ${blk} 3
mknod r${name}0a c ${chr} 0
mknod r${name}1a c ${chr} 1
mknod r${name}0b c ${chr} 2
mknod r${name}1b c ${chr} 3
chgrp operator ${name}[01][ab] r${name}[01][ab]
chmod 640 ${name}[01][ab] r${name}[01][ab]
;;
gpio)
umask 0
rm -f port[abcdefg] conf[abcdef]
mknod porta c 5 0
mknod portb c 5 1
mknod portc c 5 2
mknod portd c 5 3
mknod porte c 5 4
mknod portf c 5 5
mknod portg c 5 6
mknod confa c 5 64
mknod confb c 5 65
mknod confc c 5 66
mknod confd c 5 67
mknod confe c 5 68
mknod conff c 5 69
mknod confg c 5 70
ram*)
# Note, this must come *before* the "ra*". The entry "rram" is for
# auto fscks when ram is mentioned in /etc/fstab.
umask 2
mknod ram b 3 0
ln ram rram
chgrp operator ram
chmod 640 ram
umask 77
;;
adc)
umask 0
rm -f adc[0123456789] adc1[012345]
mknod adc0 c 6 0
mknod adc1 c 6 1
mknod adc2 c 6 2
mknod adc3 c 6 3
mknod adc4 c 6 4
mknod adc5 c 6 5
mknod adc6 c 6 6
mknod adc7 c 6 7
mknod adc8 c 6 8
mknod adc9 c 6 9
mknod adc10 c 6 10
mknod adc11 c 6 11
mknod adc12 c 6 12
mknod adc13 c 6 13
mknod adc14 c 6 14
mknod adc15 c 6 15
br*|hk*|ra*|si*|xp*|rl*)
umask 2 ; unit=`expr $i : '..\(.*\)'`
case $i in
br*) name=rp; blk=11; chr=20;;
hk*) name=hk; blk=4; chr=13;;
ra*) name=ra; blk=5; chr=14;;
si*) name=si; blk=9; chr=18;;
xp*) name=xp; blk=10; chr=19;;
rl*) name=rl; blk=7; chr=16;;
esac
case $unit in
0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|\
17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)
mknod ${name}${unit}a b $blk `expr $unit '*' 8 + 0`
mknod ${name}${unit}b b $blk `expr $unit '*' 8 + 1`
mknod ${name}${unit}c b $blk `expr $unit '*' 8 + 2`
mknod ${name}${unit}d b $blk `expr $unit '*' 8 + 3`
mknod ${name}${unit}e b $blk `expr $unit '*' 8 + 4`
mknod ${name}${unit}f b $blk `expr $unit '*' 8 + 5`
mknod ${name}${unit}g b $blk `expr $unit '*' 8 + 6`
mknod ${name}${unit}h b $blk `expr $unit '*' 8 + 7`
mknod r${name}${unit}a c $chr `expr $unit '*' 8 + 0`
mknod r${name}${unit}b c $chr `expr $unit '*' 8 + 1`
mknod r${name}${unit}c c $chr `expr $unit '*' 8 + 2`
mknod r${name}${unit}d c $chr `expr $unit '*' 8 + 3`
mknod r${name}${unit}e c $chr `expr $unit '*' 8 + 4`
mknod r${name}${unit}f c $chr `expr $unit '*' 8 + 5`
mknod r${name}${unit}h c $chr `expr $unit '*' 8 + 7`
mknod r${name}${unit}g c $chr `expr $unit '*' 8 + 6`
chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
;;
*)
echo bad unit for disk in: $i
;;
esac
umask 77
;;
spi)
umask 0
rm -f spi[1234]
mknod spi1 c 7 0
mknod spi2 c 7 1
mknod spi3 c 7 2
mknod spi4 c 7 3
dz*)
unit=`expr $i : 'dz\(.*\)'`
case $unit in
0|1|2|3|4|5|6|7)
eval `echo $unit | awk ' { u = $1 } END {
for (i = 0; i < 8; i++)
printf("mknod tty%02d c 2 %d; ",u*8+i,u*8+i); }'`
;;
*)
echo bad unit for dz in: $i
;;
esac
;;
glcd)
umask 0
rm -f glcd0
mknod glcd0 c 8 0
#
# we may want dmz and dmf someday...
# dhu*|dh*|dmf*|dmz*)
dhv*|dhu*|dh*)
case $i in
# dmz*) name=dmz; major=37; count=24;
# unit=`expr $i : "$name\(.*\)"`
# case $unit in
# 0) ch=a ;; 1) ch=b ;; 2) ch=c ;; 3) ch=e ;;
# 4) ch=f ;; 5) ch=g ;;
# *) echo bad unit for $name in: $i ;;
# esac;;
# dmf*) name=dmf; major=22; count=8;
# unit=`expr $i : "$name\(.*\)"`
# case $unit in
# 0) ch=A ;; 1) ch=B ;; 2) ch=C ;; 3) ch=E ;;
# 4) ch=F ;; 5) ch=G ;; 6) ch=H ;; 7) ch=I ;;
# *) echo bad unit for $name in: $i ;;
# esac;;
dhv*) name=dhv; major=24; count=8;
unit=`expr $i : "$name\(.*\)"`;
case $unit in
0) ch=S ;; 1) ch=T ;; 2) ch=U ;; 3) ch=V ;;
4) ch=W ;; 5) ch=X ;; 6) ch=Y ;; 7) ch=Z ;;
*) echo bad unit for $name in: $i ;;
esac;;
dhu*) name=dhu; major=4; count=16;
unit=`expr $i : "$name\(.*\)"`;
case $unit in
0) ch=S ;; 1) ch=T ;; 2) ch=U ;; 3) ch=V ;;
4) ch=W ;; 5) ch=X ;; 6) ch=Y ;; 7) ch=Z ;;
*) echo bad unit for $name in: $i ;;
esac;;
dh*) name=dh; major=3; count=16;
unit=`expr $i : "$name\(.*\)"`
case $unit in
0) ch=h ;; 1) ch=i ;; 2) ch=j ;; 3) ch=k ;;
*) echo bad unit for $name in: $i ;;
esac;;
esac
eval `echo $ch $unit $major $count |
awk ' { ch = $1; u = $4 * $2; m = $3; cnt = $4 } END {
for (i = 0; i < cnt; i++)
if (i < 10)
printf("mknod tty%s%x c %d %d; ",ch,i,m,u+i);
else
printf("mknod tty%s%c c %d %d; ",ch,87+i,m,u+i); }'`
;;
oc)
# extra DL-11 units not including the console. unit numbers start at 1 because
# the console is always unit 0. Seven units (1 - 7) are defined for the 11/93
# and 11/94. Device name is "ttyl?". The DH range was restricted from 'h'-'o'
# to 'h' - 'k' (very unlikely that more than 64 channels of DH-11 will or could
# be put on an 11.
dl*)
name=dl; major=0; ch=l
unit=`expr $i : "$name\(.*\)"`
case $unit in
1|2|3|4|5|6|7)
mknod tty${ch}${unit} c $major $unit;
;;
*)
echo bad unit for $name in: $i
;;
esac
;;
# we may want va and vp someday...
# lp*|va*|vp*)
lp*|dn*)
case $i in
lp*) name=lp; major=5;;
dn*) name=dn; major=21;;
# va*) name=va; major=10;;
# vp*) name=vp; major=6;;
esac
unit=`expr $i : "$name\(.*\)"`
case $unit in
0|1|2|3|4|5|6|7)
mknod $i c $major $unit;
chmod 666 $i
;;
*)
echo bad unit for $name in: $i
;;
esac
;;
pty*)
class=`expr $i : 'pty\(.*\)'`
case $class in
0) offset=0 name=p;;
1) offset=16 name=q;;
2) offset=32 name=r;;
3) offset=48 name=s;;
4) offset=64 name=t;;
5) offset=80 name=u;;
*) echo bad unit for pty in: $i;;
esac
case $class in
0|1|2|3|4|5)
umask 0
rm -f oc[12345]
mknod oc1 c 9 0
mknod oc2 c 9 1
mknod oc3 c 9 2
mknod oc4 c 9 3
mknod oc5 c 9 4
eval `echo $offset $name | awk ' { b=$1; n=$2 } END {
for (i = 0; i < 16; i++)
printf("mknod tty%s%x c 11 %d; \
mknod pty%s%x c 10 %d; ", \
n, i, b+i, n, i, b+i); }'`
umask 77
;;
esac
;;
dr*)
unit=`expr $i : '..\(.*\)'`
case $i in
dr*) name=dr; chr=12;;
esac
case $unit in
0|1|2|3|4|5|6|7)
umask 0
mknod ${name}${unit} c ${chr} ${unit}
umask 77
;;
*)
echo bad unit for ${name} in: $i
;;
esac
;;
ingreslock)
mknod ingreslock c 25 0
chown ingres ingreslock
chmod 200 ingreslock
;;
local)

View File

@@ -11,6 +11,7 @@ DESTDIR = /foobar
OWN = root
GRP = wheel
SUBDIR = root
FILES = crontab fstab gettytab group motd passwd \
rc rc.local shells syslog.conf ttys
@@ -18,6 +19,8 @@ all install depend lint tags:
clean:
rm -f *~
-for i in ${SUBDIR}; do \
(cd $$i; make DESTDIR=${DESTDIR} $@); done
distribution:
-@mkdir -p ${DESTDIR}/dev
@@ -72,3 +75,5 @@ distribution:
${DESTDIR}/usr/adm/savacct
install -c -o uucp -g daemon -m 600 /dev/null \
${DESTDIR}/usr/adm/aculog
-for i in ${SUBDIR}; do \
(cd $$i; make DESTDIR=${DESTDIR} distribution); done

View File

@@ -1,2 +1,2 @@
/dev/sd0a / ufs rw,async 1 1
#/dev/sd0c /u ufs rw,async 1 2
/dev/sd0 / ufs rw,async 1 1
#/dev/sd1 /u ufs rw,async 1 2

View File

@@ -16,7 +16,7 @@
# entries, and in cases where getty is called with no table name
#
default:\
:ap:im=\r\n\r\nRetroBSD (%h) (%t)\r\n\r\r\n\r:sp#1200:
:ap:im=\r\n\r\n2.11 BSD UNIX (%h) (%t)\r\n\r\r\n\r:sp#1200:
#
# Fixed speed entries
@@ -80,8 +80,6 @@ v|std.3500000|3500000-baud:\
:sp#3500000:
w|std.4000000|4000000-baud:\
:sp#4000000:
x|std.default|default-baud:\
:sp#0:
#

View File

@@ -1,7 +1,8 @@
root:5:0:1:The Man:/root:/bin/sh
daemon:*:1:1:The devil himself:/root:/bin/sh
root:5:0:1:The Man:/:/bin/sh
daemon:*:1:1:The devil himself:/:/bin/sh
sys:*:4:2:Operating System:/tmp:nologin
operator:*:2:5:System &:/u/operator:/bin/sh
bin:*:3:20:Binaries Commands and Source:/root:/bin/sh
operator:*:2:5:System &:/usr/guest/operator:/bin/csh
bin:*:3:20:Binaries Commands and Source:/:/bin/csh
nobody:*:32767:31:Nobody:/nonexistent:/bin/sh
uucp:*:66:1:UNIX-to-UNIX Copy:/spool/uucppublic:/sbin/uucico
uucp:*:66:1:UNIX-to-UNIX Copy:/usr/spool/uucppublic:/usr/sbin/uucico
ingres:*:39:74:INGRES Owner:/usr/ingres:/bin/csh

1
etc/rc
View File

@@ -64,7 +64,6 @@ rm -f /etc/nologin
echo -n "Starting daemons:"
update && echo -n "update"
cron && echo -n "cron"
echo
#/etc/rc.local

18
etc/root/Makefile Normal file
View File

@@ -0,0 +1,18 @@
#
# DESTDIR is defined here to be something which does *NOT* exist - it must be
# specified on the command line when doing a "make DESTDIR=/mnt distribution".
# This is aimed at avoiding overwriting the system disk's /etc files.
DESTDIR = /foobar
OWN = root
GRP = wheel
all install depend lint tags:
distribution:
install -c -o ${OWN} -g ${GRP} -m 644 dot.cshrc ${DESTDIR}/.cshrc
install -c -o ${OWN} -g ${GRP} -m 644 dot.login ${DESTDIR}/.login
install -c -o ${OWN} -g ${GRP} -m 644 dot.profile ${DESTDIR}/.profile
clean:
rm -f *~

14
etc/root/dot.cshrc Normal file
View File

@@ -0,0 +1,14 @@
set history=30
set path=(/bin /sbin /etc /usr/sbin /usr/ucb /usr/bin /usr/new /usr/local)
if ($?prompt) then
set prompt="\!% "
endif
set filec
set mail=( 0 /usr/spool/mail/$USER )
set cdpath=( ~ /usr/spool/mqueue)
set prompt="\!% root--> "
alias mail /usr/ucb/Mail
alias pwd 'echo $cwd'
alias h history
alias q5 'tail -5 /usr/spool/mqueue/syslog'

14
etc/root/dot.login Normal file
View File

@@ -0,0 +1,14 @@
unset noglob
set path=(/bin /etc /sbin /usr/sbin /usr/ucb /usr/bin /usr/local /usr/new)
umask 26
stty dec erase ^H kill ^U eof ^D
set prompt="[\!] root--> "
if ( "$TERM" == dialup || "$TERM" == network) then
setenv TERM vt100
echo -n "Terminal ($TERM)? "
set argv = "$<"
if ( "$argv" != '' ) setenv TERM "$argv"
endif
biff y

8
etc/root/dot.profile Normal file
View File

@@ -0,0 +1,8 @@
echo 'erase, kill ^U, intr ^C'
stty dec
stty erase
PATH=/bin:/sbin:/usr/sbin:/etc:/usr/ucb:/usr/bin:/usr/new
export PATH
HOME=/
export HOME
export TERM

View File

@@ -1,7 +1,8 @@
root:ro46DZg1ViGBs:0:1:The Man:/root:/bin/sh
daemon:*:1:1:The devil himself:/root:/bin/sh
root:ro46DZg1ViGBs:0:1:The Man:/:/bin/sh
daemon:*:1:1:The devil himself:/:/bin/sh
sys:*:4:2:Operating System:/tmp:nologin
operator:*:2:5:System &:/u/operator:/bin/sh
bin:*:3:20:Binaries Commands and Source:/root:/bin/sh
operator:*:2:5:System &:/usr/guest/operator:/bin/csh
bin:*:3:20:Binaries Commands and Source:/:/bin/csh
nobody:*:32767:31:Nobody:/nonexistent:/bin/sh
uucp:*:66:1:UNIX-to-UNIX Copy:/spool/uucppublic:/sbin/uucico
uucp:*:66:1:UNIX-to-UNIX Copy:/usr/spool/uucppublic:/usr/sbin/uucico
ingres:*:39:74:INGRES Owner:/usr/ingres:/bin/csh

View File

@@ -1,16 +1,4 @@
#
# name getty type status comments
#
console "/libexec/getty std.default" xterm on secure #special
# Enable some of these for additional logins. Do NOT enable the same one as the
# console port, or strange things will happen. You can turn off the console port
# if you would rather use the getty on the real tty - it's up to you.
tty0 "/libexec/getty std.default" xterm off secure
tty1 "/libexec/getty std.default" xterm off secure
tty2 "/libexec/getty std.default" xterm off secure
tty3 "/libexec/getty std.default" xterm off secure
tty4 "/libexec/getty std.default" xterm off secure
tty5 "/libexec/getty std.default" xterm off secure
ttyUSB0 "/libexec/getty std.default" xterm off secure
console "/libexec/getty std.115200" vt100 on secure #special

1
games/.gitignore vendored
View File

@@ -1 +0,0 @@
*

Binary file not shown.

1
include/.gitignore vendored
View File

@@ -1 +0,0 @@
readline

View File

@@ -33,14 +33,34 @@
#ifndef _AOUT_H_
#define _AOUT_H_
#include <sys/exec_aout.h>
#include <sys/exec.h>
/* Valid magic number check. */
#define N_BADMAG(x) (((x).a_magic) != RMAGIC && \
((x).a_magic) != OMAGIC && \
((x).a_magic) != NMAGIC)
/* Text segment offset. */
#define N_TXTOFF(x) sizeof(struct exec)
/* Data segment offset. */
#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
/* Text relocation table offset. */
#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
/* Data relocation table offset. */
#define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_reltext)
/* Symbol table offset. */
#define N_SYMOFF(x) ((x).a_magic == RMAGIC ? \
N_DRELOFF(x) + (x).a_reldata : \
N_DATOFF(x) + (x).a_data)
#define _AOUT_INCLUDE_
#include <nlist.h>
/* Relocations */
struct reloc {
unsigned flags;
#define RSMASK 0x70 /* bitmask for segments */
#define RABS 0
#define RTEXT 0x20
@@ -49,20 +69,12 @@ struct reloc {
#define RSTRNG 0x60 /* for assembler */
#define REXT 0x70 /* externals and bitmask */
#define RGPREL 0x08 /* gp relative */
#define RFMASK 0x07 /* bitmask for format */
#define RBYTE16 0x00 /* low part of byte address: bits 15:0 */
#define RBYTE32 0x01 /* 32-bit byte address */
#define RHIGH16 0x02 /* upper part of byte address: bits 31:16 */
#define RHIGH16S 0x03 /* upper part of address with signed offset */
#define RWORD16 0x04 /* word address: bits 17:2 */
#define RWORD26 0x05 /* word address: bits 27:2 */
#define RWORD16 0x03 /* word address: bits 17:2 */
#define RWORD26 0x04 /* word address: bits 27:2 */
unsigned index; /* 24-bit index in symbol table,
* for REXT */
unsigned offset; /* 16-bit offset,
* for RIGH16 and RIGH16S */
};
#define RINDEX(h) ((h) >> 8)
#define RSETINDEX(h) ((h) << 8)
#endif /* !_AOUT_H_ */

View File

@@ -1,15 +0,0 @@
/* alloca.h - Allocate memory on stack */
#ifndef ALLOCA_H
#define ALLOCA_H
#undef alloca
#ifdef __GNUC__
#define alloca(size) __builtin_alloca(size)
#else
#include <sys/types.h>
void *alloca(size_t);
#endif
#endif

View File

@@ -1,3 +1,5 @@
/* assert.h 4.2 85/01/21 */
# ifndef NDEBUG
# define _assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);exit(1);}}
# define assert(ex) _assert(ex)

View File

@@ -1,3 +1,5 @@
/* ctype.h 4.2 85/09/04 */
#define _U 01
#define _L 02
#define _N 04

View File

@@ -9,7 +9,8 @@
#include <sgtty.h>
#include <term.h>
#define bool int
#define bool char
#define reg register
#define TRUE (1)
#define FALSE (0)
@@ -32,6 +33,7 @@ typedef struct sgttyb SGTTY;
/*
* Capabilities from termcap
*/
extern bool AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
XB, XN, XT, XS, XX;
extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
@@ -129,6 +131,7 @@ int __void__;
/*
* psuedo functions
*/
#define clearok(win,bf) (win->_clear = bf)
#define leaveok(win,bf) (win->_leave = bf)
#define scrollok(win,bf) (win->_scroll = bf)
@@ -146,7 +149,7 @@ int __void__;
#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty))
#define nl() (_tty.sg_flags |= CRMOD, _pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty))
#define nonl() (_tty.sg_flags &= ~CRMOD,_pfast = TRUE, ioctl(_tty_ch, TIOCSETP,&_tty))
#define savetty() ((void) ioctl(_tty_ch, TIOCGETP, &_tty), _res_flg = _tty.sg_flags)
#define savetty() ((void) gtty(_tty_ch, &_tty), _res_flg = _tty.sg_flags)
#define resetty() (_tty.sg_flags = _res_flg, (void) ioctl(_tty_ch, TIOCSETP, &_tty))
#define erasechar() (_tty.sg_erase)
@@ -164,24 +167,11 @@ int wgetch (WINDOW *);
char *wstandout (WINDOW *);
char *wstandend (WINDOW *);
int touchwin (WINDOW *);
int touchline (WINDOW *, int, int, int);
void box (WINDOW *, char, char);
int touchline (WINDOW *, int, int);
int box (WINDOW *, char, char);
void endwin (void);
int printw (char *, ...);
int wprintw (WINDOW *, char *, ...);
int scroll (WINDOW *);
void wclrtoeol (WINDOW *);
void werase (WINDOW *);
int setterm (char *);
int delwin (WINDOW *);
int waddstr (WINDOW *, char *);
int wgetstr (WINDOW *, char *);
int wdeleteln (WINDOW *);
void mvcur(int ly, int lx, int y, int x);
void overwrite(WINDOW *win1, WINDOW *win2);
void wclrtobot(WINDOW *win);
int mvprintw(int y, int x, char *fmt, ...);
int mvwprintw(WINDOW *win, int y, int x, char *fmt, ...);
int printw (char *fmt, ...);
int wprintw (WINDOW *win, char *fmt, ...);
/*
* Used to be in unctrl.h.

28
include/dbm.h Normal file
View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)dbm.h 5.1 (Berkeley) 3/27/86
*/
#ifndef NULL
/*
* this is lunacy, we no longer use it (and never should have
* unconditionally defined it), but, this whole file is for
* backwards compatability - someone may rely on this.
*/
#define NULL ((char *) 0)
#endif
#include <ndbm.h>
datum fetch();
datum firstkey();
datum nextkey();
#if 0
datum makdatum();
datum firsthash();
long calchash();
long hashinc();
#endif

View File

@@ -47,6 +47,9 @@
* if type is "rq", then use concatenation of fs_file and "quotas" to locate
* quota file.
*/
#define _PATH_FSTAB "/etc/fstab"
#define FSTAB "/etc/fstab" /* deprecated */
#define FSTAB_RW "rw" /* read/write device */
#define FSTAB_RQ "rq" /* read/write with quotas */
#define FSTAB_RO "ro" /* read-only device */

View File

@@ -7,9 +7,4 @@ struct group { /* see getgrent(3) */
char **gr_mem;
};
struct group *getgrent(void);
struct group *getgrnam(const char *name);
struct group *getgrgid(gid_t gid);
void setgrent(void);
void endgrent(void);
int setgroups(size_t size, const gid_t *list);
struct group *getgrent(), *getgrgid(), *getgrnam();

View File

@@ -1,6 +0,0 @@
#ifndef _KMEM_H
#define _KMEM_H
extern dev_t kmemdev();
#endif

View File

@@ -36,6 +36,36 @@
#ifndef _LIMITS_H_
#define _LIMITS_H_
/*
* We don't need this crud at the moment so save on abuse of the C
* preprocessor by not doing the defines.
#define _POSIX_ARG_MAX 4096
#define _POSIX_CHILD_MAX 6
#define _POSIX_LINK_MAX 8
#define _POSIX_MAX_CANON 255
#define _POSIX_MAX_INPUT 255
#define _POSIX_NAME_MAX 14
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX 16
#define _POSIX_PATH_MAX 255
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX 32767
#define _POSIX_STREAM_MAX 8
#define _POSIX_TZNAME_MAX 3
#define _POSIX2_BC_BASE_MAX 99
#define _POSIX2_BC_DIM_MAX 2048
#define _POSIX2_BC_SCALE_MAX 99
#define _POSIX2_BC_STRING_MAX 1000
#define _POSIX2_EQUIV_CLASS_MAX 2
#define _POSIX2_EXPR_NEST_MAX 32
#define _POSIX2_LINE_MAX 2048
#define _POSIX2_RE_DUP_MAX 255
*/
#include <machine/limits.h>
/* #include <sys/syslimits.h> */
#endif /* !_LIMITS_H_ */

View File

@@ -4,16 +4,16 @@
* specifies the terms and conditions for redistribution.
*/
double fabs(double), floor(double), ceil(double);
double sqrt(double), hypot(double, double);
double sin(double), cos(double), tan(double);
double asin(double), acos(double), atan(double), atan2(double, double);
double exp(double), log(double), log10(double), pow(double, double);
double sinh(double), cosh(double), tanh(double);
double j0(double), j1(double), jn(int, double);
double y0(double), y1(double), yn(int, double);
extern double fabs(), floor(), ceil(), fmod(), ldexp();
extern double sqrt(), hypot(), atof();
extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2();
extern double exp(), log(), log10(), pow();
extern double sinh(), cosh(), tanh();
extern double gamma();
extern double j0(), j1(), jn(), y0(), y1(), yn();
#define HUGE_VAL 3.40282347e+38 /* TBD??? use infinity? */
#define HUGE 1.701411733192644270e38
#define LOGHUGE 39
int isnanf(float x);
int isnan(double x);
@@ -31,21 +31,3 @@ float ldexpf(float x, int exp);
double ldexp(double x, int exp);
double fmod(double x, double y);
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
#define M_E 2.7182818284590452354 /* e */
#define M_LOG2E 1.4426950408889634074 /* log 2e */
#define M_LOG10E 0.43429448190325182765 /* log 10e */
#define M_LN2 0.69314718055994530942 /* log e2 */
#define M_LN10 2.30258509299404568402 /* log e10 */
#define M_PI 3.14159265358979323846 /* pi */
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#define M_PI_4 0.78539816339744830962 /* pi/4 */
#define M_1_PI 0.31830988618379067154 /* 1/pi */
#define M_2_PI 0.63661977236758134308 /* 2/pi */
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */

View File

@@ -10,7 +10,11 @@
* Hashed key data base library.
*/
#define PBLKSIZ 1024
#define DBLKSIZ 1024
#ifdef pdp11
#define DBLKSIZ 512
#else
#define DBLKSIZ 4096
#endif
typedef struct {
int dbm_dirf; /* open directory file */

View File

@@ -35,11 +35,12 @@
#include <sys/types.h>
/*
* Symbol table entry format.
* Symbol table entry format. The #ifdef's are so that programs including
* nlist.h can initialize nlist structures statically.
*/
struct nlist {
char *n_name; /* In memory address of symbol name,
* or string table offset (file) */
or string table offset (file) */
u_short n_len; /* Length of name in bytes */
u_short n_type; /* Type of symbol - see below */
u_int n_value; /* Symbol value */
@@ -55,12 +56,13 @@ struct nlist {
#define N_BSS 0x04 /* bss segment */
#define N_STRNG 0x05 /* string segment (for assembler) */
#define N_COMM 0x06 /* .comm segment (for assembler) */
#define N_REG 0x14 /* register symbol */
#define N_FN 0x1f /* file name */
#define N_TYPE 0x1f /* mask for all the type bits */
#define N_EXT 0x20 /* external (global) bit, OR'ed in */
#define N_WEAK 0x40 /* weak reference bit, OR'ed in */
#define N_LOC 0x80 /* local, for assembler */
#define N_TYPE 0x1f /* mask for all the type bits */
#define N_FORMAT "%06o" /* namelist value format; XXX */
/*
* Get symbols from a file.

View File

@@ -24,25 +24,18 @@
#define _PATH_CORE "/core"
#define _PATH_DEV "/dev/"
#define _PATH_CONSOLE "/dev/console"
#define _PATH_LOG "/dev/log"
#define _PATH_DEVNULL "/dev/null"
#define _PATH_TTY "/dev/tty"
#define _PATH_MEM "/dev/mem"
#define _PATH_SWAP "/dev/swap"
#define _PATH_FSTAB "/etc/fstab"
#define _PATH_LOCALTIME "/etc/localtime"
#define _PATH_MOTD "/etc/motd"
#define _PATH_NOLOGIN "/etc/nologin"
#define _PATH_PASSWD "/etc/passwd"
#define _PATH_PTMP "/etc/ptmp"
#define _PATH_SHADOW "/etc/shadow"
#define _PATH_TERMCAP "/etc/termcap"
#define _PATH_USRLIB "/lib/"
#define _PATH_CTIMED "/libexec/ctimed"
#define _PATH_LOCALLIB "/local/lib/"
#define _PATH_SBIN "/sbin/"
#define _PATH_USRSBIN "/sbin/"
#define _PATH_MKPASSWD "/sbin/mkpasswd"
#define _PATH_SENDMAIL "/sbin/sendmail"
#define _PATH_SHARE "/share/"
#define _PATH_ZONEINFO "/share/zoneinfo" /* Time zone object file directory */

229
include/pcc.h Normal file
View File

@@ -0,0 +1,229 @@
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)pcc.h 5.1 (Berkeley) 5/30/85
*/
/*
* This file contains definitions for all the constants and structures
* needed to use the intermediate code files generated and read by
* the Portable C Compiler and related compilers.
*
* Rules for changing this code:
* 1) All op values must be integer constants -- this permits us to run
* a 'sed' script on this file to create %term declarations for yacc.
* 2) Because the PCC uses fancy ASG and UNARY macros, assignment
* operators must have values 1 greater than corresponding normal
* operators, and unary operators must have values 2 greater ditto.
* 3) Ops used only by f1 must have values >= 150 (PCCF_FORTOPS).
* 4) Other language-dependent ops must have values >= 200.
*/
# ifndef PCC_TOKENS
# define PCC_TOKENS 0
# define PCC_ERROR 1 /* an error node */
# define PCC_FREE 2 /* an unused node */
/*
* Constants.
*/
# define PCC_STRING 3 /* a string constant */
# define PCC_ICON 4 /* an integer constant */
# define PCC_FCON 5 /* a floating point constant */
# define PCC_DCON 6 /* a double precision f.p. constant */
/*
* Leaf types.
*/
# define PCC_NAME 7 /* an identifier */
# define PCC_REG 8 /* a register */
# define PCC_OREG 9 /* register and offset */
# define PCC_CCODES 10 /* condition codes */
# define PCC_FLD 11 /* a bit field */
/*
* Arithmetic operators.
*/
# define PCC_PLUS 12 /* + */
# define PCC_PLUSEQ 13 /* += */
# define PCC_UPLUS 14 /* unary + (for completeness) */
# define PCC_MINUS 15 /* - */
# define PCC_MINUSEQ 16 /* -= */
# define PCC_UMINUS 17 /* unary - */
# define PCC_MUL 18 /* * */
# define PCC_MULEQ 19 /* *= */
/* Reserve a slot for 'unary *', which is PCC jargon for PCC_DEREF (yech) */
# define PCC_DIV 21 /* / */
# define PCC_DIVEQ 22 /* /= */
# define PCC_MOD 23 /* % */
# define PCC_MODEQ 24 /* %= */
# define PCC_INCR 25 /* ++ */
# define PCC_DECR 26 /* -- */
# define PCC_ASSIGN 27 /* = (these last 3 are stretching it) */
/*
* Bit operators.
*/
# define PCC_AND 28 /* & */
# define PCC_ANDEQ 29 /* &= */
/* Reserve a slot for 'unary &', jargon for PCC_ADDROF */
# define PCC_OR 31 /* | */
# define PCC_OREQ 32 /* |= */
# define PCC_ER 33 /* ^ */
# define PCC_EREQ 34 /* ^= */
# define PCC_LS 35 /* << */
# define PCC_LSEQ 36 /* <<= */
# define PCC_RS 37 /* >> */
# define PCC_RSEQ 38 /* >>= */
# define PCC_COMPL 39 /* ~ */
/*
* Booleans.
*/
# define PCC_EQ 40 /* == */
# define PCC_NE 41 /* != */
# define PCC_LE 42 /* <= */
# define PCC_LT 43 /* < */
# define PCC_GE 44 /* >= */
# define PCC_GT 45 /* > */
# define PCC_ULE 46 /* unsigned <= */
# define PCC_ULT 47 /* unsigned < */
# define PCC_UGE 48 /* unsigned >= */
# define PCC_UGT 49 /* unsigned > */
# define PCC_QUEST 50 /* ? (for conditional expressions) */
# define PCC_COLON 51 /* : (for conditional expressions) */
# define PCC_ANDAND 52 /* && */
# define PCC_OROR 53 /* || */
# define PCC_NOT 54 /* ! */
/*
* Function calls.
*/
# define PCC_CALL 55 /* call by value */
/* no ASG */
# define PCC_UCALL 57 /* call with no arguments */
# define PCC_FORTCALL 58 /* call by reference? */
/* no ASG */
# define PCC_UFORTCALL 60 /* ??? */
# ifdef INLINE
# define PCC_INLINE 61 /* inline function */
/* no ASG */
# define PCC_UINLINE 63 /* inline with no arguments */
# endif INLINE
/*
* Referencing and dereferencing.
*/
# define PCC_DEREF 20 /* * */
# define PCC_ADDROF 30 /* & */
/*
* Special structure operators.
*/
# define PCC_DOT 64 /* . */
# define PCC_STREF 65 /* -> */
# define PCC_STASG 66 /* structure assignment */
# define PCC_STARG 67 /* an argument of type structure */
# define PCC_STCALL 68 /* a function of type structure */
/* no ASG */
# define PCC_USTCALL 70 /* unary structure function */
/*
* Conversions.
*/
# define PCC_SCONV 71 /* scalar conversion */
# define PCC_PCONV 72 /* pointer conversion */
# define PCC_PMCONV 73 /* pointer multiply conversion */
# define PCC_PVCONV 74 /* pointer divide conversion */
# define PCC_CAST 75 /* redundant? */
/*
* Bracket types.
*/
# define PCC_LB 76 /* [ */
# define PCC_RB 77 /* ] */
/*
* Comma nodes.
*/
# define PCC_COMOP 78 /* , (in expressions) */
# define PCC_CM 79 /* , (in argument lists) */
/*
* Miscellaneous.
*/
# define PCC_FORCE 80 /* result of last expression goes in r0 */
# define PCC_GOTO 81 /* unconditional goto */
# define PCC_CBRANCH 82 /* goto label if !test */
# define PCC_RETURN 83 /* return from function */
# define PCC_INIT 84 /* initialized data */
# define PCC_TYPE 85 /* a type */
# define PCC_CLASS 86 /* a storage class */
# define PCC_MAXOP 86 /* highest numbered PCC op */
/*
* Special codes for interfacing to /lib/f1.
*/
# define PCCF_FORTOPS 150
# define PCCF_FTEXT 150 /* pass literal assembler text */
# define PCCF_FEXPR 151 /* a statement */
# define PCCF_FSWITCH 152 /* not implemented */
# define PCCF_FLBRAC 153 /* beginning of subroutine */
# define PCCF_FRBRAC 154 /* end of subroutine */
# define PCCF_FEOF 155 /* end of file */
# define PCCF_FARIF 156 /* not implemented */
# define PCCF_FLABEL 157 /* an f77 label */
# endif PCC_TOKENS
/*
* Types, as encoded in intermediate file cookies.
*/
# define PCCT_UNDEF 0
# define PCCT_FARG 1 /* function argument */
# define PCCT_CHAR 2
# define PCCT_SHORT 3
# define PCCT_INT 4
# define PCCT_LONG 5
# define PCCT_FLOAT 6
# define PCCT_DOUBLE 7
# define PCCT_STRTY 8
# define PCCT_UNIONTY 9
# define PCCT_ENUMTY 10
# define PCCT_MOETY 11 /* member of enum */
# define PCCT_UCHAR 12
# define PCCT_USHORT 13
# define PCCT_UNSIGNED 14
# define PCCT_ULONG 15
/*
* Type modifiers.
*/
# define PCCTM_PTR 020
# define PCCTM_FTN 040
# define PCCTM_ARY 060
# define PCCTM_BASETYPE 017
# define PCCTM_TYPESHIFT 2
/*
* Useful macros. 'PCCOM' macros apply to ops.
*/
# define PCCOM_ASG 1+
# define PCCOM_UNARY 2+
# define PCCOM_NOASG (-1)+
# define PCCOM_NOUNARY (-2)+
# define PCCM_TRIPLE(op, var, type) \
((op) | ((var) << 8) | (long) (type) << 16)
# define PCCM_TEXT(s) \
PCCM_TRIPLE(PCCF_FTEXT, (strlen(s) + 3) / 4, 0)
# define PCCM_ADDTYPE(t, m) \
((((t) &~ PCCTM_BASETYPE) << PCCTM_TYPESHIFT) | \
(m) | ((t) & PCCTM_BASETYPE))

View File

@@ -34,7 +34,7 @@ struct psout {
time_t o_cstime; /* u_cstime */
short o_pgrp; /* p_pgrp */
int o_sigs; /* sum of SIGINT & SIGQUIT,
* if == 2 proc is ignoring both.*/
if == 2 proc is ignoring both.*/
char o_comm[MAXCOMLEN+1]; /* u_comm */
char o_args[64]; /* best guess at args to process */
};

View File

@@ -15,6 +15,11 @@
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#define _PATH_PASSWD "/etc/passwd"
#define _PATH_SHADOW "/etc/shadow"
#define _PATH_MKPASSWD "/sbin/mkpasswd"
#define _PATH_PTMP "/etc/ptmp"
#define _PW_KEYBYNAME '0'
#define _PW_KEYBYUID '1'

View File

@@ -39,7 +39,7 @@
struct ranlib {
int ran_len; /* 1 byte - name length in bytes */
unsigned ran_off; /* 4 bytes - file offset */
off_t ran_off; /* 4 bytes - file offset */
char *ran_name; /* in memory symbol name */
};

View File

@@ -5,7 +5,6 @@
* not the System V one.
*/
#define NSUBEXP 10
typedef struct regexp {
char *startp[NSUBEXP];
char *endp[NSUBEXP];

View File

@@ -14,29 +14,9 @@
* 9 - $ra - return address
* 10 - $gp - global data pointer
* 11 - $sp - stack pointer
* 12 - signal mask saved
* 13 - signal mask
*/
typedef int jmp_buf [14];
typedef jmp_buf sigjmp_buf;
typedef int jmp_buf [12];
/*
* Save and restore only CPU state.
* Signal mask is not saved.
*/
int _setjmp (jmp_buf env);
void _longjmp (jmp_buf env, int val);
/*
* Save and restore CPU state and signal mask.
*/
int setjmp (jmp_buf env);
void longjmp (jmp_buf env, int val);
/*
* Save and restore CPU state and optionally a signal mask.
* Signal mask is saved only when savesigs is nonzero.
*/
int sigsetjmp (sigjmp_buf env, int savesigs);
void siglongjmp (sigjmp_buf env, int val);
#endif

View File

@@ -1,114 +0,0 @@
/*
* SmallC: interface to curses library.
*/
#define WINDOW int
extern WINDOW *stdscr, *curscr;
extern int LINES, COLS;
/*
* pseudo functions for standard screen
*/
#define addch(ch) waddch(stdscr, ch)
#define getch() wgetch(stdscr)
#define addstr(str) waddstr(stdscr, str)
#define getstr(str) wgetstr(stdscr, str)
#define move(y, x) wmove(stdscr, y, x)
#define clear() wclear(stdscr)
#define erase() werase(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define clrtoeol() wclrtoeol(stdscr)
#define insertln() winsertln(stdscr)
#define deleteln() wdeleteln(stdscr)
#define refresh() wrefresh(stdscr)
#define inch() winch(stdscr)
#define insch(c) winsch(stdscr,c)
#define delch() wdelch(stdscr)
#define standout() wstandout(stdscr)
#define standend() wstandend(stdscr)
/*
* mv functions
*/
#define mvwaddch(win,y,x,ch) wmove(win,y,x) == 0 ? 0 : waddch(win,ch)
#define mvwgetch(win,y,x) wmove(win,y,x) == 0 ? 0 : wgetch(win)
#define mvwaddstr(win,y,x,str) wmove(win,y,x) == 0 ? 0 : waddstr(win,str)
#define mvwgetstr(win,y,x,str) wmove(win,y,x) == 0 ? 0 : wgetstr(win,str)
#define mvwinch(win,y,x) wmove(win,y,x) == 0 ? 0 : winch(win)
#define mvwdelch(win,y,x) wmove(win,y,x) == 0 ? 0 : wdelch(win)
#define mvwinsch(win,y,x,c) wmove(win,y,x) == 0 ? 0 : winsch(win,c)
#define mvaddch(y,x,ch) mvwaddch(stdscr,y,x,ch)
#define mvgetch(y,x) mvwgetch(stdscr,y,x)
#define mvaddstr(y,x,str) mvwaddstr(stdscr,y,x,str)
#define mvgetstr(y,x,str) mvwgetstr(stdscr,y,x,str)
#define mvinch(y,x) mvwinch(stdscr,y,x)
#define mvdelch(y,x) mvwdelch(stdscr,y,x)
#define mvinsch(y,x,c) mvwinsch(stdscr,y,x,c)
#ifdef TODO
#define TRUE (1)
#define FALSE (0)
#define ERR (0)
#define OK (1)
/*
* Capabilities from termcap
*/
extern int AM, BS, CA, DA, DB, EO, HC, HZ, IN, MI, MS, NC, NS, OS, UL,
XB, XN, XT, XS, XX;
extern char *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *CS, *DC, *DL,
*DM, *DO, *ED, *EI, *K0, *K1, *K2, *K3, *K4, *K5, *K6,
*K7, *K8, *K9, *HO, *IC, *IM, *IP, *KD, *KE, *KH, *KL,
*KR, *KS, *KU, *LL, *MA, *ND, *NL, *RC, *SC, *SE, *SF,
*SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US, *VB, *VS,
*VE, *AL_PARM, *DL_PARM, *UP_PARM, *DOWN_PARM,
*LEFT_PARM, *RIGHT_PARM;
extern char PC;
/*
* From the tty modes...
*/
extern int GT, NONL, UPPERCASE, normtty, _pfast;
extern int My_term, _echoit, _rawmode, _endwin;
extern char *Def_term, ttytype[];
extern int _tty_ch, _res_flg;
extern SGTTY _tty;
/*
* pseudo functions
*/
#define clearok(win,bf) (win->_clear = bf)
#define leaveok(win,bf) (win->_leave = bf)
#define scrollok(win,bf) (win->_scroll = bf)
#define flushok(win,bf) (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
#define getyx(win,y,x) y = win->_cury, x = win->_curx
#define winch(win) (win->_y[win->_cury][win->_curx] & 0177)
#define raw() (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
#define noraw() (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),ioctl(_tty_ch,TIOCSETP,&_tty))
#define cbreak() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, ioctl(_tty_ch,TIOCSETP,&_tty))
#define nocbreak() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,ioctl(_tty_ch,TIOCSETP,&_tty))
#define echo() (_tty.sg_flags |= ECHO, _echoit = TRUE, ioctl(_tty_ch, TIOCSETP, &_tty))
#define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch, TIOCSETP, &_tty))
#define nl() (_tty.sg_flags |= CRMOD, _pfast = _rawmode,ioctl(_tty_ch, TIOCSETP, &_tty))
#define nonl() (_tty.sg_flags &= ~CRMOD,_pfast = TRUE, ioctl(_tty_ch, TIOCSETP,&_tty))
#define savetty() ((void) ioctl(_tty_ch, TIOCGETP, &_tty), _res_flg = _tty.sg_flags)
#define resetty() (_tty.sg_flags = _res_flg, (void) ioctl(_tty_ch, TIOCSETP, &_tty))
#define erasechar() (_tty.sg_erase)
#define killchar() (_tty.sg_kill)
#define baudrate() (_tty.sg_ospeed)
/*
* Used to be in unctrl.h.
*/
#define unctrl(c) _unctrl[(c) & 0177]
extern char *_unctrl[];
#endif

View File

@@ -1,38 +0,0 @@
/* open-only flags */
#define O_RDONLY 0x0000 /* open for reading only */
#define O_WRONLY 0x0001 /* open for writing only */
#define O_RDWR 0x0002 /* open for reading and writing */
#define O_ACCMODE 0x0003 /* mask for above modes */
#define O_NONBLOCK 0x0004 /* no delay */
#define O_APPEND 0x0008 /* set append mode */
#define O_SHLOCK 0x0010 /* open with shared file lock */
#define O_EXLOCK 0x0020 /* open with exclusive file lock */
#define O_ASYNC 0x0040 /* signal pgrp when data ready */
#define O_FSYNC 0x0080 /* synchronous writes */
#define O_CREAT 0x0200 /* create if nonexistant */
#define O_TRUNC 0x0400 /* truncate to zero length */
#define O_EXCL 0x0800 /* error if already exists */
/*
* Constants used for fcntl(2)
*/
/* command values */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
/* file descriptor flags (F_GETFD, F_SETFD) */
#define FD_CLOEXEC 1 /* close-on-exec flag */
/* lock operations for flock() */
#define LOCK_SH 1 /* shared file lock */
#define LOCK_EX 2 /* exclusive file lock */
#define LOCK_NB 4 /* don't block when locking */
#define LOCK_UN 8 /* unlock file */

View File

@@ -1,77 +0,0 @@
/*
* Copyright (c) 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#ifndef NSIG
#define NSIG 32
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGIOT 6 /* IOT instruction */
#define SIGABRT SIGIOT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGBUS 10 /* bus error */
#define SIGSEGV 11 /* segmentation violation */
#define SIGSYS 12 /* bad argument to system call */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGURG 16 /* urgent condition on IO channel */
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGCLD SIGCHLD /* compatibility */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#define SIGIO 23 /* input/output possible signal */
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#define SIGWINCH 28 /* window size changes */
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
#define SIG_ERR -1
#define SIG_DFL 0
#define SIG_IGN 1
#define BADSIG SIG_ERR
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
#define SA_RESTART 0x0002 /* restart system on signal return */
#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
/*
* Flags for sigprocmask:
*/
#define SIG_BLOCK 1 /* block specified signal set */
#define SIG_UNBLOCK 2 /* unblock specified signal set */
#define SIG_SETMASK 3 /* set specified signal set */
#define MINSIGSTKSZ 128 /* minimum allowable stack */
#define SIGSTKSZ (MINSIGSTKSZ + 384) /* recommended stack size */
#define SV_ONSTACK SA_ONSTACK /* take signal on signal stack */
#define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */
/*
* Macro for converting signal number to a mask suitable for
* sigblock().
*/
#define sigmask(m) (1L << ((m)-1))
#define sigaddset(set, signo) (*(set) |= 1L << ((signo) - 1), 0)
#define sigdelset(set, signo) (*(set) &= ~(1L << ((signo) - 1)), 0)
#define sigemptyset(set) (*(set) = (sigset_t)0, (int)0)
#define sigfillset(set) (*(set) = ~(sigset_t)0, (int)0)
#define sigismember(set, signo) ((*(set) & (1L << ((signo) - 1))) != 0)
#endif /* NSIG */

View File

@@ -1,24 +0,0 @@
/*
* SmallC: interface to stdio library.
*/
#define BUFSIZ 1024
#ifndef NULL
#define NULL 0
#endif
#define FILE int
#define EOF (-1)
extern int _iob[];
#define stdin (&_iob[0])
#define stdout (&_iob[5])
#define stderr (&_iob[10])
#define SEEK_SET 0 /* set file offset to offset */
#define SEEK_CUR 1 /* set file offset to current plus offset */
#define SEEK_END 2 /* set file offset to EOF plus offset */
#define getc fgetc
#define putc fputc

View File

@@ -1,22 +0,0 @@
/*
* Ioctl definitions for GPIO driver.
*/
#define GPIO_PORT(n) (n) /* port number */
#define GPIO_PORTA 0
#define GPIO_PORTB 1
#define GPIO_PORTC 2
#define GPIO_PORTD 3
#define GPIO_PORTE 4
#define GPIO_PORTF 5
#define GPIO_PORTG 6
#define GPIO_CONFIN 0x20016700 /* configure as input */
#define GPIO_CONFOUT 0x20026700 /* configure as output */
#define GPIO_CONFOD 0x20046700 /* configure as open drain */
#define GPIO_DECONF 0x20086700 /* deconfigure */
#define GPIO_STORE 0x20106700 /* store all outputs */
#define GPIO_SET 0x20206700 /* set to 1 by mask */
#define GPIO_CLEAR 0x20406700 /* set to 0 by mask */
#define GPIO_INVERT 0x20806700 /* invert by mask */
#define GPIO_POLL 0x21006700 /* poll */
#define GPIO_LOL 0x82006700 /* display lol picture */

View File

@@ -1,9 +0,0 @@
/*
* Ioctl definitions for SPI driver.
*/
#define SPICTL_SETMODE 0x20007000 /* set SPI mode */
#define SPICTL_SETRATE 0x20007001 /* set clock rate, kHz */
#define SPICTL_SETSELPIN 0x20007002 /* set select pin */
#define SPICTL_IO8(n) (0xc0007003 | (n)<<16) /* transfer n*8 bits */
#define SPICTL_IO16(n) (0xc0007004 | (n)<<16) /* transfer n*16 bits */
#define SPICTL_IO32(n) (0xc0007005 | (n)<<16) /* transfer n*32 bits */

View File

@@ -1,12 +0,0 @@
/*
* SmallC: interface to wiznet library.
*/
#define MAX_SOCK_NUM 4 /* Max number of sockets per chip */
#define CLIENT_SIZE 3 /* Size of client structure in words */
#define UDP_SIZE 2 /* Size of UDP structure in words */
extern unsigned _socket_port[];
extern unsigned _client_srcport;
extern unsigned _server_port;

42
include/stab.h Normal file
View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* @(#)stab.h 5.1 (Berkeley) 5/30/85
*/
/* IF YOU ADD DEFINITIONS, ADD THEM TO nm.c as well */
/*
* This file gives definitions supplementing <a.out.h>
* for permanent symbol table entries.
* These must have one of the N_STAB bits on,
* and are subject to relocation according to the masks in <a.out.h>.
*/
/*
* for symbolic debugger, sdb(1):
*/
#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */
#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */
#define N_FUN 0x24 /* procedure: name,,0,linenumber,address */
#define N_STSYM 0x26 /* static symbol: name,,0,type,address */
#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */
#define N_RSYM 0x40 /* register sym: name,,0,type,register */
#define N_SLINE 0x44 /* src line: 0,,0,linenumber,address */
#define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */
#define N_SO 0x64 /* source file name: name,,0,0,address */
#define N_LSYM 0x80 /* local sym: name,,0,type,offset */
#define N_SOL 0x84 /* #included file name: name,,0,0,address */
#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */
#define N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */
#define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */
#define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */
#define N_BCOMM 0xe2 /* begin common: name,, */
#define N_ECOMM 0xe4 /* end common: name,, */
#define N_ECOML 0xe8 /* end common (local name): ,,address */
#define N_LENG 0xfe /* second stab entry with length information */
/*
* for the berkeley pascal compiler, pc(1):
*/
#define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */

View File

@@ -4,49 +4,27 @@
#ifndef _STDARG_H
#define _STDARG_H
/*
* Define va_start, va_arg, va_end, va_copy.
*/
#if defined(__GNUC__) /* Gnu C */
/* Define __gnuc_va_list. */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif
#ifdef __GNUC__
# define va_start(ap, last) __builtin_va_start((ap), last)
# define va_arg(ap, type) __builtin_va_arg((ap), type)
# define va_end(ap) __builtin_va_end((ap))
# define va_copy(dest, src) __builtin_va_copy((dest), (src))
#elif defined(__PCC__) /* PCC */
#endif
#ifdef __PCC__
# define va_start(ap, last) __builtin_stdarg_start((ap), last)
# define va_arg(ap, type) __builtin_va_arg((ap), type)
# define va_end(ap) __builtin_va_end((ap))
# define va_copy(dest, src) __builtin_va_copy((dest), (src))
#else /* SmallerC, LCC */
# define va_start(ap, last) (ap = ((char*)&(last) + \
(((sizeof(last) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))))
# define va_arg(ap, type) ((type*)(ap += \
sizeof(type) == sizeof(int) ? sizeof(type) : \
(-(int)(ap) & (sizeof(type) - 1)) + sizeof(type)))[-1]
# define va_end(ap)
# define va_copy(dest, src) (dest = (src))
#endif
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end((ap))
#define va_copy(dest, src) __builtin_va_copy((dest), (src))
/*
* Define va_list.
*/
#ifndef _VA_LIST_T
# define _VA_LIST_T
# if defined(__GNUC__) || defined(__PCC__)
typedef __builtin_va_list va_list;
# else
typedef char *va_list;
# endif
#endif
/*
* Define __gnuc_va_list.
*/
#if defined(__GNUC__) && !defined(__GNUC_VA_LIST)
# define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#ifndef _VA_LIST
#define _VA_LIST
typedef __gnuc_va_list va_list;
#endif
#endif /* not _STDARG_H */

View File

@@ -1,22 +0,0 @@
#ifndef _STDDEF_H_
#define _STDDEF_H_
typedef int ptrdiff_t;
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif
#ifndef NULL
#define NULL 0
#endif
/* Offset of member MEMBER in a struct of type TYPE. */
#if defined(__GNUC__) && __GNUC__ > 3
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#else
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE*)0)->MEMBER)
#endif
#endif /* _STDDEF_H_ */

View File

@@ -10,4 +10,6 @@ typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
#endif

View File

@@ -5,6 +5,8 @@
*/
#ifndef FILE
#include <sys/types.h>
#define BUFSIZ 1024
extern struct _iobuf {
int _cnt;
@@ -12,7 +14,7 @@ extern struct _iobuf {
char *_base; /* ditto */
int _bufsiz;
short _flag;
short _file;
char _file; /* should be short */
} _iob[];
#define _IOREAD 01
@@ -38,11 +40,6 @@ extern struct _iobuf {
#define NULL 0
#endif
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif
#define FILE struct _iobuf
#define EOF (-1)
@@ -76,7 +73,6 @@ FILE *fopen (const char *, const char *);
FILE *fdopen (int, const char *);
FILE *freopen (const char *, const char *, FILE *);
FILE *popen (const char *, const char *);
FILE *tmpfile (void);
int fclose (FILE *);
long ftell (FILE *);
int fflush (FILE *);
@@ -97,8 +93,6 @@ int setvbuf (FILE *, char *, int, size_t);
int fseek (FILE *, long, int);
void rewind (FILE *);
int remove (const char *);
int getw(FILE *stream);
int putw(int w, FILE *stream);
size_t fread (void *, size_t, size_t, FILE *);
size_t fwrite (const void *, size_t, size_t, FILE *);
@@ -113,12 +107,7 @@ int scanf (const char *, ...);
int sscanf (const char *, const char *, ...);
#ifndef _VA_LIST_
# ifdef __GNUC__
# define va_list __builtin_va_list /* For Gnu C */
# endif
# ifdef __SMALLER_C__
# define va_list char * /* For Smaller C */
# endif
#define va_list __builtin_va_list /* For GCC */
#endif
int vfprintf (FILE *, const char *, va_list);
@@ -134,7 +123,7 @@ int _doprnt (const char *, va_list, FILE *);
int _doscan (FILE *, const char *, va_list);
#ifndef _VA_LIST_
# undef va_list
#undef va_list
#endif
void perror (const char *);

View File

@@ -43,6 +43,8 @@
#ifndef _STDLIB_H_
#define _STDLIB_H_
#include <sys/types.h>
#ifndef NULL
#define NULL 0
#endif
@@ -52,52 +54,46 @@
#define RAND_MAX 0x7fff
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif
void abort (void);
void abort();
int abs (int);
int atexit (void (*)(void));
int atoi (const char *);
long atol (const char *);
double atof();
int atoi();
long atol();
void *calloc (size_t, size_t);
void exit (int);
void free (void *);
char *getenv (const char *);
long labs (long);
char *getenv();
void *malloc (size_t);
char *mktemp (char *);
int mkstemp (char *);
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
int rand (void);
void qsort();
int rand();
void *realloc (void*, size_t);
void srand (unsigned);
long strtol (const char *, char **, int);
unsigned long strtoul (const char *, char **, int);
int system (const char *);
void srand();
double strtod();
long strtol();
unsigned long strtoul();
int system();
int putenv (char *string);
int setenv (const char *name, const char *value, int overwrite);
int unsetenv (const char *name);
char *_findenv (const char *name, int *offset);
void *alloca (size_t size);
void *alloca();
int daemon (int, int);
char *devname (int dev, int type);
int getloadavg (unsigned loadavg[], int nelem);
int daemon();
char *devname();
int getloadavg(unsigned loadavg[], int nelem);
extern char *suboptarg; /* getsubopt(3) external variable */
int getsubopt (char **, char **, char **);
int getsubopt();
long random (void);
char *setstate (char *);
void srandom (unsigned);
double atof (const char *);
double strtod (const char *, char **);
char *ecvt (double, int, int *, int *);
char *fcvt (double, int, int *, int *);
char *gcvt (double, int, char *);

View File

@@ -3,15 +3,12 @@
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#include <sys/types.h>
#ifndef NULL
#define NULL 0
#endif
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif
char *strcat (char *, const char *);
char *strncat (char *, const char *, size_t);
char *strcpy (char *, const char *);
@@ -42,5 +39,5 @@ char *strtok_r (char *, const char *, char **);
size_t strcspn (const char *, const char *);
size_t strspn (const char *, const char *);
char *strerror (int);
const char *strerror (int);
const char *syserrlst (int);

View File

@@ -30,14 +30,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif
#include <sys/types.h>
int bcmp(const void *, const void *, size_t);
void bcopy(const void *, void *, size_t);
void bzero(void *, unsigned long);
void bzero(void *, size_t);
int ffs(int);
char *index(const char *, int);
char *rindex(const char *, int);

View File

@@ -59,7 +59,7 @@
#define SYS_getegid 48
#define SYS_setgid 49
#define SYS_setegid 50
#define SYS_kmemdev 51
/* 51 is old; acct */
#define SYS_phys 52
#define SYS_lock 53
#define SYS_ioctl 54
@@ -81,7 +81,7 @@
#define SYS_rdglob 70
#define SYS_wrglob 71
/* 71 is unused 4.3: mmap */
#define SYS_msec 72 /* 72 is unused 4.3: vadvise */
/* 72 is unused 4.3: vadvise */
/* 73 is unused 4.3: munmap */
/* 74 is unused 4.3: mprotect */
/* 75 is unused 4.3: madvise */

View File

@@ -2,9 +2,13 @@
#define _TERM_H
extern int tgetent(char *, char *);
extern int tnchktc();
extern int tnamatch(char *);
extern char *tskip(register char *);
extern int tgetnum(char *);
extern int tgetflag(char *);
extern char *tgetstr(char *, char **);
extern char *tdecode(register char *, char **);
extern char *tgoto(char *, int, int);
extern int tputs(register char *, int, int (*)());

View File

@@ -4,6 +4,8 @@
#include <sys/ioctl.h>
#include <stdint.h>
#define E_TERMCAP "/etc/termcap"
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
@@ -143,4 +145,5 @@ extern int tcsetattr(int, int, struct termios *);
#define TIOCSETAW _IOW(i, 92, struct termios)
#define TIOCSETAF _IOW(i, 92, struct termios)
#endif

View File

@@ -6,19 +6,7 @@
#ifndef _TIME_H
#define _TIME_H
#ifndef NULL
#define NULL 0
#endif
#ifndef _TIME_T
#define _TIME_T
typedef long time_t;
#endif
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned size_t;
#endif
#include <sys/types.h> /* for time_t */
/*
* Structure returned by gmtime and localtime calls (see ctime(3)).
@@ -37,11 +25,9 @@ struct tm {
char *tm_zone;
};
struct tm *gmtime(const time_t *);
struct tm *localtime(const time_t *);
char *asctime(const struct tm *);
char *ctime(const time_t *);
time_t time(time_t *);
extern struct tm *gmtime(), *localtime();
extern char *asctime(), *ctime();
extern time_t time();
size_t strftime (char *s, size_t maxsize, const char *format,
const struct tm *timeptr);

View File

@@ -18,5 +18,5 @@ struct ttyent { /* see getttyent(3) */
struct ttyent *getttyent (void);
struct ttyent *getttynam (const char *name);
void setttyent (void);
void endttyent (void);
int setttyent (void);
int endttyent (void);

View File

@@ -5,13 +5,14 @@
/*
** Information about time zone files.
*/
/* Time zone object file directory */
#define TZDIR "/usr/share/zoneinfo"
#define TZDEFAULT "/etc/localtime"
/*
** Each file begins with. . .
*/
struct tzhead {
char tzh_reserved[32]; /* reserved for future use */
char tzh_timecnt[4]; /* coded number of transition times */
@@ -95,4 +96,5 @@ struct tzhead {
** Accurate only for the past couple of centuries;
** that will probably do.
*/
#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)

View File

@@ -94,7 +94,6 @@ void setusershell();
void sync();
unsigned int ualarm();
void usleep();
int pause (void);
pid_t vfork();
int pipe (int pipefd[2]);
@@ -108,18 +107,11 @@ int chown (const char *path, uid_t owner, gid_t group);
int nice (int inc);
int setuid (uid_t uid);
int setgid (gid_t gid);
int seteuid (uid_t euid);
int setegid (gid_t egid);
int setreuid (uid_t ruid, uid_t euid);
int setregid (gid_t rgid, gid_t egid);
int isatty (int fd);
int chdir (const char *path);
int fchdir (int fd);
int chflags (const char *path, u_long flags);
int fchflags (int fd, u_long flags);
int getgroups (int size, gid_t list[]);
int getdtablesize (void);
int rmdir (const char *pathname);
struct stat;
int stat (const char *path, struct stat *buf);
@@ -143,12 +135,7 @@ extern char *optarg; /* getopt(3) external variables */
extern int opterr, optind, optopt;
#ifndef _VA_LIST_
# ifdef __GNUC__
# define va_list __builtin_va_list /* For Gnu C */
# endif
# ifdef __SMALLER_C__
# define va_list char * /* For Smaller C */
# endif
#define va_list __builtin_va_list /* For GCC */
#endif
void err (int eval, const char *fmt, ...);
@@ -161,6 +148,6 @@ void vwarn (const char *fmt, va_list ap);
void vwarnx (const char *fmt, va_list ap);
#ifndef _VA_LIST_
# undef va_list
#undef va_list
#endif
#endif /* !_UNISTD_H_ */

View File

@@ -11,7 +11,8 @@
* Define segment+offset and modified macros.
* Place into the public domain.
* --------------------------------------------------
*/
*/
#include <sys/types.h>
#define MAXSEGNO 16384 /* max number of segments in a space */
@@ -23,12 +24,12 @@ struct vspace {
int v_fd; /* file for swapping */
off_t v_foffset; /* offset for computing file addresses */
int v_maxsegno; /* number of segments in this space */
};
};
struct dlink { /* general double link structure */
struct dlink *fwd; /* forward link */
struct dlink *back; /* back link */
};
};
struct vseg { /* structure of a segment in memory */
struct dlink s_link; /* for linking into lru list */
@@ -36,11 +37,12 @@ struct vseg { /* structure of a segment in memory */
struct vspace *s_vspace; /* which virtual space */
int s_lock_count;
int s_flags;
union {
union
{
int _winfo[WORDSPERSEG]; /* the actual segment */
char _cinfo[BYTESPERSEG];
} v_un;
};
};
#define s_winfo v_un._winfo
#define s_cinfo v_un._cinfo
@@ -48,16 +50,15 @@ struct vseg { /* structure of a segment in memory */
/* masks for s_flags */
#define S_DIRTY 01 /* segment has been modified */
long nswaps; /* number of swaps */
long nmapsegs; /* number of mapseg calls */
long nswaps; /* number of swaps */
long nmapsegs; /* number of mapseg calls */
int vminit(), vmopen();
struct vseg *vmmapseg();
void vmlock(), vmunlock(), vmclrseg(), vmmodify();
void vmflush(), vmclose();
int vminit(), vmopen();
struct vseg *vmmapseg();
void vmlock(), vmunlock(), vmclrseg(), vmmodify();
void vmflush(), vmclose();
typedef long VADDR;
#define VMMODIFY(seg) (seg->s_flags |= S_DIRTY)
#define VSEG(va) ((short)(va >> LOG2BPS))
#define VOFF(va) ((u_short)va % BYTESPERSEG)

View File

@@ -3,7 +3,7 @@
#include "w5100.h"
extern unsigned _socket_port [MAX_SOCK_NUM];
extern uint16_t _socket_port [MAX_SOCK_NUM];
/*
* Opens a socket(TCP or UDP or IP_RAW mode)

View File

@@ -62,13 +62,13 @@ void udp_stop (udp_t *u);
/*
* Send a packet to specified peer.
*/
unsigned udp_send_packet (udp_t *u, const uint8_t *data, unsigned len,
uint16_t udp_send_packet (udp_t *u, const uint8_t *data, unsigned len,
uint8_t *ip, unsigned port);
/*
* Send a zero-terminated string to specified peer.
*/
unsigned udp_send_string (udp_t *u, const char *data,
uint16_t udp_send_string (udp_t *u, const char *data,
uint8_t *ip, unsigned port);
/*

14
lib/.gitignore vendored
View File

@@ -1,14 +0,0 @@
a.out.h
aout
ar
ar.h
as
ld
nlist.h
nm
ranlib
ranlib.h
retroImage
size
strip
gccdump.s

View File

@@ -1,56 +0,0 @@
TOPSRC = $(shell cd ..; pwd)
SUBDIR = startup libc libm libcurses libtermlib libwiznet libreadline libgpanel
PROG = ar as aout ld nm ranlib size strip
CFLAGS = -m32 -Os -std=gnu89 -fno-builtin -g -Wall -DCROSS -I. \
-idirafter $(TOPSRC)/include \
-idirafter $(TOPSRC)/src/cmd/ar \
-idirafter $(TOPSRC)/src/cmd/as
LDFLAGS += -g
AR_OBJS = ar.o append.o archive.o contents.o delete.o extract.o \
misc.o move.o print.o replace.o strmode.o
AOUT_OBJS = aout.o mips-dis.o
RANLIB_OBJS = ranlib.o archive.o
HEADERS = a.out.h ar.h nlist.h ranlib.h
vpath %.c $(TOPSRC)/src/cmd/aout $(TOPSRC)/src/cmd/ar $(TOPSRC)/src/cmd/as \
$(TOPSRC)/src/cmd/ld $(TOPSRC)/src/cmd/nm $(TOPSRC)/src/cmd/ranlib \
$(TOPSRC)/src/cmd
all install depend: $(HEADERS) $(SUBDIR) $(PROG)
-for i in $(SUBDIR); do $(MAKE) -C $$i $(MFLAGS) DESTDIR=$(DESTDIR) $@; done
clean:
rm -f *~ *.o *.a *.h $(PROG) retroImage gccdump.s
for i in $(SUBDIR); do $(MAKE) -C $$i $(MFLAGS) clean; done
ar: $(AR_OBJS)
$(CC) -m32 $(LDFLAGS) -o $@ $(AR_OBJS) $(LIBS)
as: as.o
$(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS)
aout: $(AOUT_OBJS)
$(CC) -m32 $(LDFLAGS) -o $@ $(AOUT_OBJS) $(LIBS)
ld: ld.o
$(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS)
nm: nm.o
$(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS)
ranlib: $(RANLIB_OBJS)
$(CC) -m32 $(LDFLAGS) -o $@ $(RANLIB_OBJS) $(LIBS)
size: size.o
$(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS)
strip: strip.o
$(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS)
$(HEADERS):
-ln -s -f ../include/a.out.h .
-ln -s -f ../include/ar.h .
-ln -s -f ../include/nlist.h .
-ln -s -f ../include/ranlib.h .

View File

@@ -1,112 +0,0 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
LIBCDIR = $(TOPSRC)/src/libc
vpath %.S $(LIBCDIR)/mips/sys $(LIBCDIR)/mips/string $(LIBCDIR)/mips/gen \
$(LIBCDIR)/runtime
vpath %.c $(LIBCDIR)/mips/sys $(LIBCDIR)/gen $(LIBCDIR)/stdio \
$(LIBCDIR)/stdlib $(LIBCDIR)/string $(LIBCDIR)/inet \
$(LIBCDIR)/compat $(LIBCDIR)/runtime
CFLAGS = -Os -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
ASFLAGS += -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -I$(LIBCDIR)/mips/sys
# modules which can not use SYSCALL and must be assembled from sources. The
# rest of the system calls are generated with printf(1) and do not have
# source files associated with them.
# libc/mips/sys
SYSOBJS = __sysctl.o accept.o access.o adjtime.o bind.o chdir.o \
chflags.o chmod.o chown.o chroot.o close.o connect.o dup.o \
dup2.o execve.o fchdir.o fchflags.o fchmod.o fchown.o \
fcntl.o flock.o fork.o fstat.o fsync.o ftruncate.o \
getdtablesize.o getgroups.o getitimer.o getsockname.o \
getpeername.o getpriority.o getrlimit.o getrusage.o \
getsockopt.o gettimeofday.o ioctl.o kill.o killpg.o link.o \
listen.o lstat.o mkdir.o mknod.o mount.o open.o pselect.o \
quota.o read.o readlink.o readv.o reboot.o recv.o \
recvfrom.o recvmsg.o rename.o rmdir.o select.o send.o \
sendmsg.o sendto.o setgroups.o setitimer.o setpgrp.o \
setpriority.o setquota.o setuid.o seteuid.o setgid.o \
setegid.o setrlimit.o setsockopt.o settimeofday.o \
shutdown.o sigaltstack.o socket.o socketpair.o stat.o \
symlink.o sigprocmask.o sigstack.o sigwait.o statfs.o \
fstatfs.o getfsstat.o truncate.o umount.o unlink.o \
utimes.o wait4.o write.o writev.o lseek.o sigsuspend.o \
getgid.o getegid.o getpgrp.o getpid.o getppid.o getuid.o \
geteuid.o profil.o sigpending.o sync.o ufetch.o ustore.o \
ucall.o umask.o vfork.o vhangup.o rdglob.o wrglob.o
OBJS = $(SYSOBJS) sbrk.o execl.o execle.o execv.o \
_exit.o _brk.o pipe.o ptrace.o sigaction.o
# libc/mips/string
ASFLAGS += -DLWHI=lwr -DLWLO=lwl -DSWHI=swr -DSWLO=swl
OBJS += bcopy.o bzero.o ffs.o memcpy.o memmove.o memset.o \
strlen.o bcmp.o index.o rindex.o strcmp.o
# libc/mips/gen
OBJS += _setjmp.o htonl.o htons.o
# libc/gen
OBJS += abort.o alarm.o atof.o atoi.o atol.o calloc.o closedir.o crypt.o \
ctime.o ctype_.o daemon.o devname.o ecvt.o err.o \
execvp.o fakcu.o frexp.o fstab.o gcvt.o getenv.o getgrent.o \
getgrgid.o getgrnam.o getlogin.o \
getgrouplist.o gethostname.o getpagesize.o \
getpass.o getpwent.o getloadavg.o getmntinfo.o \
getttyent.o getttynam.o getusershell.o getwd.o \
initgroups.o isatty.o isinff.o isnanf.o ldexp.o malloc.o mktemp.o \
modff.o ndbm.o nlist.o knlist.o opendir.o perror.o popen.o \
psignal.o qsort.o random.o readdir.o regex.o scandir.o \
seekdir.o setmode.o sethostname.o setenv.o siglist.o \
signal.o siginterrupt.o sigsetops.o \
sleep.o strcasecmp.o strftime.o swab.o sysctl.o syslog.o system.o \
strcat.o strncat.o strcpy.o strncpy.o strncmp.o \
telldir.o time.o timezone.o ttyname.o ttyslot.o ualarm.o usleep.o \
strdup.o uname.o wait.o wait3.o waitpid.o
# libc/stdio
OBJS += fgetc.o fgets.o fputc.o fputs.o gets.o puts.o \
clrerr.o doscan.o exit.o fdopen.o filbuf.o findiop.o \
flsbuf.o fopen.o fprintf.o fread.o freopen.o fseek.o \
ftell.o fwrite.o getchar.o getw.o printf.o putchar.o putw.o \
rew.o scanf.o setbuf.o setbuffer.o setvbuf.o snprintf.o sprintf.o \
strout.o ungetc.o vfprintf.o vprintf.o vsprintf.o doprnt.o \
remove.o feof.o ferror.o fileno.o
# libc/stdlib
OBJS += getopt.o getsubopt.o strtol.o strtoul.o strtod.o
# libc/string
OBJS += strcspn.o strpbrk.o strerror.o strsep.o strspn.o \
strstr.o strtok.o strtok_r.o
# libc/inet
OBJS += inet_addr.o inet_network.o inet_netof.o \
inet_ntoa.o inet_lnaof.o inet_maddr.o
# libc/compat
OBJS += creat.o ftime.o gethostid.o memccpy.o memchr.o \
memcmp.o memcpy.o memset.o nice.o pause.o rand.o \
sethostid.o setregid.o setreuid.o setrgid.o setruid.o \
sigcompat.o strchr.o strrchr.o times.o tmpnam.o \
utime.o
# libc/runtime
OBJS += addsf3.o comparesf2.o divsf3.o fixsfsi.o floatsisf.o \
mulsf3.o negsf2.o subsf3.o sc_case.o fixunssfsi.o \
floatunsisf.o
all: ../libc.a
../libc.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
$(SYSOBJS): $(LIBCDIR)/mips/sys/SYS.h
@echo creating $*.o
@printf '#include "SYS.h"\nSYS($*)\n' | $(AS) $(ASFLAGS) - -c -o $*.o
clean:
rm -f *~ *.o a.out *.a

View File

@@ -1,22 +0,0 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libcurses
CFLAGS = -Os -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = addch.o addstr.o box.o clear.o clrtobot.o clrtoeol.o cr_put.o \
cr_tty.o curses.o delch.o deleteln.o delwin.o endwin.o erase.o \
fullname.o getch.o getstr.o idlok.o id_subwins.o initscr.o insch.o \
insertln.o longname.o move.o mvprintw.o mvscanw.o mvwin.o newwin.o \
overlay.o overwrite.o printw.o putchar.o refresh.o scanw.o scroll.o \
toucholap.o standout.o touchwin.o tstp.o unctrl.o
all: ../libcurses.a
../libcurses.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

View File

@@ -1,18 +0,0 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libgpanel
CFLAGS = -Os -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = open.o clear.o pixel.o line.o rect.o fill.o fill_triangle.o \
circle.o image.o char.o text.o text_width.o
all: ../libgpanel.a
../libgpanel.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

View File

@@ -1,18 +0,0 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libm
CFLAGS = -Os -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = asin.o atan.o exp.o erf.o floor.o fmod.o hypot.o j0.o j1.o \
jn.o log.o pow.o sin.o sinh.o sqrt.o tan.o tanh.o
all: ../libm.a
../libm.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

View File

@@ -1,17 +0,0 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libreadline
CFLAGS = -Os -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = readline.o
all: ../libreadline.a
../libreadline.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

View File

@@ -1,17 +0,0 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libtermlib
CFLAGS = -Os -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = termcap.o tgoto.o tputs.o tcattr.o
all: ../libtermlib.a
../libtermlib.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

View File

@@ -1,17 +0,0 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/libwiznet
CFLAGS = -Os -B$(TOPSRC)/lib/ $(DEFS) -Wa,-x -Wall -Werror
OBJS = w5100.o socket.o ethernet.o client.o server.o udp.o
all: ../libwiznet.a
../libwiznet.a: ../ar ../ranlib $(OBJS)
../ar rc $@ $(OBJS)
../ranlib $@
clean:
rm -f *~ *.o a.out *.a

View File

@@ -1,22 +0,0 @@
#
# Copyright (c) 1987 Regents of the University of California.
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# crt0 Normal C run time startoff
#
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
vpath %.c $(TOPSRC)/src/startup-mips
CFLAGS = -Os -B$(TOPSRC)/lib/ -Wa,-x $(DEFS)
OBJS = ../crt0.o
all: $(OBJS)
../crt0.o: crt0.c
$(CC) $(DEFS) $(CFLAGS) -c $< -o $@
clean:
rm -f $(OBJS) *~

1
libexec/.gitignore vendored
View File

@@ -1 +0,0 @@
*

View File

@@ -1,7 +0,0 @@
echo 'erase ^?, kill ^U, intr ^C'
stty dec
PATH=/bin:/sbin:/etc
export PATH
HOME=/
export HOME
export TERM

File diff suppressed because it is too large Load Diff

1
sbin/.gitignore vendored
View File

@@ -1 +0,0 @@
*

755
sdram-fpga.S Normal file
View File

@@ -0,0 +1,755 @@
/*
* SDRAM Access Routines for PIC32.
*
* Retromaster - 10.05.2010
*
* This file is in the public domain. You can use, modify, and distribute the source code
* and executable programs based on the source code. This file is provided "as is" and
* without any express or implied warranties whatsoever. Use at your own risk!
*
* Changes by jmcgee for inclusion in the retrobsd project.
*/
/* SDRAM Used: HY57V281620
* SDRAM Pin to PIC32 Pin Mapping:
* SDRAM PIC32
* ------ ------
* note: the order of An to RBn DOES matter
* At the moment it is a bit of a mess and
* needs to be cleaned up.
* A0 23 RB11
* A1 24 RB12
* A2 25 RB13
* A3 26 RB14
* A4 29 RB5
* A5 30 RB4
* A6 31 RB3
* A7 32 RB2
* A8 33 RB6
* A9 34 RB7
* A10 22 RB15
* A11 35 RB9
*
* BA0 20 RD4
* BA1 21 RD5
*
* note: the order of DQn to RAn does not matter
* DQ0 2 RA6
* DQ1 4 RA1
* DQ2 5 RA7
* DQ3 7 RA2
* DQ4 8 RA3
* DQ5 10 RA4
* DQ6 11 RA5
* DQ7 13 RA0
* CLK 38 OC1-RD0
* CKE 37 A10
* CS 19 RF12
* WE 16 RF0
* CAS 17 RF1
* RAS 18 RF13
*
* SDRam 42, 44, 45, 47, 48, 50, 51, 53 - (d8-d15) should be pulled up, but
* on the prototype board these were simply left floating
*
* Power connections not listed.
*/
/*
* Retrobsd does not currently contain a good header
* for pulling the pic32 port addresses into an assembly
* file, so define some needed registers here for the moment.
*/
#define TRISA 0xBF886000
#define T2CON 0xBF800800
#define TMR2 0xBF800810
#define PR2 0xBF800820
#define T2CONSET 0xBF800808
#define OC1CON 0xBF803000
#define OC4CON 0xBF803600
#define OCXR_OFFSET 0x10
#define OCXRS_OFFSET 0x20
#define AD1PCFGSET 0xBF809068
/* Offsets (from TRISA) for the io ports */
#define SDR_OFFSET_A 0
#define SDR_OFFSET_B 0x40
#define SDR_OFFSET_C 0x80
#define SDR_OFFSET_D 0xc0
#define SDR_OFFSET_E 0x100
#define SDR_OFFSET_F 0x140
#define SDR_OFFSET_G 0x180
/* Offsets (from TRISA) for the various port control registers */
#define TRIS_OFFSET 0x0
#define PORT_OFFSET 0x10
#define LAT_OFFSET 0x20
#define ODCF_OFFSET 0x30
/* Offsets (from TRISA) for the various io port bit manipulator registers */
#define NOP_OP_OFFSET 0x0
#define CLR_OP_OFFSET 0x4
#define SET_OP_OFFSET 0x8
#define INV_OP_OFFSET 0xc
/*
* Specific assignments of ports ports used
* Note: In general, it is not sufficient to
* change the constants below - corresponding
* changes to the code below will likely be
* required if any of the following values
* are changed.
*/
/* DATA_PORT_TRIS must be assigned to a TRIS of the port
* that has the low 8 bits tied the 8 data bits on the ram.
*/
#define SDR_OCR OC1CON
#define SDR_DATA_IO SDR_OFFSET_A
#define SDR_DATA_TRIS SDR_OFFSET_A
#define SDR_ADDRESS_IO SDR_OFFSET_B
#define SDR_ADDRESS_TRIS SDR_OFFSET_B
#define ADDRESS_MASK 0xfafc
#define SDR_BANK_IO SDR_OFFSET_D
#define SDR_BANK_TRIS SDR_OFFSET_D
#define BANK_0_BIT 4
#define BANK_1_BIT 5
#define SDR_CONTROL_IO SDR_OFFSET_F
#define SDR_CONTROL_TRIS SDR_OFFSET_F
#define CONTROL_WE_BIT 0
#define CONTROL_CAS_BIT 1
#define CONTROL_CS_BIT 12
#define CONTROL_RAS_BIT 13
#define SDR_CKE_IO SDR_OFFSET_A
#define SDR_CKE_TRIS SDR_OFFSET_A
#define CKE_BIT 10
#define DATA_DIR_BIT 15
#define CONTROL_ALL_MASK ( (1<<CONTROL_CS_BIT) | (1<<CONTROL_RAS_BIT) | (1<<CONTROL_CAS_BIT) | (1<<CONTROL_WE_BIT) )
#define BANK_ALL_MASK ( (1 << BANK_1_BIT) | ( 1 << BANK_0_BIT ) )
/* Global Symbols */
.globl sdram_init
.globl sdram_read
.globl sdram_write
.globl sdram_active
.globl sdram_auto_refresh
.globl sdram_precharge
.globl sdram_precharge_all
.globl sdram_sleep
.globl sdram_wake
.globl sdram_bank
.type sdram_init, @function
.type sdram_read, @function
.type sdram_write, @function
.type sdram_active, @function
.type sdram_auto_refresh, @function
.type sdram_precharge, @function
.type sdram_precharge_all, @function
.type sdram_sleep, @function
.type sdram_wake, @function
.type sdram_bank, @function
/*
* This code MUST execute from ram and the ram MUST be configured
* for zero wait states. Interrupts MUST disabled before
* calling any of these functions, and any DMA MUST also be
* disabled.
*
* Also, the peripheral bus divisor must be set to 1.
*/
.section .ramfunc,"ax",@progbits
/* No instruction reordering */
.set noreorder
#define clock4 \
nop;nop;nop;nop
#define clock3 \
nop;nop;nop
#define clock2 \
nop;nop
#define clock1 \
nop
/*
* The SDRAM clock is output from the output compare unit.
* This macro synchronizes with that clock so that we are
* sure to have at least two clock cycles to issue control
* line changes and access the data bus before the rising
* edge.
*/
#define sync_clock \
la $t8, TMR2; \
li $v0, 2; \
lw $v1, ($t8); \
bge $v1, $v0, 1f; \
nop; \
nop; \
nop; \
1: \
nop;
#define output_column \
and $t5, $a0, 0x1f; \
sll $t5, 2; \
and $t6, $a0, 0x20; \
sll $t6, 9; \
or $t5, $t6; \
lw $t6, SDR_ADDRESS_TRIS + LAT_OFFSET($t0); \
and $t6, ~ADDRESS_MASK; \
or $t6, $t5; \
sw $t6, SDR_ADDRESS_TRIS + LAT_OFFSET($t0);
#define output_address \
sll $t5, $a0, 2; \
and $t5, ADDRESS_MASK; \
and $t6, $a0, 0x40; \
sll $t6, 8; \
or $t5, $t6; \
and $t6, $a0, 0x100; \
sll $t6, 7; \
or $t5, $t6; \
lw $t6, SDR_ADDRESS_TRIS + LAT_OFFSET($t0); \
and $t6, ~ADDRESS_MASK; \
or $t6, $t5; \
sw $t6, SDR_ADDRESS_TRIS + LAT_OFFSET($t0);
/*.ent sdram_init*/
/*
* Initializes the SDRAM.
* Should be called once sometime after startup
* C Prototype:
* extern __attribute__((far)) void sdram_init();
*/
sdram_init:
/* Initialize address lines */
la $t0, TRISA /* base of io addresses */
li $t1, ADDRESS_MASK
sw $t1, SDR_ADDRESS_IO + TRIS_OFFSET + CLR_OP_OFFSET($t0)
li $t1, 0xFFFF
sw $t1, AD1PCFGSET
li $t1, BANK_ALL_MASK
sw $t1, SDR_BANK_IO + TRIS_OFFSET + CLR_OP_OFFSET($t0)
/* All address lines low */
li $t1, ADDRESS_MASK
sw $t1, SDR_ADDRESS_IO + LAT_OFFSET + CLR_OP_OFFSET($t0)
li $t1, BANK_ALL_MASK
sw $t1, SDR_BANK_IO + LAT_OFFSET + CLR_OP_OFFSET($t0)
/* Initialize data lines */
li $t1, 0xFF
sw $t1, SDR_DATA_IO + TRIS_OFFSET + SET_OP_OFFSET($t0)
/* Initialize SDRAM control lines */
li $t1, CONTROL_ALL_MASK
sw $t1, SDR_CONTROL_IO + TRIS_OFFSET + CLR_OP_OFFSET($t0)
/* Command Inhibit */
li $t1, CONTROL_ALL_MASK
sw $t1, SDR_CONTROL_IO + LAT_OFFSET + SET_OP_OFFSET($t0)
li $t1, (1<<DATA_DIR_BIT)
sw $t1, SDR_CKE_IO + LAT_OFFSET + SET_OP_OFFSET($t0)
/* Initialize CKE line */
// li $t1, (1<<CKE_BIT)
li $t1, (1<<CKE_BIT)|(1<<DATA_DIR_BIT)
sw $t1, SDR_CKE_IO + TRIS_OFFSET + CLR_OP_OFFSET($t0)
/* CKE low */
li $t1, (1<<CKE_BIT)
sw $t1, SDR_CKE_IO + LAT_OFFSET + CLR_OP_OFFSET($t0)
/* SDRAM clock output */
/* Initialize Timer2 */
sw $zero, T2CON
sw $zero, TMR2
li $t1, 3
sw $t1, PR2
li $t1, 0x8000
sw $t1, T2CONSET
/* Initialize OC device */
sw $zero, SDR_OCR /*OC4CON */
li $t1, 1
sw $t1, SDR_OCR + OCXRS_OFFSET /*OC4RS*/
li $t1, 3
sw $t1, SDR_OCR + OCXR_OFFSET /*OC4R*/
li $t1, 0x8005
sw $t1, SDR_OCR /*OC4CON*/
/* Clock output starts here */
/* SD-RAM initialization delay */
li $t2, 500
move $t1, $zero
sdram_init_delay_1:
addi $t1, $t1, 1
bne $t1, $t2, sdram_init_delay_1
nop
/* CKE high */
li $t1, (1<<CKE_BIT)
sw $t1, SDR_CKE_IO + LAT_OFFSET + SET_OP_OFFSET($t0)
/* Delay some more */
li $t2, 3000
move $t1, $zero
sdram_init_delay_2:
addi $t1, $t1, 1
bne $t1, $t2, sdram_init_delay_2
nop
/* Get ready for the commands we are about to issue. */
li $t4, (1<<CONTROL_CAS_BIT)
li $t5, (1<<CONTROL_WE_BIT)
li $t6, 0x1810 /* Mode Register: CL:2, BL:8 (0x23) */
li $t7, CONTROL_ALL_MASK
li $t8, 0x8000 /* A10 */
sw $t8, SDR_ADDRESS_IO + LAT_OFFSET + SET_OP_OFFSET($t0) /* A10 = 1 for Precharge ALL */
sync_clock
.set nomacro
/* Precharge All */
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + CLR_OP_OFFSET($t0) /* LLLL */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + SET_OP_OFFSET($t0) /* LLHL */
clock2
/* Auto Refresh 1 */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + CLR_OP_OFFSET($t0) /* LLLL */
sw $t5, SDR_CONTROL_IO + LAT_OFFSET + SET_OP_OFFSET($t0) /* LLLH */
clock2
/* Auto Refresh 2 */
clock4
/* Auto Refresh 3 */
clock4
/* Auto Refresh 4 */
clock4
/* Auto Refresh 5 */
clock4
/* Auto Refresh 6 */
clock4
/* Auto Refresh 7 */
clock4
/* Auto Refresh 8 */
li $t4, ADDRESS_MASK
sw $t4, SDR_ADDRESS_IO + LAT_OFFSET + CLR_OP_OFFSET($t0)
clock2
/* Load Mode Register */
sw $t6, SDR_ADDRESS_IO + LAT_OFFSET + SET_OP_OFFSET($t0)
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + CLR_OP_OFFSET($t0)
clock2
/* Command Inhibit */
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + SET_OP_OFFSET($t0)
clock3
/* Command Inhibit */
clock4
.set macro
jr $ra
nop
/*.end sdram_init*/
/*
* Sends ACTIVE command
* C Prototype:
* extern __attribute__((far)) void sdram_active(uint16_t rowaddr);
*/
sdram_active:
la $t0, TRISA /* Port Base */
li $t7, (1<<CONTROL_CS_BIT)|(1<<CONTROL_RAS_BIT)
/* Set row */
output_address
sync_clock
.set nomacro
/* Active */
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0)
clock3
/* Command Inhibit */
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0)
clock3
/* Command Inhibit */
clock4
.set macro
jr $ra
nop
/*
* Sends WRITE command
* C Prototype:
* extern __attribute__((far)) void sdram_write(uint16_t pseudocoladdr, uint64_t val);
* Each pseudo column contains 8 bytes of data (consists of 8 ram columns)
*/
sdram_write:
la $t0, TRISA /* Port Base */
li $t4, 0xFF
li $t7, (1<<CONTROL_CS_BIT) | (1<<CONTROL_CAS_BIT) | (1<<CONTROL_WE_BIT)
li $t3, (1<<DATA_DIR_BIT)
/* Set column */
output_column
/* Set data lines */
srl $t5, $a2, 24
sb $t5, SDR_DATA_IO + LAT_OFFSET + NOP_OP_OFFSET($t0)
sw $t3, SDR_CKE_IO + LAT_OFFSET + INV_OP_OFFSET($t0)
sync_clock
.set nomacro
/* Write */
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LHLL */
sw $t4, SDR_DATA_IO + TRIS_OFFSET + INV_OP_OFFSET($t0) /* 1 - enable data lines */
srl $t5, $a2, 16
clock1
/* Command Inhibit */
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* HHHH */
sb $t5, SDR_DATA_IO + LAT_OFFSET + NOP_OP_OFFSET($t0) /* 2 */
srl $t5, $a2, 8
clock1
/* Command Inhibit */
sb $t5, SDR_DATA_IO + LAT_OFFSET + NOP_OP_OFFSET($t0) /* 3 */
clock3
/* Command Inhibit */
sb $a2, SDR_DATA_IO + LAT_OFFSET + NOP_OP_OFFSET($t0) /* 4 */
srl $t5, $a3, 24
clock2
/* Command Inhibit */
sb $t5, SDR_DATA_IO + LAT_OFFSET + NOP_OP_OFFSET($t0) /* 5 */
srl $t5, $a3, 16
clock2
/* Command Inhibit */
sb $t5, SDR_DATA_IO + LAT_OFFSET + NOP_OP_OFFSET($t0) /* 6 */
srl $t5, $a3, 8
clock2
/* Command Inhibit */
sb $t5, SDR_DATA_IO + LAT_OFFSET + NOP_OP_OFFSET($t0) /* 7 */
clock3
/* Command Inhibit */
sb $a3, SDR_DATA_IO + LAT_OFFSET + NOP_OP_OFFSET($t0) /* 8 */
clock3
sw $t4, SDR_DATA_IO + TRIS_OFFSET + INV_OP_OFFSET($t0) /* Data lines input again */
clock4 /* make certain sdram output has had time to disable - probably not needed */
sw $t3, SDR_CKE_IO + LAT_OFFSET + INV_OP_OFFSET($t0)
.set macro
jr $ra
nop
/*
* Sends READ command
* C Prototype:
* extern __attribute__((far)) uint64_t sdram_read(uint16_t pseudocoladdr);
* Each pseudo column contains 8 bytes of data (consists of 8 ram columns)
*/
sdram_read:
la $t0, TRISA /* Port Base */
li $t7, (1<<CONTROL_CS_BIT) | (1<<CONTROL_CAS_BIT)
/* Set column */
output_column
sync_clock
.set nomacro
/* Read */
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LHLH */
clock3
/* Command Inhibit */
sw $t7, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* HHHH */
clock3
/* Command Inhibit */
clock3
lbu $v0, SDR_DATA_IO + PORT_OFFSET + NOP_OP_OFFSET($t0) /* 1 */
/* Command Inhibit */
clock3
lbu $t5, SDR_DATA_IO + PORT_OFFSET + NOP_OP_OFFSET($t0) /* 2 */
/* Command Inhibit */
sll $v0, $v0, 8
or $v0, $v0, $t5
clock1
lbu $t5, SDR_DATA_IO + PORT_OFFSET + NOP_OP_OFFSET($t0) /* 3 */
/* Command Inhibit */
sll $v0, $v0, 8
or $v0, $v0, $t5
clock1
lbu $t5, SDR_DATA_IO + PORT_OFFSET + NOP_OP_OFFSET($t0) /* 4 */
/* Command Inhibit */
sll $v0, $v0, 8
or $v0, $v0, $t5
clock1
lbu $v1, SDR_DATA_IO + PORT_OFFSET + NOP_OP_OFFSET($t0) /* 5 */
/* Command Inhibit */
clock3
lbu $t5, SDR_DATA_IO + PORT_OFFSET + NOP_OP_OFFSET($t0) /* 6 */
/* Command Inhibit */
sll $v1, $v1, 8
or $v1, $v1, $t5
clock1
lbu $t5, SDR_DATA_IO + PORT_OFFSET + NOP_OP_OFFSET($t0) /* 7 */
/* Command Inhibit */
sll $v1, $v1, 8
or $v1, $v1, $t5
clock1
lbu $t5, SDR_DATA_IO + PORT_OFFSET + NOP_OP_OFFSET($t0) /* 8 */
/* Command Inhibit */
sll $v1, $v1, 8
or $v1, $v1, $t5
.set macro
jr $ra
nop
/*
* Sends PRECHARGE ALL command
* C Prototype:
* extern __attribute__((far)) void sdram_precharge_all(void);
*/
sdram_precharge_all:
la $t0, TRISA /* Port Base */
li $t3, 0x8000 /* A10 */
li $t4, (1<<CONTROL_CS_BIT) | (1<<CONTROL_RAS_BIT) | (1<<CONTROL_WE_BIT)
sw $t3, SDR_ADDRESS_IO + LAT_OFFSET + SET_OP_OFFSET($t0) /* A10 = 1 for Precharge ALL */
sync_clock
.set nomacro
/* Precharge All */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LLHL */
clock3
/* Command Inhibit */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LLLL */
clock3
.set macro
jr $ra
nop
/*
* Sends PRECHARGE command
* C Prototype:
* extern __attribute__((far)) void sdram_precharge(void);
*/
sdram_precharge:
la $t0, TRISA /* Port Base */
li $t3, 0x8000 /* A10 */
li $t4, (1<<CONTROL_CS_BIT) | (1<<CONTROL_RAS_BIT) | (1<<CONTROL_WE_BIT)
sw $t3, SDR_ADDRESS_IO + LAT_OFFSET + CLR_OP_OFFSET($t0) /* A10 = 0 for Precharge */
sync_clock
.set nomacro
/* Precharge All */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LLHL */
clock3
/* Command Inhibit */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LLLL */
clock3
.set macro
jr $ra
nop
/*
* Sends AUTO REFRESH command
* All banks must be in PRECHARGEd state
* C Prototype:
* extern __attribute__((far)) void sdram_auto_refresh(void);
*/
sdram_auto_refresh:
la $t0, TRISA /* Port Base */
li $t4, (1<<CONTROL_CS_BIT)|(1<<CONTROL_RAS_BIT)|(1<<CONTROL_CAS_BIT)
sync_clock
.set nomacro
/* Auto Refresh */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LLLH */
clock3
/* Command Inhibit */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LLLL */
clock3
.set macro
jr $ra
nop
/*
* Puts the SDRAM into the self refresh mode.
* SDRAM retains data in this state.
* C Prototype:
* extern __attribute__((far)) void sdram_sleep(void);
*/
sdram_sleep:
la $t0, TRISA /* Port Base */
li $t1, (1<<CKE_BIT)
li $t4, (1<<CONTROL_CS_BIT)|(1<<CONTROL_RAS_BIT)|(1<<CONTROL_CAS_BIT)
sync_clock
.set nomacro
/* Auto Refresh */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LLLH */
sw $t1, SDR_CKE_IO + LAT_OFFSET + CLR_OP_OFFSET($t0) /* CKE low */
clock2
/* Command Inhibit */
sw $t4, SDR_CONTROL_IO + LAT_OFFSET + INV_OP_OFFSET($t0) /* LLLL */
clock3
.set macro
jr $ra
nop
/*
* Takes the SDRAM out of the self refresh mode.
* Parameters: none
* C Prototype:
* extern __attribute__((far)) void sdram_wake(void);
*/
sdram_wake:
la $t0, TRISA /* Port Base */
li $t1, (1<<CKE_BIT)
sync_clock
.set nomacro
/* Command Inhibit */
sw $t1, SDR_CKE_IO + LAT_OFFSET + SET_OP_OFFSET($t0) /* CKE low */
clock3
/* Command Inhibit */
clock4
/* Command Inhibit */
clock4
.set macro
jr $ra
nop
/*
* Selects the bank to which commands are issued
* Parameters:
* C Prototype:
* extern __attribute__((far)) void sdram_bank(uint8_t bank);
* (only lower 2 bits are of bank are currently significant)
*/
sdram_bank:
la $t0, TRISA /* Port Base */
lw $t1, SDR_BANK_IO + LAT_OFFSET + NOP_OP_OFFSET($t0);
and $t1, ~BANK_ALL_MASK
sll $t2, $a0, BANK_0_BIT
or $t1, $t2
sw $t1, SDR_BANK_IO + LAT_OFFSET + NOP_OP_OFFSET($t0);
jr $ra
nop

6
share/.gitignore vendored
View File

@@ -1,6 +0,0 @@
calendar
emg.keys
misc
re.help
unixbench
zoneinfo

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,9 @@ all: ashello echo
ashello: ashello.o
$(LD) ashello.o -o $@
chello: chello.o
$(CC) chello.o -o $@
echo: echo.o
$(LD) $@.o -o $@

View File

@@ -0,0 +1,30 @@
TOPSRC = $(shell cd ../..; pwd)
include $(TOPSRC)/target.mk
CFLAGS += -Werror
ASFLAGS += -DCROSS
ASLDFLAGS = --oformat=elf32-tradlittlemips -N -nostartfiles -T $(TOPSRC)/src/elf32-mips.ld
all: hello cplus
hello: hello.o
${CC} ${LDFLAGS} -o hello.elf hello.o ${LIBS}
${OBJDUMP} -S hello.elf > hello.dis
${SIZE} hello.elf
${ELF2AOUT} hello.elf $@
cplus: cplus.o
${CXX} ${LDFLAGS} -nostdlib -o cplus.elf cplus.o ${LIBS}
${OBJDUMP} -S cplus.elf > cplus.dis
${SIZE} cplus.elf
${ELF2AOUT} cplus.elf $@
echo: echo.o
${LD} ${ASLDFLAGS} -o $@.elf $@.o
${OBJDUMP} -S $@.elf > $@.dis
${SIZE} $@.elf
${ELF2AOUT} $@.elf $@
./aout $@ > $@.dis
clean:
rm -f *.o *.elf ${MAN} hello cplus *.elf *.dis tags *~

7
share/example/chello.c Normal file
View File

@@ -0,0 +1,7 @@
#include <stdio.h>
int main()
{
printf ("Hello, C World!\n");
return 0;
}

View File

@@ -1,17 +0,0 @@
TOPSRC = $(shell cd ../../..; pwd)
include $(TOPSRC)/target.mk
CFLAGS += -Werror
ASFLAGS += -DCROSS
ASLDFLAGS = --oformat=elf32-tradlittlemips -N -nostartfiles -T $(TOPSRC)/src/elf32-mips.ld
all: echo
echo: echo.o
${LD} ${ASLDFLAGS} -o $@.elf $@.o
${OBJDUMP} -S $@.elf > $@.dis
${SIZE} $@.elf
${ELF2AOUT} $@.elf $@
clean:
rm -f *.o *.elf ${MAN} echo *.elf *.dis tags *~

View File

@@ -1,50 +0,0 @@
CC = cc
PROG = hello stdarg skeleton primelist primesum test1 test2 test3 \
gpio adc rain q8 tetris lcd6
all: $(PROG)
hello: hello.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
stdarg: stdarg.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
skeleton: skeleton.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
primelist: primelist.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
primesum: primesum.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
gpio: gpio.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
adc: adc.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
rain: rain.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
q8: q8.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
tetris: tetris.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
lcd6: lcd6.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
test1: test1.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
test2: test2.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
test3: test3.c
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $?
clean:
rm -f *.o *~ $(PROG)

View File

@@ -1,27 +0,0 @@
TOPSRC = $(shell cd ../../..; pwd)
include $(TOPSRC)/target.mk
CFLAGS += -Werror -Wall
all: chello stdarg lcd6
chello: chello.o
${CC} ${LDFLAGS} -o chello.elf chello.o ${LIBS}
${OBJDUMP} -S chello.elf > chello.dis
${SIZE} chello.elf
${ELF2AOUT} chello.elf $@
tetris: tetris.o
${CC} ${LDFLAGS} -o tetris.elf tetris.o ${LIBS}
${OBJDUMP} -S tetris.elf > tetris.dis
${SIZE} tetris.elf
${ELF2AOUT} tetris.elf $@
lcd6: lcd6.o
${CC} ${LDFLAGS} -o lcd6.elf lcd6.o ${LIBS}
${OBJDUMP} -S lcd6.elf > lcd6.dis
${SIZE} lcd6.elf
${ELF2AOUT} lcd6.elf $@
clean:
rm -f *.o *.elf ${MAN} chello stdarg lcd6 *.elf *.dis tags *~

View File

@@ -1,29 +0,0 @@
/*
* Example of reading ADC data.
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
char buf[100];
int main(void)
{
int i, fd, value;
for (i=0; i<16; i++) {
sprintf(buf, "/dev/adc%d", i);
fd = open(buf, O_RDWR);
if (fd < 0) {
printf("Error: unable to open %s\n", buf);
} else {
if (read(fd, buf, 20) > 0) {
value = strtol (buf, 0, 0);
printf("adc%-2d = %d\n", i, value);
}
close(fd);
}
}
return 0;
}

Some files were not shown because too many files have changed in this diff Show More