User:Combuster/Recovered USB Sheet

From OSDev Wiki
Jump to: navigation, search

Contents

USB UHCI Enumeration

  • Enumerate the UHCI Controller(s)
    • Class: 0x0C, Sub: 0x03, Intf: 0x00
  • Store the I/O Base Address and Size
    • Determine Access Type
      • Address & (1<<0) ? IOMAP : MEMIO
    • Calculate I/O Address (MEMIO)
      • Address & 0xFFFFFFF0
    • Calculate I/O Address (IOMAP)
      • Address & 0xFFFFFFFC
    • Calculate Size of I/O
      • Address & 0xFFFFFFFF
  • Store IRQ
    • 8 bit read to Base + 0x3C
  • Enable Bus Master and IO Access
    • MEMIO Access
      • 16 bit write to Base + 0x04 of value 0x0006
    • IOMAP Access
      • 16 bit write to Base + 0x04 of value 0x0005
    • MEMIO & IOMAP Access
      • 16 bit write to Base + 0x04 of value 0x0007
  • Disable Legacy Support
    • 16 bit write to Base + 0xC0 of value 0x8F00
    • 16 bit write to Base + 0xC0 of value 0x2000
  • GRESET
    • 16 bit write to Base + 0x00 of value (1<<2)
    • Delay for 50 ms
    • 16 bit write to Base + 0x00 of value (~(1<<2))
    • Delay for 50 ms

Host Controller Configuration

  • Allocate Physical Memory
  • Initialize the Queue Chain
    • qh.h = 0x00000001
    • qh.v = 0x00000001
  • Initialize the Frame List
    • frlist[0-1023] = QH.head | (1<<1)
  • Set Basic Configurations
    • SOFMOD
      • 16 bit write to Base + 0x0C of value 0x40
    • FRBASEADD
      • 32 bit write to Base + 0x08 of value [physical address aligned to 4KB boundary]
    • FRNUM
      • 16 bit write to Base + 0x06 of value 0
    • USBINTR
      • 16 bit write to Base + 0x04 of value 0x000F
  • Start the Host Controller
    • 16 bit write to Base + 0x00 of value (1<<0)

Detecting Device Attachment

  • Test the CSC bit
    • 16 bit read to Base + [port #]
    • Value & (1<<1) ? TRUE : FALSE
  • TRUE
    • Clear the CSC bit
      • 16 bit write to Base + [port #] of value (~(1<<1))
    • Test the CCS bit
      • 16 bit read to Base + [port #]
      • Value & (1<<0) ? TRUE : FALSE
    • TRUE
      • Device Attached
    • FALSE
      • Device Not Attached
  • FALSE
    • Repeat

Basic Device Configuration

  • In Progress...
Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox