LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
usb.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _usbctrlrequest
 
struct  _usbendpointdesc
 
struct  _usbinterfacedesc
 
struct  _usbconfdesc
 
struct  _usbdevdesc
 

Macros

#define USB_MAXPATH   IPC_MAXPATH_LEN
 
#define USB_OK   0
 
#define USB_FAILED   1
 
#define USB_DT_DEVICE   0x01
 
#define USB_DT_CONFIG   0x02
 
#define USB_DT_STRING   0x03
 
#define USB_DT_INTERFACE   0x04
 
#define USB_DT_ENDPOINT   0x05
 
#define USB_REQ_GETSTATUS   0x00
 
#define USB_REQ_CLEARFEATURE   0x01
 
#define USB_REQ_SETFEATURE   0x03
 
#define USB_REQ_SETADDRESS   0x05
 
#define USB_REQ_GETDESCRIPTOR   0x06
 
#define USB_REQ_SETDESCRIPTOR   0x07
 
#define USB_REQ_GETCONFIG   0x08
 
#define USB_REQ_SETCONFIG   0x09
 
#define USB_REQ_GETINTERFACE   0x0a
 
#define USB_REQ_SETINTERFACE   0x0b
 
#define USB_REQ_SYNCFRAME   0x0c
 
#define USB_DT_DEVICE_SIZE   18
 
#define USB_DT_CONFIG_SIZE   9
 
#define USB_DT_INTERFACE_SIZE   9
 
#define USB_DT_ENDPOINT_SIZE   7
 
#define USB_DT_ENDPOINT_AUDIO_SIZE   9 /* Audio extension */
 
#define USB_DT_HUB_NONVAR_SIZE   7
 
#define USB_CTRLTYPE_DIR_HOST2DEVICE   (0<<7)
 
#define USB_CTRLTYPE_DIR_DEVICE2HOST   (1<<7)
 
#define USB_CTRLTYPE_TYPE_STANDARD   (0<<5)
 
#define USB_CTRLTYPE_TYPE_CLASS   (1<<5)
 
#define USB_CTRLTYPE_TYPE_VENDOR   (2<<5)
 
#define USB_CTRLTYPE_TYPE_RESERVED   (3<<5)
 
#define USB_CTRLTYPE_REC_DEVICE   0
 
#define USB_CTRLTYPE_REC_INTERFACE   1
 
#define USB_CTRLTYPE_REC_ENDPOINT   2
 
#define USB_CTRLTYPE_REC_OTHER   3
 
#define USB_FEATURE_ENDPOINT_HALT   0
 
#define USB_ENDPOINT_IN   0x80
 
#define USB_ENDPOINT_OUT   0x00
 
#define ATTRIBUTE_PACKED   __attribute__((packed))
 

Typedefs

typedef struct _usbctrlrequest usbctrlrequest
 
typedef struct _usbendpointdesc usb_endpointdesc
 
typedef struct _usbinterfacedesc usb_interfacedesc
 
typedef struct _usbconfdesc usb_configurationdesc
 
typedef struct _usbdevdesc usb_devdesc
 

Functions

s32 USB_OpenDevice (const char *device, u16 vid, u16 pid, struct ehci_device **fd)
 
s32 USB_CloseDevice (struct ehci_device **fd)
 
s32 USB_GetDescriptors (struct ehci_hcd *ehci, struct ehci_device *fd, usb_devdesc *udd)
 
void USB_FreeDescriptors (usb_devdesc *udd)
 
s32 USB_GetDeviceDescription (struct ehci_device *fd, usb_devdesc *devdesc)
 
void USB_SuspendDevice (struct ehci_device *fd)
 
void USB_ResumeDevice (struct ehci_device *fd)
 
s32 USB_ReadIntrMsg (struct ehci_device *fd, u8 bEndpoint, u16 wLength, void *rpData)
 
s32 USB_ReadBlkMsg (struct ehci_device *fd, u8 bEndpoint, u16 wLength, void *rpData)
 
s32 USB_ReadCtrlMsg (struct ehci_device *fd, u8 bmRequestType, u8 bmRequest, u16 wValue, u16 wIndex, u16 wLength, void *rpData)
 
s32 USB_WriteIntrMsg (struct ehci_device *fd, u8 bEndpoint, u16 wLength, void *rpData)
 
s32 USB_WriteBlkMsg (struct ehci_hcd *ehci, struct ehci_device *fd, u8 bEndpoint, u16 wLength, void *rpData)
 
s32 USB_WriteCtrlMsg (struct ehci_hcd *ehci, struct ehci_device *fd, u8 bmRequestType, u8 bmRequest, u16 wValue, u16 wIndex, u16 wLength, void *rpData)
 
s32 USB_GetConfiguration (struct ehci_hcd *ehci, struct ehci_device *fd, u8 *configuration)
 
s32 USB_SetConfiguration (struct ehci_hcd *ehci, struct ehci_device *fd, u8 configuration)
 
s32 USB_SetAlternativeInterface (struct ehci_hcd *ehci, struct ehci_device *fd, u8 interface, u8 alternateSetting)
 
