Skip to content

Commit 3019bb7

Browse files
committed
feat(iot_eth): rename usb_host_rndis to iot_usbh_rndis
1 parent 2fcd257 commit 3019bb7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+687
-382
lines changed

.github/workflows/upload_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
components/usb/iot_usbh_modem;
9797
components/usb/usb_device_uac;
9898
components/usb/usb_device_uvc;
99-
components/usb/usb_host_rndis;
99+
components/usb/iot_usbh_rndis;
100100
components/usb/usb_stream;
101101
components/utilities/adc_tp_calibration;
102102
components/utilities/xz;

.gitlab/ci/build.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,19 @@ build_example_usb_host_usb_msc_ota:
969969
variables:
970970
EXAMPLE_DIR: examples/usb/host/usb_msc_ota
971971

972+
build_example_usb_host_usb_rndis_4g_module:
973+
extends:
974+
- .build_examples_template
975+
- .rules:build:example_usb_host_usb_rndis_4g_module
976+
parallel:
977+
matrix:
978+
- IMAGE: espressif/idf:release-v5.1
979+
- IMAGE: espressif/idf:release-v5.2
980+
- IMAGE: espressif/idf:release-v5.3
981+
- IMAGE: espressif/idf:release-v5.4
982+
variables:
983+
EXAMPLE_DIR: examples/usb/host/usb_rndis_4g_module
984+
972985
build_example_usb_otg_usb_host_device_mode_manual_switch:
973986
extends:
974987
- .build_examples_template
@@ -1597,15 +1610,13 @@ build_components_usb_esp_msc_ota_test_apps:
15971610
IMAGE: espressif/idf:release-v5.1
15981611
EXAMPLE_DIR: components/usb/esp_msc_ota/test_apps
15991612

1600-
build_components_usb_usb_host_rndis_test_apps:
1613+
build_components_usb_iot_usbh_rndis_test_apps:
16011614
extends:
16021615
- .build_examples_template
1603-
- .rules:build:components_usb_usb_host_rndis_test_apps
1604-
parallel:
1605-
matrix:
1606-
- IMAGE: espressif/idf:release-v5.4
1616+
- .rules:build:components_usb_iot_usbh_rndis_test_apps
1617+
- .build_idf_version_greater_equal_v5_0
16071618
variables:
1608-
EXAMPLE_DIR: components/usb/usb_host_rndis/test_apps
1619+
EXAMPLE_DIR: components/usb/iot_usbh_rndis/test_apps
16091620

16101621
build_components_usb_usb_stream_test_apps:
16111622
extends:

.gitlab/ci/rules.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,18 @@
315315
- "components/usb/iot_usbh_modem/**/*"
316316
- "tools/cmake_utilities/package_manager.cmake"
317317

318+
.patterns-components_usb_usb_host_rndis_test_apps: &patterns-components_usb_usb_host_rndis_test_apps
319+
- "components/usb/usb_host_rndis/test_apps/**/*"
320+
- "tools/cmake_utilities/package_manager.cmake"
321+
318322
.patterns-components_usb_usb_device_uac: &patterns-components_usb_usb_device_uac
319323
- "components/usb/usb_device_uac/**/*"
320324

321325
.patterns-components_usb_usb_device_uvc: &patterns-components_usb_usb_device_uvc
322326
- "components/usb/usb_device_uvc/**/*"
323327

324-
.patterns-components_usb_usb_host_rndis: &patterns-components_usb_usb_host_rndis
325-
- "components/usb/usb_host_rndis/**/*"
328+
.patterns-components_usb_iot_usbh_rndis: &patterns-components_usb_iot_usbh_rndis
329+
- "components/usb/iot_usbh_rndis/**/*"
326330
- "tools/cmake_utilities/package_manager.cmake"
327331

328332
.patterns-components_usb_usb_stream: &patterns-components_usb_usb_stream
@@ -638,6 +642,9 @@
638642
.patterns-example_usb_host_usb_msc_ota: &patterns-example_usb_host_usb_msc_ota
639643
- "examples/usb/host/usb_msc_ota/**/*"
640644

