XU XUv0.16.0

#core/xhci

import: #core/xhci

counts: 12 functions, 0 methods, 3 types, 22 constants, 0 method sets

Standard library package `#core/xhci`.

const XHCI_PCI_CLASS

XuAPI
pub const XHCI_PCI_CLASS = 0x0C

Purpose

PCI Class/Subclass/ProgIF for xHCI

const XHCI_PCI_SUBCLASS

XuAPI
pub const XHCI_PCI_SUBCLASS = 0x03

Purpose

Constant XHCI_PCI_SUBCLASS, defining protocol or algorithm parameters.

const XHCI_PCI_PROGIF

XuAPI
pub const XHCI_PCI_PROGIF = 0x30

Purpose

Constant XHCI_PCI_PROGIF, defining protocol or algorithm parameters.

const XHCI_USBCMD_RS

XuAPI
pub const XHCI_USBCMD_RS = 0x1

Purpose

USBCMD Register Bits

const XHCI_USBCMD_HCRST

XuAPI
pub const XHCI_USBCMD_HCRST = 0x2

Purpose

Constant XHCI_USBCMD_HCRST, defining protocol or algorithm parameters.

const XHCI_USBCMD_INTE

XuAPI
pub const XHCI_USBCMD_INTE = 0x4

Purpose

Constant XHCI_USBCMD_INTE, defining protocol or algorithm parameters.

const XHCI_USBSTS_HCH

XuAPI
pub const XHCI_USBSTS_HCH = 0x1

Purpose

USBSTS Register Bits

const XHCI_USBSTS_CNR

XuAPI
pub const XHCI_USBSTS_CNR = 0x800

Purpose

Constant XHCI_USBSTS_CNR, defining protocol or algorithm parameters.

const XHCI_TRB_TYPE_SHIFT

XuAPI
pub const XHCI_TRB_TYPE_SHIFT = 10

Purpose

TRB Control & Type Constants

const XHCI_TRB_ENABLE_SLOT

XuAPI
pub const XHCI_TRB_ENABLE_SLOT = 9

Purpose

Constant XHCI_TRB_ENABLE_SLOT, defining protocol or algorithm parameters.

const XHCI_TRB_DISABLE_SLOT

XuAPI
pub const XHCI_TRB_DISABLE_SLOT = 10

Purpose

Constant XHCI_TRB_DISABLE_SLOT, defining protocol or algorithm parameters.

const XHCI_TRB_ADDRESS_DEVICE

XuAPI
pub const XHCI_TRB_ADDRESS_DEVICE = 11

Purpose

Constant XHCI_TRB_ADDRESS_DEVICE, defining protocol or algorithm parameters.

const XHCI_TRB_NOOP_CMD

XuAPI
pub const XHCI_TRB_NOOP_CMD = 23

Purpose

Constant XHCI_TRB_NOOP_CMD, defining protocol or algorithm parameters.

const XHCI_TRB_CMD_COMPLETION

XuAPI
pub const XHCI_TRB_CMD_COMPLETION = 33

Purpose

Constant XHCI_TRB_CMD_COMPLETION, defining protocol or algorithm parameters.

const XHCI_TRB_PORT_STATUS_CHANGE

XuAPI
pub const XHCI_TRB_PORT_STATUS_CHANGE = 34

Purpose

Constant XHCI_TRB_PORT_STATUS_CHANGE, defining protocol or algorithm parameters.

const XHCI_CC_SUCCESS

XuAPI
pub const XHCI_CC_SUCCESS = 1

Purpose

Completion Codes

const XHCI_PORTSC_CCS

XuAPI
pub const XHCI_PORTSC_CCS = 0x1

Purpose

PORTSC Register Bits

const XHCI_PORTSC_PED

XuAPI
pub const XHCI_PORTSC_PED = 0x2

Purpose

Constant XHCI_PORTSC_PED, defining protocol or algorithm parameters.

const XHCI_CMD_RING_TRBS

XuAPI
pub const XHCI_CMD_RING_TRBS = 64

Purpose

Ring sizes (each 64 * 16 = 1024 bytes, fitting comfortably in a 4 KiB page)

const XHCI_EVT_RING_TRBS

XuAPI
pub const XHCI_EVT_RING_TRBS = 64

Purpose

Constant XHCI_EVT_RING_TRBS, defining protocol or algorithm parameters.

const XHCI_DMA_MIN_BYTES

XuAPI
pub const XHCI_DMA_MIN_BYTES = 16384

Purpose

Constant XHCI_DMA_MIN_BYTES, defining protocol or algorithm parameters.

struct XhciTrb

XuAPI
pub struct XhciTrb {
    pub param u64
    pub status u32
    pub control u32
}

Purpose

Structure encapsulating param, status, control.

Public fields

param u64
field (u64)
status u32
field (u32)
control u32
field (u32)

struct XhciErstEntry

XuAPI
pub struct XhciErstEntry {
    pub ring_base u64
    pub ring_size u32
    pub reserved u32
}

Purpose

Structure encapsulating ring_base, ring_size, reserved.

Public fields

