This is an automated email from the ASF dual-hosted git repository.

kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 1ac2a4863a323dc976f9be377923ce3754f39c04
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Tue Oct 13 12:39:51 2026 +0200

    tinyusb: Add network endpoint defaults to port tusb_hw.h
    
    Network class functions (CDC-NCM, CDC-ECM, RNDIS) need an interrupt
    IN notification endpoint and a bulk IN/OUT pair.  Define
    USBD_NET_NOTIFY_EP, USBD_NET_DATA_OUT_EP and USBD_NET_DATA_IN_EP in
    each port next to the other class defaults, choosing numbers that
    stay clear of CDC (and CDC console) where the controller has enough
    endpoints:
    
     - nrf5x, nrf53: 0x84, 0x05/0x85
     - stm32_fsdev, pic32mz: 0x85, 0x07/0x87
     - synopsys: 0x84, 0x05/0x85; STM32F4 OTG_FS (endpoints 0-3 only)
       0x83, 0x01/0x81
     - lpc55: 0x83, 0x04/0x84 (full speed controller has endpoints 0-4)
     - da146xx: 0x81, 0x02/0x82 (four endpoints, shared with CDC)
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 hw/usb/tinyusb/da146xx/include/tusb_hw.h           | 23 ++++++++++++++++++
 hw/usb/tinyusb/lpc55/include/tusb_hw.h             | 22 +++++++++++++++++
 hw/usb/tinyusb/nrf53/include/tusb_hw.h             | 22 +++++++++++++++++
 hw/usb/tinyusb/nrf5x/include/tusb_hw.h             | 22 +++++++++++++++++
 hw/usb/tinyusb/pic32mz/include/tusb_hw.h           | 23 ++++++++++++++++++
 hw/usb/tinyusb/stm32_fsdev/include/tusb_hw.h       | 22 +++++++++++++++++
 .../tinyusb/stm32_fsdev/stm32f3/include/tusb_hw.h  | 22 +++++++++++++++++
 .../tinyusb/stm32_fsdev/stm32g0/include/tusb_hw.h  | 22 +++++++++++++++++
 .../tinyusb/stm32_fsdev/stm32g4/include/tusb_hw.h  | 22 +++++++++++++++++
 .../tinyusb/stm32_fsdev/stm32h5/include/tusb_hw.h  | 22 +++++++++++++++++
 .../tinyusb/stm32_fsdev/stm32l0/include/tusb_hw.h  | 22 +++++++++++++++++
 .../stm32_fsdev/stm32wb55/include/tusb_hw.h        | 22 +++++++++++++++++
 hw/usb/tinyusb/synopsys/include/tusb_hw.h          | 28 ++++++++++++++++++++++
 13 files changed, 294 insertions(+)

