From 81114030bddfeb9e4bc1745f6a91730387a193da Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 7 May 2023 01:05:35 +0600 Subject: [PATCH 1/3] usb: Increment HcFmNumber in EOF function --- src/usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/usb.c b/src/usb.c index cde3ee4a9..897f07bdc 100644 --- a/src/usb.c +++ b/src/usb.c @@ -243,6 +243,7 @@ void ohci_end_of_frame(usb_t* dev) { /* TODO: Put endpoint and transfer descriptor processing here. */ + dev->ohci_mmio_w[OHCI_HcFmNumber / 2]++; } void @@ -262,8 +263,9 @@ ohci_update_frame_counter(void* priv) dev->ohci_mmio_w[OHCI_HcFmRemaining / 2] = dev->ohci_mmio_w[OHCI_HcFmInterval / 2] & 0x3fff; dev->ohci_mmio_l[OHCI_HcFmRemaining / 4] &= ~(1 << 31); dev->ohci_mmio_l[OHCI_HcFmRemaining / 4] |= dev->ohci_mmio_l[OHCI_HcFmInterval / 4] & (1 << 31); - dev->ohci_mmio_w[OHCI_HcFmNumber / 2]++; ohci_start_of_frame(dev); + timer_on_auto(&dev->ohci_frame_timer, 1. / (12. * 1000. * 1000.)); + return; } if (dev->ohci_mmio_w[OHCI_HcFmRemaining / 2]) dev->ohci_mmio_w[OHCI_HcFmRemaining / 2]--; timer_on_auto(&dev->ohci_frame_timer, 1. / (12. * 1000. * 1000.)); From 610db29480d59cd96ead69ca2cb72b7aa11c3f66 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 7 May 2023 01:11:38 +0600 Subject: [PATCH 2/3] usb: HCCA structure --- src/include/86box/usb.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/include/86box/usb.h b/src/include/86box/usb.h index af1922570..ab9ae53a7 100644 --- a/src/include/86box/usb.h +++ b/src/include/86box/usb.h @@ -76,6 +76,15 @@ typedef struct } usb_desc_conf_t; #pragma pack(pop) +typedef struct +{ + uint32_t HccaInterrruptTable[32]; + uint16_t HccaFrameNumber; + uint16_t HccaPad1; + uint32_t HccaDoneHead; + uint32_t Reserved[29]; +} usb_hcca_t; + /* USB endpoint device struct. Incomplete and unused. */ typedef struct { From d0efb0079fb1f48d1fda83c772f410893f22916a Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 7 May 2023 01:16:18 +0600 Subject: [PATCH 3/3] usb: include dma.h header for future busmastering usage --- src/usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/usb.c b/src/usb.c index 897f07bdc..f0c7113b7 100644 --- a/src/usb.c +++ b/src/usb.c @@ -28,6 +28,7 @@ #include <86box/mem.h> #include <86box/timer.h> #include <86box/usb.h> +#include <86box/dma.h> #ifdef ENABLE_USB_LOG int usb_do_log = ENABLE_USB_LOG;