From: Alan Cox Date: Tue, 28 Aug 2018 16:01:59 +0000 (+0100) Subject: sbcv2: more documentation X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=31384e096722be17c25043187860515dbeb1104b;p=FUZIX.git sbcv2: more documentation --- diff --git a/Kernel/platform-sbcv2/config.h b/Kernel/platform-sbcv2/config.h index db467844..e42038be 100644 --- a/Kernel/platform-sbcv2/config.h +++ b/Kernel/platform-sbcv2/config.h @@ -1,7 +1,3 @@ -/* We have an RTC - well maybe (its optional) */ -#define CONFIG_RTC -#define CONFIG_RTC_FULL -#define CONFIG_NO_CLOCK /* Enable to make ^Z dump the inode table for debug */ #undef CONFIG_IDUMP /* Enable to make ^A drop back into the monitor */ @@ -12,56 +8,116 @@ #define CONFIG_MULTI /* Single tasking */ #undef CONFIG_SINGLETASK -/* Banked memory set up */ + +/* Select a banked memory set up */ #define CONFIG_BANK_FIXED +/* This is the number of banks of user memory available (maximum) */ #define MAX_MAPS 15 /* 512 KByte... minus the high one */ +/* How big is each bank - in our case 32K, 48K is actually more common. This + is hardware dependant */ #define MAP_SIZE 0x8000 +/* How many banks do we have in our address space */ +#define CONFIG_BANKS 2 /* 2 x 32K */ + +/* + * Define the program loading area (needs to match kernel.def) + */ +#define PROGBASE 0x0000 /* Base of user */ +#define PROGLOAD 0x0100 /* Load and run here */ +#define PROGTOP 0x7E00 /* Top of program, base of U_DATA stash */ +#define PROC_SIZE 32 /* Memory needed per process including stash */ +/* + * Definitions for swapping. + */ +#define SWAPDEV (swap_dev) /* A variable for dynamic, or a device major/minor */ +extern unsigned int swap_dev; +#define SWAP_SIZE 0x40 /* 32K in 512 byte blocks */ +#define SWAPBASE 0x0000 /* We swap the lot in one, include the */ +#define SWAPTOP 0x8000 /* vectors so its a round number of sectors */ + +#define MAX_SWAPS 16 /* Maximum number of swapped out processes. + As we use the default 15 process max this + is definitely sufficient (14 would do) */ +/* + * When the kernel swaps something it needs to map the right page into + * memory using map_for_swap and then turn the user address into a + * physical address. For a simple banked setup there is no conversion + * needed so identity map it. + */ +#define swap_map(x) ((uint8_t *)(x)) /* Set these two for networking - no point right now */ //#define CONFIG_NET //#define CONFIG_NET_NATIVE -/* PPIDE is present */ + +/* What is the maximum number of /dev/hd devices we have. In theory right now + it's actually 3 - two in the IDE and one on the SD interface */ +#define MAX_BLKDEV 4 +/* Select IDE disk support, and PPIDE (parallel port IDE) as the interface */ #define CONFIG_IDE -#define CONFIG_PPIDE +#define CONFIG_PPIDE /* PPIDE is present */ + /* Floppy controller does not do high density. Well it does but we can't keep up at 4MHz so default to 720K media for now */ #define CONFIG_FLOPPY_NOHD +/* We will resize the buffers available after boot. This is the normal setting */ #define CONFIG_DYNAMIC_BUFPOOL +/* Swap will be set up when a suitably labelled partition is seen */ #define CONFIG_DYNAMIC_SWAP +/* Larger transfers (including process execution) should go directly not via + the buffer cache. For all small (eg bit) systems this is the right setting + as it avoids polluting the small cache with data when it needs to be full + of directory and inode information */ #define CONFIG_LARGE_IO_DIRECT -#define MAX_BLKDEV 4 - -#define CONFIG_BANKS 2 /* 2 x 32K */ - +/* Specify this if there is a real time clock capable of reporting seconds. It + will be used to lock the kernel time better to reality. Other details like + Y2K support, or even supporting dates as well don't matter */ +#define CONFIG_RTC +/* Specify that there is a full real time clock that can supply the date and + time to the system. */ +#define CONFIG_RTC_FULL +/* Set this if the system has no proper real time clock (or has configurations + where it lacks one). This is not usually needed but for platforms it is also + see platform-sbcv2/main.c on what is needed */ +#define CONFIG_NO_CLOCK +/* + * How fast does the clock tick (if present), or how many times a second do + * we simulate if not. For a machine without video 10 is a good number. If + * you have video you probably want whatever vertical sync/blank interrupt + * rate the machine has. For many systems it's whatever the hardware gives + * you. + * + * Note that this needs to be divisible by 10 and at least 10. If your clock + * is a bit slower you may need to fudge things somewhat so that the kernel + * gets 10 timer interrupt calls per second. + */ #define TICKSPERSEC 10 /* Ticks per second */ -#define PROGBASE 0x0000 /* Base of user */ -#define PROGLOAD 0x0100 /* Load and run here */ -#define PROGTOP 0x7E00 /* Top of program, base of U_DATA stash */ -#define PROC_SIZE 32 /* Memory needed per process */ - -#define SWAPDEV (swap_dev) -#define SWAP_SIZE 0x40 /* 32K in blocks */ -#define SWAPBASE 0x0000 /* We swap the lot in one, include the */ -#define SWAPTOP 0x8000 /* vectors so its a round number of sectors */ - -#define MAX_SWAPS 16 /* Should be plenty */ - -#define swap_map(x) ((uint8_t *)(x)) +/* + * The device (major/minor) for the console and boot up tty attached to + * init at start up. 512 is the major 2, so all the tty devices are + * 512 + n where n is the tty. + */ #define BOOT_TTY (512 + 1) /* Set this to default device for stdio, stderr */ /* In this case, the default is the first TTY device */ - -/* We need a tidier way to do this from the loader */ +/* + * If you have a mechanism to pass in a root device configuration then + * this holds the address of the buffer (eg a CP/M command line or similar). + * If the configuration is fixed then this can be a string holding the + * configuration. NULL means 'prompt the user'. + */ #define CMDLINE NULL /* Location of root dev name */ /* Device parameters */ -#define NUM_DEV_TTY 2 +#define NUM_DEV_TTY 2 /* How many tty devices does the platform support */ #define TTYDEV BOOT_TTY /* Device used by kernel for messages, panics */ -#define NBUFS 5 /* Number of block buffers */ +#define NBUFS 5 /* Number of block buffers. Must be 4+ and must match + kernel.def */ #define NMOUNTS 4 /* Number of mounts at a time */ +/* This can optionally be set to force a default baud rate, eg if the system + console should match a firmware set rate */ #define TTY_INIT_BAUD B38400 /* To match ROMWBW */ -extern unsigned int swap_dev; diff --git a/Kernel/platform-sbcv2/kernel.def b/Kernel/platform-sbcv2/kernel.def index ca90eb87..581d8215 100644 --- a/Kernel/platform-sbcv2/kernel.def +++ b/Kernel/platform-sbcv2/kernel.def @@ -1,21 +1,51 @@ -; FUZIX mnemonics for memory addresses etc - +; FUZIX mnemonics for memory addresses etc +; +; +; The U_DATA address. If we are doing a normal build this is the start +; of common memory. We do actually have a symbol for udata so +; eventually this needs to go away +; U_DATA .equ 0xF000 ; (this is struct u_data from kernel.h) U_DATA__TOTALSIZE .equ 0x200 ; 256+256 bytes) - +; +; Space for the udata of a switched out process within the bank of +; memory that it uses. Normally placed at the very top +; U_DATA_STASH .equ 0x7E00 ; 7E00-7FFF - +; +; Z80 systems start program space at 0, and load at 0x100 so that the +; low 256 bytes are free for syscall vectors and the like, with some +; also used as a special case by the CP/M emulator. +; PROGBASE .equ 0x0000 PROGLOAD .equ 0x0100 - +; +; CPU type +; 0 = CMOS Z80 +; 1 = NMOS Z80 (also works with CMOS) +; 2 = Z180 +; +; If either NMOS or CMOS may be present pick NMOS as the NMOS build +; contains extra code to work around an erratum n the NUMS Z80 +; Z80_TYPE .equ 1 ; NMOS (IRQ bugs) Z80 - +; +; For special platforms that have external memory protectuon hardware +; Just say 0. +; Z80_MMU_HOOKS .equ 0 - +; +; Set this if the platform has swap enabled in config.h +; CONFIG_SWAP .equ 1 - +; +; The number of disk buffers. Must match config.h +; NBUFS .equ 5 - +; +; Configuration for the Zeta floppy controller. Specific to that +; driver rather than generic. +; ; FDC9266 floppy controller ports FDC_CCR .equ 0 ; No CCR FDC_MSR .equ 0x36 ; 8272 Main Status Register (R/O) diff --git a/Kernel/platform-sbcv2/target.mk b/Kernel/platform-sbcv2/target.mk index 3bffcde0..4f5b9269 100644 --- a/Kernel/platform-sbcv2/target.mk +++ b/Kernel/platform-sbcv2/target.mk @@ -1 +1,4 @@ +# +# Tell the build system what processor type we are using +# export CPU = z80