diff --git a/hw/usb/tinyusb/da146xx/include/tusb_hw.h 
b/hw/usb/tinyusb/da146xx/include/tusb_hw.h
index 518ecc819..6bb972f82 100644
--- a/hw/usb/tinyusb/da146xx/include/tusb_hw.h
+++ b/hw/usb/tinyusb/da146xx/include/tusb_hw.h
@@ -149,4 +149,27 @@ void tusb_vbus_changed(bool present);
 #define USBD_AUDIO_FEEDBACK_EP  0x83
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Controller has four
+ * endpoints, defaults are shared with CDC so both can not be used
+ * together.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x81
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x02
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x82
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/lpc55/include/tusb_hw.h 
b/hw/usb/tinyusb/lpc55/include/tusb_hw.h
index 45ed8093c..6d61cd13b 100644
--- a/hw/usb/tinyusb/lpc55/include/tusb_hw.h
+++ b/hw/usb/tinyusb/lpc55/include/tusb_hw.h
@@ -111,4 +111,26 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x84
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Full speed controller has
+ * endpoints 0-4 only, defaults are shared with HID and MSC.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x83
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x04
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x84
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/nrf53/include/tusb_hw.h 
b/hw/usb/tinyusb/nrf53/include/tusb_hw.h
index c8ee70fa9..11a5d9141 100644
--- a/hw/usb/tinyusb/nrf53/include/tusb_hw.h
+++ b/hw/usb/tinyusb/nrf53/include/tusb_hw.h
@@ -160,4 +160,26 @@ nrf52_errata_199(void)
 #define USBD_AUDIO_FEEDBACK_EP  0x88
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints, clear of CDC, HID and MSC
+ * defaults.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x84
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x05
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x85
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/nrf5x/include/tusb_hw.h 
b/hw/usb/tinyusb/nrf5x/include/tusb_hw.h
index 075445d57..07bcf0af5 100755
--- a/hw/usb/tinyusb/nrf5x/include/tusb_hw.h
+++ b/hw/usb/tinyusb/nrf5x/include/tusb_hw.h
@@ -163,4 +163,26 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x88
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints, clear of CDC, HID and MSC
+ * defaults.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x84
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x05
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x85
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/pic32mz/include/tusb_hw.h 
b/hw/usb/tinyusb/pic32mz/include/tusb_hw.h
index 9dc67b475..0f5659e83 100644
--- a/hw/usb/tinyusb/pic32mz/include/tusb_hw.h
+++ b/hw/usb/tinyusb/pic32mz/include/tusb_hw.h
@@ -113,4 +113,27 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x85
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  PIC32MZ endpoint can be used
+ * in one direction only, so each endpoint gets its own number.  Notification
+ * endpoint shares number with audio feedback, data OUT with HID default.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x85
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x03
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x87
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/stm32_fsdev/include/tusb_hw.h 
b/hw/usb/tinyusb/stm32_fsdev/include/tusb_hw.h
index f94ed9d97..d445b6398 100755
--- a/hw/usb/tinyusb/stm32_fsdev/include/tusb_hw.h
+++ b/hw/usb/tinyusb/stm32_fsdev/include/tusb_hw.h
@@ -108,4 +108,26 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x85
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Notification endpoint
+ * shares number with audio feedback endpoint default.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x85
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x07
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x87
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/stm32_fsdev/stm32f3/include/tusb_hw.h 
b/hw/usb/tinyusb/stm32_fsdev/stm32f3/include/tusb_hw.h
index 94e4d8ab4..2633a8c50 100644
--- a/hw/usb/tinyusb/stm32_fsdev/stm32f3/include/tusb_hw.h
+++ b/hw/usb/tinyusb/stm32_fsdev/stm32f3/include/tusb_hw.h
@@ -108,4 +108,26 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x85
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Notification endpoint
+ * shares number with audio feedback endpoint default.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x85
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x07
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x87
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/stm32_fsdev/stm32g0/include/tusb_hw.h 
b/hw/usb/tinyusb/stm32_fsdev/stm32g0/include/tusb_hw.h
index 76e5cc65b..6000d6015 100644
--- a/hw/usb/tinyusb/stm32_fsdev/stm32g0/include/tusb_hw.h
+++ b/hw/usb/tinyusb/stm32_fsdev/stm32g0/include/tusb_hw.h
@@ -108,4 +108,26 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x85
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Notification endpoint
+ * shares number with audio feedback endpoint default.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x85
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x07
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x87
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/stm32_fsdev/stm32g4/include/tusb_hw.h 
b/hw/usb/tinyusb/stm32_fsdev/stm32g4/include/tusb_hw.h
index a27bbc38c..17753d62d 100644
--- a/hw/usb/tinyusb/stm32_fsdev/stm32g4/include/tusb_hw.h
+++ b/hw/usb/tinyusb/stm32_fsdev/stm32g4/include/tusb_hw.h
@@ -108,4 +108,26 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x85
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Notification endpoint
+ * shares number with audio feedback endpoint default.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x85
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x07
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x87
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/stm32_fsdev/stm32h5/include/tusb_hw.h 
b/hw/usb/tinyusb/stm32_fsdev/stm32h5/include/tusb_hw.h
index 2043dfe5c..39b87719b 100644
--- a/hw/usb/tinyusb/stm32_fsdev/stm32h5/include/tusb_hw.h
+++ b/hw/usb/tinyusb/stm32_fsdev/stm32h5/include/tusb_hw.h
@@ -108,4 +108,26 @@
 #define USBD_AUDIO_FEEDBACK_EP 0x85
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Notification endpoint
+ * shares number with audio feedback endpoint default.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP 0x85
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP 0x07
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP 0x87
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/stm32_fsdev/stm32l0/include/tusb_hw.h 
b/hw/usb/tinyusb/stm32_fsdev/stm32l0/include/tusb_hw.h
index 6079f0999..5c6049a52 100644
--- a/hw/usb/tinyusb/stm32_fsdev/stm32l0/include/tusb_hw.h
+++ b/hw/usb/tinyusb/stm32_fsdev/stm32l0/include/tusb_hw.h
@@ -108,4 +108,26 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x85
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Notification endpoint
+ * shares number with audio feedback endpoint default.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x85
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x07
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x87
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/stm32_fsdev/stm32wb55/include/tusb_hw.h 
b/hw/usb/tinyusb/stm32_fsdev/stm32wb55/include/tusb_hw.h
index 9200c851e..9806aaca1 100644
--- a/hw/usb/tinyusb/stm32_fsdev/stm32wb55/include/tusb_hw.h
+++ b/hw/usb/tinyusb/stm32_fsdev/stm32wb55/include/tusb_hw.h
@@ -108,4 +108,26 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x85
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  Notification endpoint
+ * shares number with audio feedback endpoint default.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#else
+#define USBD_NET_NOTIFY_EP      0x85
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#else
+#define USBD_NET_DATA_OUT_EP    0x07
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#else
+#define USBD_NET_DATA_IN_EP     0x87
+#endif
+
 #endif
