mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_eth: esp_eth_ioctl v5.0 migration guide
This commit is contained in:
parent
d1f2a3dfcc
commit
d91bbdf7b9
33
docs/en/migration-guides/ethernet.rst
Normal file
33
docs/en/migration-guides/ethernet.rst
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
Migrate Ethernet Drivers to ESP-IDF 5.0
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
esp_eth_ioctl() API
|
||||||
|
-------------------
|
||||||
|
:cpp:func:`esp_eth_ioctl` third argument could take `int` (`bool`) number as an input in some cases. However, it was not properly documented and, in addition, the number had to be "unnaturally" type casted to `void *` datatype to prevent compiler warnings as shown in below example:
|
||||||
|
|
||||||
|
.. highlight:: c
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
esp_eth_ioctl(eth_handle, ETH_CMD_S_FLOW_CTRL, (void *)true);
|
||||||
|
|
||||||
|
|
||||||
|
This could lead to misuse of the :cpp:func:`esp_eth_ioctl`. Therefore, ESP-IDF 5.0 unified usage of :cpp:func:`esp_eth_ioctl`. Its third argument now always acts as pointer to a memory location of specific type from/to where the configuration option is read/stored.
|
||||||
|
|
||||||
|
Usage example to set Ethernet configuration:
|
||||||
|
|
||||||
|
.. highlight:: c
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
eth_duplex_t new_duplex_mode = ETH_DUPLEX_HALF;
|
||||||
|
esp_eth_ioctl(eth_handle, ETH_CMD_S_DUPLEX_MODE, &new_duplex_mode);
|
||||||
|
|
||||||
|
Usage example to get Ethernet configuration:
|
||||||
|
|
||||||
|
.. highlight:: c
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
eth_duplex_t duplex_mode;
|
||||||
|
esp_eth_ioctl(eth_handle, ETH_CMD_G_DUPLEX_MODE, &duplex_mode);
|
@ -8,3 +8,4 @@ ESP-IDF 5.0 Migration Guides
|
|||||||
Peripherals <peripherals>
|
Peripherals <peripherals>
|
||||||
Build System <build-system>
|
Build System <build-system>
|
||||||
System <system>
|
System <system>
|
||||||
|
Ethernet <ethernet>
|
||||||
|
1
docs/zh_CN/migration-guides/ethernet.rst
Normal file
1
docs/zh_CN/migration-guides/ethernet.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
.. include:: ../../en/migration-guides/ethernet.rst
|
@ -8,3 +8,4 @@ ESP-IDF 5.0 迁移指南
|
|||||||
外设 <peripherals>
|
外设 <peripherals>
|
||||||
构建系统 <build-system>
|
构建系统 <build-system>
|
||||||
系统 <system>
|
系统 <system>
|
||||||
|
以太网 <ethernet>
|
||||||
|
Loading…
Reference in New Issue
Block a user