Skip to content

Commit

Permalink
rcbus-6800: switch to tinydisk
Browse files Browse the repository at this point in the history
  • Loading branch information
EtchedPixels committed Dec 16, 2024
1 parent 13ae52f commit ff6e4d0
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 62 deletions.
6 changes: 3 additions & 3 deletions Kernel/platform/platform-rcbus-6800/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ ASRCS += tricks.S commonmem.S

CDSRCS = discard.c

DSRCS = ../../dev/devide.c ../../dev/blkdev.c
DISCARD_DSRCS = ../../dev/mbr.c ../../dev/devide_discard.c
DSRCS = ../../dev/tinydisk.c ../../dev/tinyide.c
DISCARD_DSRCS = ../../dev/tinydisk_discard.c ../../dev/tinyide_discard.c

COBJS = $(CSRCS:.c=$(BINEXT))
CDOBJS = $(CDSRCS:.c=$(BINEXT))
Expand Down Expand Up @@ -47,7 +47,7 @@ image: loader
$(CROSS_LD) -b -C 0x100 -S 0xF200 -Z 0x20 -o ../../fuzix.bin -m fuzix.tmpmap crt0.o commonmem.o \
rcbus-6800.o ../../start.o ../../version.o ../../cpu-6800/lowlevel-6800.o \
tricks.o main.o discard.o ../../timer.o ../../kdata.o devices.o \
blkdev.o mbr.o devide.o devide_discard.o ../../mm/memalloc_none.o \
tinydisk.o tinydisk_discard.o tinyide.o tinyide_discard.o ../../mm/memalloc_none.o \
../../devio.o ../../filesys.o ../../process.o ../../inode.o ../../syscall_fs.o \
../../syscall_proc.o ../../syscall_other.o ../../mm.o ../../swap.o ../../mm/bank16kfc.o \
../../tty.o ../../devsys.o ../../syscall_fs2.o ../../syscall_fs3.o \
Expand Down
4 changes: 2 additions & 2 deletions Kernel/platform/platform-rcbus-6800/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ rcbus-6800 -b -i emu-ide.img -1

## Things To Do

- Switch to tinydisk
- Swap support
- Stop using CONFIG_SMALL
- Serial speed/format support

- DS1302
- Dynamic bufpool
8 changes: 6 additions & 2 deletions Kernel/platform/platform-rcbus-6800/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ extern uint16_t swap_dev;
#define CONFIG_DYNAMIC_SWAP
#define swap_map(x) (x)

#define CONFIG_IDE
#define MAX_BLKDEV 1
#define CONFIG_TD_NUM 2
#define CONFIG_TD_IDE
#define CONFIG_TINYIDE_8BIT
#define IDE_IS_8BIT(x) 1

#define BOOT_TTY 513 /* Set this to default device for stdio, stderr */

Expand All @@ -61,3 +63,5 @@ extern uint16_t swap_dev;
#define BOOTDEVICENAMES "hd#"

#define CONFIG_SMALL

/* TODO DS1302 support, CONFIG_DYNAMIC_BUFPOOL */
18 changes: 7 additions & 11 deletions Kernel/platform/platform-rcbus-6800/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <version.h>
#include <kdata.h>
#include <devsys.h>
#include <blkdev.h>
#include <tinydisk.h>
#include <tty.h>
#include <devtty.h>

