wut  v1.7.0
Wii U Toolchain
Data Structures | Macros | Typedefs | Enumerations | Functions
uhs.h File Reference
#include <wut.h>
#include <stdbool.h>
#include "uhs_usbspec.h"
Include dependency graph for uhs.h:

Go to the source code of this file.

Data Structures

struct  UhsConfig
 
struct  UhsHandle
 
struct  UhsInterfaceFilter
 
struct  UhsEndpointDescriptor
 
struct  UhsInterfaceProfile
 

Macros

#define MATCH_ANY   0x000
 
#define MATCH_DEV_VID   0x001
 
#define MATCH_DEV_PID   0x002
 
#define MATCH_DEV_CLASS   0x010
 
#define MATCH_DEV_SUBCLASS   0x020
 
#define MATCH_DEV_PROTOCOL   0x040
 
#define MATCH_IF_CLASS   0x080
 
#define MATCH_IF_SUBCLASS   0x100
 
#define MATCH_IF_PROTOCOL   0x200
 
#define UHS_CONFIG_BUFFER_SIZE   0x137f
 
#define ENDPOINT_TRANSFER_OUT   1
 
#define ENDPOINT_TRANSFER_IN   2
 
#define TIMEOUT_NONE   -1
 

Typedefs

typedef struct UhsInterfaceFilter UhsInterfaceFilter
 
typedef struct UhsInterfaceProfile UhsInterfaceProfile
 
typedef struct UhsEndpointDescriptor UhsEndpointDescriptor
 
typedef struct UhsHandle UhsHandle
 
typedef struct UhsConfig UhsConfig
 
typedef enum UHSStatus UHSStatus
 
typedef enum UHSHandleState UHSHandleState
 
typedef enum UHSAdminDevType UHSAdminDevType
 
typedef enum UHSAdminEpType UHSAdminEpType
 
typedef void(* UHSDrvRegCallback) (void *context, UhsInterfaceProfile *profile)
 
typedef void(* UhsAcquireInterfaceCallback) (void *context, int32_t arg1, int32_t arg2)
 

Enumerations

enum  UHSStatus {
  UHS_STATUS_OK = 0 ,
  UHS_STATUS_HANDLE_INVALID_ARGS = 0xffdefffd ,
  UHS_STATUS_HANDLE_INVALID_STATE = 0xffdefffc
}
 
enum  UHSHandleState {
  UHS_HANDLE_STATE_INIT = 0x00 ,
  UHS_HANDLE_STATE_OPENING = 0x01 ,
  UHS_HANDLE_STATE_OPENED = 0x02 ,
  UHS_HANDLE_STATE_CLOSING = 0x03 ,
  UHS_HANDLE_STATE_CLOSED = 0x04 ,
  UHS_HANDLE_STATE_ERROR = 0x05
}
 
enum  UHSAdminDevType {
  UHS_ADMIN_DEV_RESET = 0x01 ,
  UHS_ADMIN_DEV_FREEZE = 0x02 ,
  UHS_ADMIN_DEV_SUSPEND = 0x03 ,
  UHS_ADMIN_DEV_RESUME = 0x04 ,
  UHS_ADMIN_DEV_DESTROY = 0x05
}
 
enum  UHSAdminEpType {
  UHS_ADMIN_EP_ENABLE = 0x01 ,
  UHS_ADMIN_EP_DISABLE = 0x02 ,
  UHS_ADMIN_EP_CANCEL = 0x03 ,
  UHS_ADMIN_EP_CANCEL_RESET = 0x04
}
 

Functions

UHSStatus UhsClientOpen (UhsHandle *handle, UhsConfig *config)
 
UHSStatus UhsClientClose (UhsHandle *handle)
 
UHSStatus UhsClassDrvReg (UhsHandle *handle, UhsInterfaceFilter *filter, void *context, UHSDrvRegCallback callback)
 
UHSStatus UhsClassDrvUnReg (UhsHandle *handle, uint32_t drv_handle)
 