s32 USB_ClearHalt (struct ehci_hcd *ehci, struct ehci_device *fd, u8 endpointAddress)
 
s32 USB_GetDeviceList (const char *devpath, void *descr_buffer, u8 num_descr, u8 b0, u8 *cnt_descr)
 
void * USB_Alloc (int size)
 
void USB_Free (void *ptr)
 

Macro Definition Documentation

◆ ATTRIBUTE_PACKED

#define ATTRIBUTE_PACKED   __attribute__((packed))

Definition at line 58 of file usb.h.

◆ USB_CTRLTYPE_DIR_DEVICE2HOST

#define USB_CTRLTYPE_DIR_DEVICE2HOST   (1<<7)

Definition at line 39 of file usb.h.

◆ USB_CTRLTYPE_DIR_HOST2DEVICE

#define USB_CTRLTYPE_DIR_HOST2DEVICE   (0<<7)

Definition at line 38 of file usb.h.

◆ USB_CTRLTYPE_REC_DEVICE

#define USB_CTRLTYPE_REC_DEVICE   0

Definition at line 44 of file usb.h.

◆ USB_CTRLTYPE_REC_ENDPOINT

#define USB_CTRLTYPE_REC_ENDPOINT   2

Definition at line 46 of file usb.h.

◆ USB_CTRLTYPE_REC_INTERFACE

#define USB_CTRLTYPE_REC_INTERFACE   1

Definition at line 45 of file usb.h.

◆ USB_CTRLTYPE_REC_OTHER

#define USB_CTRLTYPE_REC_OTHER   3

Definition at line 47 of file usb.h.

◆ USB_CTRLTYPE_TYPE_CLASS

#define USB_CTRLTYPE_TYPE_CLASS   (1<<5)

Definition at line 41 of file usb.h.

◆ USB_CTRLTYPE_TYPE_RESERVED

#define USB_CTRLTYPE_TYPE_RESERVED   (3<<5)

Definition at line 43 of file usb.h.

◆ USB_CTRLTYPE_TYPE_STANDARD

#define USB_CTRLTYPE_TYPE_STANDARD   (0<<5)

Definition at line 40 of file usb.h.

◆ USB_CTRLTYPE_TYPE_VENDOR

#define USB_CTRLTYPE_TYPE_VENDOR   (2<<5)

Definition at line 42 of file usb.h.

◆ USB_DT_CONFIG

#define USB_DT_CONFIG   0x02

Definition at line 11 of file usb.h.

◆ USB_DT_CONFIG_SIZE

#define USB_DT_CONFIG_SIZE   9

Definition at line 31 of file usb.h.

◆ USB_DT_DEVICE

#define USB_DT_DEVICE   0x01

Definition at line 10 of file usb.h.

◆ USB_DT_DEVICE_SIZE

#define USB_DT_DEVICE_SIZE   18

Definition at line 30 of file usb.h.

◆ USB_DT_ENDPOINT

#define USB_DT_ENDPOINT   0x05

Definition at line 14 of file usb.h.

◆ USB_DT_ENDPOINT_AUDIO_SIZE

#define USB_DT_ENDPOINT_AUDIO_SIZE   9 /* Audio extension */

Definition at line 34 of file usb.h.

◆ USB_DT_ENDPOINT_SIZE

#define USB_DT_ENDPOINT_SIZE   7

Definition at line 33 of file usb.h.

◆ USB_DT_HUB_NONVAR_SIZE

#define USB_DT_HUB_NONVAR_SIZE   7

Definition at line 35 of file usb.h.

◆ USB_DT_INTERFACE

#define USB_DT_INTERFACE   0x04

Definition at line 13 of file usb.h.

◆ USB_DT_INTERFACE_SIZE

#define USB_DT_INTERFACE_SIZE   9

Definition at line 32 of file usb.h.

◆ USB_DT_STRING

#define USB_DT_STRING   0x03

Definition at line 12 of file usb.h.

◆ USB_ENDPOINT_IN

#define USB_ENDPOINT_IN   0x80

Definition at line 51 of file usb.h.

◆ USB_ENDPOINT_OUT

#define USB_ENDPOINT_OUT   0x00

Definition at line 52 of file usb.h.

◆ USB_FAILED

#define USB_FAILED   1

Definition at line 7 of file usb.h.

◆ USB_FEATURE_ENDPOINT_HALT

#define USB_FEATURE_ENDPOINT_HALT   0

Definition at line 49 of file usb.h.

◆ USB_MAXPATH

#define USB_MAXPATH   IPC_MAXPATH_LEN

Definition at line 4 of file usb.h.

◆ USB_OK

#define USB_OK   0

Definition at line 6 of file usb.h.

◆ USB_REQ_CLEARFEATURE

#define USB_REQ_CLEARFEATURE   0x01

Definition at line 18 of file usb.h.

◆ USB_REQ_GETCONFIG

#define USB_REQ_GETCONFIG   0x08

Definition at line 23 of file usb.h.

◆ USB_REQ_GETDESCRIPTOR

#define USB_REQ_GETDESCRIPTOR   0x06

