Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasmota changes #158

Merged
merged 44 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a2f8df4
Update install.sh
Jason2866 Apr 7, 2023
5d1421b
Create package.json
Jason2866 Apr 7, 2023
c44a36a
Create version.txt
Jason2866 Apr 7, 2023
ff37e95
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Apr 11, 2023
ded6093
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 May 5, 2023
c7d1a71
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 May 7, 2023
86f6b6c
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 May 9, 2023
4065f8a
Update version.txt
Jason2866 May 9, 2023
c8f0df9
Update release_zips.yml
Jason2866 May 9, 2023
3bd955b
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 May 13, 2023
dda1876
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 May 19, 2023
1cbb96e
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 May 20, 2023
5b179ec
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 May 24, 2023
ca243ad
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Jun 3, 2023
57576cf
Update version.txt
Jason2866 Jun 5, 2023
f6e4324
Update release_zips.yml
Jason2866 Jun 14, 2023
92983e9
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Jun 27, 2023
9508691
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Jun 30, 2023
4843e6d
Release 5.1.0
Jason2866 Jul 1, 2023
79f24ab
Release 5.1.0
Jason2866 Jul 1, 2023
6105f97
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Jul 7, 2023
3197dc1
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Jul 8, 2023
9407eb5
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Jul 22, 2023
b2a7eae
Update version.txt
Jason2866 Jul 22, 2023
8ec841a
Delete issue_comment.yml
Jason2866 Jul 22, 2023
3d4f85e
Delete docker.yml
Jason2866 Jul 22, 2023
69cdc81
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Jul 27, 2023
48aa82c
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Aug 13, 2023
e3e2c14
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Aug 14, 2023
eeffb38
Update version.txt
Jason2866 Aug 17, 2023
6ddde83
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Aug 18, 2023
90b05ef
Update version.txt
Jason2866 Aug 18, 2023
1220a86
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Aug 20, 2023
fd89ae4
Update version.txt
Jason2866 Aug 20, 2023
ecd5dfc
Create esp_eth_phy_jl1101.c
Jason2866 Aug 20, 2023
b91c29c
add esp_eth_phy_jl1101.c
Jason2866 Aug 20, 2023
c457056
add jl1101
Jason2866 Aug 20, 2023
303acc2
fix Copy&Paste error
Jason2866 Aug 20, 2023
d76bd58
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Aug 23, 2023
707b703
Update version.txt
Jason2866 Aug 23, 2023
8abcb7c
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Sep 2, 2023
b376bba
Update version.txt
Jason2866 Sep 2, 2023
8dd5efb
Update package.json
Jason2866 Sep 2, 2023
5f7e313
Merge branch 'espressif:release/v5.1' into release/v5.1
Jason2866 Sep 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 0 additions & 87 deletions .github/workflows/docker.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/issue_comment.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release_zips.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
name: Create release zip file
runs-on: ubuntu-20.04
steps:
- name: Create a recursive clone source zip
uses: espressif/github-actions/release_zips@master
- name: Create a recursive clone source and stripped zip
uses: Jason2866/github-actions/release_zips@release_idf
env:
RELEASE_PROJECT_NAME: ESP-IDF
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion components/esp_eth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ if(CONFIG_ETH_ENABLED)
"src/esp_eth_phy_ip101.c"
"src/esp_eth_phy_ksz80xx.c"
"src/esp_eth_phy_lan87xx.c"
"src/esp_eth_phy_rtl8201.c")
"src/esp_eth_phy_rtl8201.c"
"src/esp_eth_phy_jl1101.c")
endif()

if(CONFIG_ETH_SPI_ETHERNET_DM9051)
Expand Down
11 changes: 11 additions & 0 deletions components/esp_eth/include/esp_eth_phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ esp_eth_phy_t *esp_eth_phy_new_dp83848(const eth_phy_config_t *config);
*/
esp_eth_phy_t *esp_eth_phy_new_ksz80xx(const eth_phy_config_t *config);

/**
* @brief Create a PHY instance of JL1101
*
* @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_jl1101(const eth_phy_config_t *config);

#if CONFIG_ETH_SPI_ETHERNET_DM9051
/**
* @brief Create a PHY instance of DM9051
Expand Down
145 changes: 145 additions & 0 deletions components/esp_eth/src/esp_eth_phy_jl1101.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <string.h>
#include <stdlib.h>
#include <sys/cdefs.h>
#include "esp_log.h"
#include "esp_check.h"
#include "esp_eth_phy_802_3.h"

static const char *TAG = "jl1101";

/***************Vendor Specific Register***************/

/**
* @brief PSR(Page Select Register)
*
*/
typedef union {
struct {
uint16_t page_select : 8; /* Select register page, default is 0 */
uint16_t reserved : 8; /* Reserved */
};
uint16_t val;
} psr_reg_t;
#define ETH_PHY_PSR_REG_ADDR (0x1F)

typedef struct {
phy_802_3_t phy_802_3;
} phy_jl1101_t;

static esp_err_t jl1101_page_select(phy_jl1101_t *jl1101, uint32_t page)
{
esp_err_t ret = ESP_OK;
esp_eth_mediator_t *eth = jl1101->phy_802_3.eth;
psr_reg_t psr = {
.page_select = page
};
ESP_GOTO_ON_ERROR(eth->phy_reg_write(eth, jl1101->phy_802_3.addr, ETH_PHY_PSR_REG_ADDR, psr.val), err, TAG, "write PSR failed");
return ESP_OK;
err:
return ret;
}

