ReactOS 0.4.16-dev-329-g9223134
usbuhci.h File Reference
#include <ntddk.h>
#include <windef.h>
#include <stdio.h>
#include <hubbusif.h>
#include <usbbusif.h>
#include <usbdlib.h>
#include <drivers/usbport/usbmport.h>
#include "hardware.h"
Include dependency graph for usbuhci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _UHCI_HCD_TD
 
struct  _UHCI_HCD_QH
 
struct  _UHCI_ENDPOINT
 
struct  _UHCI_TRANSFER
 
struct  _UHCI_HC_RESOURCES
 
struct  _UHCI_EXTENSION
 

Macros

#define UHCI_MAX_HC_SCHEDULE_ERRORS   16
 
#define UHCI_MAX_ISO_TRANSFER_SIZE   0x10000
 
#define UHCI_MAX_BULK_TRANSFER_SIZE   0x1000
 
#define UHCI_MAX_ISO_TD_COUNT   256
 
#define UHCI_MAX_INTERRUPT_TD_COUNT   8
 
#define UHCI_HCD_TD_FLAG_ALLOCATED   0x00000001
 
#define UHCI_HCD_TD_FLAG_PROCESSED   0x00000002
 
#define UHCI_HCD_TD_FLAG_DONE   0x00000008
 
#define UHCI_HCD_TD_FLAG_NOT_ACCESSED   0x00000010
 
#define UHCI_HCD_TD_FLAG_DATA_BUFFER   0x00000020
 
#define UHCI_HCD_TD_FLAG_GOOD_FRAME   0x00000040
 
#define UHCI_HCD_TD_FLAG_CONTROLL   0x00000400
 
#define UHCI_HCD_TD_FLAG_STALLED_SETUP   0x00000800
 
#define UHCI_HCD_QH_FLAG_ACTIVE   0x00000001
 
#define UHCI_HCD_QH_FLAG_REMOVE   0x00000002
 
#define UHCI_ENDPOINT_FLAG_HALTED   1
 
#define UHCI_ENDPOINT_FLAG_RESERVED   2
 
#define UHCI_ENDPOINT_FLAG_CONTROL_OR_ISO   4
 
#define UHCI_FRAME_LIST_POINTER_VALID   (0 << 0)
 
#define UHCI_FRAME_LIST_POINTER_TERMINATE   (1 << 0)
 
#define UHCI_FRAME_LIST_POINTER_TD   (0 << 1)
 
#define UHCI_FRAME_LIST_POINTER_QH   (1 << 1)
 
#define UHCI_FRAME_LIST_INDEX_MASK   0x3FF
 
#define UHCI_MAX_STATIC_SOF_TDS   8
 
#define UHCI_EXTENSION_FLAG_SUSPENDED   0x00000002
 

Typedefs

typedef struct _UHCI_ENDPOINTPUHCI_ENDPOINT
 
typedef struct _UHCI_TRANSFERPUHCI_TRANSFER
 
typedef struct _UHCI_HCD_TD UHCI_HCD_TD
 
typedef struct _UHCI_HCD_TDPUHCI_HCD_TD
 
typedef struct _UHCI_HCD_QH UHCI_HCD_QH
 
typedef struct _UHCI_HCD_QHPUHCI_HCD_QH
 
typedef struct _UHCI_ENDPOINT UHCI_ENDPOINT
 
typedef struct _UHCI_TRANSFER UHCI_TRANSFER
 
typedef struct _UHCI_HC_RESOURCES UHCI_HC_RESOURCES
 
typedef struct _UHCI_HC_RESOURCESPUHCI_HC_RESOURCES
 
typedef struct _UHCI_EXTENSION UHCI_EXTENSION
 
typedef struct _UHCI_EXTENSIONPUHCI_EXTENSION
 

Functions

 C_ASSERT (sizeof(UHCI_HCD_TD)==0x40)
 
 C_ASSERT (sizeof(UHCI_HCD_QH)==0x40)
 
VOID NTAPI UhciRHGetRootHubData (IN PVOID uhciExtension, IN PVOID rootHubData)
 
MPSTATUS NTAPI UhciRHGetStatus (IN PVOID uhciExtension, IN PUSHORT Status)
 
