From 35a43ac10211dda55551de3fff8c6337a501a449 Mon Sep 17 00:00:00 2001 From: lzh Date: Fri, 5 Jan 2024 15:39:50 +0800 Subject: [PATCH] scripts update && new standalone vertion adaption --- bsp/phytium/aarch32/SConstruct | 11 ++------- bsp/phytium/aarch64/SConstruct | 13 ++-------- bsp/phytium/libraries/drivers/drv_xmac.c | 6 ++--- bsp/phytium/libraries/drivers/drv_xmac.h | 3 +++ .../phytium_standalone_sdk_install.py | 24 +++++++++++++++++++ .../port/fdriver_port/fdrivers_port.h | 5 ++-- 6 files changed, 36 insertions(+), 26 deletions(-) create mode 100644 bsp/phytium/libraries/phytium_standalone_sdk_install.py diff --git a/bsp/phytium/aarch32/SConstruct b/bsp/phytium/aarch32/SConstruct index a1671f2235..13e3a3d229 100644 --- a/bsp/phytium/aarch32/SConstruct +++ b/bsp/phytium/aarch32/SConstruct @@ -51,16 +51,9 @@ def is_phytium_sdk_installed(): def install_phytium_sdk(): if is_phytium_sdk_installed(): return 0 - print("Checking for the presence of phytium_standalone_sdk_install.py script...") - sconstruct_dir = os.getcwd() - install_script_path = os.path.join(sconstruct_dir, "phytium_standalone_sdk_install.py") - if os.path.exists(install_script_path): - subprocess.call(["rm","-rf", install_script_path]) - try: - subprocess.call(["wget", "https://gitee.com/phytium_embedded/phytium-standalone-sdk/raw/Standalone-Sdk_RT-thread/phytium_standalone_sdk_install.py"]) - except: - print("Please refer to the ./README and manual download phytium_standalone_sdk_install.py, place in current folder") + install_script_path = os.getcwd() + "/../libraries/phytium_standalone_sdk_install.py" + if os.path.exists(install_script_path): try: subprocess.call(["python", install_script_path]) diff --git a/bsp/phytium/aarch64/SConstruct b/bsp/phytium/aarch64/SConstruct index 2bcc9699bd..b60e77ad1b 100644 --- a/bsp/phytium/aarch64/SConstruct +++ b/bsp/phytium/aarch64/SConstruct @@ -51,18 +51,9 @@ def is_phytium_sdk_installed(): def install_phytium_sdk(): if is_phytium_sdk_installed(): return 0 - print("Checking for the presence of phytium_standalone_sdk_install.py script...") - sconstruct_dir = os.getcwd() - install_script_path = os.path.join(sconstruct_dir, "phytium_standalone_sdk_install.py") - if os.path.exists(install_script_path): - subprocess.call(["rm","-rf", install_script_path]) - if not os.path.exists(install_script_path): - try: - subprocess.call(["wget", "https://gitee.com/phytium_embedded/phytium-standalone-sdk/raw/Standalone-Sdk_RT-thread/phytium_standalone_sdk_install.py"]) - except: - print("Please refer to the ./README and manual download phytium_standalone_sdk_install.py, place in current folder") - + install_script_path = os.getcwd() + "/../libraries/phytium_standalone_sdk_install.py" + if os.path.exists(install_script_path): try: subprocess.call(["python", install_script_path]) diff --git a/bsp/phytium/libraries/drivers/drv_xmac.c b/bsp/phytium/libraries/drivers/drv_xmac.c index 44340c13fc..06eba67b34 100644 --- a/bsp/phytium/libraries/drivers/drv_xmac.c +++ b/bsp/phytium/libraries/drivers/drv_xmac.c @@ -919,7 +919,7 @@ enum lwip_port_link_status FXmacLwipPortLinkDetect(FXmacOs *instance_p) if ((phy_link_status == FXMAC_LINKUP) && FXmacPhyAutonegStatus(xmac_p, xmac_p->phy_address)) { err_t phy_ret; - phy_ret = FXmacPhyInit(xmac_p, xmac_p->config.speed, xmac_p->config.duplex, xmac_p->config.auto_neg); + phy_ret = FXmacPhyInit(xmac_p, xmac_p->config.speed, xmac_p->config.duplex, xmac_p->config.auto_neg,XMAC_PHY_RESET_DISABLE); if (phy_ret != FT_SUCCESS) { @@ -953,7 +953,7 @@ enum lwip_port_link_status FXmacPhyReconnect(FXmacOs *instance_p) { /* auto negotiation again*/ err_t phy_ret; - phy_ret = FXmacPhyInit(xmac_p, xmac_p->config.speed, xmac_p->config.duplex, xmac_p->config.auto_neg); + phy_ret = FXmacPhyInit(xmac_p, xmac_p->config.speed, xmac_p->config.duplex, xmac_p->config.auto_neg,XMAC_PHY_RESET_DISABLE); if (phy_ret != FT_SUCCESS) { LOG_I("FXmacPhyInit is error."); @@ -1154,7 +1154,7 @@ FError FXmacOsInit(FXmacOs *instance_p) } /* initialize phy */ - status = FXmacPhyInit(xmac_p, xmac_p->config.speed, xmac_p->config.duplex, xmac_p->config.auto_neg); + status = FXmacPhyInit(xmac_p, xmac_p->config.speed, xmac_p->config.duplex, xmac_p->config.auto_neg,XMAC_PHY_RESET_ENABLE); if (status != FT_SUCCESS) { LOG_W("FXmacPhyInit is error."); diff --git a/bsp/phytium/libraries/drivers/drv_xmac.h b/bsp/phytium/libraries/drivers/drv_xmac.h index f571685188..7076f419c3 100644 --- a/bsp/phytium/libraries/drivers/drv_xmac.h +++ b/bsp/phytium/libraries/drivers/drv_xmac.h @@ -43,6 +43,9 @@ extern "C" { #define FXMAX_MAX_HARDWARE_ADDRESS_LENGTH 6 +#define XMAC_PHY_RESET_ENABLE 1 +#define XMAC_PHY_RESET_DISABLE 0 + /* configuration */ #define FXMAC_OS_CONFIG_JUMBO BIT(0) #define FXMAC_OS_CONFIG_MULTICAST_ADDRESS_FILITER BIT(1) /* Allow multicast address filtering */ diff --git a/bsp/phytium/libraries/phytium_standalone_sdk_install.py b/bsp/phytium/libraries/phytium_standalone_sdk_install.py new file mode 100644 index 0000000000..d99a8c73cb --- /dev/null +++ b/bsp/phytium/libraries/phytium_standalone_sdk_install.py @@ -0,0 +1,24 @@ +import os +import subprocess + +def clone_repository(branch, commit_hash): + repository_url = "https://gitee.com/phytium_embedded/phytium-standalone-sdk.git" + target_folder = "../libraries/phytium_standalone_sdk" + + # Clone the repository + subprocess.call(["git", "clone", "-b", branch, repository_url, target_folder]) + + # Change to the cloned repository folder + os.chdir(target_folder) + + # Checkout the specific commit + subprocess.call(["git", "checkout", commit_hash]) + + print("Repository cloned successfully to {}".format(os.getcwd())) + +if __name__ == "__main__": + + branch_to_clone = "master" + commit_to_clone = "7e5edbfb79928ee3505bfe2b831da9a5832c25aa" + + clone_repository(branch_to_clone, commit_to_clone) \ No newline at end of file diff --git a/bsp/phytium/libraries/port/fdriver_port/fdrivers_port.h b/bsp/phytium/libraries/port/fdriver_port/fdrivers_port.h index 4e53c2eaf0..50e0e2945c 100644 --- a/bsp/phytium/libraries/port/fdriver_port/fdrivers_port.h +++ b/bsp/phytium/libraries/port/fdriver_port/fdrivers_port.h @@ -13,7 +13,7 @@ * * FilePath: fdrivers_port.h * Created Date: 2023-10-16 17:02:35 - * Last Modified: 2023-10-27 09:22:20 + * Last Modified: 2024-01-05 14:51:14 * Description: This file is for drive layer code decoupling * * Modify History: @@ -25,7 +25,6 @@ #ifndef FDRIVERS_PORT_H #define FDRIVERS_PORT_H -#include "ftypes.h" #ifdef __aarch64__ #include "faarch64.h" #else @@ -36,7 +35,7 @@ #include "rtconfig.h" #include "ftypes.h" #include "drv_log.h" - +#include "fkernel.h" #ifdef __aarch64__ #include "faarch64.h" #else