From c1e3a3fcacf709b4ce901c3014a72f6d3726a7cf Mon Sep 17 00:00:00 2001 From: yz70s Date: Sun, 21 Aug 2016 18:44:45 +0200 Subject: [PATCH] xbox: more usb (nw) --- src/mame/includes/xbox_usb.h | 44 +++++++++++++++++++++++++++++++++-- src/mame/machine/xbox_usb.cpp | 16 ++++++------- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/src/mame/includes/xbox_usb.h b/src/mame/includes/xbox_usb.h index 5e9505d3723..b95bb3001c9 100644 --- a/src/mame/includes/xbox_usb.h +++ b/src/mame/includes/xbox_usb.h @@ -74,17 +74,57 @@ enum OHCIRegisters { enum HcControlBits { - CBSR = 1 << 0, // ControlBulkServiceRatio + CBSR = 3 << 0, // ControlBulkServiceRatio PLE = 1 << 2, // PeriodicListEnable IE = 1 << 3, // IsochronousEnable CLE = 1 << 4, // ControlListEnable BLE = 1 << 5, // BulkListEnable - HCFS = 1 << 6, // HostControllerFunctionalState + HCFS = 3 << 6, // HostControllerFunctionalState IR = 1 << 8, // InterruptRouting RWC = 1 << 9, // RemoteWakeupConnected RWE = 1 << 10 // RemoteWakeupEnable }; +enum HcCommandStatusBits +{ + HCR = 1 << 0, // HostControllerReset + CLF = 1 << 1, // ControlListFilled + BLF = 1 << 2, // BulkListFilled + OCR = 1 << 3, // OwnershipChangeRequest + SOC = 3 << 16 // SchedulingOverrunCount +}; + +enum HcInterruptEnableBits +{ + SO = 1 << 0, // SchedulingOverrun + WDH = 1 << 1, // WritebackDoneHead + SF = 1 << 2, // StartofFrame + RD = 1 << 3, // ResumeDetected + UE = 1 << 4, // UnrecoverableError + FNO = 1 << 5, // FrameNumberOverflow + RHSC = 1 << 6, // RootHubStatusChange + OC = 1 << 30, // OwnershipChange + MIE = 1 << 31, // MasterInterruptEnable +}; + + +enum HcRhDescriptorABits +{ + NDP = 0xff << 0, // NumberDownstreamPorts + PSM = 1 << 8, // PowerSwitchingMode + NPS = 1 << 9, // NoPowerSwitching + DT = 1 << 10, // DeviceType + OCPM = 1 << 11, // OverCurrentProtectionMode + NOCPM = 1 << 12, // NoOverCurrentProtection + POTPGT = 0xff << 24 // PowerOnToPowerGoodTime +}; + +enum HcRhDescriptorBBits +{ + DR = 0xffff << 0, // DeviceRemovable + PPCM = 0xffff << 16 // PortPowerControlMask +}; + enum HcRhStatusBits { LPS = 1 << 0, // LocalPowerStatus diff --git a/src/mame/machine/xbox_usb.cpp b/src/mame/machine/xbox_usb.cpp index 29d7920b634..f7b4914c62a 100644 --- a/src/mame/machine/xbox_usb.cpp +++ b/src/mame/machine/xbox_usb.cpp @@ -431,11 +431,11 @@ void ohci_usb_controller::device_timer(emu_timer &timer, device_timer_id id, int // if current endpoint descriptor is not 0 use it, otherwise ... if (ohcist.hc_regs[HcControlCurrentED] == 0) { // ... check the filled bit ... - if (ohcist.hc_regs[HcCommandStatus] & (1 << 1)) { + if (ohcist.hc_regs[HcCommandStatus] & CLF) { // ... if 1 start processing from the head of the list ohcist.hc_regs[HcControlCurrentED] = ohcist.hc_regs[HcControlHeadED]; // clear CLF (ControlListFilled) - ohcist.hc_regs[HcCommandStatus] &= ~(1 << 1); + ohcist.hc_regs[HcCommandStatus] &= ~CLF; // but if the list is empty, go to the next list if (ohcist.hc_regs[HcControlCurrentED] == 0) cont = false; @@ -457,7 +457,7 @@ void ohci_usb_controller::device_timer(emu_timer &timer, device_timer_id id, int if (ohcist.endpoint_descriptor.headp != ohcist.endpoint_descriptor.tailp) { UINT32 a, b; // set CLF (ControlListFilled) - ohcist.hc_regs[HcCommandStatus] |= (1 << 1); + ohcist.hc_regs[HcCommandStatus] |= CLF; // service transfer descriptor usb_ohci_read_transfer_descriptor(ohcist.endpoint_descriptor.headp); // get pid @@ -568,11 +568,11 @@ void ohci_usb_controller::device_timer(emu_timer &timer, device_timer_id id, int // if current endpoint descriptor is not 0 use it, otherwise ... if (ohcist.hc_regs[HcBulkCurrentED] == 0) { // ... check the filled bit ... - if (ohcist.hc_regs[HcCommandStatus] & (1 << 2)) { + if (ohcist.hc_regs[HcCommandStatus] & BLF) { // ... if 1 start processing from the head of the list ohcist.hc_regs[HcBulkCurrentED] = ohcist.hc_regs[HcBulkHeadED]; // clear BLF (BulkListFilled) - ohcist.hc_regs[HcCommandStatus] &= ~(1 << 2); + ohcist.hc_regs[HcCommandStatus] &= ~BLF; // but if the list is empty, go to the next list if (ohcist.hc_regs[HcBulkCurrentED] == 0) cont = false; @@ -593,7 +593,7 @@ void ohci_usb_controller::device_timer(emu_timer &timer, device_timer_id id, int if (ohcist.endpoint_descriptor.headp != ohcist.endpoint_descriptor.tailp) { UINT32 a, b; // set BLF (BulkListFilled) - ohcist.hc_regs[HcCommandStatus] |= (1 << 2); + ohcist.hc_regs[HcCommandStatus] |= BLF; // service transfer descriptor usb_ohci_read_transfer_descriptor(ohcist.endpoint_descriptor.headp); // get pid @@ -682,9 +682,9 @@ void ohci_usb_controller::device_timer(emu_timer &timer, device_timer_id id, int } } // go to the next list - if ((ohcist.hc_regs[HcCommandStatus] & (1 << 1)) && (ohcist.hc_regs[HcControl] & CLE)) + if ((ohcist.hc_regs[HcCommandStatus] & CLF) && (ohcist.hc_regs[HcControl] & CLE)) list = 1; // go to control list if enabled and filled - else if ((ohcist.hc_regs[HcCommandStatus] & (1 << 2)) && (ohcist.hc_regs[HcControl] & BLE)) + else if ((ohcist.hc_regs[HcCommandStatus] & BLF) && (ohcist.hc_regs[HcControl] & BLE)) list = 2; // otherwise stay in bulk list if enabled and filled else list = 0; // if no control or bulk lists, go to periodic list