Menu Toggle
v2.3.1 (RP2350)
Toggle main menu visibility
Loading...
Searching...
No Matches
usb_reset_tusb.h
1
/*
2
* Copyright (c) 2025 Raspberry Pi (Trading) Ltd.
3
*
4
* SPDX-License-Identifier: BSD-3-Clause
5
*/
6
7
#ifndef _PICO_USB_RESET_TUSB_H
8
#define _PICO_USB_RESET_TUSB_H
9
10
#ifdef __cplusplus
11
extern
"C"
{
12
#endif
13
14
// Interface descriptor
15
#define TUD_RPI_RESET_DESC_LEN 9
16
#define TUD_RPI_RESET_DESCRIPTOR(_itfnum, _stridx) \
17
/* Interface */
\
18
TUD_RPI_RESET_DESC_LEN, TUSB_DESC_INTERFACE, _itfnum, 0, 0, TUSB_CLASS_VENDOR_SPECIFIC, RESET_INTERFACE_SUBCLASS, RESET_INTERFACE_PROTOCOL, _stridx
19
20
21
// Microsoft OS 2.0 Descriptor
22
#define RPI_RESET_MS_OS_20_DESC_LEN (0x08 + 0x14 + 0x80)
23
#define RPI_RESET_MS_OS_20_DESCRIPTOR(itf_num) \
24
/* Function Subset header: length, type, first interface, reserved, subset length */
\
25
U16_TO_U8S_LE(0x0008), U16_TO_U8S_LE(MS_OS_20_SUBSET_HEADER_FUNCTION), itf_num, 0, U16_TO_U8S_LE(RPI_RESET_MS_OS_20_DESC_LEN), \
26
\
27
/* MS OS 2.0 Compatible ID descriptor: length, type, compatible ID, sub compatible ID */
\
28
U16_TO_U8S_LE(0x0014), U16_TO_U8S_LE(MS_OS_20_FEATURE_COMPATBLE_ID), 'W', 'I', 'N', 'U', 'S', 'B', 0x00, 0x00, \
29
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* sub-compatible */
\
30
\
31
/* MS OS 2.0 Registry property descriptor: length, type */
\
32
U16_TO_U8S_LE(0x0080), U16_TO_U8S_LE(MS_OS_20_FEATURE_REG_PROPERTY), \
33
U16_TO_U8S_LE(0x0001), U16_TO_U8S_LE(0x0028),
/* wPropertyDataType, wPropertyNameLength and PropertyName "DeviceInterfaceGUID" in UTF-16 */
\
34
'D', 0x00, 'e', 0x00, 'v', 0x00, 'i', 0x00, 'c', 0x00, 'e', 0x00, 'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, \
35
'r', 0x00, 'f', 0x00, 'a', 0x00, 'c', 0x00, 'e', 0x00, 'G', 0x00, 'U', 0x00, 'I', 0x00, 'D', 0x00, 0x00, 0x00, \
36
U16_TO_U8S_LE(0x004E),
/* wPropertyDataLength */
\
37
/* Vendor-defined Property Data: {bc7398c1-73cd-4cb7-98b8-913a8fca7bf6} */
\
38
'{', 0, 'b', 0, 'c', 0, '7', 0, '3', 0, '9', 0, \
39
'8', 0, 'c', 0, '1', 0, '-', 0, '7', 0, '3', 0, \
40
'c', 0, 'd', 0, '-', 0, '4', 0, 'c', 0, 'b', 0, \
41
'7', 0, '-', 0, '9', 0, '8', 0, 'b', 0, '8', 0, \
42
'-', 0, '9', 0, '1', 0, '3', 0, 'a', 0, '8', 0, \
43
'f', 0, 'c', 0, 'a', 0, '7', 0, 'b', 0, 'f', 0, \
44
'6', 0, '}', 0, 0, 0
45
46
#include "stdint.h"
47
#include "device/usbd_pvt.h"
48
49
void
usb_reset_interface_init(
void
);
50
void
usb_reset_interface_reset(uint8_t __unused rhport);
51
uint16_t usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t
const
*itf_desc, uint16_t max_len);
52
bool
usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t
const
* request);
53
bool
usb_reset_interface_xfer_cb(uint8_t __unused rhport, uint8_t __unused ep_addr, xfer_result_t __unused result, uint32_t __unused xferred_bytes);
54
55
static
usbd_class_driver_t
const
usb_reset_interface_driver =
56
{
57
#if CFG_TUSB_DEBUG >= 2
58
.name =
"RESET"
,
59
#endif
60
.init = usb_reset_interface_init,
61
.reset = usb_reset_interface_reset,
62
.open = usb_reset_interface_open,
63
.control_xfer_cb = usb_reset_interface_control_xfer_cb,
64
.xfer_cb = usb_reset_interface_xfer_cb,
65
.sof = NULL
66
};
67
68
#ifdef __cplusplus
69
}
70
#endif
71
72
#endif