libxr
1.0
Want to be the best embedded framework
|
USB 设备类接口基类,所有自定义 USB 类(如 HID、CDC、MSC)都需派生自本类。 USB device class base interface, all custom device classes (HID, CDC, MSC, etc.) should derive from this. More...
#include <dev_core.hpp>
Data Structures | |
struct | RequestResult |
控制请求结果结构体 / Structure for control transfer results More... | |
Protected Member Functions | |
virtual ErrorCode | OnGetDescriptor (bool in_isr, uint8_t bRequest, uint16_t wValue, uint16_t wLength, ConstRawData &need_write) |
处理标准请求 GET_DESCRIPTOR Handle standard request GET_DESCRIPTOR | |
virtual ErrorCode | OnClassRequest (bool in_isr, uint8_t bRequest, uint16_t wValue, uint16_t wLength, RequestResult &result) |
处理类特定请求(Class-specific Request) Handle class-specific request | |
virtual ErrorCode | OnClassData (bool in_isr, uint8_t bRequest, LibXR::ConstRawData &data) |
处理类请求的数据阶段 Handle data stage for class request | |
![]() | |
RawData | GetData () |
获取本配置项描述符的二进制数据 Get the binary data of this configuration item | |
void | SetData (RawData data) |
设置配置项数据 Set configuration item data | |
Friends | |
class | DeviceCore |
Additional Inherited Members | |
![]() | |
virtual void | Init (EndpointPool &endpoint_pool, uint8_t start_itf_num)=0 |
USB配置描述符初始化,派生类在此处申请端点 | |
virtual void | Deinit (EndpointPool &endpoint_pool)=0 |
USB配置描述符反初始化,派生类在此处释放端点 | |
virtual ErrorCode | WriteDeviceDescriptor (DeviceDescriptor &header) |
写入/补全设备描述符(非IAD情况下会被调用) Write device descriptor (non-IAD case will be called) | |
virtual ErrorCode | SetAltSetting (uint8_t itf, uint8_t alt) |
设置接口的备用设置 Set the alternate setting of an interface | |
virtual ErrorCode | GetAltSetting (uint8_t itf, uint8_t &alt) |
获取接口的备用设置 Get the alternate setting of an interface | |
virtual size_t | GetMaxConfigSize ()=0 |
获取该配置项的最大描述符长度 Get the maximum descriptor length of this configuration item | |
virtual size_t | GetInterfaceNum ()=0 |
获取该配置项包含的接口数 Get the number of interfaces included in this configuration item | |
virtual bool | HasIAD ()=0 |
判断是否包含IAD Check if this configuration item contains IAD | |
USB 设备类接口基类,所有自定义 USB 类(如 HID、CDC、MSC)都需派生自本类。 USB device class base interface, all custom device classes (HID, CDC, MSC, etc.) should derive from this.
Definition at line 21 of file dev_core.hpp.
|
inlineprotectedvirtual |
处理类请求的数据阶段 Handle data stage for class request
in_isr | 是否在中断中 / In ISR |
bRequest | 请求码 / Request code |
data | 主机写入数据 / Data from host |
Reimplemented in LibXR::USB::CDCBase, LibXR::USB::HID< REPORT_DESC_LEN, TX_REPORT_LEN, RX_REPORT_LEN >, LibXR::USB::HID< 50, 9, 0 >, LibXR::USB::HID< sizeof(HID_KEYBOARD_REPORT_DESC), 8, 1 >, and LibXR::USB::HID< sizeof(HID_MOUSE_REPORT_DESC), 4, 0 >.
Definition at line 86 of file dev_core.hpp.
|
inlineprotectedvirtual |
处理类特定请求(Class-specific Request) Handle class-specific request
in_isr | 是否在中断中 / In ISR |
bRequest | 请求码 / Request code |
wValue | 请求值 / wValue field |
wLength | 请求长度 / Requested length |
result | 读写数据结构体 / Data result struct |
Reimplemented in LibXR::USB::CDCBase, LibXR::USB::HID< REPORT_DESC_LEN, TX_REPORT_LEN, RX_REPORT_LEN >, LibXR::USB::HID< 50, 9, 0 >, LibXR::USB::HID< sizeof(HID_KEYBOARD_REPORT_DESC), 8, 1 >, and LibXR::USB::HID< sizeof(HID_MOUSE_REPORT_DESC), 4, 0 >.
Definition at line 67 of file dev_core.hpp.
|
inlineprotectedvirtual |
处理标准请求 GET_DESCRIPTOR Handle standard request GET_DESCRIPTOR
in_isr | 是否在中断中 / In ISR |
bRequest | 请求码 / Request code |
wValue | 请求值 / wValue field |
wLength | 请求长度 / Requested length |
need_write | 返回数据指针 / Output data |
Reimplemented in LibXR::USB::HID< REPORT_DESC_LEN, TX_REPORT_LEN, RX_REPORT_LEN >, LibXR::USB::HID< 50, 9, 0 >, LibXR::USB::HID< sizeof(HID_KEYBOARD_REPORT_DESC), 8, 1 >, and LibXR::USB::HID< sizeof(HID_MOUSE_REPORT_DESC), 4, 0 >.
Definition at line 46 of file dev_core.hpp.
|
friend |
Definition at line 94 of file dev_core.hpp.