ring_base u64
field (u64)
ring_size u32
field (u32)
reserved u32
field (u32)

struct XhciController

XuAPI
pub struct XhciController {
    pub mmio_base u64
    pub op_base u64
    pub rt_base u64
    pub db_base u64
    pub hci_version u16
    pub max_slots u8
    pub max_ports u8
    pub dcbaa_pa u64
    pub cmd_ring_pa u64
    pub evt_ring_pa u64
    pub erst_pa u64
    pub cmd_enq u32
    pub cmd_cycle u8
    pub evt_deq u32
    pub evt_cycle u8
}

Purpose

Structure encapsulating mmio_base, op_base, rt_base, db_base, hci_version.

Public fields

mmio_base u64
field (u64)
op_base u64
field (u64)
rt_base u64
field (u64)
db_base u64
field (u64)
hci_version u16
field (u16)
max_slots u8
field (u8)
max_ports u8
field (u8)
dcbaa_pa u64
field (u64)
cmd_ring_pa u64
field (u64)
evt_ring_pa u64
field (u64)
erst_pa u64
field (u64)
cmd_enq u32
field (u32)
cmd_cycle u8
field (u8)
evt_deq u32
field (u32)
evt_cycle u8
field (u8)

xhci_trb_make

XuAPI
pub fn xhci_trb_make(param u64, status u32, trb_type u32, slot_id u8, cycle bool) XhciTrb

Purpose

Xhci trb make.

Parameters

param u64
param (u64)
status u32
status (u32)
trb_type u32
trb_type (u32)
slot_id u8
slot_id (u8)
cycle bool
cycle (bool)

Returns

XhciTrb — a value of this type

xhci_trb_type

XuAPI
pub fn xhci_trb_type(ctrl u32) u32

Purpose

Xhci trb type.

Parameters

ctrl u32
ctrl (u32)

Returns

u32 — a value of this type

xhci_trb_cc

XuAPI
pub fn xhci_trb_cc(status u32) u8

Purpose

Xhci trb cc.

Parameters

status u32
status (u32)

Returns

u8 — a value of this type

xhci_trb_slot

XuAPI
pub fn xhci_trb_slot(ctrl u32) u8

Purpose

Xhci trb slot.

Parameters

ctrl u32
ctrl (u32)

Returns

u8 — a value of this type

xhci_find_pci

XuAPI
pub fn xhci_find_pci(out *raw pci.PciDevice) bool

Purpose

Xhci find pci.

Parameters

out *raw pci.PciDevice
out (*raw pci.PciDevice)

Returns

bool — true or false

xhci_controller_init

XuAPI
pub fn xhci_controller_init(ctrl *raw XhciController, mmio_base u64, dma_base u64, dma_bytes u64) bool

Purpose

Xhci controller init.

Parameters

ctrl *raw XhciController
ctrl (*raw XhciController)
mmio_base u64
mmio_base (u64)
dma_base u64
dma_base (u64)
dma_bytes u64
dma_bytes (u64)

Returns

bool — true or false

xhci_submit_cmd

XuAPI
pub fn xhci_submit_cmd( ctrl *raw XhciController, trb_type u32, param u64, slot_id u8, out_cc *raw u8, out_slot *raw u8 ) bool

Purpose

Xhci submit cmd.

Parameters

ctrl *raw XhciController
ctrl (*raw XhciController)
trb_type u32
trb_type (u32)
param u64
param (u64)
slot_id u8
slot_id (u8)
out_cc *raw u8
out_cc (*raw u8)
out_slot *raw u8
out_slot (*raw u8)

Returns

bool — true or false

xhci_noop

XuAPI
pub fn xhci_noop(ctrl *raw XhciController) bool

Purpose

Xhci noop.

Parameters

ctrl *raw XhciController
ctrl (*raw XhciController)

Returns

bool — true or false

xhci_enable_slot

XuAPI
pub fn xhci_enable_slot(ctrl *raw XhciController, out_slot *raw u8) bool

Purpose

Xhci enable slot.

Parameters

ctrl *raw XhciController
ctrl (*raw XhciController)
out_slot *raw u8
out_slot (*raw u8)

Returns

bool — true or false

xhci_port_sc

XuAPI
pub fn xhci_port_sc(ctrl *raw XhciController, port_1based u32) u32

Purpose

Xhci port sc.

Parameters

ctrl *raw XhciController
ctrl (*raw XhciController)
port_1based u32
port_1based (u32)

Returns

u32 — a value of this type

xhci_port_connected

XuAPI
pub fn xhci_port_connected(ctrl *raw XhciController, port_1based u32) bool

Purpose

Xhci port connected.

Parameters

ctrl *raw XhciController
ctrl (*raw XhciController)
port_1based u32
port_1based (u32)

Returns

bool — true or false

xhci_port_speed

XuAPI
pub fn xhci_port_speed(ctrl *raw XhciController, port_1based u32) u8

Purpose

Xhci port speed.

Parameters

ctrl *raw XhciController
ctrl (*raw XhciController)
port_1based u32
port_1based (u32)

Returns

u8 — a value of this type