尊敬的专家:
您能指导我如何在定制电路板上添加 PHY 驱动程序吗?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
尊敬的专家:
您能指导我如何在定制电路板上添加 PHY 驱动程序吗?
您好!
AM263x 具有 DP83869HMRGZT 和 DP83826ERHBT PHY 板载。 为了方便理解该过程、让我们在基于 AM263x 的定制电路板上集成 DP83TC812 PHY。 以下指南使用 syscfg V1.18和 CCS v12.5在 MCU_PLUS_SDK v09.01上进行了验证
在定制电路板上添加 PHY 驱动器可分为两个部分:
1. PHY 驱动程序的集成
第一步是获取 PHY 驱动程序的 Header (.h)和 C (.c)文件。 如果您使用的是 TI PHY、您可以在以下网址找到一些 RTOS 和 Linux 驱动程序: https://github.com/TexasInstruments/ti-ethernet-software/blob/main/README.md。如果您在此处未找到所需的驱动器、请为此提交 E2E、TI 专家将为您提供指导。
要集成 PHY 驱动程序、请执行以下步骤:
使用以下命令重新编译 Enet cpsw 库:
# TO CLEAN gmake -s -f makefile.am263x enet-cpsw_r5f.ti-arm-clang_clean # TO BUILD gmake -s -f makefile.am263x enet-cpsw_r5f.ti-arm-clang
2. Phy 驱动程序的定制电路板配置
为 PHY 驱动程序定义一个 Cfg 结构(本例中为 DP83tc812_Cfg)。 (请参阅 PHY 驱动程序包含文件以了解结构)
#include <networking/enet/core/include/phy/dp83tc812.h>
/* PHY drivers */
extern EnetPhy_Drv gEnetPhyDrvGeneric;
extern EnetPhy_Drv gEnetPhyDrvDp83tc812;
/*! \brief All the registered PHY specific drivers. */
static const EnetPhyDrv_Handle gEnetPhyDrvs[] =
{
&gEnetPhyDrvDp83tc812,
&gEnetPhyDrvGeneric, /* Generic PHY - must be last */
};
/* Create a config struct for the PHY */
/*!
* \brief Common Processor Board (CPB) board's DP83tc812 PHY configuration.
*/
static const Dp83tc812_Cfg gEnetCpbBoard_dp83tc812PhyCfg =
{
.txClkShiftEn = true,
.rxClkShiftEn = true,
.interruptEn = false,
.sgmiiAutoNegEn = true,
.MasterSlaveMode = DP83TC812_MASTER_SLAVE_STRAP,
};
/*
* AM263x board configuration.
*
* 1 x RGMII PHY connected to AM263x CPSW_3G MAC port.
*/
static const EnetBoard_PortCfg gEnetCpbBoard_am263xEthPort[] =
{
{ /* "CPSW3G" */
.enetType = ENET_CPSW_3G,
.instId = 0U,
.macPort = ENET_MAC_PORT_1,
.mii = { ENET_MAC_LAYER_GMII, ENET_MAC_SUBLAYER_REDUCED },
.phyCfg =
{
.phyAddr = 0,
.isStrapped = false,
.skipExtendedCfg = false,
.extendedCfg = &gEnetCpbBoard_dp83tc812PhyCfg,
.extendedCfgSize = sizeof(gEnetCpbBoard_dp83tc812PhyCfg),
},
.flags = 0U,
},
{ /* "CPSW3G" */
.enetType = ENET_CPSW_3G,
.instId = 0U,
.macPort = ENET_MAC_PORT_2,
.mii = { ENET_MAC_LAYER_GMII, ENET_MAC_SUBLAYER_REDUCED },
.phyCfg =
{
.phyAddr = 3,
.isStrapped = false,
.skipExtendedCfg = false,
.extendedCfg = &gEnetCpbBoard_dp83tc812PhyCfg,
.extendedCfgSize = sizeof(gEnetCpbBoard_dp83tc812PhyCfg),
},
.flags = 0U,
},
};
现在、使用此定制板配置文件编译您的应用。 此致、
Shaunak