static esp_err_t jl1101_update_link_duplex_speed(phy_jl1101_t *jl1101)
{
esp_err_t ret = ESP_OK;
esp_eth_mediator_t *eth = jl1101->phy_802_3.eth;
uint32_t addr = jl1101->phy_802_3.addr;
eth_speed_t speed = ETH_SPEED_10M;
eth_duplex_t duplex = ETH_DUPLEX_HALF;
bmcr_reg_t bmcr;
bmsr_reg_t bmsr;
uint32_t peer_pause_ability = false;
anlpar_reg_t anlpar;
ESP_GOTO_ON_ERROR(jl1101_page_select(jl1101, 0), err, TAG, "select page 0 failed");
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMSR_REG_ADDR, &(bmsr.val)), err, TAG, "read BMSR failed");
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_ANLPAR_REG_ADDR, &(anlpar.val)), err, TAG, "read ANLPAR failed");
eth_link_t link = bmsr.link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
/* check if link status changed */
if (jl1101->phy_802_3.link_status != link) {
/* when link up, read negotiation result */
if (link == ETH_LINK_UP) {
ESP_GOTO_ON_ERROR(eth->phy_reg_read(eth, addr, ETH_PHY_BMCR_REG_ADDR, &(bmcr.val)), err, TAG, "read BMCR failed");
if (bmcr.speed_select) {
speed = ETH_SPEED_100M;
} else {
speed = ETH_SPEED_10M;
}
if (bmcr.duplex_mode) {
duplex = ETH_DUPLEX_FULL;
} else {
duplex = ETH_DUPLEX_HALF;
}
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_SPEED, (void *)speed), err, TAG, "change speed failed");
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_DUPLEX, (void *)duplex), err, TAG, "change duplex failed");
/* if we're in duplex mode, and peer has the flow control ability */
if (duplex == ETH_DUPLEX_FULL && anlpar.symmetric_pause) {
peer_pause_ability = 1;
} else {
peer_pause_ability = 0;
}
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_PAUSE, (void *)peer_pause_ability), err, TAG, "change pause ability failed");
}
ESP_GOTO_ON_ERROR(eth->on_state_changed(eth, ETH_STATE_LINK, (void *)link), err, TAG, "change link failed");
jl1101->phy_802_3.link_status = link;
}
return ESP_OK;
err:
return ret;
}

static esp_err_t jl1101_get_link(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
phy_jl1101_t *jl1101 = __containerof(esp_eth_phy_into_phy_802_3(phy), phy_jl1101_t, phy_802_3);
/* Updata information about link, speed, duplex */
ESP_GOTO_ON_ERROR(jl1101_update_link_duplex_speed(jl1101), err, TAG, "update link duplex speed failed");
return ESP_OK;
err:
return ret;
}

static esp_err_t jl1101_init(esp_eth_phy_t *phy)
{
esp_err_t ret = ESP_OK;
phy_802_3_t *phy_802_3 = esp_eth_phy_into_phy_802_3(phy);

/* Basic PHY init */
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_basic_phy_init(phy_802_3), err, TAG, "failed to init PHY");

/* Check PHY ID */
uint32_t oui;
uint8_t model;
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_read_oui(phy_802_3, &oui), err, TAG, "read OUI failed");
ESP_GOTO_ON_ERROR(esp_eth_phy_802_3_read_manufac_info(phy_802_3, &model, NULL), err, TAG, "read manufacturer's info failed");
ESP_GOTO_ON_FALSE(oui == 0x24DF10 && model == 0x2, ESP_FAIL, err, TAG, "wrong chip ID");

return ESP_OK;
err:
return ret;
}

esp_eth_phy_t *esp_eth_phy_new_jl1101(const eth_phy_config_t *config)
{
esp_eth_phy_t *ret = NULL;
phy_jl1101_t *jl1101 = calloc(1, sizeof(phy_jl1101_t));
ESP_GOTO_ON_FALSE(jl1101, NULL, err, TAG, "calloc jl1101 failed");
ESP_GOTO_ON_FALSE(esp_eth_phy_802_3_obj_config_init(&jl1101->phy_802_3, config) == ESP_OK,
NULL, err, TAG, "configuration initialization of PHY 802.3 failed");

// redefine functions which need to be customized for sake of jl1101
jl1101->phy_802_3.parent.init = jl1101_init;
jl1101->phy_802_3.parent.get_link = jl1101_get_link;

return &jl1101->phy_802_3.parent;
err:
if (jl1101 != NULL) {
free(jl1101);
}
return ret;
}
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ echo "Checking Python compatibility"
TARGETS=`"${ESP_PYTHON}" "${IDF_PATH}/tools/install_util.py" extract targets "$@"`

echo "Installing ESP-IDF tools"
"${ESP_PYTHON}" "${IDF_PATH}/tools/idf_tools.py" install --targets=${TARGETS}
"${ESP_PYTHON}" "${IDF_PATH}/tools/idf_tools.py" --non-interactive install --targets=${TARGETS}

FEATURES=`"${ESP_PYTHON}" "${IDF_PATH}/tools/install_util.py" extract features "$@"`

echo "Installing Python environment and packages"
"${ESP_PYTHON}" "${IDF_PATH}/tools/idf_tools.py" install-python-env --features=${FEATURES}
"${ESP_PYTHON}" "${IDF_PATH}/tools/idf_tools.py" --non-interactive install-python-env --features=${FEATURES}

echo "All done! You can now run:"
echo ""
Expand Down
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "framework-espidf",
"version": "3.50101",
"description": "Espressif IoT Development Framework. Tasmota development framework for ESP32 chip",
"keywords": [
"framework",
"esp32",
"esp32s2",
"esp32s3",
"esp32c3",
"esp32c6",
"espressif"
],
"homepage": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32/",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/tasmota/esp-idf"
}
}
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.1.1.230901
Loading