Deploying to gh-pages from @ cherry-embedded/CherryUSB@4f2d87e6ce 🚀

This commit is contained in:
sakumisu
2025-12-31 06:45:24 +00:00
parent 0492956c21
commit fdbe9e6dfb
3 changed files with 40 additions and 22 deletions

View File

@@ -1,12 +1,15 @@
usbh_net usbh_net
=============== ===============
本节主要介绍 USB 网卡的使用,USB 网卡推荐采用 AIR780(RNDIS)EC20(ECM/RNDIS), 手机RNDIS,RTL8152 USB 网卡AX88772 USB 网卡。 本节主要介绍 USB 网卡的使用,当前已经支持和测试以下 USB 网卡:
.. note:: 看完下面内容,你将感受到什么是全自动化的 USB 网卡驱动对接,无需手动调用任何函数。 - 4G 网卡EC20(ECM/RNDIS)、手机RNDIS、SIMCOM7600(RNDIS)、ML307R(RNDIS)、AIR780(RNDIS)
.. caution:: 请注意,部分 4G 网卡默认不带自动拨号功能,请更换固件或者使用 AT 配置成自动拨号,否则无法获取 IP。 .. caution:: 请注意,部分 4G 网卡默认不带自动拨号功能,请更换固件或者使用 AT 配置成自动拨号,否则无法获取 IP。
- USB 以太网卡ASIX AX88772REALTEK RTL8152
- USB WIFI 网卡: 博流 BL616RNDIS/ECM
USB 网卡相关的宏和文件 USB 网卡相关的宏和文件
------------------------ ------------------------
@@ -20,14 +23,14 @@ USB 网卡相关的宏和文件
// #define CONFIG_USBHOST_PLATFORM_ASIX // #define CONFIG_USBHOST_PLATFORM_ASIX
// #define CONFIG_USBHOST_PLATFORM_RTL8152 // #define CONFIG_USBHOST_PLATFORM_RTL8152
.. note:: 如果使用 Kconfig 系统,上述宏自定生成,其他平台请手动定义。 .. note:: 如果使用 Kconfig 系统,上述宏自定生成,其他平台请手动定义。
USB 网卡传输层面已经对接好了相关网络组件,列举如下: USB 网卡传输层面已经对接好了相关网络组件,列举如下:
- 自定义 OS + LWIP 请使用 **platform/lwip/usbh_lwip.c**,需要自行包含该文件,并使能上述相关的宏 - 自定义 OS + LWIP 请使用 **platform/lwip/usbh_lwip.c**,需要自行包含该文件,并使能上述相关的宏。并在初始化 USB 之前调用 `tcpip_init(NULL, NULL)`
- RT-THREAD + LWIP 请使用 **platform/rtthread/usbh_lwip.c**,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件 - RT-THREAD + LWIP 请使用 **platform/rtthread/usbh_lwip.c**,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件,勾选 rt-thread lwip以后自动调用 `tcpip_init(NULL, NULL)`
- ESP-IDF + LWIP 请使用 **platform/freertos/usbh_net.c**,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件 - ESP-IDF + LWIP 请使用 **platform/freertos/usbh_net.c**,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件,并且在初始化 USB 之前调用 `esp_netif_init()` + `esp_event_loop_create_default()`
- NUTTX + NUTTX 网络组件 请使用 **platform/nuttx/usbh_net.c**,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件 - NUTTX + NUTTX 网络组件 请使用 **platform/nuttx/usbh_net.c**,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件,勾选网络组件以后自动调用
.. note:: 如果是自行添加代码,别忘了添加 USB 网卡驱动相关的源文件,例如 **class/usbh_cdc_ecm.c**。所以我们推荐搭配对应平台使用哦,省去自己添加文件的麻烦 .. note:: 如果是自行添加代码,别忘了添加 USB 网卡驱动相关的源文件,例如 **class/usbh_cdc_ecm.c**。所以我们推荐搭配对应平台使用哦,省去自己添加文件的麻烦
@@ -144,4 +147,10 @@ USB 网卡 LWIP 配置宏相关注意事项
#error TCPIP_THREAD_STACKSIZE must be >= 1024 #error TCPIP_THREAD_STACKSIZE must be >= 1024
#endif #endif
- 具体移植文章可以参考开发者的一些笔记 https://club.rt-thread.org/ask/article/5cf3e9e0b2d95800.html
总结
--------------
.. note:: 通过以上内容,我们可以看到 CherryUSB 对 USB 网卡的支持是非常完善的,用户只需要使能对应的宏或者勾选,就可以实现 USB 网卡的自动识别和驱动注册,无需手动初始化网卡相关配置,用户只需关注应用层,极大地方便了用户的使用。
具体移植文章可以参考开发者的一些笔记 https://club.rt-thread.org/ask/article/5cf3e9e0b2d95800.html

