libtransistor
A userland library for the Nintendo Switch
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
interface.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #include<libtransistor/types.h>
13 #include<libtransistor/ipc.h>
15 
16 #define USB_DS_INTERFACE_NUMBER_AUTO 0x4
17 
18 extern usb_interface_descriptor_t usb_default_interface_descriptor;
19 
20 typedef struct {
21  ipc_object_t object;
22  uint8_t interface_id;
23  uint8_t next_in_ep_addr;
24  uint8_t next_out_ep_addr;
25  bool is_enabled;
27 
35 result_t usb_ds_interface_get_endpoint(usb_ds_interface_t *intf, usb_endpoint_descriptor_t *descriptor, usb_ds_endpoint_t *endpoint);
36 
41 
46 
51 
55 result_t usb_ds_ctrl_in_post_buffer_async(usb_ds_interface_t *intf, void *buffer, size_t size, uint32_t *urb_id);
56 
60 result_t usb_ds_ctrl_out_post_buffer_async(usb_ds_interface_t *intf, void *buffer, size_t size, uint32_t *urb_id);
61 
66 
71 
76 
81 
86 
87 #ifdef __cplusplus
88 }
89 #endif
Various system types.
result_t usb_ds_stall_ctrl(usb_ds_interface_t *intf)
Stalls control endpoints.
result_t usb_ds_get_ctrl_in_report_data(usb_ds_interface_t *intf, usb_ds_report_t *report)
Gets report data for the control input endpoint.
result_t usb_ds_get_ctrl_out_report_data(usb_ds_interface_t *intf, usb_ds_report_t *report)
Gets report data for the control output endpoint.
result_t usb_ds_ctrl_out_post_buffer_async(usb_ds_interface_t *intf, void *buffer, size_t size, uint32_t *urb_id)
Submits a buffer for transfer over the control output endpoint.
uint32_t result_t
Function result.
Definition: types.h:51
handle_t revent_h
revent handle
Definition: types.h:47
Definition: endpoint.h:26
result_t usb_ds_get_ctrl_out_completion_event(usb_ds_interface_t *intf, revent_h *event)
Gets an event that is signalled when a transaction completes on the control output endpoint...
result_t usb_ds_interface_disable(usb_ds_interface_t *intf)
Disables the given interface so it can no longer be used.
Represents either an object within an IPC domain or a standalone object.
Definition: ipc.h:32
Definition: interface.h:20
result_t usb_ds_close_interface(usb_ds_interface_t *intf)
Close and destroy the given interface.
result_t usb_ds_ctrl_in_post_buffer_async(usb_ds_interface_t *intf, void *buffer, size_t size, uint32_t *urb_id)
Submits a buffer for transfer over the control input endpoint.
result_t usb_ds_interface_enable(usb_ds_interface_t *intf)
Enables the given interface for use.
USB-as-device endpoint.
Interprocess Communication data structures and functions.
result_t usb_ds_interface_get_endpoint(usb_ds_interface_t *intf, usb_endpoint_descriptor_t *descriptor, usb_ds_endpoint_t *endpoint)
Create a new endpoint on the given interface.
Definition: endpoint.h:15
result_t usb_ds_get_ctrl_in_completion_event(usb_ds_interface_t *intf, revent_h *event)
Gets an event that is signalled when a transaction completes on the control input endpoint...