MPSTATUS NTAPI UhciRHGetPortStatus (IN PVOID uhciExtension, IN USHORT Port, IN PUSB_PORT_STATUS_AND_CHANGE PortStatus)
 
MPSTATUS NTAPI UhciRHGetHubStatus (IN PVOID uhciExtension, IN PUSB_HUB_STATUS_AND_CHANGE HubStatus)
 
MPSTATUS NTAPI UhciRHSetFeaturePortReset (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHSetFeaturePortPower (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHSetFeaturePortEnable (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHSetFeaturePortSuspend (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHClearFeaturePortEnable (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHClearFeaturePortPower (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHClearFeaturePortSuspend (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHClearFeaturePortEnableChange (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHClearFeaturePortConnectChange (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHClearFeaturePortResetChange (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHClearFeaturePortSuspendChange (IN PVOID uhciExtension, IN USHORT Port)
 
MPSTATUS NTAPI UhciRHClearFeaturePortOvercurrentChange (IN PVOID uhciExtension, IN USHORT Port)
 
VOID NTAPI UhciRHDisableIrq (IN PVOID uhciExtension)
 
VOID NTAPI UhciRHEnableIrq (IN PVOID uhciExtension)
 
VOID NTAPI UhciDisableInterrupts (IN PVOID uhciExtension)
 
ULONG NTAPI UhciGet32BitFrameNumber (IN PVOID uhciExtension)
 
BOOLEAN NTAPI UhciHardwarePresent (IN PUHCI_EXTENSION UhciExtension)
 

Variables

USBPORT_REGISTRATION_PACKET RegPacket
 

Macro Definition Documentation

◆ UHCI_ENDPOINT_FLAG_CONTROL_OR_ISO

#define UHCI_ENDPOINT_FLAG_CONTROL_OR_ISO   4

Definition at line 105 of file usbuhci.h.

◆ UHCI_ENDPOINT_FLAG_HALTED

#define UHCI_ENDPOINT_FLAG_HALTED   1

Definition at line 103 of file usbuhci.h.

◆ UHCI_ENDPOINT_FLAG_RESERVED

#define UHCI_ENDPOINT_FLAG_RESERVED   2

Definition at line 104 of file usbuhci.h.

◆ UHCI_EXTENSION_FLAG_SUSPENDED

#define UHCI_EXTENSION_FLAG_SUSPENDED   0x00000002

Definition at line 150 of file usbuhci.h.

◆ UHCI_FRAME_LIST_INDEX_MASK

#define UHCI_FRAME_LIST_INDEX_MASK   0x3FF

Definition at line 137 of file usbuhci.h.

◆ UHCI_FRAME_LIST_POINTER_QH

#define UHCI_FRAME_LIST_POINTER_QH   (1 << 1)

Definition at line 135 of file usbuhci.h.

◆ UHCI_FRAME_LIST_POINTER_TD

#define UHCI_FRAME_LIST_POINTER_TD   (0 << 1)

Definition at line 134 of file usbuhci.h.

◆ UHCI_FRAME_LIST_POINTER_TERMINATE

#define UHCI_FRAME_LIST_POINTER_TERMINATE   (1 << 0)

Definition at line 133 of file usbuhci.h.

◆ UHCI_FRAME_LIST_POINTER_VALID

#define UHCI_FRAME_LIST_POINTER_VALID   (0 << 0)

Definition at line 132 of file usbuhci.h.

◆ UHCI_HCD_QH_FLAG_ACTIVE

#define UHCI_HCD_QH_FLAG_ACTIVE   0x00000001

Definition at line 77 of file usbuhci.h.

◆ UHCI_HCD_QH_FLAG_REMOVE

#define UHCI_HCD_QH_FLAG_REMOVE   0x00000002

Definition at line 78 of file usbuhci.h.

◆ UHCI_HCD_TD_FLAG_ALLOCATED

#define UHCI_HCD_TD_FLAG_ALLOCATED   0x00000001

Definition at line 31 of file usbuhci.h.

◆ UHCI_HCD_TD_FLAG_CONTROLL

#define UHCI_HCD_TD_FLAG_CONTROLL   0x00000400

Definition at line 37 of file usbuhci.h.

◆ UHCI_HCD_TD_FLAG_DATA_BUFFER

#define UHCI_HCD_TD_FLAG_DATA_BUFFER   0x00000020

Definition at line 35 of file usbuhci.h.

◆ UHCI_HCD_TD_FLAG_DONE

#define UHCI_HCD_TD_FLAG_DONE   0x00000008

Definition at line 33 of file usbuhci.h.

◆ UHCI_HCD_TD_FLAG_GOOD_FRAME

#define UHCI_HCD_TD_FLAG_GOOD_FRAME   0x00000040

Definition at line 36 of file usbuhci.h.

◆ UHCI_HCD_TD_FLAG_NOT_ACCESSED

#define UHCI_HCD_TD_FLAG_NOT_ACCESSED   0x00000010

Definition at line 34 of file usbuhci.h.

◆ UHCI_HCD_TD_FLAG_PROCESSED

#define UHCI_HCD_TD_FLAG_PROCESSED   0x00000002

Definition at line 32 of file usbuhci.h.

◆ UHCI_HCD_TD_FLAG_STALLED_SETUP

#define UHCI_HCD_TD_FLAG_STALLED_SETUP   0x00000800

Definition at line 38 of file usbuhci.h.

◆ UHCI_MAX_BULK_TRANSFER_SIZE

#define UHCI_MAX_BULK_TRANSFER_SIZE   0x1000

Definition at line 25 of file usbuhci.h.

◆ UHCI_MAX_HC_SCHEDULE_ERRORS

#define UHCI_MAX_HC_SCHEDULE_ERRORS   16

Definition at line 22 of file usbuhci.h.

◆ UHCI_MAX_INTERRUPT_TD_COUNT

#define UHCI_MAX_INTERRUPT_TD_COUNT   8

Definition at line 28 of file usbuhci.h.

◆ UHCI_MAX_ISO_TD_COUNT

#define UHCI_MAX_ISO_TD_COUNT   256

Definition at line 27 of file usbuhci.h.

◆ UHCI_MAX_ISO_TRANSFER_SIZE

#define UHCI_MAX_ISO_TRANSFER_SIZE   0x10000

Definition at line 24 of file usbuhci.h.

◆ UHCI_MAX_STATIC_SOF_TDS

#define UHCI_MAX_STATIC_SOF_TDS   8

Definition at line 138 of file usbuhci.h.

Typedef Documentation

◆ PUHCI_ENDPOINT

Definition at line 40 of file usbuhci.h.

◆ PUHCI_EXTENSION

◆ PUHCI_HC_RESOURCES

◆ PUHCI_HCD_QH

◆ PUHCI_HCD_TD

◆ PUHCI_TRANSFER

Definition at line 41 of file usbuhci.h.

◆ UHCI_ENDPOINT

◆ UHCI_EXTENSION

◆ UHCI_HC_RESOURCES

◆ UHCI_HCD_QH

◆ UHCI_HCD_TD

◆ UHCI_TRANSFER

Function Documentation

◆ C_ASSERT() [1/2]

C_ASSERT ( sizeof(UHCI_HCD_QH = =0x40)

◆ C_ASSERT() [2/2]

C_ASSERT ( sizeof(UHCI_HCD_TD = =0x40)

◆ UhciDisableInterrupts()

VOID NTAPI UhciDisableInterrupts ( IN PVOID  uhciExtension)

Definition at line 2553 of file usbuhci.c.

2554{
2555 PUHCI_EXTENSION UhciExtension = uhciExtension;
2556 PUHCI_HW_REGISTERS BaseRegister;
2557 USB_CONTROLLER_FLAVOR HcFlavor;
2558 UHCI_PCI_LEGSUP LegacySupport;
2559
2560 DPRINT("UhciDisableInterrupts: UhciExtension - %p\n", UhciExtension);
2561
2562 BaseRegister = UhciExtension->BaseRegister;
2563 WRITE_PORT_USHORT(&BaseRegister->HcInterruptEnable.AsUSHORT, 0);
2564
2565 HcFlavor = UhciExtension->HcFlavor;
2566 DPRINT("UhciDisableInterrupts: FIXME HcFlavor - %lx\n", HcFlavor);
2567
2569 TRUE,
2570 &LegacySupport.AsUSHORT,
2571 PCI_LEGSUP,
2572 sizeof(USHORT));
2573
2574 LegacySupport.UsbPIRQ = 0;
2575
2577 FALSE,
2578 &LegacySupport.AsUSHORT,
2579 PCI_LEGSUP,
2580 sizeof(USHORT));
2581}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define PCI_LEGSUP
Definition: hardware.h:22
VOID NTAPI WRITE_PORT_USHORT(IN PUSHORT Port, IN USHORT Value)
Definition: portio.c:115
unsigned short USHORT
Definition: pedump.c:61
#define DPRINT
Definition: sndvol32.h:73
PUHCI_HW_REGISTERS BaseRegister
Definition: usbuhci.h:154
USB_CONTROLLER_FLAVOR HcFlavor
Definition: usbuhci.h:155
UHCI_INTERRUPT_ENABLE HcInterruptEnable
Definition: hardware.h:130
PUSBPORT_READ_WRITE_CONFIG_SPACE UsbPortReadWriteConfigSpace
Definition: usbmport.h:621
USHORT AsUSHORT
Definition: hardware.h:46
USHORT UsbPIRQ
Definition: hardware.h:42
enum _USB_CONTROLLER_FLAVOR USB_CONTROLLER_FLAVOR
USBPORT_REGISTRATION_PACKET RegPacket
Definition: usbuhci.c:17

Referenced by DriverEntry(), and UhciTakeControlHC().

◆ UhciGet32BitFrameNumber()

ULONG NTAPI UhciGet32BitFrameNumber ( IN PVOID  uhciExtension)

Definition at line 2440 of file usbuhci.c.

2441{
2442 PUHCI_EXTENSION UhciExtension = uhciExtension;
2443 ULONG Uhci32BitFrame;
2444 USHORT Fn; // FrameNumber
2445 ULONG Hp; // FrameHighPart
2446
2447 Fn = READ_PORT_USHORT(&UhciExtension->BaseRegister->FrameNumber);
2449 Hp = UhciExtension->FrameHighPart;
2450
2451 Uhci32BitFrame = Hp;
2452 Uhci32BitFrame += ((USHORT)Hp ^ Fn) & UHCI_FRNUM_OVERFLOW_LIST;
2453 Uhci32BitFrame |= Fn;
2454
2455 DPRINT_UHCI("UhciGet32BitFrameNumber: Uhci32BitFrame - %lX\n",
2456 Uhci32BitFrame);
2457
2458 return Uhci32BitFrame;
2459}
#define DPRINT_UHCI(...)
Definition: dbg_uhci.h:50
#define UHCI_FRNUM_FRAME_MASK
Definition: hardware.h:102
#define UHCI_FRNUM_OVERFLOW_LIST
Definition: hardware.h:104
USHORT NTAPI READ_PORT_USHORT(IN PUSHORT Port)
Definition: portio.c:63
BOOLEAN(* Fn)(ULONG Argc, PCHAR Argv[])
Definition: kdb_cli.c:346
ULONG FrameHighPart
Definition: usbuhci.h:165
USHORT FrameNumber
Definition: hardware.h:131
uint32_t ULONG
Definition: typedefs.h:59

Referenced by DriverEntry(), UhciCleanupFrameList(), UhciInterruptNextSOF(), and UhciSubmitTransfer().

◆ UhciHardwarePresent()

BOOLEAN NTAPI UhciHardwarePresent ( IN PUHCI_EXTENSION  UhciExtension)

Definition at line 792 of file usbuhci.c.

793{
794 UHCI_USB_STATUS UhciStatus;
795 PUSHORT StatusReg;
796
797 StatusReg = &UhciExtension->BaseRegister->HcStatus.AsUSHORT;
798 UhciStatus.AsUSHORT = READ_PORT_USHORT(StatusReg);
799
800 if (UhciStatus.AsUSHORT == MAXUSHORT)
801 DPRINT_UHCI("UhciHardwarePresent: HW not present\n");
802
803 return UhciStatus.AsUSHORT != MAXUSHORT;
804}
uint16_t * PUSHORT
Definition: typedefs.h:56
#define MAXUSHORT
Definition: typedefs.h:83
USHORT AsUSHORT
Definition: hardware.h:82

Referenced by UhciCheckController(), UhciInterruptService(), and UhciRHPortResetComplete().

◆ UhciRHClearFeaturePortConnectChange()

MPSTATUS NTAPI UhciRHClearFeaturePortConnectChange ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 406 of file roothub.c.

408{
409 PUHCI_EXTENSION UhciExtension = uhciExtension;
410 PUHCI_HW_REGISTERS BaseRegister;
411 PUSHORT PortControlRegister;
412 UHCI_PORT_STATUS_CONTROL PortControl;
413
414 DPRINT("UhciRHClearFeaturePortConnectChange: Port - %04X\n", Port);
415
416 ASSERT(Port);
417
418 BaseRegister = UhciExtension->BaseRegister;
419 PortControlRegister = (PUSHORT)&BaseRegister->PortControl[Port - 1];
420 PortControl.AsUSHORT = READ_PORT_USHORT(PortControlRegister);
421
422 if (PortControl.ConnectStatusChange == 1)
423 {
424 /* WC (Write Clear) bits */
425 PortControl.PortEnableDisableChange = 0;
426 PortControl.ConnectStatusChange = 1;
427 WRITE_PORT_USHORT(PortControlRegister, PortControl.AsUSHORT);
428 }
429
430 return MP_STATUS_SUCCESS;
431}
CPPORT Port[4]
Definition: headless.c:35
#define ASSERT(a)
Definition: mode.c:44
UHCI_PORT_STATUS_CONTROL PortControl[UHCI_NUM_ROOT_HUB_PORTS]
Definition: hardware.h:135
#define MP_STATUS_SUCCESS
Definition: usbmport.h:134

Referenced by DriverEntry().

◆ UhciRHClearFeaturePortEnable()

MPSTATUS NTAPI UhciRHClearFeaturePortEnable ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 350 of file roothub.c.

352{
353 PUHCI_EXTENSION UhciExtension = uhciExtension;
354 DPRINT("UhciRHClearFeaturePortEnable: ...\n");
355 ASSERT(Port);
356 return UhciRHPortEnable(UhciExtension, Port, FALSE);
357}
MPSTATUS NTAPI UhciRHPortEnable(IN PVOID uhciExtension, IN USHORT Port, IN BOOLEAN IsSet)
Definition: roothub.c:296

Referenced by DriverEntry().

◆ UhciRHClearFeaturePortEnableChange()

MPSTATUS NTAPI UhciRHClearFeaturePortEnableChange ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 381 of file roothub.c.

383{
384 PUHCI_EXTENSION UhciExtension = uhciExtension;
385 PUHCI_HW_REGISTERS BaseRegister;
386 PUSHORT PortControlRegister;
387 UHCI_PORT_STATUS_CONTROL PortControl;
388
389 DPRINT("UhciRHClearFeaturePortEnableChange: ...\n");
390
391 ASSERT(Port);
392
393 BaseRegister = UhciExtension->BaseRegister;
394 PortControlRegister = (PUSHORT)&BaseRegister->PortControl[Port - 1];
395 PortControl.AsUSHORT = READ_PORT_USHORT(PortControlRegister);
396
397 PortControl.ConnectStatusChange = 0;
398 PortControl.PortEnableDisableChange = 1;
399 WRITE_PORT_USHORT(PortControlRegister, PortControl.AsUSHORT);
400
401 return MP_STATUS_SUCCESS;
402}

Referenced by DriverEntry().

◆ UhciRHClearFeaturePortOvercurrentChange()

MPSTATUS NTAPI UhciRHClearFeaturePortOvercurrentChange ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 457 of file roothub.c.

459{
460 DPRINT("UhciRHClearFeaturePortOvercurrentChange: UNIMPLEMENTED. FIXME\n");
461 ASSERT(Port);
462 return MP_STATUS_SUCCESS;
463}

Referenced by DriverEntry().

◆ UhciRHClearFeaturePortPower()

MPSTATUS NTAPI UhciRHClearFeaturePortPower ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 361 of file roothub.c.

363{
364 DPRINT("UhciRHClearFeaturePortPower: UNIMPLEMENTED. FIXME\n");
365 ASSERT(Port);
366 return MP_STATUS_SUCCESS;
367}

Referenced by DriverEntry().

◆ UhciRHClearFeaturePortResetChange()

MPSTATUS NTAPI UhciRHClearFeaturePortResetChange ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 435 of file roothub.c.

437{
438 PUHCI_EXTENSION UhciExtension = uhciExtension;
439 DPRINT("UhciRHClearFeaturePortResetChange: ...\n");
440 ASSERT(Port);
441 UhciExtension->ResetChangePortMask &= ~(1 << (Port - 1));
442 return MP_STATUS_SUCCESS;
443}
ULONG ResetChangePortMask
Definition: usbuhci.h:169

Referenced by DriverEntry().

◆ UhciRHClearFeaturePortSuspend()

MPSTATUS NTAPI UhciRHClearFeaturePortSuspend ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 371 of file roothub.c.

373{
374 DPRINT("UhciRHClearFeaturePortSuspend: UNIMPLEMENTED. FIXME\n");
375 ASSERT(Port);
376 return MP_STATUS_SUCCESS;
377}

Referenced by DriverEntry().

◆ UhciRHClearFeaturePortSuspendChange()

MPSTATUS NTAPI UhciRHClearFeaturePortSuspendChange ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 447 of file roothub.c.

449{
450 DPRINT("UhciRHClearFeaturePortSuspendChange: UNIMPLEMENTED. FIXME\n");
451 ASSERT(Port);
452 return MP_STATUS_SUCCESS;
453}

Referenced by DriverEntry().

◆ UhciRHDisableIrq()

VOID NTAPI UhciRHDisableIrq ( IN PVOID  uhciExtension)

Definition at line 467 of file roothub.c.

468{
469 /* Do nothing */
470 return;
471}

Referenced by DriverEntry().

◆ UhciRHEnableIrq()

VOID NTAPI UhciRHEnableIrq ( IN PVOID  uhciExtension)

Definition at line 475 of file roothub.c.

476{
477 /* Do nothing */
478 return;
479}

Referenced by DriverEntry().

◆ UhciRHGetHubStatus()

MPSTATUS NTAPI UhciRHGetHubStatus ( IN PVOID  uhciExtension,
IN PUSB_HUB_STATUS_AND_CHANGE  HubStatus 
)

Definition at line 137 of file roothub.c.

139{
140 //DPRINT("UhciRHGetHubStatus: ...\n");
141 HubStatus->AsUlong32 = 0;
142 return MP_STATUS_SUCCESS;
143}

Referenced by DriverEntry().

◆ UhciRHGetPortStatus()

MPSTATUS NTAPI UhciRHGetPortStatus ( IN PVOID  uhciExtension,
IN USHORT  Port,
IN PUSB_PORT_STATUS_AND_CHANGE  PortStatus 
)

Definition at line 50 of file roothub.c.

53{
54 PUHCI_EXTENSION UhciExtension = uhciExtension;
55 PUHCI_HW_REGISTERS BaseRegister;
56 PUSHORT PortControlRegister;
57 UHCI_PORT_STATUS_CONTROL PortControl;
58 ULONG PortBit;
59 USB_20_PORT_STATUS portStatus;
60 USB_20_PORT_CHANGE portChange;
61
62 //DPRINT("UhciRHGetPortStatus: ...\n");
63
64 ASSERT(Port);
65
66 BaseRegister = UhciExtension->BaseRegister;
67 PortControlRegister = &BaseRegister->PortControl[Port-1].AsUSHORT;
68 PortControl.AsUSHORT = READ_PORT_USHORT(PortControlRegister);
69
70 portStatus.AsUshort16 = 0;
71 portChange.AsUshort16 = 0;
72
73 portStatus.CurrentConnectStatus = PortControl.CurrentConnectStatus;
74 portStatus.PortEnabledDisabled = PortControl.PortEnabledDisabled;
75
76 if (PortControl.Suspend == 1 &&
77 PortControl.PortEnabledDisabled == 1)
78 {
79 portStatus.Suspend = 1;
80 }
81 else
82 {
83 portStatus.Suspend = 0;
84 }
85
86 //if (UhciExtension->HcFlavor == UHCI_Piix4) // check will work after supporting HcFlavor in usbport.
87 if (TRUE)
88 {
89 portStatus.OverCurrent = PortControl.Reserved2 & 1;
90 portStatus.PortPower = (~PortControl.Reserved2 & 1);
91 portChange.OverCurrentIndicatorChange = (PortControl.Reserved2 & 2) != 0;
92 }
93 else
94 {
95 portStatus.OverCurrent = 0;
96 portStatus.PortPower = 1;
97 portChange.OverCurrentIndicatorChange = 0;
98 }
99
100 portStatus.HighSpeedDeviceAttached = 0;
101
102 portStatus.Reset = PortControl.PortReset;
103 portStatus.LowSpeedDeviceAttached = PortControl.LowSpeedDevice;
104 portChange.ConnectStatusChange = PortControl.ConnectStatusChange;
105
106 PortBit = 1 << (Port - 1);
107
108 if (UhciExtension->ResetPortMask & PortBit)
109 {
110 portChange.ConnectStatusChange = 0;
111 portChange.PortEnableDisableChange = 0;
112 }
113 else
114 {
115 portChange.PortEnableDisableChange = PortControl.PortEnableDisableChange;
116 }
117
118 if (UhciExtension->SuspendChangePortMask & PortBit)
119 portChange.SuspendChange = 1;
120
121 if (UhciExtension->ResetChangePortMask & PortBit)
122 portChange.ResetChange = 1;
123
124 PortStatus->PortStatus.Usb20PortStatus = portStatus;
125 PortStatus->PortChange.Usb20PortChange = portChange;
126
127 //DPRINT("UhciRHGetPortStatus: PortControl.AsUSHORT[%x] - %X, PortStatus - %X\n",
128 // Port,
129 // PortControl.AsUSHORT,
130 // PortStatus->AsUlong32);
131
132 return MP_STATUS_SUCCESS;
133}
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:42
ULONG SuspendChangePortMask
Definition: usbuhci.h:170
ULONG ResetPortMask
Definition: usbuhci.h:168
USHORT AsUshort16
Definition: usb200.h:161
USHORT PortEnableDisableChange
Definition: usb200.h:164
USHORT ResetChange
Definition: usb200.h:167
USHORT SuspendChange
Definition: usb200.h:165
USHORT OverCurrentIndicatorChange
Definition: usb200.h:166
USHORT ConnectStatusChange
Definition: usb200.h:163
USHORT LowSpeedDeviceAttached
Definition: usb200.h:141
USHORT PortPower
Definition: usb200.h:140
USHORT CurrentConnectStatus
Definition: usb200.h:133
USHORT AsUshort16
Definition: usb200.h:131
USHORT OverCurrent
Definition: usb200.h:136
USHORT HighSpeedDeviceAttached
Definition: usb200.h:142
USHORT PortEnabledDisabled
Definition: usb200.h:134

Referenced by DriverEntry().

◆ UhciRHGetRootHubData()

VOID NTAPI UhciRHGetRootHubData ( IN PVOID  uhciExtension,
IN PVOID  rootHubData 
)

Definition at line 15 of file roothub.c.

17{
18 PUHCI_EXTENSION UhciExtension = uhciExtension;
19 PUSBPORT_ROOT_HUB_DATA RootHubData = rootHubData;
20 USBPORT_HUB_11_CHARACTERISTICS HubCharacteristics;
21
22 DPRINT("UhciRHGetRootHubData: ...\n");
23
24 HubCharacteristics.AsUSHORT = 0;
25 HubCharacteristics.PowerControlMode = 1;
26 HubCharacteristics.NoPowerSwitching = 1;
27 HubCharacteristics.OverCurrentProtectionMode = 1;
28
29 if (UhciExtension->HcFlavor != UHCI_Piix4)
30 HubCharacteristics.NoOverCurrentProtection = 1;
31
33 RootHubData->HubCharacteristics.Usb11HubCharacteristics = HubCharacteristics;
34 RootHubData->PowerOnToPowerGood = 1;
35 RootHubData->HubControlCurrent = 0;
36}
#define UHCI_NUM_ROOT_HUB_PORTS
Definition: hardware.h:9
USBPORT_HUB_CHARACTERISTICS HubCharacteristics
Definition: usbmport.h:697
USBPORT_HUB_11_CHARACTERISTICS Usb11HubCharacteristics
Definition: usbmport.h:688
@ UHCI_Piix4
Definition: usb.h:60

Referenced by DriverEntry().

◆ UhciRHGetStatus()

MPSTATUS NTAPI UhciRHGetStatus ( IN PVOID  uhciExtension,
IN PUSHORT  Status 
)

Definition at line 40 of file roothub.c.

42{
43 DPRINT("UhciRHGetStatus: ...\n");
45 return MP_STATUS_SUCCESS;
46}
Status
Definition: gdiplustypes.h:25
#define USB_GETSTATUS_SELF_POWERED
Definition: usb100.h:45

Referenced by DriverEntry().

◆ UhciRHSetFeaturePortEnable()

MPSTATUS NTAPI UhciRHSetFeaturePortEnable ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 329 of file roothub.c.

331{
332 PUHCI_EXTENSION UhciExtension = uhciExtension;
333 DPRINT("UhciRHSetFeaturePortEnable: ...\n");
334 ASSERT(Port);
335 return UhciRHPortEnable(UhciExtension, Port, TRUE);
336}

Referenced by DriverEntry().

◆ UhciRHSetFeaturePortPower()

MPSTATUS NTAPI UhciRHSetFeaturePortPower ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 286 of file roothub.c.

288{
289 DPRINT("UhciRHSetFeaturePortPower: ...\n");
290 ASSERT(Port);
291 return MP_STATUS_SUCCESS;
292}

Referenced by DriverEntry().

◆ UhciRHSetFeaturePortReset()

MPSTATUS NTAPI UhciRHSetFeaturePortReset ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 250 of file roothub.c.

252{
253 PUHCI_EXTENSION UhciExtension = uhciExtension;
254 ULONG ResetPortMask;
255 ULONG PortBit;
256
257 DPRINT("UhciRHSetFeaturePortReset: ...\n");
258
259 ASSERT(Port);
260
261 ResetPortMask = UhciExtension->ResetPortMask;
262 PortBit = 1 << (Port - 1);
263
264 if (ResetPortMask & PortBit)
265 return MP_STATUS_FAILURE;
266
267 UhciExtension->ResetPortMask = ResetPortMask | PortBit;
268
269 if (UhciExtension->HcFlavor == UHCI_VIA ||
270 UhciExtension->HcFlavor == UHCI_VIA_x01 ||
271 UhciExtension->HcFlavor == UHCI_VIA_x02 ||
272 UhciExtension->HcFlavor == UHCI_VIA_x03 ||
273 UhciExtension->HcFlavor == UHCI_VIA_x04)
274 {
275 DPRINT1("UhciRHSetFeaturePortReset: Via chip. FIXME\n");
276 return MP_STATUS_SUCCESS;
277 }
278
279 UhciRHSetFeaturePortResetWorker(UhciExtension, &Port);
280
281 return MP_STATUS_SUCCESS;
282}
#define DPRINT1
Definition: precomp.h:8
@ UHCI_VIA_x03
Definition: usb.h:73
@ UHCI_VIA_x01
Definition: usb.h:71
@ UHCI_VIA
Definition: usb.h:70
@ UHCI_VIA_x04
Definition: usb.h:74
@ UHCI_VIA_x02
Definition: usb.h:72
#define MP_STATUS_FAILURE
Definition: usbmport.h:135
VOID NTAPI UhciRHSetFeaturePortResetWorker(IN PUHCI_EXTENSION UhciExtension, IN PUSHORT pPort)
Definition: roothub.c:217

Referenced by DriverEntry().

◆ UhciRHSetFeaturePortSuspend()

MPSTATUS NTAPI UhciRHSetFeaturePortSuspend ( IN PVOID  uhciExtension,
IN USHORT  Port 
)

Definition at line 340 of file roothub.c.

342{
343 DPRINT("UhciRHSetFeaturePortSuspend: UNIMPLEMENTED. FIXME\n");
344 ASSERT(Port);
345 return MP_STATUS_SUCCESS;
346}

Referenced by DriverEntry().

Variable Documentation

◆ RegPacket