|
| | DeviceClass (std::initializer_list< BosCapability * > bos_caps={}) |
| | 构造:传入本类提供的 BOS capabilities(对象指针列表) Constructor: pass BOS capabilities provided by this class (pointer list).
|
| |
| | ~DeviceClass () override |
| | 析构函数 / Destructor
|
| |
| virtual void | BindEndpoints (EndpointPool &endpoint_pool, uint8_t start_itf_num, bool in_isr)=0 |
| | 绑定端点资源 / Bind endpoint resources
|
| |
| virtual void | UnbindEndpoints (EndpointPool &endpoint_pool, bool in_isr)=0 |
| | 解绑端点资源 / Unbind endpoint resources
|
| |
| virtual ErrorCode | WriteDeviceDescriptor (DeviceDescriptor &header) |
| | 可选:覆盖设备描述符字段 / Optional: override device descriptor fields
|
| |
| virtual ErrorCode | SetAltSetting (uint8_t itf, uint8_t alt) |
| | 可选:设置接口备用设置 / Optional: set interface alternate setting
|
| |
| virtual ErrorCode | GetAltSetting (uint8_t itf, uint8_t &alt) |
| | 可选:获取接口备用设置 / Optional: get interface alternate setting
|
| |
| virtual bool | OwnsEndpoint (uint8_t ep_addr) const |
| | 可选:端点归属判定 / Optional: endpoint ownership
|
| |
| virtual size_t | GetMaxConfigSize ()=0 |
| | 最大配置描述符占用 / Maximum bytes required in configuration descriptor
|
| |
| virtual size_t | GetInterfaceCount ()=0 |
| | 接口数量 / Number of interfaces contributed
|
| |
| virtual bool | HasIAD ()=0 |
| | 是否包含 IAD / Whether an IAD is used
|
| |
| virtual size_t | GetBosCapabilityCount () |
| | 获取 BOS 能力数量 / Get BOS capability count
|
| |
| virtual BosCapability * | GetBosCapability (size_t index) |
| | 获取指定索引的 BOS 能力 / Get BOS capability at index
|
| |
|
| virtual ErrorCode | OnGetDescriptor (bool in_isr, uint8_t bRequest, uint16_t wValue, uint16_t wLength, ConstRawData &out_data) |
| | 处理标准请求 GET_DESCRIPTOR(类特定描述符) Handle standard GET_DESCRIPTOR request (class-specific descriptors).
|
| |
| virtual ErrorCode | OnClassRequest (bool in_isr, uint8_t bRequest, uint16_t wValue, uint16_t wLength, uint16_t wIndex, ControlTransferResult &result) |
| | 处理 Class-specific 请求(Setup stage)/ Handle class-specific request (Setup stage)
|
| |
| virtual ErrorCode | OnClassData (bool in_isr, uint8_t bRequest, LibXR::ConstRawData &data) |
| | 处理 Class request 数据阶段 / Handle class request data stage
|
| |
| virtual ErrorCode | OnVendorRequest (bool in_isr, uint8_t bRequest, uint16_t wValue, uint16_t wLength, uint16_t wIndex, ControlTransferResult &result) |
| | 处理 Vendor request(Setup stage)/ Handle vendor request (Setup stage)
|
| |
| RawData | GetData () |
| | 获取内部数据缓存 / Get internal data cache
|
| |
| void | SetData (RawData data) |
| | 设置内部数据缓存 / Set internal data cache
|
| |
USB 设备类接口基类 / USB device class interface base.
所有自定义 USB 类(HID/CDC/MSC 等)应派生自本类。 All custom USB classes (HID/CDC/MSC, etc.) should derive from this class.
- Note
- 该类主要供 DeviceCore 驱动及派生类扩展使用。 This class is mainly used by DeviceCore and derived-class extensions.
Definition at line 25 of file dev_core.hpp.
| virtual ErrorCode LibXR::USB::DeviceClass::OnClassData |
( |
bool | in_isr, |
|
|
uint8_t | bRequest, |
|
|
LibXR::ConstRawData & | data ) |
|
inlineprotectedvirtual |
处理 Class request 数据阶段 / Handle class request data stage
- Parameters
-
| in_isr | 是否在 ISR / Whether in ISR context |
| bRequest | 请求码 / Request code |
| data | 数据阶段数据 / Data stage payload |
- Returns
- 错误码 / Error code
- Note
- 当 OnClassRequest 返回需要 OUT/IN data stage 时,数据阶段完成后回调此函数。 When OnClassRequest requires an OUT/IN data stage, this callback is invoked after completion.
Reimplemented in LibXR::USB::CDCBase, LibXR::USB::GsUsbClass< CanChNum >, 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 >, LibXR::USB::HID< sizeof(HID_MOUSE_REPORT_DESC), 4, 0 >, and LibXR::USB::UAC1MicrophoneQ< CHANNELS, BITS_PER_SAMPLE >.
Definition at line 133 of file dev_core.hpp.
134 {
135 UNUSED(in_isr);
136 UNUSED(bRequest);
137 UNUSED(data);
138 return ErrorCode::NOT_SUPPORT;
139 }
| virtual ErrorCode LibXR::USB::DeviceClass::OnClassRequest |
( |
bool | in_isr, |
|
|
uint8_t | bRequest, |
|
|
uint16_t | wValue, |
|
|
uint16_t | wLength, |
|
|
uint16_t | wIndex, |
|
|
ControlTransferResult & | result ) |
|
inlineprotectedvirtual |
处理 Class-specific 请求(Setup stage)/ Handle class-specific request (Setup stage)
- Parameters
-
| in_isr | 是否在 ISR / Whether in ISR context |
| bRequest | 请求码 / Request code |
| wValue | wValue / wValue |
| wLength | wLength / wLength |
| wIndex | wIndex / wIndex |
| result | 输出:控制传输结果 / Output: control transfer result |
- Returns
- 错误码 / Error code
Reimplemented in LibXR::USB::CDCBase, LibXR::USB::GsUsbClass< CanChNum >, 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 >, LibXR::USB::HID< sizeof(HID_MOUSE_REPORT_DESC), 4, 0 >, and LibXR::USB::UAC1MicrophoneQ< CHANNELS, BITS_PER_SAMPLE >.
Definition at line 108 of file dev_core.hpp.
111 {
112 UNUSED(in_isr);
113 UNUSED(bRequest);
114 UNUSED(wValue);
115 UNUSED(wLength);
116 UNUSED(wIndex);
117 UNUSED(result);
118 return ErrorCode::NOT_SUPPORT;
119 }
| virtual ErrorCode LibXR::USB::DeviceClass::OnGetDescriptor |
( |
bool | in_isr, |
|
|
uint8_t | bRequest, |
|
|
uint16_t | wValue, |
|
|
uint16_t | wLength, |
|
|
ConstRawData & | out_data ) |
|
inlineprotectedvirtual |
处理标准请求 GET_DESCRIPTOR(类特定描述符) Handle standard GET_DESCRIPTOR request (class-specific descriptors).
- Parameters
-
| in_isr | 是否在 ISR / Whether in ISR context |
| bRequest | 请求码 / Request code |
| wValue | wValue / wValue |
| wLength | wLength / wLength |
| out_data | 输出:返回给主机的描述符数据(Device->Host) Output: descriptor data to return (Device->Host) |
- Returns
- 错误码 / Error code
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 >, LibXR::USB::HID< sizeof(HID_MOUSE_REPORT_DESC), 4, 0 >, and LibXR::USB::UAC1MicrophoneQ< CHANNELS, BITS_PER_SAMPLE >.
Definition at line 85 of file dev_core.hpp.
87 {
88 UNUSED(in_isr);
89 UNUSED(bRequest);
90 UNUSED(wValue);
91 UNUSED(wLength);
92 UNUSED(out_data);
93 return ErrorCode::NOT_SUPPORT;
94 }