UHSStatus UhsGetFullConfigDescriptor (UhsHandle *handle, uint32_t if_handle, void *data, uint32_t size)
 
UHSStatus UhsGetDescriptorString (UhsHandle *handle, uint32_t if_handle, uint8_t string_index, BOOL as_unicode, void *data, uint32_t size)
 
UHSStatus UhsQueryInterfaces (UhsHandle *handle, UhsInterfaceFilter *filter, UhsInterfaceProfile *profiles, int32_t max_profiles)
 
UHSStatus UhsAcquireInterface (UhsHandle *handle, uint32_t if_handle, void *context, UhsAcquireInterfaceCallback callback)
 
UHSStatus UhsReleaseInterface (UhsHandle *handle, uint32_t if_handle, bool no_reacquire)
 
UHSStatus UhsAdministerDevice (UhsHandle *handle, uint32_t if_handle, UHSAdminDevType type, int32_t arg3)
 
UHSStatus UhsAdministerEndpoint (UhsHandle *handle, uint32_t if_handle, UHSAdminEpType type, uint32_t endpointMask, uint32_t max_pending_requests, uint32_t max_request_size)
 
UHSStatus UhsClearEndpointHalt (UhsHandle *handle, uint32_t if_handle, uint32_t endpoint, int32_t direction)
 
UHSStatus UhsSubmitControlRequest (UhsHandle *handle, uint32_t if_handle, void *buffer, uint8_t bRequest, uint8_t bmRequestType, uint16_t wValue, uint16_t wIndex, uint16_t wLength, int32_t timeout)
 
UHSStatus UhsSubmitBulkRequest (UhsHandle *handle, uint32_t if_handle, uint8_t endpoint, int32_t direction, void *buffer, int32_t length, int32_t timeout)
 
UHSStatus UhsSubmitInterruptRequest (UhsHandle *handle, uint32_t if_handle, uint8_t endpoint, int32_t direction, void *buffer, int32_t length, int32_t timeout)
 
static uint32_t UHSEndpointDirIsIn (UhsEndpointDescriptor *endpoint_descriptor)
 
static uint32_t UHSEndpointGetNum (UhsEndpointDescriptor *endpoint_descriptor)
 
static uint32_t UHSEndpointGetMask (UhsEndpointDescriptor *endpoint_descriptor)
 

Data Structure Documentation

◆ UhsConfig

struct UhsConfig

Definition at line 47 of file uhs.h.

Data Fields
uint32_t controller_num
void * buffer
uint32_t buffer_size

◆ UhsHandle

struct UhsHandle

Definition at line 59 of file uhs.h.

Data Fields
UHSHandleState state
void * ipc_buffer
uint32_t handle
UhsConfig * config

◆ UhsInterfaceFilter

struct UhsInterfaceFilter

Definition at line 82 of file uhs.h.

Data Fields
uint16_t match_params
uint16_t vid
uint16_t pid
uint8_t dev_class
uint8_t dev_subclass
uint8_t dev_protocol
uint8_t if_class
uint8_t if_subclass
uint8_t if_protocol

◆ UhsEndpointDescriptor

struct UhsEndpointDescriptor

Definition at line 108 of file uhs.h.

Data Fields
uint8_t bLength
uint8_t bDescriptorType
uint8_t bEndpointAddress
uint8_t bmAttributes
uint16_t wMaxPacketSize
uint8_t bInterval

◆ UhsInterfaceProfile

struct UhsInterfaceProfile

Definition at line 127 of file uhs.h.

Data Fields
uint32_t if_handle
UhsDeviceDescriptor dev_desc
UhsConfigDescriptor cfg_desc
UhsInterfaceDescriptor if_desc
UhsEndpointDescriptor in_endpoints[16]
UhsEndpointDescriptor out_endpoints[16]

Macro Definition Documentation

◆ MATCH_ANY

#define MATCH_ANY   0x000

Definition at line 18 of file uhs.h.

◆ MATCH_DEV_VID

