-ASRCS = crt0.s tricks.s commonmem.s rc2014.s monitor.s vfdterm.s
-CSRCS = devices.c main.c devtty.c vfd-debug.c vfd-term.c
+ASRCS = crt0.s tricks.s commonmem.s rc2014.s monitor.s vfdterm.s buffers.s
+CSRCS = devices.c main.c devtty.c vfd-debug.c vfd-term.c extbuffer.c
CSRCS += devinput.c
DISCARD_CSRCS = discard.c
DISCARD_DSRCS = ../dev/devide_discard.c ../dev/ds1302_discard.c
#define MAX_SWAPS 16 /* We will size if from the partition */
/* Swap will be set up when a suitably labelled partition is seen */
#define CONFIG_DYNAMIC_SWAP
-
+/* We have lots of RAM so make better use of it for disk buffers. We grab
+ a 16K page and use it as our disk cache */
+#define CONFIG_BLKBUF_EXTERNAL
/*
* 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
#define CMDLINE NULL /* Location of root dev name */
#define BOOTDEVICENAMES "hd#,fd,,rd"
-#define CONFIG_DYNAMIC_BUFPOOL /* we expand bufpool to overwrite the _DISCARD segment at boot */
-#define NBUFS 4 /* Number of block buffers, keep in line with space reserved in zeta-v2.s */
+#define NBUFS 32 /* Number of block buffers, keep in line with space reserved in zeta-v2.s */
#define NMOUNTS 4 /* Number of mounts at a time */
#define MAX_BLKDEV 5 /* 1 floppy, 4 IDE */
#define CONFIG_NO_CLOCK
/* Floppy support */
-#define CONFIG_FLOPPY /* #define CONFIG_FLOPPY to enable floppy */
+#undef CONFIG_FLOPPY /* #define CONFIG_FLOPPY to enable floppy */
/* IDE/CF support */
#define CONFIG_IDE
-#define CONFIG_VFD_TERM /* #define CONFIG_VFD_TERM to show console output on VFD display */
+#undef CONFIG_VFD_TERM /* #define CONFIG_VFD_TERM to show console output on VFD display */
#define CONFIG_INPUT /* Input device for joystick */
#define CONFIG_INPUT_GRABMAX 0 /* No keyboard to grab */
/* Core Networking support */
-#define CONFIG_NET
+#undef CONFIG_NET
/* User mode uIP TCP/IP daemon */
-#define CONFIG_NET_NATIVE
+#undef CONFIG_NET_NATIVE
#define NUM_DEV_TTY 2
.area _HEAP
; note that areas below here may be overwritten by the heap at runtime, so
; put initialisation stuff in here
- .area _BUFFERS ; _BUFFERS grows to consume all before it (up to KERNTOP)
.area _INITIALIZER ; binman copies this to the right place for us
.area _GSINIT ; unused
.area _GSFINAL ; unused
void init_hardware_c(void)
{
-// vfd_debug_init();
#ifdef CONFIG_VFD_TERM
vfd_term_init();
#endif
ramsize = 512;
procmem = 512 - 64;
- /* zero out the initial bufpool */
- memset(bufpool, 0, (char*)bufpool_end - (char*)bufpool);
}
void pagemap_init(void)
/* RC2014 512/512K has RAM in the top 512 KiB of physical memory
* corresponding pages are 32-63 (page size is 16 KiB)
* Pages 32-34 are used by the kernel
- * Page 35 is the common area
- * Pages starting from DEV_RD_START are used by RAM disk
+ * Page 35 is the common area for init
+ * Page 36 is the disk cache
*/
- for (i = 32 + 4; i < 64; i++)
+ for (i = 32 + 5; i < 64; i++)
pagemap_add(i);
/* finally add the common area */
void map_init(void)
{
+ /* Point the buffers into the 16-32K range that will be used by
+ the buffer remap. It's an ideal location because it has no
+ vectors and is low enough it will overlay only code so we never
+ worry about copying into the overlaid address space */
+ bufptr bp = bufpool;
+ uint8_t *p = (uint8_t *)0x4000;
+ while(bp < bufpool_end) {
+ bp++->__bf_data = p;
+ p += BLKSIZE;
+ }
}
/*
lowlevel-z80.rel
platform-rc2014/tricks.rel
platform-rc2014/main.rel
+platform-rc2014/extbuffer.rel
+platform-rc2014/buffers.rel
timer.rel
kdata.rel
platform-rc2014/devfd.rel
#include <ds1302.h>
extern unsigned char irqvector;
-struct blkbuf *bufpool_end = bufpool + NBUFS; /* minimal for boot -- expanded after we're done with _DISCARD */
uint8_t timermsr = 0;
uint16_t swap_dev = 0xFFFF;
void platform_discard(void)
{
- while (bufpool_end < (struct blkbuf *) (KERNTOP - sizeof(struct blkbuf))) {
- memset(bufpool_end, 0, sizeof(struct blkbuf));
-#if BF_FREE != 0
- bufpool_end->bf_busy = BF_FREE; /* redundant when BF_FREE == 0 */
-#endif
- bufpool_end->bf_dev = NO_DEVICE;
- bufpool_end++;
- }
}
void platform_idle(void)
.globl _program_vectors
.globl map_kernel
.globl map_process
+ .globl map_buffers
+ .globl map_buffers_user
+ .globl map_buffers_user_h
.globl map_kernel_di
.globl map_process_di
.globl map_process_always
ACIA_RTS_LOW_A .EQU 0x96 ; rts low, xmit interrupt disabled
;ACIA_RTS_LOW_A .EQU 0xB6 ; rts low, xmit interrupt enabled
-;=========================================================================
-; Buffers
-;=========================================================================
- .area _BUFFERS
-_bufpool:
- .ds (BUFSIZE * 4) ; adjust NBUFS in config.h in line with this
-
;=========================================================================
; Initialization code
;=========================================================================
ld hl,#U_DATA__U_PAGE
jr map_process_2_pophl_ret
+map_buffers_user:
+ push hl
+ ld hl,(U_DATA__U_PAGE)
+ ld h,#36
+ ld (_ubuffer_pages),hl
+ ld hl,(U_DATA__U_PAGE + 2)
+ ld (_ubuffer_pages + 2),hl
+ ld hl,#_ubuffer_pages
+ jr map_process_2_pophl_ret
+
+map_buffers_user_h:
+ push hl
+ ld hl,(U_DATA__U_PAGE)
+ ld (_ubuffer_pages),hl
+ ld hl,(U_DATA__U_PAGE + 2)
+ ld l,#36
+ ld (_ubuffer_pages + 2),hl
+ ld hl,#_ubuffer_pages
+ jr map_process_2_pophl_ret
+
;=========================================================================
; map_process - map process or kernel pages
; Inputs: page table address in HL, map kernel if HL == 0
ld hl,#_kernel_pages
jr map_process_2_pophl_ret
+;=========================================================================
+; map_buffers - map kernel with disk buffers at 0x4000-0x7FFF
+; Inputs: none
+; Outputs: none; all registers preserved
+;=========================================================================
+map_buffers:
+ push hl
+ ld hl,#_kernelbuf_pages
+ jr map_process_2_pophl_ret
+
;=========================================================================
; map_process_2 - map process or kernel pages
; Inputs: page table address in HL
_kernel_pages:
.db 32,33,34,35
+; kernel page mapping with buffer window
+_kernelbuf_pages:
+ .db 32,36,34,35
+
+_ubuffer_pages:
+ .db 0,0,0,0
; memory page mapping save area for map_save/map_restore
map_savearea:
.db 0,0,0,0