diff options
| author | hathach <[email protected]> | 2019-07-24 09:45:32 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-07-24 09:45:32 +0700 |
| commit | c63f2b30cbad128d5b46820965f0734be9879cb1 (patch) | |
| tree | 7a7d4aa4f9c9a962e7a8310a45508be9904e2cda /src/class | |
| parent | 8fad8fb5c2d4b586431c1893f912ad2ebedc9b33 (diff) | |
rename tud_control_vendor_request_cb/complete_cb to tud_vendor_control_request_cb/complete_cb
Diffstat (limited to 'src/class')
| -rw-r--r-- | src/class/midi/midi_device.c | 3 | ||||
| -rw-r--r-- | src/class/msc/msc_device.c | 2 | ||||
| -rw-r--r-- | src/class/vendor/vendor_device.h | 42 | ||||
| -rw-r--r-- | src/class/vendor/vendor_host.h | 6 |
4 files changed, 40 insertions, 13 deletions
diff --git a/src/class/midi/midi_device.c b/src/class/midi/midi_device.c index 1e684edde..a33ced169 100644 --- a/src/class/midi/midi_device.c +++ b/src/class/midi/midi_device.c @@ -275,7 +275,8 @@ bool midid_open(uint8_t rhport, tusb_desc_interface_t const * p_interface_desc, (*p_length) = sizeof(tusb_desc_interface_t);
uint8_t found_endpoints = 0;
- while (found_endpoints < p_interface_desc->bNumEndpoints) {
+ while (found_endpoints < p_interface_desc->bNumEndpoints)
+ {
if ( TUSB_DESC_ENDPOINT == p_desc[DESC_OFFSET_TYPE])
{
TU_ASSERT( dcd_edpt_open(rhport, (tusb_desc_endpoint_t const *) p_desc), false);
diff --git a/src/class/msc/msc_device.c b/src/class/msc/msc_device.c index ebc2af1d5..609b4b2ad 100644 --- a/src/class/msc/msc_device.c +++ b/src/class/msc/msc_device.c @@ -111,7 +111,7 @@ bool tud_msc_set_sense(uint8_t lun, uint8_t sense_key, uint8_t add_sense_code, u }
//--------------------------------------------------------------------+
-// USBD-CLASS API
+// USBD Driver API
//--------------------------------------------------------------------+
void mscd_init(void)
{
diff --git a/src/class/vendor/vendor_device.h b/src/class/vendor/vendor_device.h index 0c9d0184f..d2048fb63 100644 --- a/src/class/vendor/vendor_device.h +++ b/src/class/vendor/vendor_device.h @@ -24,20 +24,34 @@ * This file is part of the TinyUSB stack. */ -#ifndef _TUSB_CUSTOM_DEVICE_H_ -#define _TUSB_CUSTOM_DEVICE_H_ +#ifndef _TUSB_VENDOR_DEVICE_H_ +#define _TUSB_VENDOR_DEVICE_H_ #include "common/tusb_common.h" #include "device/usbd.h" +#ifndef CFG_TUD_VENDOR_EPSIZE +#define CFG_TUD_VENDOR_EPSIZE 64 +#endif + +#ifndef CFG_TUD_VENDOR_RX_BUFSIZE +#define CFG_TUD_VENDOR_RX_BUFSIZE 0 +#endif + +#ifndef CFG_TUD_VENDOR_TX_BUFSIZE +#define CFG_TUD_VENDOR_TX_BUFSIZE 0 +#endif + +#ifdef __cplusplus + extern "C" { +#endif + //--------------------------------------------------------------------+ -// APPLICATION API (Multiple Root Ports) -// Should be used only with MCU that support more than 1 ports +// Application API (Multiple Interfaces) //--------------------------------------------------------------------+ //--------------------------------------------------------------------+ -// APPLICATION API (Single Port) -// Should be used with MCU supporting only 1 USB port for code simplicity +// Application API (Single Port) //--------------------------------------------------------------------+ bool tud_vendor_mounted(void); @@ -47,9 +61,17 @@ uint32_t tud_vendor_read(void* buffer, uint32_t bufsize); //--------------------------------------------------------------------+ -// APPLICATION CALLBACK API (WEAK is optional) +// Application Callback API (weak is optional) //--------------------------------------------------------------------+ +// Invoked when received control request with VENDOR TYPE +TU_ATTR_WEAK bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const * request); +TU_ATTR_WEAK bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const * request); + +// Invoked when received new data +TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf); + + //--------------------------------------------------------------------+ // Internal Class Driver API //--------------------------------------------------------------------+ @@ -58,4 +80,8 @@ void vendord_reset(uint8_t rhport); bool vendord_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t *p_length); bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes); -#endif /* _TUSB_CUSTOM_DEVICE_H_ */ +#ifdef __cplusplus + } +#endif + +#endif /* _TUSB_VENDOR_DEVICE_H_ */ diff --git a/src/class/vendor/vendor_host.h b/src/class/vendor/vendor_host.h index 2ca16222a..fa1879376 100644 --- a/src/class/vendor/vendor_host.h +++ b/src/class/vendor/vendor_host.h @@ -28,8 +28,8 @@ * \defgroup Group_Custom Custom Class (not supported yet) * @{ */ -#ifndef _TUSB_CUSTOM_HOST_H_ -#define _TUSB_CUSTOM_HOST_H_ +#ifndef _TUSB_VENDOR_HOST_H_ +#define _TUSB_VENDOR_HOST_H_ #include "common/tusb_common.h" #include "host/usbh.h" @@ -69,6 +69,6 @@ void cush_close(uint8_t dev_addr); } #endif -#endif /* _TUSB_CUSTOM_HOST_H_ */ +#endif /* _TUSB_VENDOR_HOST_H_ */ /** @} */ |