#define MATCH_DEV_VID   0x001

Definition at line 19 of file uhs.h.

◆ MATCH_DEV_PID

#define MATCH_DEV_PID   0x002

Definition at line 20 of file uhs.h.

◆ MATCH_DEV_CLASS

#define MATCH_DEV_CLASS   0x010

Definition at line 21 of file uhs.h.

◆ MATCH_DEV_SUBCLASS

#define MATCH_DEV_SUBCLASS   0x020

Definition at line 22 of file uhs.h.

◆ MATCH_DEV_PROTOCOL

#define MATCH_DEV_PROTOCOL   0x040

Definition at line 23 of file uhs.h.

◆ MATCH_IF_CLASS

#define MATCH_IF_CLASS   0x080

Definition at line 24 of file uhs.h.

◆ MATCH_IF_SUBCLASS

#define MATCH_IF_SUBCLASS   0x100

Definition at line 25 of file uhs.h.

◆ MATCH_IF_PROTOCOL

#define MATCH_IF_PROTOCOL   0x200

Definition at line 26 of file uhs.h.

◆ UHS_CONFIG_BUFFER_SIZE

#define UHS_CONFIG_BUFFER_SIZE   0x137f

Definition at line 45 of file uhs.h.

◆ ENDPOINT_TRANSFER_OUT

#define ENDPOINT_TRANSFER_OUT   1

Definition at line 75 of file uhs.h.

◆ ENDPOINT_TRANSFER_IN

#define ENDPOINT_TRANSFER_IN   2

Definition at line 76 of file uhs.h.

◆ TIMEOUT_NONE

#define TIMEOUT_NONE   -1

Definition at line 79 of file uhs.h.

Typedef Documentation

◆ UhsInterfaceFilter

Definition at line 1 of file uhs.h.

◆ UhsInterfaceProfile

Definition at line 1 of file uhs.h.

◆ UhsEndpointDescriptor

Definition at line 1 of file uhs.h.

◆ UhsHandle

typedef struct UhsHandle UhsHandle

Definition at line 1 of file uhs.h.

◆ UhsConfig

typedef struct UhsConfig UhsConfig

Definition at line 1 of file uhs.h.

◆ UHSStatus

typedef enum UHSStatus UHSStatus

◆ UHSHandleState

◆ UHSAdminDevType

◆ UHSAdminEpType

◆ UHSDrvRegCallback

typedef void(* UHSDrvRegCallback) (void *context, UhsInterfaceProfile *profile)

Definition at line 170 of file uhs.h.

◆ UhsAcquireInterfaceCallback

typedef void(* UhsAcquireInterfaceCallback) (void *context, int32_t arg1, int32_t arg2)

Definition at line 205 of file uhs.h.

Enumeration Type Documentation

◆ UHSStatus

enum UHSStatus
Enumerator
UHS_STATUS_OK 
UHS_STATUS_HANDLE_INVALID_ARGS 
UHS_STATUS_HANDLE_INVALID_STATE 

Definition at line 28 of file uhs.h.

◆ UHSHandleState

Enumerator
UHS_HANDLE_STATE_INIT 
UHS_HANDLE_STATE_OPENING 
UHS_HANDLE_STATE_OPENED 
UHS_HANDLE_STATE_CLOSING 
UHS_HANDLE_STATE_CLOSED 
UHS_HANDLE_STATE_ERROR 

Definition at line 35 of file uhs.h.

◆ UHSAdminDevType

Enumerator
UHS_ADMIN_DEV_RESET 
UHS_ADMIN_DEV_FREEZE 
UHS_ADMIN_DEV_SUSPEND 
UHS_ADMIN_DEV_RESUME 
UHS_ADMIN_DEV_DESTROY 

Definition at line 145 of file uhs.h.

◆ UHSAdminEpType

Enumerator
UHS_ADMIN_EP_ENABLE 
UHS_ADMIN_EP_DISABLE 
UHS_ADMIN_EP_CANCEL 
UHS_ADMIN_EP_CANCEL_RESET 

