From 7dbe9a5abb2008cfec33ab17463b96279264a41a Mon Sep 17 00:00:00 2001 From: Dean Netherton Date: Tue, 15 Jul 2025 11:08:41 +1000 Subject: [PATCH] ch376-native: updated readme notes and adjusted config for Z80 and eZ80 to not by default, enable the USB drivers --- Source/HBIOS/Config/RCEZ80_std.asm | 17 +++--- Source/HBIOS/Config/RCZ80_std.asm | 15 ++--- Source/HBIOS/ch376-native/keyboard.s | 2 +- Source/HBIOS/ch376-native/readme.md | 89 ++++++++++++++++++++++++---- Source/HBIOS/ch376-native/scsi-drv.s | 2 +- Source/HBIOS/ch376-native/ufi-drv.s | 2 +- 6 files changed, 93 insertions(+), 34 deletions(-) diff --git a/Source/HBIOS/Config/RCEZ80_std.asm b/Source/HBIOS/Config/RCEZ80_std.asm index 760f4c7d..12411306 100644 --- a/Source/HBIOS/Config/RCEZ80_std.asm +++ b/Source/HBIOS/Config/RCEZ80_std.asm @@ -71,6 +71,14 @@ PPIDEENABLE .SET TRUE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) SDENABLE .SET FALSE ; SD: ENABLE SD CARD DISK DRIVER (SD.ASM) SDMODE .SET SDMODE_PIO ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4|SC|MT|USR|PIO|Z80R|EPITX|FZ80|GM|EZ512|K80W] SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY +; +CHENABLE .SET TRUE ; CH: ENABLE CH375/376 USB SUPPORT +CHNATIVEENABLE .SET FALSE ; CH376: ENABLE CH376 NATIVE USB DRIVER +CHSCSIENABLE .SET FALSE ; CH376: ENABLE CH376 NATIVE MASS STORAGE DEVICES (REQUIRES CHNATIVEENABLE) +CHUFIENABLE .SET FALSE ; CH376: ENABLE CH376 NATIVE UFI FLOPPY DISK DEVICES (REQUIRES CHNATIVEENABLE) +CHNATIVEEZ80 .SET TRUE ; CH376: DELEGATE USB DRIVERS TO EZ80'S FIRMWARE +CHNATIVEFORCE .SET FALSE ; CH376: DISABLE AUTO-DETECTION OF MODULE - ASSUME ITS INSTALLED +; PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) ; LPTENABLE .SET FALSE ; LPT: ENABLE CENTRONICS PRINTER DRIVER (LPT.ASM) @@ -83,13 +91,4 @@ AY38910ENABLE .SET FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC|DUO|NABU] AY_FORCE .SET FALSE ; AY: BYPASS AUTO-DETECT, FORCED PRESENT -CHENABLE .SET FALSE ; CH: ENABLE CH375/376 USB SUPPORT -CH0USBENABLE .SET FALSE ; CH375: ENABLE CH375 USB DRIVER -CH1USBENABLE .SET FALSE ; CH376: ENABLE CH376 USB DRIVER -CHNATIVEENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE USB DRIVER -CHSCSIENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE MASS STORAGE DEVICES (REQUIRES CHNATIVEENABLE) -CHUFIENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE UFI FLOPPY DISK DEVICES (REQUIRES CHNATIVEENABLE) -CHNATIVEEZ80 .SET TRUE ; CH376: DELEGATE USB DRIVERS TO EZ80'S FIRMWARE -CHNATIVEFORCE .SET TRUE ; CH376: DISABLE AUTO-DETECTION OF MODULE - ASSUME ITS INSTALLED - EZ80TIMER .SET EZ80TMR_FIRM ; EZ80: TIMER TICK MODEL: EZ80TMR_[INT|FIRM] diff --git a/Source/HBIOS/Config/RCZ80_std.asm b/Source/HBIOS/Config/RCZ80_std.asm index dd81ef6b..f8cce67c 100644 --- a/Source/HBIOS/Config/RCZ80_std.asm +++ b/Source/HBIOS/Config/RCZ80_std.asm @@ -72,7 +72,7 @@ ACIAENABLE .SET TRUE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) ; TMSENABLE .SET FALSE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) -TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MSX|MSXKBD|MSXMKY|MBC|COLECO|DUO|NABU] +TMSMODE .SET TMSMODE_MSX ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MSX|MSXKBD|MSXMKY|MBC|COLECO|DUO|NABU|MSXUKY] TMS80COLS .SET FALSE ; TMS: ENABLE 80 COLUMN SCREEN, REQUIRES V9958 TMSTIMENABLE .SET FALSE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) VRCENABLE .SET FALSE ; VRC: ENABLE VGARC VIDEO/KBD DRIVER (VRC.ASM) @@ -92,6 +92,10 @@ SDMODE .SET SDMODE_PIO ; SD: DRIVER MODE: SDMODE_[JUHA|N8|CSIO|PPI|UART|DSD|MK4 SDCNT .SET 1 ; SD: NUMBER OF SD CARD DEVICES (1-2), FOR DSD/SC/MT ONLY ; CHENABLE .SET TRUE ; CH: ENABLE CH375/376 USB SUPPORT +CHNATIVEENABLE .SET FALSE ; CH376: ENABLE CH376 NATIVE USB DRIVER +CHSCSIENABLE .SET FALSE ; CH376: ENABLE CH376 NATIVE MASS STORAGE DEVICES (REQUIRES CHNATIVEENABLE) +CHUFIENABLE .SET FALSE ; CH376: ENABLE CH376 NATIVE UFI FLOPPY DISK DEVICES (REQUIRES CHNATIVEENABLE) +CHNATIVEFORCE .SET FALSE ; CH376: DISABLE AUTO-DETECTION OF MODULE - ASSUME ITS INSTALLED ; PRPENABLE .SET FALSE ; PRP: ENABLE ECB PROPELLER IO BOARD DRIVER (PRP.ASM) ; @@ -106,12 +110,3 @@ SN76489ENABLE .SET FALSE ; SN: ENABLE SN76489 SOUND DRIVER AY38910ENABLE .SET FALSE ; AY: ENABLE AY-3-8910 / YM2149 SOUND DRIVER AYMODE .SET AYMODE_RCZ80 ; AY: DRIVER MODE: AYMODE_[SCG|N8|RCZ80|RCZ180|MSX|LINC|MBC|DUO|NABU] AY_FORCE .SET FALSE ; AY: BYPASS AUTO-DETECT, FORCED PRESENT - -CHENABLE .SET FALSE ; CH: ENABLE CH375/376 USB SUPPORT -CH0USBENABLE .SET FALSE ; CH375: ENABLE CH375 USB DRIVER -CH1USBENABLE .SET FALSE ; CH376: ENABLE CH376 USB DRIVER -CHNATIVEENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE USB DRIVER -CHNATIVEFORCE .SET TRUE ; CH376: DISABLE AUTO-DETECTION OF MODULE - ASSUME ITS INSTALLED -CHSCSIENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE MASS STORAGE DEVICES (REQUIRES CHNATIVEENABLE) -CHUFIENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE UFI FLOPPY DISK DEVICES (REQUIRES CHNATIVEENABLE) -USBKYBENABLE .SET TRUE ; USB KEYBOARD DRIVER diff --git a/Source/HBIOS/ch376-native/keyboard.s b/Source/HBIOS/ch376-native/keyboard.s index 221b24c7..abc73e8a 100644 --- a/Source/HBIOS/ch376-native/keyboard.s +++ b/Source/HBIOS/ch376-native/keyboard.s @@ -5,7 +5,7 @@ #IF (!CHNATIVEEZ80) #include "ch376-native/keyboard/class_hid_keyboard.c.s" #ENDIF -#include "ch376-native/keyboard/kyb-init.c.s" #IF (!CHNATIVEEZ80) #include "ch376-native/keyboard/kyb_driver.c.s" #ENDIF +#include "ch376-native/keyboard/kyb-init.c.s" diff --git a/Source/HBIOS/ch376-native/readme.md b/Source/HBIOS/ch376-native/readme.md index 8fbb46fb..f92ffd8c 100644 --- a/Source/HBIOS/ch376-native/readme.md +++ b/Source/HBIOS/ch376-native/readme.md @@ -11,50 +11,115 @@ The build process, is a 3 stage process. The original C code and produced/translated .s files are all committed units in the repo. But it is expected, that only the c files are to be modified/updated. -The .s files are checked in, to builders to not require the C compiler tool chain (z88dk) to be installed. +The .s files are checked in, so builders do not require the C compiler tool chain (z88dk) to be installed. -The c compiling/translating process is also only support on linux, as the script to translate the .asm files +The c compiling/translating process is only supported on linux, as the script to translate the .asm files to .s files is a linux bash script. (Although the script can be easily run within Windows's Sub-system for linux) ## Compiling the C code -To compile the c code, to update the .s files: +> Requires linux with docker installed. -Within the `Source/HBIOS/ch376-native` directly: +> The C code only needs to be recompiled if and when you change any of the `.c` source files. + +To compile the `.c` code to generate updated `.s` files: + +Within the `Source/HBIOS/ch376-native` directory: ``` make ``` -The make script will search for z88dk's `zcc` compiler, if not found, will attempt to use a docker wrapper. +The make script will search for z88dk's `zcc` compiler, if not found, will attempt to use a docker wrapper. It will not work if z88dk or docker is not installed. ## USB Native Driver systems +The default builds of RomWBW do not enable the CH376 native usb drivers. These drivers take a reasonable chunk of ROM space. As such you +will need to build a new HBIOS image customised for your platform. Please familiarise yourself with the HBIOS/RomWBW build and configuration process. + The usb driver is divided into a few sub-system, which can be individually enabled within the standard HBIOS config files. -### base-drv +For activating the full native USB support, the non native CH365 drivers need to be disabled and the relevant `CHNATIVE` drivers enabled + +Example: + +``` +CHENABLE .SET FALSE ; CH: ENABLE CH375/376 USB SUPPORT +CH0USBENABLE .SET FALSE ; CH375: ENABLE CH375 USB DRIVER +CH1USBENABLE .SET FALSE ; CH376: ENABLE CH376 USB DRIVER +CHNATIVEENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE USB DRIVER +CHSCSIENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE MASS STORAGE DEVICES (REQUIRES CHNATIVEENABLE) +CHUFIENABLE .SET TRUE ; CH376: ENABLE CH376 NATIVE UFI FLOPPY DISK DEVICES (REQUIRES CHNATIVEENABLE) +CHNATIVEEZ80 .SET FALSE ; CH376: DELEGATE USB DRIVERS TO EZ80'S FIRMWARE +CHNATIVEFORCE .SET TRUE ; CH376: DISABLE AUTO-DETECTION OF MODULE - ASSUME ITS INSTALLED +``` -The `base-drv` system contains the core code to discover, enumerate, and communicate to USB devices. +As the USB driver is a fairly large, you may need to disable other HBIOS drivers in your configuration. As such, it is +recommend to only enable drivers for your platform's hardware configuration - for example, enable only the serial driver +required for your system. -It also includes the driver code for enumerate and operating USB devices on USB hubs. +``` +DUARTENABLE .SET FALSE ; DUART: ENABLE 2681/2692 SERIAL DRIVER (DUART.ASM) +UARTENABLE .SET FALSE ; UART: ENABLE 8250/16550-LIKE SERIAL DRIVER (UART.ASM) +ACIAENABLE .SET FALSE ; ACIA: ENABLE MOTOROLA 6850 ACIA DRIVER (ACIA.ASM) +SIOENABLE .SET TRUE ; SIO: ENABLE ZILOG SIO SERIAL DRIVER (SIO.ASM) +``` + +You may also need to disable other storage drivers: + +``` +FDENABLE .SET FALSE ; FD: ENABLE FLOPPY DISK DRIVER (FD.ASM) +IDEENABLE .SET FALSE ; IDE: ENABLE IDE DISK DRIVER (IDE.ASM) +PPIDEENABLE .SET FALSE ; PPIDE: ENABLE PARALLEL PORT IDE DISK DRIVER (PPIDE.ASM) +``` -### scsi-drv +### base-drv `CHNATIVEENABLE` + +The `base-drv` system contains the core code to discover, enumerate, and communicate with USB devices. + +It also includes the driver code to enumerate and operating USB devices through a USB hub. + +### scsi-drv `CHSCSIENABLE` The `scsi-drv` system can be enabled with the HBIOS config `CHSCSIENABLE` When activated, access to most USB mass storage devices (thumb drives, magnetic usb drives) is enabled. -### ufi-drv +### ufi-drv `CHUFIENABLE` The `ufi-drv` system can be enabled with the HBIOS config `CHUFIENABLE` When activated, access to 3.5" Floppy USB devices will be enabled. -### keyboard +### keyboard `TMSMODE_MSXUKY` + +The `keyboard` system can be enabled with the inferred config entry `USBKYBENABLE` + +This config item is not to be directly set, but is activated via the TMS keyboard driver + +Example configuration, combined with the TMS VDP module driver. -The `keyboard` system can be enabled with the HBIOS config `USBKYBENABLE` +``` +TMSENABLE .SET TRUE ; TMS: ENABLE TMS9918 VIDEO/KBD DRIVER (TMS.ASM) +TMSMODE .SET TMSMODE_MSXUKY ; TMS: DRIVER MODE: TMSMODE_[SCG|N8|MSX|MSXKBD|MSXMKY|MBC|COLECO|DUO|NABU|MSXUKY] +TMS80COLS .SET FALSE ; TMS: ENABLE 80 COLUMN SCREEN, REQUIRES V9958 +TMSTIMENABLE .SET TRUE ; TMS: ENABLE TIMER INTERRUPTS (REQUIRES IM1) +``` When activated, usb keyboards can be used as input devices. +### Force activation `CHNATIVEFORCE` + +The CH376 module, during a cold power on boot, can take many seconds before it will +respond to the CPU. As such, the CPU may fail to detect the presence of the module. + +A manual reset (without power cycling) generally enables detection. The config entry +`CHNATIVEFORCE` can be enabled to force the CPU to always wait for the module to come online. + + +### eZ80 support `CHNATIVEEZ80` +If you have the eZ80 CPU installed with onboard USB firmware support, you +can gain performance by delegating HBIOS to the firmware implementation. To enable +delegation, enable the config entry `CHNATIVEEZ80` diff --git a/Source/HBIOS/ch376-native/scsi-drv.s b/Source/HBIOS/ch376-native/scsi-drv.s index 3723445a..ea6f8a70 100644 --- a/Source/HBIOS/ch376-native/scsi-drv.s +++ b/Source/HBIOS/ch376-native/scsi-drv.s @@ -2,7 +2,7 @@ #IF (!CHNATIVEEZ80) #include "ch376-native/scsi-drv/class_scsi.c.s" #ENDIF -#include "ch376-native/scsi-drv/scsi-init.c.s" #IF (!CHNATIVEEZ80) #include "ch376-native/scsi-drv/scsi_driver.c.s" #ENDIF +#include "ch376-native/scsi-drv/scsi-init.c.s" diff --git a/Source/HBIOS/ch376-native/ufi-drv.s b/Source/HBIOS/ch376-native/ufi-drv.s index d37ebb30..bcc735b4 100644 --- a/Source/HBIOS/ch376-native/ufi-drv.s +++ b/Source/HBIOS/ch376-native/ufi-drv.s @@ -2,10 +2,10 @@ #IF (!CHNATIVEEZ80) #include "ch376-native/ufi-drv/class_ufi.c.s" #ENDIF -#include "ch376-native/ufi-drv/ufi-init.c.s" #IF (!CHNATIVEEZ80) #include "ch376-native/ufi-drv/ufi_driver.c.s" #ENDIF +#include "ch376-native/ufi-drv/ufi-init.c.s" #IF (!CHNATIVEEZ80) #include "ch376-native/ufi-drv/usb_cbi.c.s" #ENDIF