From 1347154bb3026da689eb17dad6cc46162b60cf69 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sun, 5 Mar 2017 22:14:47 +0100 Subject: created doc --- AUTHORS | 1 + LICENSE | 21 ++++ TODO | 28 +++++ doc/datasheets/DM9368_7SEG_DRIVER.pdf | Bin 0 -> 212585 bytes doc/datasheets/TL16C550C_UART.pdf | Bin 0 -> 1056499 bytes doc/report/build/notes.pdf | Bin 0 -> 28265 bytes doc/report/build/z80uPC.pdf | Bin 0 -> 29047 bytes doc/report/makefile | 29 ++++++ doc/report/notes.tex | 90 ++++++++++++++++ doc/report/res/addrspace.pdf | Bin 0 -> 6465 bytes doc/report/res/addrspace.svg | 190 ++++++++++++++++++++++++++++++++++ doc/report/z80uPC.tex | 10 ++ 12 files changed, 369 insertions(+) create mode 100644 AUTHORS create mode 100644 LICENSE create mode 100644 TODO create mode 100644 doc/datasheets/DM9368_7SEG_DRIVER.pdf create mode 100644 doc/datasheets/TL16C550C_UART.pdf create mode 100644 doc/report/build/notes.pdf create mode 100644 doc/report/build/z80uPC.pdf create mode 100644 doc/report/makefile create mode 100644 doc/report/notes.tex create mode 100644 doc/report/res/addrspace.pdf create mode 100644 doc/report/res/addrspace.svg create mode 100644 doc/report/z80uPC.tex diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..f3ab365 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +nao pross diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0076984 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Nao Pross + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/TODO b/TODO new file mode 100644 index 0000000..87a131d --- /dev/null +++ b/TODO @@ -0,0 +1,28 @@ +STRUCTURE +--------- +[*] address space +[ ] pcb size (standard) +[ ] ram pages + +HARDWARE +-------- +[ ] bus buffering +[*] ROM +[*] RAM +[*] clock circuit +[ ] reset circuit +[ ] digital port interface +[ ] serial terminal +[ ] extension connector +[ ] keyboard driver +[ ] display driver +[ ] PCB layout + +SOFTWARE +-------- +[ ] bootloader +[ ] command interpreter +[ ] program loader +[ ] address editor +[ ] NVRAM eraser +[ ] data dump/copy diff --git a/doc/datasheets/DM9368_7SEG_DRIVER.pdf b/doc/datasheets/DM9368_7SEG_DRIVER.pdf new file mode 100644 index 0000000..1b2c216 Binary files /dev/null and b/doc/datasheets/DM9368_7SEG_DRIVER.pdf differ diff --git a/doc/datasheets/TL16C550C_UART.pdf b/doc/datasheets/TL16C550C_UART.pdf new file mode 100644 index 0000000..54017c9 Binary files /dev/null and b/doc/datasheets/TL16C550C_UART.pdf differ diff --git a/doc/report/build/notes.pdf b/doc/report/build/notes.pdf new file mode 100644 index 0000000..d895c04 Binary files /dev/null and b/doc/report/build/notes.pdf differ diff --git a/doc/report/build/z80uPC.pdf b/doc/report/build/z80uPC.pdf new file mode 100644 index 0000000..38b7bcd Binary files /dev/null and b/doc/report/build/z80uPC.pdf differ diff --git a/doc/report/makefile b/doc/report/makefile new file mode 100644 index 0000000..e10c0b9 --- /dev/null +++ b/doc/report/makefile @@ -0,0 +1,29 @@ +# documents +BUILD_DIR := build +RES_DIR := res + +SOURCES := z80uPC.tex notes.tex +DOCUMENTS := $(patsubst %.tex,$(BUILD_DIR)/%.pdf,$(SOURCES)) + +RES_SRC := $(wildcard $(RES_DIR)/*.svg) +RES := $(patsubst %.svg,%.pdf,$(RES_SRC)) + +# compiler settings +TEX := texfot lualatex + +# recipes +.PHONY: all dir clean +all: $(DOCUMENTS) + +$(DOCUMENTS): $(BUILD_DIR)/%.pdf: %.tex $(SOURCES) $(RES) dir + @printf "\nBuilding $< \n\n" + $(TEX) --output-directory=$(BUILD_DIR) $< + +$(RES): $(RES_DIR)/%.pdf: $(RES_DIR)/%.svg $(RES_SRC) dir + inkscape -z -D --file=$< --export-pdf=$@ + +dir: + mkdir -p $(BUILD_DIR) + +clean: + rm $(BUILD_DIR)/* diff --git a/doc/report/notes.tex b/doc/report/notes.tex new file mode 100644 index 0000000..971d85b --- /dev/null +++ b/doc/report/notes.tex @@ -0,0 +1,90 @@ +\documentclass[final, ms, a4paper, 11pt]{memoir} + +\usepackage[a4paper, inner=3cm, outer=3cm, marginpar=0pt]{geometry} +\usepackage[explicit]{titlesec} +\usepackage{wrapfig} +\usepackage{graphicx} +\usepackage{xcolor} % + +% set line height +\renewcommand{\baselinestretch}{1} +% font hyphenation +\usepackage{everysel} +\EverySelectfont{% +\fontdimen2\font=0.6em % interword space +\fontdimen3\font=0.2em % interword stretch +\fontdimen4\font=0.1em % interword shrink +\fontdimen7\font=0.9em % extra space +\hyphenchar\font=`\-% to allow hyphenation +} + + +% set section style +% \newcommand{\secstyle}[2]{[ #2 ] \textcolor{red!50!black}{\MakeUppercase{#1}}} +% \renewcommand*\thesection{\arabic{section}} % hide chapter + +\newcommand\ddate{01.01.1970} +\titleformat{\section} + {\normalfont}{- \ddate{}:}{1em} + {\textcolor{red!50!black}{\MakeUppercase{#1}} -} +% monochrome +% \titleformat{\section} +% {\normalfont}{\thesection}{1em}{\MakeUppercase{#1}} + +\begin{document} +\noindent {\Large Z80 Single Board Computer: Note e Diario di Lavoro} \\\\ +\noindent SAM Bellinzona 2016/2017 \\ +\noindent REF: Daniele Kamm \\ +\noindent PIF: Naoki Pross \\ +\vspace{5mm} + +\renewcommand\ddate{30.01.2017} +\section{Perch\`e uno Z80?} +Originariamente questo progetto era un esperimento per costruire una +cartridge per il GameBoy Classic (DMZ-01) che conteneva dell'hardware +aggiuntivo che avrebbe potuto interfacciare dell'hardware esterno con la CPU +del GameBoy. Successivamente per\`o il progetto si \`e rivelato pi\`u +complicato del previsto a causa della complessa struttura del GB (GameBoy) e +la difficolt\`a per ritrovare l'hardware stesso. Quindi sotto consiglio del +docente ho cambiato il progetto in un Single Board Computer dato che sono +interessato in informatica di basso livello e la CPU del GB era basata sul +processore Z80 con un instruction set e assembly simile. + +\renewcommand\ddate{09.02.2017} +\section{Hardware} +Dopo una ricerca abbastanza intensiva dal magazzino della scuola abbiamo trovato +i seguenti componenti principali del che utilizzer\`o per costruire il computer. +\begin{table}[h!] \centering +\begin{tabular}{ l l l l } + Z8400AB1 (Z80ACPU) & Zilog & x1 & CPU \\ + Z8420AB1 (Z80APIO) & Zilog & x1 & Port Interface \\ + Z8430AB1 (Z80ACTC) & Zilog & x1 & Timer Clock \\ + M28C64 & ST & x2 & EEPROM \\ + HM62256B & HITACHI & x1 & SRAM \\ + TL16C550C & TI & x1 & Seriale (UART / RS232) \\ +\end{tabular} +\end{table} + +Tutti gli altri componenti secondati come porte logiche e circuiti combinatori +integrati saranno indicati in una lista finale nella documentazione riassuntiva. + +\renewcommand\ddate{13.02.2017} +\section{Address space} +\begin{wrapfigure}{R}{.35\linewidth} \centering + \includegraphics[width=.9\linewidth]{res/addrspace.pdf} +\end{wrapfigure} +Come prima cosa dopo aver deciso il processore (Z80) \`e necessario definire +l'address space per decidere come collegare l'hardware. Si vede chiaramente che +la RAM usa la maggior parte dell'address space mentre la rom \`e solamente di +16KB, ma questo non \`e un problema perch\`e ho intenzione di aggiungere delle +interfacce esterne per poter collegare dispositivi di memoria come per esempio +le uSD. Dunque questa EEPROM vicina al processore sar\`a utilizzata unicamente +per il bootloader e per un sistema operativo molto basilare. + +\renewcommand\ddate{23.02.2017} +\section{Banchi di memoria} + +\renewcommand\ddate{04.03.2017} +\section{Standards e Norme} + +\end{document} diff --git a/doc/report/res/addrspace.pdf b/doc/report/res/addrspace.pdf new file mode 100644 index 0000000..2689fca Binary files /dev/null and b/doc/report/res/addrspace.pdf differ diff --git a/doc/report/res/addrspace.svg b/doc/report/res/addrspace.svg new file mode 100644 index 0000000..6af7e7f --- /dev/null +++ b/doc/report/res/addrspace.svg @@ -0,0 +1,190 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + 0x0000 + 0x2000 + 0x4000 + 0x8000 + 0xFFFF + 32KB RAM + 16KB I/OSPACE + 8KB ROM + 8KB ROM + + diff --git a/doc/report/z80uPC.tex b/doc/report/z80uPC.tex new file mode 100644 index 0000000..aa5d13c --- /dev/null +++ b/doc/report/z80uPC.tex @@ -0,0 +1,10 @@ +\documentclass[a4paper, 11pt, twoside]{article} + + + +\title{Z80 Single Board Computer Development} +\author{Naoki Pross} + +\begin{document} + \maketitle +\end{document} -- cgit v1.2.1 From 31e1544df5f97b90e855566031d5bb6d306b07c3 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sun, 5 Mar 2017 22:15:35 +0100 Subject: sw: started to implement serial on linux side --- sw/linux/config.h | 26 ++++++++++++++++++++++++++ sw/linux/src/serial.c | 20 ++++++++++++++++++++ sw/linux/src/z80prog | Bin 0 -> 34688 bytes 3 files changed, 46 insertions(+) create mode 100644 sw/linux/config.h create mode 100755 sw/linux/src/z80prog diff --git a/sw/linux/config.h b/sw/linux/config.h new file mode 100644 index 0000000..d319f43 --- /dev/null +++ b/sw/linux/config.h @@ -0,0 +1,26 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Name of package */ +#define PACKAGE "z80prog" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "naopross@tharcway.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "z80prog" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "z80prog 0.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "z80prog" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.1" + +/* Version number of package */ +#define VERSION "0.1" diff --git a/sw/linux/src/serial.c b/sw/linux/src/serial.c index a13ef45..564676b 100644 --- a/sw/linux/src/serial.c +++ b/sw/linux/src/serial.c @@ -16,7 +16,27 @@ int serial_connect(const char *devpath, long baudrate) return -1; } + // TODO: update UI or add support for custom baudrate // cfsetospeed(&tty, + // cfsetispeed(&tty, + + tty.c_cflag &= ~PARENB; // no parity + tty.c_cflag &= ~CSTOPB; // no stop bit + tty.c_cflag |= CS8; // 8 bit data + tty.c_cflag &= ~CRTSCTS; // no flow control + + tty.c_lflag = 0; // no signaling chars, no echo, no canonical processing + tty.c_oflag = 0; // no remapping, no delays + tty.c_cc[VMIN] = 0; // no block read + tty.c_cc[VTIME] = .5; // .5 seconds read timeout + + tty.c_cflag |= CREAD | CLOCAL; // turn on read and ignore ctrl lines + tty.c_iflag &= ~(IXON | IXOFF | IXANY); // turn off s/w flow ctrl + tty.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); // make raw + tty.c_oflag &= ~OPOST; // make raw + + tcflush(fd , TCIFLUSH); + // if (tcsetaddr( return fd; } diff --git a/sw/linux/src/z80prog b/sw/linux/src/z80prog new file mode 100755 index 0000000..878683b Binary files /dev/null and b/sw/linux/src/z80prog differ -- cgit v1.2.1