View File

@@ -97,6 +97,7 @@
<li class="toctree-l2"><a class="reference internal" href="#usb">USB 网卡相关的宏和文件</a></li> <li class="toctree-l2"><a class="reference internal" href="#usb">USB 网卡相关的宏和文件</a></li>
<li class="toctree-l2"><a class="reference internal" href="#id1">USB 网卡对接过程</a></li> <li class="toctree-l2"><a class="reference internal" href="#id1">USB 网卡对接过程</a></li>
<li class="toctree-l2"><a class="reference internal" href="#usb-lwip">USB 网卡 LWIP 配置宏相关注意事项</a></li> <li class="toctree-l2"><a class="reference internal" href="#usb-lwip">USB 网卡 LWIP 配置宏相关注意事项</a></li>
<li class="toctree-l2"><a class="reference internal" href="#id2">总结</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="usbh_bluetooth.html">usbh_bluetooth</a></li> <li class="toctree-l1"><a class="reference internal" href="usbh_bluetooth.html">usbh_bluetooth</a></li>
@@ -164,15 +165,18 @@
<section id="usbh-net"> <section id="usbh-net">
<h1>usbh_net<a class="headerlink" href="#usbh-net" title="Link to this heading"></a></h1> <h1>usbh_net<a class="headerlink" href="#usbh-net" title="Link to this heading"></a></h1>
<p>本节主要介绍 USB 网卡的使用,USB 网卡推荐采用 AIR780(RNDIS)EC20(ECM/RNDIS), 手机RNDIS,RTL8152 USB 网卡AX88772 USB 网卡。</p> <p>本节主要介绍 USB 网卡的使用,当前已经支持和测试以下 USB 网卡:</p>
<div class="admonition note"> <ul class="simple">
<p class="admonition-title">Note</p> <li><p>4G 网卡EC20(ECM/RNDIS)、手机RNDIS、SIMCOM7600(RNDIS)、ML307R(RNDIS)、AIR780(RNDIS)</p></li>
<p>看完下面内容,你将感受到什么是全自动化的 USB 网卡驱动对接,无需手动调用任何函数。</p> </ul>
</div>
<div class="admonition caution"> <div class="admonition caution">
<p class="admonition-title">Caution</p> <p class="admonition-title">Caution</p>
<p>请注意,部分 4G 网卡默认不带自动拨号功能,请更换固件或者使用 AT 配置成自动拨号,否则无法获取 IP。</p> <p>请注意,部分 4G 网卡默认不带自动拨号功能,请更换固件或者使用 AT 配置成自动拨号,否则无法获取 IP。</p>
</div> </div>
<ul class="simple">
<li><p>USB 以太网卡ASIX AX88772REALTEK RTL8152</p></li>
<li><p>USB WIFI 网卡: 博流 BL616RNDIS/ECM</p></li>
</ul>
<section id="usb"> <section id="usb">
<h2>USB 网卡相关的宏和文件<a class="headerlink" href="#usb" title="Link to this heading"></a></h2> <h2>USB 网卡相关的宏和文件<a class="headerlink" href="#usb" title="Link to this heading"></a></h2>
<p>网卡相关的宏如下,主要用于根据不同的网络组件注册网卡驱动:</p> <p>网卡相关的宏如下,主要用于根据不同的网络组件注册网卡驱动:</p>
@@ -185,14 +189,14 @@
</div> </div>
<div class="admonition note"> <div class="admonition note">
<p class="admonition-title">Note</p> <p class="admonition-title">Note</p>
<p>如果使用 Kconfig 系统,上述宏自定生成,其他平台请手动定义。</p> <p>如果使用 Kconfig 系统,上述宏自定生成,其他平台请手动定义。</p>
</div> </div>
<p>USB 网卡传输层面已经对接好了相关网络组件,列举如下:</p> <p>USB 网卡传输层面已经对接好了相关网络组件,列举如下:</p>
<ul class="simple"> <ul class="simple">
<li><p>自定义 OS + LWIP 请使用 <strong>platform/lwip/usbh_lwip.c</strong>,需要自行包含该文件,并使能上述相关的宏</p></li> <li><p>自定义 OS + LWIP 请使用 <strong>platform/lwip/usbh_lwip.c</strong>,需要自行包含该文件,并使能上述相关的宏。并在初始化 USB 之前调用 <cite>tcpip_init(NULL, NULL)</cite></p></li>
<li><p>RT-THREAD + LWIP 请使用 <strong>platform/rtthread/usbh_lwip.c</strong>,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件</p></li> <li><p>RT-THREAD + LWIP 请使用 <strong>platform/rtthread/usbh_lwip.c</strong>,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件,勾选 rt-thread lwip以后自动调用 <cite>tcpip_init(NULL, NULL)</cite></p></li>
<li><p>ESP-IDF + LWIP 请使用 <strong>platform/freertos/usbh_net.c</strong>,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件</p></li> <li><p>ESP-IDF + LWIP 请使用 <strong>platform/freertos/usbh_net.c</strong>,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件,并且在初始化 USB 之前调用 <cite>esp_netif_init()</cite> + <cite>esp_event_loop_create_default()</cite></p></li>
<li><p>NUTTX + NUTTX 网络组件 请使用 <strong>platform/nuttx/usbh_net.c</strong>,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件</p></li> <li><p>NUTTX + NUTTX 网络组件 请使用 <strong>platform/nuttx/usbh_net.c</strong>,在 Kconfig 中使能对应的网卡驱动后自动勾选该文件,勾选网络组件以后自动调用</p></li>
</ul> </ul>
<div class="admonition note"> <div class="admonition note">
<p class="admonition-title">Note</p> <p class="admonition-title">Note</p>
@@ -306,9 +310,14 @@
<span class="cp">#endif</span> <span class="cp">#endif</span>
</pre></div> </pre></div>
</div> </div>
<ul class="simple"> </section>
<li><p>具体移植文章可以参考开发者的一些笔记 <a class="reference external" href="https://club.rt-thread.org/ask/article/5cf3e9e0b2d95800.html">https://club.rt-thread.org/ask/article/5cf3e9e0b2d95800.html</a></p></li> <section id="id2">
</ul> <h2>总结<a class="headerlink" href="#id2" title="Link to this heading"></a></h2>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>通过以上内容,我们可以看到 CherryUSB 对 USB 网卡的支持是非常完善的,用户只需要使能对应的宏或者勾选,就可以实现 USB 网卡的自动识别和驱动注册,无需手动初始化网卡相关配置,用户只需关注应用层,极大地方便了用户的使用。</p>
</div>
<p>具体移植文章可以参考开发者的一些笔记 <a class="reference external" href="https://club.rt-thread.org/ask/article/5cf3e9e0b2d95800.html">https://club.rt-thread.org/ask/article/5cf3e9e0b2d95800.html</a></p>
</section> </section>
</section> </section>

File diff suppressed because one or more lines are too long