diff options
| author | hathach <[email protected]> | 2021-10-05 12:32:07 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-10-05 16:00:07 +0700 |
| commit | a867d87072e6f25e47f209e9615e00b97a9eb36f (patch) | |
| tree | 953346cbb1aa11697cf5b5f183c41952fbeb1681 /examples | |
| parent | 31cfd5a68443db941dbce88cebaf8fdf2d16a6a0 (diff) | |
rename CFG_TUD_NET to CFG_TUD_ECM_RNDIS
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/device/cdc_msc_freertos/src/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | examples/device/hid_composite_freertos/src/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | examples/device/net_lwip_webserver/src/tusb_config.h | 12 | ||||
| -rw-r--r-- | examples/device/net_lwip_webserver/src/usb_descriptors.c | 12 | ||||
| -rw-r--r-- | examples/rules.mk | 2 |
5 files changed, 16 insertions, 14 deletions
diff --git a/examples/device/cdc_msc_freertos/src/CMakeLists.txt b/examples/device/cdc_msc_freertos/src/CMakeLists.txt index f1c1e8c5d..07fc4df89 100644 --- a/examples/device/cdc_msc_freertos/src/CMakeLists.txt +++ b/examples/device/cdc_msc_freertos/src/CMakeLists.txt @@ -23,7 +23,7 @@ target_sources(${COMPONENT_TARGET} PUBLIC "${TOP}/src/class/hid/hid_device.c" "${TOP}/src/class/midi/midi_device.c" "${TOP}/src/class/msc/msc_device.c" - "${TOP}/src/class/net/ecmrndis_device.c" + "${TOP}/src/class/net/ecm_rndis_device.c" "${TOP}/src/class/net/ncm_device.c" "${TOP}/src/class/usbtmc/usbtmc_device.c" "${TOP}/src/class/vendor/vendor_device.c" diff --git a/examples/device/hid_composite_freertos/src/CMakeLists.txt b/examples/device/hid_composite_freertos/src/CMakeLists.txt index 70df447dd..6f156379f 100644 --- a/examples/device/hid_composite_freertos/src/CMakeLists.txt +++ b/examples/device/hid_composite_freertos/src/CMakeLists.txt @@ -23,7 +23,7 @@ target_sources(${COMPONENT_TARGET} PUBLIC "${TOP}/src/class/hid/hid_device.c" "${TOP}/src/class/midi/midi_device.c" "${TOP}/src/class/msc/msc_device.c" - "${TOP}/src/class/net/ecmrndis_device.c" + "${TOP}/src/class/net/ecm_rndis_device.c" "${TOP}/src/class/net/ncm_device.c" "${TOP}/src/class/usbtmc/usbtmc_device.c" "${TOP}/src/class/vendor/vendor_device.c" diff --git a/examples/device/net_lwip_webserver/src/tusb_config.h b/examples/device/net_lwip_webserver/src/tusb_config.h index 457918cac..114961cb7 100644 --- a/examples/device/net_lwip_webserver/src/tusb_config.h +++ b/examples/device/net_lwip_webserver/src/tusb_config.h @@ -95,13 +95,11 @@ #endif //------------- CLASS -------------// -#define CFG_TUD_CDC 0 -#define CFG_TUD_MSC 0 -#define CFG_TUD_HID 0 -#define CFG_TUD_MIDI 0 -#define CFG_TUD_VENDOR 0 -#define CFG_TUD_NET 1 -#define CFG_TUD_NCM 0 + +// Network class has 2 drivers: ECM/RNDIS and NCM. +// Only one of the drivers can be enabled +#define CFG_TUD_ECM_RNDIS 1 +#define CFG_TUD_NCM (1-CFG_TUD_ECM_RNDIS) #ifdef __cplusplus } diff --git a/examples/device/net_lwip_webserver/src/usb_descriptors.c b/examples/device/net_lwip_webserver/src/usb_descriptors.c index d9618a3dc..2b4b2a0c3 100644 --- a/examples/device/net_lwip_webserver/src/usb_descriptors.c +++ b/examples/device/net_lwip_webserver/src/usb_descriptors.c @@ -33,7 +33,7 @@ */ #define _PID_MAP(itf, n) ( (CFG_TUD_##itf) << (n) ) #define USB_PID (0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \ - _PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) | _PID_MAP(NET, 5) ) + _PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4) | _PID_MAP(ECM_RNDIS, 5) | _PID_MAP(NCM, 5) ) // String Descriptor Index enum @@ -55,7 +55,7 @@ enum enum { -#if !CFG_TUD_NCM +#if CFG_TUD_ECM_RNDIS CONFIG_ID_RNDIS = 0, CONFIG_ID_ECM = 1, #else @@ -125,7 +125,8 @@ uint8_t const * tud_descriptor_device_cb(void) #define EPNUM_NET_IN 0x82 #endif -#if !CFG_TUD_NCM +#if CFG_TUD_ECM_RNDIS + static uint8_t const rndis_configuration[] = { // Config number (index+1), interface count, string index, total length, attribute, power in mA @@ -143,7 +144,9 @@ static uint8_t const ecm_configuration[] = // Interface number, description string index, MAC address string index, EP notification address and size, EP data address (out, in), and size, max segment size. TUD_CDC_ECM_DESCRIPTOR(ITF_NUM_CDC, STRID_INTERFACE, STRID_MAC, EPNUM_NET_NOTIF, 64, EPNUM_NET_OUT, EPNUM_NET_IN, CFG_TUD_NET_ENDPOINT_SIZE, CFG_TUD_NET_MTU), }; + #else + static uint8_t const ncm_configuration[] = { // Config number (index+1), interface count, string index, total length, attribute, power in mA @@ -152,6 +155,7 @@ static uint8_t const ncm_configuration[] = // Interface number, description string index, MAC address string index, EP notification address and size, EP data address (out, in), and size, max segment size. TUD_CDC_NCM_DESCRIPTOR(ITF_NUM_CDC, STRID_INTERFACE, STRID_MAC, EPNUM_NET_NOTIF, 64, EPNUM_NET_OUT, EPNUM_NET_IN, CFG_TUD_NET_ENDPOINT_SIZE, CFG_TUD_NET_MTU), }; + #endif // Configuration array: RNDIS and CDC-ECM @@ -160,7 +164,7 @@ static uint8_t const ncm_configuration[] = // - Linux will work on both static uint8_t const * const configuration_arr[2] = { -#if !CFG_TUD_NCM +#if CFG_TUD_ECM_RNDIS [CONFIG_ID_RNDIS] = rndis_configuration, [CONFIG_ID_ECM ] = ecm_configuration #else diff --git a/examples/rules.mk b/examples/rules.mk index a9dfa1363..5f9dd9d19 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -33,7 +33,7 @@ SRC_C += \ src/class/hid/hid_device.c \ src/class/midi/midi_device.c \ src/class/msc/msc_device.c \ - src/class/net/ecmrndis_device.c \ + src/class/net/ecm_rndis_device.c \ src/class/net/ncm_device.c \ src/class/usbtmc/usbtmc_device.c \ src/class/vendor/vendor_device.c |