645+
.patterns-example_usb_host_usb_rndis_4g_module: &patterns-example_usb_host_usb_rndis_4g_module
646+
- "examples/usb/host/usb_rndis_4g_module/**/*"
647+
641648
.patterns-example_usb_otg_usb_host_device_mode_manual_switch: &patterns-example_usb_otg_usb_host_device_mode_manual_switch
642649
- "examples/usb/otg/usb_host_device_mode_manual_switch/**/*"
643650

@@ -1610,6 +1617,22 @@
16101617
- <<: *if-dev-push
16111618
changes: *patterns-example_usb_host_usb_msc_ota
16121619

1620+
.rules:build:example_usb_host_usb_rndis_4g_module:
1621+
rules:
1622+
- <<: *if-protected
1623+
- <<: *if-label-build
1624+
- <<: *if-trigger-job
1625+
- <<: *if-dev-push
1626+
changes: *patterns-build_system
1627+
- <<: *if-dev-push
1628+
changes: *patterns-components_usb_iot_usbh_cdc
1629+
- <<: *if-dev-push
1630+
changes: *patterns-components_usb_iot_usbh_rndis
1631+
- <<: *if-dev-push
1632+
changes: *patterns-components_iot_eth
1633+
- <<: *if-dev-push
1634+
changes: *patterns-example_usb_host_usb_rndis_4g_module
1635+
16131636
.rules:build:example_usb_otg_usb_host_device_mode_manual_switch:
16141637
rules:
16151638
- <<: *if-protected
@@ -2458,6 +2481,7 @@
24582481
changes: *patterns-build_system
24592482
- <<: *if-dev-push
24602483
changes: *patterns-components_touch_touch_slider_sensor
2484+
24612485
.rules:build:components_usb_usb_host_rndis_test_apps:
24622486
rules:
24632487
- <<: *if-protected
@@ -2467,7 +2491,20 @@
24672491
- <<: *if-dev-push
24682492
changes: *patterns-build_system
24692493
- <<: *if-dev-push
2470-
changes: *patterns-components_usb_usb_host_rndis
2494+
changes: *patterns-components_usb_usb_host_rndis_test_apps
2495+
- <<: *if-dev-push
2496+
changes: *patterns-components_usb_iot_usbh_cdc
2497+
2498+
.rules:build:components_usb_iot_usbh_rndis_test_apps:
2499+
rules:
2500+
- <<: *if-protected
2501+
- <<: *if-label-build
2502+
- <<: *if-label-target_test
2503+
- <<: *if-trigger-job
2504+
- <<: *if-dev-push
2505+
changes: *patterns-build_system
2506+
- <<: *if-dev-push
2507+
changes: *patterns-components_usb_iot_usbh_rndis
24712508
- <<: *if-dev-push
24722509
changes: *patterns-components_usb_iot_usbh_cdc
24732510

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ The registered components in ESP-IoT-Solution are listed below:
112112
| [iot_usbh](https://components.espressif.com/components/espressif/iot_usbh) | [![Component Registry](https://components.espressif.com/components/espressif/iot_usbh/badge.svg)](https://components.espressif.com/components/espressif/iot_usbh) |
113113
| [iot_usbh_cdc](https://components.espressif.com/components/espressif/iot_usbh_cdc) | [![Component Registry](https://components.espressif.com/components/espressif/iot_usbh_cdc/badge.svg)](https://components.espressif.com/components/espressif/iot_usbh_cdc) |
114114
| [iot_usbh_modem](https://components.espressif.com/components/espressif/iot_usbh_modem) | [![Component Registry](https://components.espressif.com/components/espressif/iot_usbh_modem/badge.svg)](https://components.espressif.com/components/espressif/iot_usbh_modem) |
115+
| [iot_usbh_rndis](https://components.espressif.com/components/espressif/iot_usbh_rndis) | [![Component Registry](https://components.espressif.com/components/espressif/iot_usbh_rndis/badge.svg)](https://components.espressif.com/components/espressif/iot_usbh_rndis) |
115116
| [ir_learn](https://components.espressif.com/components/espressif/ir_learn) | [![Component Registry](https://components.espressif.com/components/espressif/ir_learn/badge.svg)](https://components.espressif.com/components/espressif/ir_learn) |
116117
| [keyboard_button](https://components.espressif.com/components/espressif/keyboard_button) | [![Component Registry](https://components.espressif.com/components/espressif/keyboard_button/badge.svg)](https://components.espressif.com/components/espressif/keyboard_button) |
117118
| [knob](https://components.espressif.com/components/espressif/knob) | [![Component Registry](https://components.espressif.com/components/espressif/knob/badge.svg)](https://components.espressif.com/components/espressif/knob) |
@@ -136,7 +137,6 @@ The registered components in ESP-IoT-Solution are listed below:
136137
| [touch_slider_sensor](https://components.espressif.com/components/espressif/touch_slider_sensor) | [![Component Registry](https://components.espressif.com/components/espressif/touch_slider_sensor/badge.svg)](https://components.espressif.com/components/espressif/touch_slider_sensor) |
137138
| [usb_device_uac](https://components.espressif.com/components/espressif/usb_device_uac) | [![Component Registry](https://components.espressif.com/components/espressif/usb_device_uac/badge.svg)](https://components.espressif.com/components/espressif/usb_device_uac) |
138139
| [usb_device_uvc](https://components.espressif.com/components/espressif/usb_device_uvc) | [![Component Registry](https://components.espressif.com/components/espressif/usb_device_uvc/badge.svg)](https://components.espressif.com/components/espressif/usb_device_uvc) |
139-
| [usb_host_rndis](https://components.espressif.com/components/espressif/usb_host_rndis) | [![Component Registry](https://components.espressif.com/components/espressif/usb_host_rndis/badge.svg)](https://components.espressif.com/components/espressif/usb_host_rndis) |
140140
| [usb_stream](https://components.espressif.com/components/espressif/usb_stream) | [![Component Registry](https://components.espressif.com/components/espressif/usb_stream/badge.svg)](https://components.espressif.com/components/espressif/usb_stream) |
141141
| [veml6040](https://components.espressif.com/components/espressif/veml6040) | [![Component Registry](https://components.espressif.com/components/espressif/veml6040/badge.svg)](https://components.espressif.com/components/espressif/veml6040) |
142142
| [veml6075](https://components.espressif.com/components/espressif/veml6075) | [![Component Registry](https://components.espressif.com/components/espressif/veml6075/badge.svg)](https://components.espressif.com/components/espressif/veml6075) |

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ ESP-IoT-Solution 中注册的组件如下:
112112
| [iot_usbh](https://components.espressif.com/components/espressif/iot_usbh) | [![Component Registry](https://components.espressif.com/components/espressif/iot_usbh/badge.svg)](https://components.espressif.com/components/espressif/iot_usbh) |
113113
| [iot_usbh_cdc](https://components.espressif.com/components/espressif/iot_usbh_cdc) | [![Component Registry](https://components.espressif.com/components/espressif/iot_usbh_cdc/badge.svg)](https://components.espressif.com/components/espressif/iot_usbh_cdc) |
114114
| [iot_usbh_modem](https://components.espressif.com/components/espressif/iot_usbh_modem) | [![Component Registry](https://components.espressif.com/components/espressif/iot_usbh_modem/badge.svg)](https://components.espressif.com/components/espressif/iot_usbh_modem) |
115+
| [iot_usbh_rndis](https://components.espressif.com/components/espressif/iot_usbh_rndis) | [![Component Registry](https://components.espressif.com/components/espressif/iot_usbh_rndis/badge.svg)](https://components.espressif.com/components/espressif/iot_usbh_rndis) |
115116
| [ir_learn](https://components.espressif.com/components/espressif/ir_learn) | [![Component Registry](https://components.espressif.com/components/espressif/ir_learn/badge.svg)](https://components.espressif.com/components/espressif/ir_learn) |
116117
| [keyboard_button](https://components.espressif.com/components/espressif/keyboard_button) | [![Component Registry](https://components.espressif.com/components/espressif/keyboard_button/badge.svg)](https://components.espressif.com/components/espressif/keyboard_button) |
117118
| [knob](https://components.espressif.com/components/espressif/knob) | [![Component Registry](https://components.espressif.com/components/espressif/knob/badge.svg)](https://components.espressif.com/components/espressif/knob) |
@@ -136,7 +137,6 @@ ESP-IoT-Solution 中注册的组件如下:
136137
| [touch_slider_sensor](https://components.espressif.com/components/espressif/touch_slider_sensor) | [![Component Registry](https://components.espressif.com/components/espressif/touch_slider_sensor/badge.svg)](https://components.espressif.com/components/espressif/touch_slider_sensor) |
137138
| [usb_device_uac](https://components.espressif.com/components/espressif/usb_device_uac) | [![Component Registry](https://components.espressif.com/components/espressif/usb_device_uac/badge.svg)](https://components.espressif.com/components/espressif/usb_device_uac) |
138139
| [usb_device_uvc](https://components.espressif.com/components/espressif/usb_device_uvc) | [![Component Registry](https://components.espressif.com/components/espressif/usb_device_uvc/badge.svg)](https://components.espressif.com/components/espressif/usb_device_uvc) |
139-
| [usb_host_rndis](https://components.espressif.com/components/espressif/usb_host_rndis) | [![Component Registry](https://components.espressif.com/components/espressif/usb_host_rndis/badge.svg)](https://components.espressif.com/components/espressif/usb_host_rndis) |
140140
| [usb_stream](https://components.espressif.com/components/espressif/usb_stream) | [![Component Registry](https://components.espressif.com/components/espressif/usb_stream/badge.svg)](https://components.espressif.com/components/espressif/usb_stream) |
141141
| [veml6040](https://components.espressif.com/components/espressif/veml6040) | [![Component Registry](https://components.espressif.com/components/espressif/veml6040/badge.svg)](https://components.espressif.com/components/espressif/veml6040) |
142142
| [veml6075](https://components.espressif.com/components/espressif/veml6075) | [![Component Registry](https://components.espressif.com/components/espressif/veml6075/badge.svg)](https://components.espressif.com/components/espressif/veml6075) |

components/.build-rules.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ components/usb/esp_msc_ota/test_apps:
3333
enable:
3434
- if: IDF_TARGET in ["esp32s3"]
3535

36+
components/usb/iot_usbh_rndis/test_apps:
37+
enable:
38+
- if: SOC_USB_OTG_SUPPORTED == 1
39+
3640
components/usb/usb_stream/test_apps:
3741
enable:
3842
- if: IDF_TARGET in ["esp32s2","esp32s3"]

components/iot_eth/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
idf_component_register(SRCS "iot_eth.c"
1+
idf_component_register(SRCS "iot_eth.c" "iot_eth_netif_glue.c"
22
INCLUDE_DIRS "include" "interface"
33
REQUIRES esp_netif)
44

components/iot_eth/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: "0.1.0"
2-
description: Ethernet driver for USB Ethernet adapter
2+
description: Ethernet interface driver for cellular modems and USB-to-Ethernet adapters
33
url: https://github.com/espressif/esp-iot-solution/tree/master/components/iot_eth
44
repository: https://github.com/espressif/esp-iot-solution.git
55
documentation: https://docs.espressif.com/projects/esp-iot-solution/en/latest/solution/4g/iot_eth.html

components/iot_eth/include/iot_eth.h

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,56 @@
66
#pragma once
77

88
#include "esp_err.h"
9+
#include "esp_event.h"
910
#include "iot_eth_interface.h"
1011

1112
#ifdef __cplusplus
1213
extern "C" {
1314
#endif
1415

16+
/**
17+
* @brief iot_eth event declarations
18+
*
19+
*/
20+
typedef enum {
21+
IOT_ETH_EVENT_START, /*!< IOT_ETH driver start */
22+
IOT_ETH_EVENT_STOP, /*!< IOT_ETH driver stop */
23+
IOT_ETH_EVENT_CONNECTED, /*!< IOT_ETH got a valid link */
24+
IOT_ETH_EVENT_DISCONNECTED, /*!< IOT_ETH lost a valid link */
25+
} iot_eth_event_t;
26+
27+
/**
28+
* @brief iot_eth event base declaration
29+
*
30+
*/
31+
/** @cond **/
32+
ESP_EVENT_DECLARE_BASE(IOT_ETH_EVENT);
33+
/** @endcond **/
34+
1535
/**
1636
* @brief Ethernet handle type
1737
*
1838
* This is a handle to an Ethernet instance, used for managing Ethernet operations.
1939
*/
2040
typedef void *iot_eth_handle_t;
2141

42+
/**
43+
* @brief Static input callback function type
44+
*
45+
* This type defines a function pointer for a static input callback.
46+
* It takes an Ethernet handle, a pointer to data, the length of the data,
47+
* and a user data pointer as arguments.
48+
*/
49+
typedef esp_err_t (*static_input_cb_t)(iot_eth_handle_t handle, uint8_t *data, size_t len, void *user_data);
50+
2251
/**
2352
* @brief Ethernet configuration structure
2453
*
2554
* This structure holds the configuration for initializing an Ethernet instance.
2655
*/
2756
typedef struct {
2857
iot_eth_driver_t *driver; /*!< Pointer to the Ethernet driver */
29-
esp_err_t (*on_lowlevel_init_done)(iot_eth_handle_t handle); /*!< Callback for low-level initialization completion */
30-
esp_err_t (*on_lowlevel_deinit)(iot_eth_handle_t handle); /*!< Callback for low-level deinitialization */
31-
esp_err_t (*stack_input)(iot_eth_handle_t handle, uint8_t *data, size_t len, void *user_data); /*!< Function pointer for stack input */
58+
static_input_cb_t stack_input; /*!< Function pointer for stack input */
3259
void *user_data; /*!< User data for callbacks */
3360
} iot_eth_config_t;
3461

@@ -101,7 +128,7 @@ esp_err_t iot_eth_stop(iot_eth_handle_t handle);
101128
* - ESP_ERR_INVALID_ARG if arguments are invalid
102129
* - ESP_ERR_INVALID_STATE if Ethernet link is down
103130
*/
104-
esp_err_t iot_eth_transmit(iot_eth_handle_t handle, uint8_t *data, size_t len);
131+
esp_err_t iot_eth_transmit(iot_eth_handle_t handle, void *data, size_t len);
105132

106133
/*
107134
* @brief Get Ethernet MAC address
@@ -117,6 +144,22 @@ esp_err_t iot_eth_transmit(iot_eth_handle_t handle, uint8_t *data, size_t len);
117144
*/
118145
esp_err_t iot_eth_get_addr(iot_eth_handle_t handle, uint8_t *mac);
119146

147+
/*
148+
* @brief Update the input path for Ethernet data
149+
*
150+
* This function updates the stack input callback function and user data pointer
151+
* that will be used when receiving Ethernet packets.
152+
*
153+
* @param[in] handle Ethernet handle
154+
* @param[in] stack_input Function pointer for stack input callback
155+
* @param[in] user_data User data to be passed to stack input callback
156+
*
157+
* @return
158+
* - ESP_OK: Successfully updated input path
159+
* - ESP_ERR_INVALID_ARG: Invalid handle argument
160+
*/
161+
esp_err_t iot_eth_update_input_path(iot_eth_handle_t handle, static_input_cb_t stack_input, void *user_data);
162+
120163
#ifdef __cplusplus
121164
}
122165
#endif
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#pragma once
7+
8+
#include "iot_eth.h"
9+
10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
14+
/**
15+
* @brief Handle of netif glue - an intermediate layer between netif and Ethernet driver
16+
*
17+
*/
18+
typedef struct iot_eth_netif_glue_t* iot_eth_netif_glue_handle_t;
19+
20+
/**
21+
* @brief Create a netif glue
22+
*
23+
* @param eth_hdl Ethernet handle
24+
*
25+
* @return iot_eth_netif_glue_handle_t
26+
*/
27+
iot_eth_netif_glue_handle_t iot_eth_new_netif_glue(iot_eth_handle_t eth_hdl);
28+
29+
/**
30+
* @brief Destroy a netif glue
31+
*
32+
* @param netif_glue_hdl Netif glue handle
33+
*/
34+
esp_err_t iot_eth_del_netif_glue(iot_eth_netif_glue_handle_t netif_glue_hdl);
35+
36+
#ifdef __cplusplus
37+
}
38+
#endif

0 commit comments

Comments
 (0)