本帖最后由 ctsdswk 于 2017-8-31 11:09 编辑
年代久远,忘记当时怎么搞的了。翻出来一些代码你试下吧。好像是调用rtk_port_macForceLinkExt0_set 后就可以了,然后发往mac的时钟就出来了。
/* main switch init
if (rtk_switch_init() != RT_ERR_OK)
{
err++;
}
rtk_port_mac_ability_t mac_cfg;
mac_cfg.forcemode = MAC_FORCE;
mac_cfg.speed = SPD_100M;
mac_cfg.duplex = FULL_DUPLEX;
mac_cfg.link = PORT_LINKUP;
mac_cfg.nway = DISABLED;
mac_cfg.rxpause = ENABLED;
mac_cfg.txpause = ENABLED;
rtk_port_macForceLinkExt0_set (MODE_EXT_MII_PHY, &mac_cfg);
rtk_port_macForceLinkExt1_set (MODE_EXT_MII_PHY, &mac_cfg);
//rtk_port_macForceLinkExt_set(EXT_PORT_2, MODE_EXT_MII_PHY, &mac_cfg);
rtk_port_rgmiiDelayExt0_set(1,0);
rtk_port_rgmiiDelayExt1_set(1,0);
*/
/*
rtk_port_phyEnableAll_set(ENABLED);
#include "rtl8367b_asicdrv.h"
rtl8367b_setAsicRegBit(RTL8367B_REG_CPU_CTRL, RTL8367B_CPU_EN_OFFSET, 1);
rtl8367b_setAsicRegBits(RTL8367B_REG_CPU_CTRL, RTL8367B_CPU_TRAP_PORT_MASK, 5);
rtl8367b_setAsicRegBits(RTL8367B_REG_CPU_CTRL, RTL8367B_CPU_TRAP_PORT_MASK, 7);
rtl8367b_setAsicRegBits(RTL8367B_REG_CPU_CTRL, RTL8367B_CPU_TRAP_PORT_MASK, 6);
*/
/* 初始化交换机芯片
if (swtichstate == 0)
{
swtichstate = 1;
rt_memset (swtichreg0, 0xee, 64);
rt_memset (swtichreg1, 0xee, 64);
if (SimI2C_Read_RTL8367 (swtichaddr, swtichdata, 2, 64, (u8 *)swtichreg0) != SimI2C_SUCCESS)
{
err++;
}
//SimI2C_Write (swtichaddr, 4, swtichdata);
rt_thread_delay (1000);
if (SimI2C_Read_RTL8367 (swtichaddr, swtichdata, 2, 64, (u8 *)swtichreg1) != SimI2C_SUCCESS)
{
err++;
}
}*/
|