Expand All @@ -11,23 +11,19 @@ struct devsw dev_tab[] = /* The device driver switch table */
// minor open close read write ioctl
// -----------------------------------------------------------------
/* 0: /dev/hd - block device interface */
#ifdef CONFIG_IDE
{ blkdev_open, no_close, blkdev_read, blkdev_write, blkdev_ioctl},
#else
{ no_open, no_close, no_rdwr, no_rdwr, no_ioctl},
#endif
{ td_open, no_close, td_read, td_write, td_ioctl },
/* 1: /dev/fd - Floppy disk block devices */
#ifdef CONFIG_FLOPPY
{ fd_open, fd_close, fd_read, fd_write, no_ioctl},
{ fd_open, fd_close, fd_read, fd_write, no_ioctl },
#else
{ no_open, no_close, no_rdwr, no_rdwr, no_ioctl},
{ no_open, no_close, no_rdwr, no_rdwr, no_ioctl },
#endif
/* 2: /dev/tty TTY devices */
{ tty_open, tty_close, tty_read, tty_write, tty_ioctl },
{ tty_open, tty_close, tty_read, tty_write, tty_ioctl },
/* 3: /dev/lpr Printer devices */
{ no_open, no_close, no_rdwr, no_rdwr, no_ioctl },
{ no_open, no_close, no_rdwr, no_rdwr, no_ioctl },
/* 4: /dev/mem etc System devices (one offs) */
{ no_open, no_close, sys_read, sys_write, sys_ioctl },
{ no_open, no_close, sys_read, sys_write, sys_ioctl },
/* Pack to 7 with nxio if adding private devices and start at 8 */
};

Expand Down
19 changes: 2 additions & 17 deletions Kernel/platform/platform-rcbus-6800/discard.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#include <kernel.h>
#include <devide.h>

/* Onboard I/O */
static volatile uint8_t *cpuio = (volatile uint8_t *)0;

/*
* Map handling: allocate 4 banks per process
* Map handling: addd all the spare 16K pages
*/

void pagemap_init(void)
Expand All @@ -24,19 +21,7 @@ uint_fast8_t plt_param(char *p)
return 0;
}


/*
* We don't have a counter but a free running timer at system E clock
* rate (1.8432MHz) and compare register. We can reset the timer but
* that horks the serial port so we have to play comparison games or
* just go with the timer. Now as it happens the timer wraps 28 times
* a second to within 1%. Good enough for scheduling but will need minor
* compensation logic for the clock later TODO
*/

void device_init(void)
{
#ifdef CONFIG_IDE
devide_init();
#endif
ide_probe();
}
18 changes: 8 additions & 10 deletions Kernel/platform/platform-rcbus-6800/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#include <timer.h>
#include <kdata.h>
#include <printf.h>
#include <blkdev.h>
#include <devide.h>
#include <tinydisk.h>
#include <devtty.h>

uint8_t kernel_flag = 1;
Expand Down Expand Up @@ -38,25 +37,24 @@ void plt_interrupt(void)
}

/* For now this and the supporting logic don't handle swap */

extern uint8_t hd_map;
extern void hd_read_data(uint8_t *p);
extern void hd_write_data(uint8_t *p);

void devide_read_data(void)
void devide_read_data(uint8_t *p)
{
if (blk_op.is_user)
if (td_raw)
hd_map = 1;
else
hd_map = 0;
hd_read_data(blk_op.addr);
hd_read_data(p);
}

void devide_write_data(void)
void devide_write_data(uint8_t *p)
{
if (blk_op.is_user)
if (td_raw)
hd_map = 1;
else
hd_map = 0;
hd_write_data(blk_op.addr);
}
hd_write_data(p);
}
17 changes: 0 additions & 17 deletions Kernel/platform/platform-rcbus-6800/platform_ide.h

This file was deleted.

9 changes: 9 additions & 0 deletions Kernel/platform/platform-rcbus-6800/plt_ide.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define data ((volatile uint8_t *)0xFE10)
#define error ((volatile uint8_t *)0xFE11)
#define count ((volatile uint8_t *)0xFE12)
#define sec ((volatile uint8_t *)0xFE13)
#define cyll ((volatile uint8_t *)0xFE14)
#define cylh ((volatile uint8_t *)0xFE15)
#define devh ((volatile uint8_t *)0xFE16)
#define status ((volatile uint8_t *)0xFE17)
#define cmd ((volatile uint8_t *)0xFE17)

0 comments on commit ff6e4d0

Please sign in to comment.