mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2026-01-28 01:47:21 +01:00
Review fixups
pico_usb_reset_... -> usb_reset_... PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB -> PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB Add to docs/index.h
This commit is contained in:
parent
ff769aadb9
commit
34d0660a42
5 changed files with 25 additions and 24 deletions
|
|
@ -127,5 +127,6 @@
|
|||
* \cond boot_picoboot_headers \defgroup boot_picoboot_headers boot_picoboot_headers \endcond
|
||||
* \cond boot_uf2_headers \defgroup boot_uf2_headers boot_uf2_headers \endcond
|
||||
* \cond pico_usb_reset_interface_headers \defgroup pico_usb_reset_interface_headers pico_usb_reset_interface_headers \endcond
|
||||
* \cond pico_usb_reset_interface \defgroup pico_usb_reset_interface pico_usb_reset_interface \endcond
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// PICO_CONFIG: PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB, Set to 0 if your application defines usbd_app_driver_get_cb, type=bool, default=1 when using pico_usb_reset_interface, 0 otherwise, group=pico_usb_reset_interface
|
||||
#ifndef PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB
|
||||
#define PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB LIB_PICO_STDIO_USB
|
||||
// PICO_CONFIG: PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB, Set to 0 if your application defines its own usbd_app_driver_get_cb function, type=bool, default=1 when using pico_usb_reset_interface, 0 otherwise, group=pico_usb_reset_interface
|
||||
#ifndef PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB
|
||||
#define PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB LIB_PICO_STDIO_USB
|
||||
#endif
|
||||
|
||||
// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_RESET_TO_BOOTSEL, If vendor reset interface is included allow rebooting to BOOTSEL mode, type=bool, default=1, group=pico_usb_reset_interface
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF, If vendor reset interface is included the USB interface number for the reset interface, type=int, default=2 if application is not using TinyUSB directly, undefined otherwise, group=pico_usb_reset_interface
|
||||
// PICO_CONFIG: PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF, If vendor reset interface is included this specifies the USB interface number for the reset interface, type=int, default=2 if application is not using TinyUSB directly, undefined otherwise, group=pico_usb_reset_interface
|
||||
#ifndef PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF
|
||||
#if !LIB_TINYUSB_HOST && !LIB_TINYUSB_DEVICE
|
||||
#define PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF 2
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
* 2. Define PICO_STDIO_USB_ENABLE_RESET_VIA_VENDOR_INTERFACE=1
|
||||
* 3. Add `TUD_RPI_RESET_DESCRIPTOR(<ITF_NUM>, <STR_IDX>)` to your USB descriptors (length is `TUD_RPI_RESET_DESC_LEN`)
|
||||
* 4. Check if your project has an existing `usbd_app_driver_get_cb` function:
|
||||
* - If it does, you need to add the `pico_usb_reset_interface_driver` to the drivers returned
|
||||
* - If it does not, and you aren't using the `pico_stdio_usb` library, you need to define `PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB=1`
|
||||
* - If it does, you need to add the `usb_reset_interface_driver` to the drivers returned
|
||||
* - If it does not, and you aren't using the `pico_stdio_usb` library, you need to define `PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB=1`
|
||||
* 5. Check if your project has an existing Microsoft OS 2.0 Descriptor:
|
||||
* - If it does, you need to add the Function Subset header `RPI_RESET_MS_OS_20_DESCRIPTOR(<ITF_NUM>)` to your Microsoft OS 2.0 Descriptor (length is `RPI_RESET_MS_OS_20_DESC_LEN`)
|
||||
* - If it does not, you need to define `PICO_STDIO_USB_RESET_INTERFACE_SUPPORT_MS_OS_20_DESCRIPTOR=1` and `PICO_STDIO_USB_RESET_INTERFACE_MS_OS_20_DESCRIPTOR_ITF=<ITF_NUM>`
|
||||
|
|
|
|||
|
|
@ -42,22 +42,22 @@
|
|||
#include "stdint.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
void pico_usb_reset_interface_init(void);
|
||||
void pico_usb_reset_interface_reset(uint8_t __unused rhport);
|
||||
uint16_t pico_usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len);
|
||||
bool pico_usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request);
|
||||
bool pico_usb_reset_interface_xfer_cb(uint8_t __unused rhport, uint8_t __unused ep_addr, xfer_result_t __unused result, uint32_t __unused xferred_bytes);
|
||||
void usb_reset_interface_init(void);
|
||||
void usb_reset_interface_reset(uint8_t __unused rhport);
|
||||
uint16_t usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len);
|
||||
bool usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request);
|
||||
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);
|
||||
|
||||
static usbd_class_driver_t const pico_usb_reset_interface_driver =
|
||||
static usbd_class_driver_t const usb_reset_interface_driver =
|
||||
{
|
||||
#if CFG_TUSB_DEBUG >= 2
|
||||
.name = "RESET",
|
||||
#endif
|
||||
.init = pico_usb_reset_interface_init,
|
||||
.reset = pico_usb_reset_interface_reset,
|
||||
.open = pico_usb_reset_interface_open,
|
||||
.control_xfer_cb = pico_usb_reset_interface_control_xfer_cb,
|
||||
.xfer_cb = pico_usb_reset_interface_xfer_cb,
|
||||
.init = usb_reset_interface_init,
|
||||
.reset = usb_reset_interface_reset,
|
||||
.open = usb_reset_interface_open,
|
||||
.control_xfer_cb = usb_reset_interface_control_xfer_cb,
|
||||
.xfer_cb = usb_reset_interface_xfer_cb,
|
||||
.sof = NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,14 +68,14 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
|
|||
}
|
||||
#endif
|
||||
|
||||
void pico_usb_reset_interface_init(void) {
|
||||
void usb_reset_interface_init(void) {
|
||||
}
|
||||
|
||||
void pico_usb_reset_interface_reset(uint8_t __unused rhport) {
|
||||
void usb_reset_interface_reset(uint8_t __unused rhport) {
|
||||
itf_num = 0;
|
||||
}
|
||||
|
||||
uint16_t pico_usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len) {
|
||||
uint16_t usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interface_t const *itf_desc, uint16_t max_len) {
|
||||
TU_VERIFY(TUSB_CLASS_VENDOR_SPECIFIC == itf_desc->bInterfaceClass &&
|
||||
RESET_INTERFACE_SUBCLASS == itf_desc->bInterfaceSubClass &&
|
||||
RESET_INTERFACE_PROTOCOL == itf_desc->bInterfaceProtocol, 0);
|
||||
|
|
@ -88,7 +88,7 @@ uint16_t pico_usb_reset_interface_open(uint8_t __unused rhport, tusb_desc_interf
|
|||
}
|
||||
|
||||
// Support for parameterized reset via vendor interface control request
|
||||
bool pico_usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request) {
|
||||
bool usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t stage, tusb_control_request_t const * request) {
|
||||
// nothing to do with DATA & ACK stage
|
||||
if (stage != CONTROL_STAGE_SETUP) return true;
|
||||
|
||||
|
|
@ -125,15 +125,15 @@ bool pico_usb_reset_interface_control_xfer_cb(uint8_t __unused rhport, uint8_t s
|
|||
return false;
|
||||
}
|
||||
|
||||
bool pico_usb_reset_interface_xfer_cb(uint8_t __unused rhport, uint8_t __unused ep_addr, xfer_result_t __unused result, uint32_t __unused xferred_bytes) {
|
||||
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) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if PICO_STDIO_USB_RESET_INCLUDE_APP_DRIVER_CB
|
||||
#if PICO_STDIO_USB_RESET_INCLUDE_DEFAULT_APP_DRIVER_CB
|
||||
// Implement callback to add our custom driver
|
||||
usbd_class_driver_t const *usbd_app_driver_get_cb(uint8_t *driver_count) {
|
||||
*driver_count = 1;
|
||||
return &pico_usb_reset_interface_driver;
|
||||
return &usb_reset_interface_driver;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue