ethernet: add ksz8041 in basic ethernet example
This commit is contained in:
@@ -240,6 +240,17 @@ esp_eth_phy_t *esp_eth_phy_new_lan8720(const eth_phy_config_t *config);
|
||||
*/
|
||||
esp_eth_phy_t *esp_eth_phy_new_dp83848(const eth_phy_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Create a PHY instance of KSZ8041
|
||||
*
|
||||
* @param[in] config: configuration of PHY
|
||||
*
|
||||
* @return
|
||||
* - instance: create PHY instance successfully
|
||||
* - NULL: create PHY instance failed because some error occurred
|
||||
*/
|
||||
esp_eth_phy_t *esp_eth_phy_new_ksz8041(const eth_phy_config_t *config);
|
||||
|
||||
#if CONFIG_ETH_SPI_ETHERNET_DM9051
|
||||
/**
|
||||
* @brief Create a PHY instance of DM9051
|
||||
@@ -251,18 +262,8 @@ esp_eth_phy_t *esp_eth_phy_new_dp83848(const eth_phy_config_t *config);
|
||||
* - NULL: create PHY instance failed because some error occurred
|
||||
*/
|
||||
esp_eth_phy_t *esp_eth_phy_new_dm9051(const eth_phy_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Create a PHY instance of KSZ8041
|
||||
*
|
||||
* @param[in] config: configuration of PHY
|
||||
*
|
||||
* @return
|
||||
* - instance: create PHY instance successfully
|
||||
* - NULL: create PHY instance failed because some error occurred
|
||||
*/
|
||||
esp_eth_phy_t *esp_eth_phy_new_ksz8041(const eth_phy_config_t *config);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_rom_gpio.h"
|
||||
|
||||
static const char *TAG = "ksz8041";
|
||||
#define PHY_CHECK(a, str, goto_tag, ...) \
|
||||
@@ -166,7 +167,7 @@ static esp_err_t ksz8041_reset_hw(esp_eth_phy_t *phy)
|
||||
{
|
||||
phy_ksz8041_t *ksz8041 = __containerof(phy, phy_ksz8041_t, parent);
|
||||
if (ksz8041->reset_gpio_num >= 0) {
|
||||
gpio_pad_select_gpio(ksz8041->reset_gpio_num);
|
||||
esp_rom_gpio_pad_select_gpio(ksz8041->reset_gpio_num);
|
||||
gpio_set_direction(ksz8041->reset_gpio_num, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level(ksz8041->reset_gpio_num, 0);
|
||||
gpio_set_level(ksz8041->reset_gpio_num, 1);
|
||||
|
||||
Reference in New Issue
Block a user