Definition at line 21 of file usb.h.

◆ USB_REQ_GETINTERFACE

#define USB_REQ_GETINTERFACE   0x0a

Definition at line 25 of file usb.h.

◆ USB_REQ_GETSTATUS

#define USB_REQ_GETSTATUS   0x00

Definition at line 17 of file usb.h.

◆ USB_REQ_SETADDRESS

#define USB_REQ_SETADDRESS   0x05

Definition at line 20 of file usb.h.

◆ USB_REQ_SETCONFIG

#define USB_REQ_SETCONFIG   0x09

Definition at line 24 of file usb.h.

◆ USB_REQ_SETDESCRIPTOR

#define USB_REQ_SETDESCRIPTOR   0x07

Definition at line 22 of file usb.h.

◆ USB_REQ_SETFEATURE

#define USB_REQ_SETFEATURE   0x03

Definition at line 19 of file usb.h.

◆ USB_REQ_SETINTERFACE

#define USB_REQ_SETINTERFACE   0x0b

Definition at line 26 of file usb.h.

◆ USB_REQ_SYNCFRAME

#define USB_REQ_SYNCFRAME   0x0c

Definition at line 27 of file usb.h.

Typedef Documentation

◆ usb_configurationdesc

◆ usb_devdesc

typedef struct _usbdevdesc usb_devdesc

◆ usb_endpointdesc

◆ usb_interfacedesc

◆ usbctrlrequest

Function Documentation

◆ USB_Alloc()

void * USB_Alloc ( int  size)

Definition at line 116 of file usb_os.c.

◆ USB_ClearHalt()

s32 USB_ClearHalt ( struct ehci_hcd ehci,
struct ehci_device fd,
u8  endpointAddress 
)

Definition at line 213 of file usb2.c.

◆ USB_CloseDevice()

s32 USB_CloseDevice ( struct ehci_device **  fd)

◆ USB_Free()

void USB_Free ( void *  ptr)

Definition at line 121 of file usb_os.c.

◆ USB_FreeDescriptors()

void USB_FreeDescriptors ( usb_devdesc udd)

Definition at line 147 of file usb2.c.

◆ USB_GetConfiguration()

s32 USB_GetConfiguration ( struct ehci_hcd ehci,
struct ehci_device fd,
u8 configuration 
)

Definition at line 185 of file usb2.c.

◆ USB_GetDescriptors()

s32 USB_GetDescriptors ( struct ehci_hcd ehci,
struct ehci_device fd,
usb_devdesc udd 
)

Definition at line 29 of file usb2.c.

◆ USB_GetDeviceDescription()

s32 USB_GetDeviceDescription ( struct ehci_device fd,
usb_devdesc devdesc 
)

◆ USB_GetDeviceList()

s32 USB_GetDeviceList ( const char *  devpath,
void *  descr_buffer,
u8  num_descr,
u8  b0,
u8 cnt_descr 
)

◆ USB_OpenDevice()

s32 USB_OpenDevice ( const char *  device,
u16  vid,
u16  pid,
struct ehci_device **  fd 
)

◆ USB_ReadBlkMsg()

s32 USB_ReadBlkMsg ( struct ehci_device fd,
u8  bEndpoint,
u16  wLength,
void *  rpData 
)

◆ USB_ReadCtrlMsg()

s32 USB_ReadCtrlMsg ( struct ehci_device fd,
u8  bmRequestType,
u8  bmRequest,
u16  wValue,
u16  wIndex,
u16  wLength,
void *  rpData 
)

◆ USB_ReadIntrMsg()

s32 USB_ReadIntrMsg ( struct ehci_device fd,
u8  bEndpoint,
u16  wLength,
void *  rpData 
)

◆ USB_ResumeDevice()

void USB_ResumeDevice ( struct ehci_device fd)

◆ USB_SetAlternativeInterface()

s32 USB_SetAlternativeInterface ( struct ehci_hcd ehci,
struct ehci_device fd,
u8  interface,
u8  alternateSetting 
)

Definition at line 205 of file usb2.c.

◆ USB_SetConfiguration()

s32 USB_SetConfiguration ( struct ehci_hcd ehci,
struct ehci_device fd,
u8  configuration 
)

Definition at line 201 of file usb2.c.

◆ USB_SuspendDevice()

void USB_SuspendDevice ( struct ehci_device fd)

◆ USB_WriteBlkMsg()

s32 USB_WriteBlkMsg ( struct ehci_hcd ehci,
struct ehci_device fd,
u8  bEndpoint,
u16  wLength,
void *  rpData 
)

Definition at line 175 of file usb2.c.

◆ USB_WriteCtrlMsg()

s32 USB_WriteCtrlMsg ( struct ehci_hcd ehci,
struct ehci_device fd,
u8  bmRequestType,
u8  bmRequest,
u16  wValue,
u16  wIndex,
u16  wLength,
void *  rpData 
)

Definition at line 180 of file usb2.c.

◆ USB_WriteIntrMsg()

s32 USB_WriteIntrMsg ( struct ehci_device fd,
u8  bEndpoint,
u16  wLength,
void *  rpData 
)