summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorMengsk <[email protected]>2025-10-03 09:34:40 +0200
committerMengsk <[email protected]>2025-10-03 09:34:40 +0200
commit05ea8cf0ee1365dfe5b2c43c304838648f739abb (patch)
treeef4b339711c41927c35ef036e26640ae84c81ee7 /src/device
parentd322207441d55f636be911899f1c7928ba6b00b7 (diff)
parentc1bf19ed6cf1eaa791f221c1bc5ce4b3d069f76d (diff)
Merge remote-tracking branch 'tinyusb/master' into uac1
Diffstat (limited to 'src/device')
-rw-r--r--src/device/usbd.c14
-rw-r--r--src/device/usbd.h19
2 files changed, 33 insertions, 0 deletions
diff --git a/src/device/usbd.c b/src/device/usbd.c
index 9d241c168..05fc752af 100644
--- a/src/device/usbd.c
+++ b/src/device/usbd.c
@@ -321,6 +321,20 @@ tu_static usbd_class_driver_t const _usbd_driver[] = {
.sof = NULL
},
#endif
+
+ #if CFG_TUD_MTP
+ {
+ .name = DRIVER_NAME("MTP"),
+ .init = mtpd_init,
+ .deinit = mtpd_deinit,
+ .reset = mtpd_reset,
+ .open = mtpd_open,
+ .control_xfer_cb = mtpd_control_xfer_cb,
+ .xfer_cb = mtpd_xfer_cb,
+ .xfer_isr = NULL,
+ .sof = NULL
+ },
+ #endif
};
enum { BUILTIN_DRIVER_COUNT = TU_ARRAY_SIZE(_usbd_driver) };
diff --git a/src/device/usbd.h b/src/device/usbd.h
index 9c61c5ef8..92409f6b4 100644
--- a/src/device/usbd.h
+++ b/src/device/usbd.h
@@ -270,6 +270,25 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
//--------------------------------------------------------------------+
+// MTP Descriptor Templates
+//--------------------------------------------------------------------+
+
+// Length of template descriptor: 30 bytes
+#define TUD_MTP_DESC_LEN (9 + 7 + 7 + 7)
+
+// Interface number, string index, EP event, EP event size, EP event polling, EP Out & EP In address, EP size
+#define TUD_MTP_DESCRIPTOR(_itfnum, _stridx, _ep_evt, _ep_evt_size, _ep_evt_polling_interval, _epout, _epin, _epsize) \
+ /* Interface */\
+ 9, TUSB_DESC_INTERFACE, _itfnum, 0, 3, TUSB_CLASS_IMAGE, MTP_SUBCLASS_STILL_IMAGE, MTP_PROTOCOL_PIMA_15470, _stridx,\
+ /* Endpoint Interrupt */\
+ 7, TUSB_DESC_ENDPOINT, _ep_evt, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_evt_size), _ep_evt_polling_interval,\
+ /* Endpoint Out */\
+ 7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\
+ /* Endpoint In */\
+ 7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0
+
+
+//--------------------------------------------------------------------+
// HID Descriptor Templates
//--------------------------------------------------------------------+