libnx
usb_comms.h
Go to the documentation of this file.
1 /**
2  * @file usb_comms.h
3  * @brief USB comms.
4  * @author yellows8
5  * @author plutoo
6  * @copyright libnx Authors
7  */
8 #pragma once
9 #include "../../types.h"
10 
11 Result usbCommsInitialize(void);
12 void usbCommsExit(void);
13 
14 /// Same as usbCommsInitialize, except this can be used after usbCommsInitialize (or instead of usbCommsInitialize), for creating new interface(s).
15 /// bInterface* are the values for the same fields in usb.h \ref usb_interface_descriptor. \ref usbCommsInitialize uses USB_CLASS_VENDOR_SPEC for all of these internally.
16 Result usbCommsInitializeEx(u32 *interface, u8 bInterfaceClass, u8 bInterfaceSubClass, u8 bInterfaceProtocol);
17 
18 /// Shutdown the specified interface. If no interfaces are remaining, this then uses \ref usbCommsExit internally.
19 void usbCommsExitEx(u32 interface);
20 
21 /// Read data with the default interface.
22 size_t usbCommsRead(void* buffer, size_t size);
23 
24 /// Write data with the default interface.
25 size_t usbCommsWrite(const void* buffer, size_t size);
26 
27 /// Same as usbCommsRead except with the specified interface.
28 size_t usbCommsReadEx(void* buffer, size_t size, u32 interface);
29 
30 /// Same as usbCommsWrite except with the specified interface.
31 size_t usbCommsWriteEx(const void* buffer, size_t size, u32 interface);
size_t usbCommsWriteEx(const void *buffer, size_t size, u32 interface)
Same as usbCommsWrite except with the specified interface.
u32 Result
Function error code result type.
Definition: types.h:46
uint8_t u8
8-bit unsigned integer.
Definition: types.h:21
Result usbCommsInitializeEx(u32 *interface, u8 bInterfaceClass, u8 bInterfaceSubClass, u8 bInterfaceProtocol)
Same as usbCommsInitialize, except this can be used after usbCommsInitialize (or instead of usbCommsI...
size_t usbCommsReadEx(void *buffer, size_t size, u32 interface)
Same as usbCommsRead except with the specified interface.
uint32_t u32
32-bit unsigned integer.
Definition: types.h:23
void usbCommsExitEx(u32 interface)
Shutdown the specified interface. If no interfaces are remaining, this then uses usbCommsExit interna...
size_t usbCommsRead(void *buffer, size_t size)
Read data with the default interface.
size_t usbCommsWrite(const void *buffer, size_t size)
Write data with the default interface.