diff --git a/hw/usb/tinyusb/synopsys/include/tusb_hw.h 
b/hw/usb/tinyusb/synopsys/include/tusb_hw.h
index 325fc7600..37421d38c 100755
--- a/hw/usb/tinyusb/synopsys/include/tusb_hw.h
+++ b/hw/usb/tinyusb/synopsys/include/tusb_hw.h
@@ -124,4 +124,32 @@
 #define USBD_AUDIO_FEEDBACK_EP  0x84
 #endif
 
+/*
+ * Network class (NCM/ECM/RNDIS) endpoints.  STM32F4 OTG_FS has endpoints
+ * 0-3 only, so there the network class can not be used together with CDC.
+ */
+#if defined(MYNEWT_VAL_USBD_NET_NOTIFY_EP)
+#define USBD_NET_NOTIFY_EP      MYNEWT_VAL(USBD_NET_NOTIFY_EP)
+#elif MYNEWT_VAL(MCU_STM32F4) && !MYNEWT_VAL(USB_USE_OTG_HS)
+#define USBD_NET_NOTIFY_EP      0x83
+#else
+#define USBD_NET_NOTIFY_EP      0x84
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_OUT_EP)
+#define USBD_NET_DATA_OUT_EP    MYNEWT_VAL(USBD_NET_DATA_OUT_EP)
+#elif MYNEWT_VAL(MCU_STM32F4) && !MYNEWT_VAL(USB_USE_OTG_HS)
+#define USBD_NET_DATA_OUT_EP    0x01
+#else
+#define USBD_NET_DATA_OUT_EP    0x05
+#endif
+
+#if defined(MYNEWT_VAL_USBD_NET_DATA_IN_EP)
+#define USBD_NET_DATA_IN_EP     MYNEWT_VAL(USBD_NET_DATA_IN_EP)
+#elif MYNEWT_VAL(MCU_STM32F4) && !MYNEWT_VAL(USB_USE_OTG_HS)
+#define USBD_NET_DATA_IN_EP     0x81
+#else
+#define USBD_NET_DATA_IN_EP     0x85
+#endif
+
 #endif

Reply via email to