Definition at line 154 of file uhs.h.

Function Documentation

◆ UhsClientOpen()

UHSStatus UhsClientOpen ( UhsHandle handle,
UhsConfig config 
)

◆ UhsClientClose()

UHSStatus UhsClientClose ( UhsHandle handle)

◆ UhsClassDrvReg()

UHSStatus UhsClassDrvReg ( UhsHandle handle,
UhsInterfaceFilter filter,
void *  context,
UHSDrvRegCallback  callback 
)

◆ UhsClassDrvUnReg()

UHSStatus UhsClassDrvUnReg ( UhsHandle handle,
uint32_t  drv_handle 
)

◆ UhsGetFullConfigDescriptor()

UHSStatus UhsGetFullConfigDescriptor ( UhsHandle handle,
uint32_t  if_handle,
void *  data,
uint32_t  size 
)

◆ UhsGetDescriptorString()

UHSStatus UhsGetDescriptorString ( UhsHandle handle,
uint32_t  if_handle,
uint8_t  string_index,
BOOL  as_unicode,
void *  data,
uint32_t  size 
)

◆ UhsQueryInterfaces()

UHSStatus UhsQueryInterfaces ( UhsHandle handle,
UhsInterfaceFilter filter,
UhsInterfaceProfile profiles,
int32_t  max_profiles 
)

◆ UhsAcquireInterface()

UHSStatus UhsAcquireInterface ( UhsHandle handle,
uint32_t  if_handle,
void *  context,
UhsAcquireInterfaceCallback  callback 
)

◆ UhsReleaseInterface()

UHSStatus UhsReleaseInterface ( UhsHandle handle,
uint32_t  if_handle,
bool  no_reacquire 
)

◆ UhsAdministerDevice()

UHSStatus UhsAdministerDevice ( UhsHandle handle,
uint32_t  if_handle,
UHSAdminDevType  type,
int32_t  arg3 
)

◆ UhsAdministerEndpoint()

UHSStatus UhsAdministerEndpoint ( UhsHandle handle,
uint32_t  if_handle,
UHSAdminEpType  type,
uint32_t  endpointMask,
uint32_t  max_pending_requests,
uint32_t  max_request_size 
)

◆ UhsClearEndpointHalt()

UHSStatus UhsClearEndpointHalt ( UhsHandle handle,
uint32_t  if_handle,
uint32_t  endpoint,
int32_t  direction 
)

◆ UhsSubmitControlRequest()

UHSStatus UhsSubmitControlRequest ( UhsHandle handle,
uint32_t  if_handle,
void *  buffer,
uint8_t  bRequest,
uint8_t  bmRequestType,
uint16_t  wValue,
uint16_t  wIndex,
uint16_t  wLength,
int32_t  timeout 
)

◆ UhsSubmitBulkRequest()

UHSStatus UhsSubmitBulkRequest ( UhsHandle handle,
uint32_t  if_handle,
uint8_t  endpoint,
int32_t  direction,
void *  buffer,
int32_t  length,
int32_t  timeout 
)

◆ UhsSubmitInterruptRequest()

UHSStatus UhsSubmitInterruptRequest ( UhsHandle handle,
uint32_t  if_handle,
uint8_t  endpoint,
int32_t  direction,
void *  buffer,
int32_t  length,
int32_t  timeout 
)

◆ UHSEndpointDirIsIn()

static uint32_t UHSEndpointDirIsIn ( UhsEndpointDescriptor endpoint_descriptor)
inlinestatic

Definition at line 273 of file uhs.h.

◆ UHSEndpointGetNum()

static uint32_t UHSEndpointGetNum ( UhsEndpointDescriptor endpoint_descriptor)
inlinestatic

Definition at line 277 of file uhs.h.

◆ UHSEndpointGetMask()

static uint32_t UHSEndpointGetMask ( UhsEndpointDescriptor endpoint_descriptor)
inlinestatic

Definition at line 281 of file uhs.h.