-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/generic_phy' into 'master'
Feat/generic phy Closes IDF-11249 and DOC-9102 See merge request espressif/esp-idf!33708
- Loading branch information
Showing
16 changed files
with
298 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <stdlib.h> | ||
#include "esp_log.h" | ||
#include "esp_check.h" | ||
#include "esp_eth.h" | ||
#include "esp_eth_phy_802_3.h" | ||
|
||
static const char *TAG = "eth_phy_generic"; | ||
|
||
// Default reset timing is intentionally conservative | ||
#define DEFAULT_PHY_GENERIC_RESET_ASSERTION_TIME_US 10000 | ||
#define DEFAULT_PHY_GENERIC_POST_RESET_DELAY_MS 500 | ||
|
||
esp_eth_phy_t *esp_eth_phy_new_generic(const eth_phy_config_t *config) | ||
{ | ||
esp_eth_phy_t *ret = NULL; | ||
phy_802_3_t *phy_802_3 = calloc(1, sizeof(phy_802_3_t)); | ||
eth_phy_config_t phy_802_3_config = *config; | ||
// default chip specific configuration if not defined by user | ||
if (config->hw_reset_assert_time_us == 0) { | ||
phy_802_3_config.hw_reset_assert_time_us = DEFAULT_PHY_GENERIC_RESET_ASSERTION_TIME_US; | ||
} | ||
if (config->post_hw_reset_delay_ms == 0) { | ||
phy_802_3_config.post_hw_reset_delay_ms = DEFAULT_PHY_GENERIC_POST_RESET_DELAY_MS; | ||
} | ||
ESP_GOTO_ON_FALSE(esp_eth_phy_802_3_obj_config_init(phy_802_3, &phy_802_3_config) == ESP_OK, | ||
NULL, err, TAG, "configuration initialization of PHY 802.3 failed"); | ||
|
||
return &phy_802_3->parent; | ||
err: | ||
return ret; | ||
} |
Oops, something went wrong.