Zynq-Linux移植学习笔记之67- 国产ZYNQ上通过GPIO模拟MDC/MDIO协议

1、背景介绍

模块上有9个PHY,其中两个PHY通过ZYNQ PS端的MDIO总线连接,其余7个PHY单独通过GPIO进行控制,需要实现GPIO模拟MDC/MDIO协议。

2、vivado工程设计

vivado工程内为每个PHY建立两个GPIO IP核,分别用来代表MDC和MDIO(虽然有点浪费)

MDC配置为默认输出

MDIO配置为双向

MDIO管脚默认上拉

3、MDIO时序介绍

MDIO接口包括两条线,MDIO和MDC,其中MDIO是双向数据线,而MDC是由STA驱动的时钟线。MDC时钟的最高速率一般为2.5MHz,MDC也可以是非固定频率,甚至可以是非周期的。MDIO接口只是会在MDC时钟的上升沿进行采样,而并不在意MDC时钟的频率(类似于I2C接口)。MDIO是一个PHY的管理接口,用来读/写PHY的寄存器,以控制PHY的行为或获取PHY的状态,MDC为MDIO提供时钟。

Preamble+Start:32bits的前导码以及2bit的开始位。

OP Code:2bits的操作码,10表示读,01表示写。

PHYAD:5bits的PHY地址,一般PHY地址,从0开始顺序编号,例如6口switch中PHY地址为0-5。

REGAD:5bits的寄存器地址,即要读或写的寄存器。

Turn Around:2bits的TA,在读命令中,MDIO在此时由MAC驱动改为PHY驱动,并等待一个时钟周期准备发送数据。在写命令中,不需要MDIO方向发生变化,则只是等待两个时钟周期准备写入数据。

Data:16bits数据,在读命令中,PHY芯片将读到的对应PHYAD的REGAD寄存器的数据写到Data中,在写命令中,MAC将要写入对应PHYAD的REGAD寄存器的值写入Data中。

Idle:空闲状态,此时MDIO无源驱动,处高阻状态,但一般用上拉电阻使其处在高电平,上拉电阻一般为1.5K。(空闲电平是低电平)

逻辑分析上抓到的示意图如下:

4、应用程序设计

参考上面的时序,采用GPIO翻转实现,注意AXI GPIO IP核0x4写0为输出,写1为输入,主要是用来操作MDIO方向

代码如下:

/*
 * Copyright (c) 2012 Xilinx, Inc.  All rights reserved.
 *
 * Xilinx, Inc.
 * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
 * COURTESY TO YOU.  BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
 * ONE POSSIBLE   IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
 * STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
 * IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
 * FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
 * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
 * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
 * ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
 * FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <linux/mii.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/sockios.h>
#include <linux/types.h>
#include <netinet/in.h>
#include <unistd.h>
#include "xil_io.h"


#define  PHY2_YT8521_ADDR                             0x01
#define  PHY3_YT8521_ADDR                             0x02
#define  PHY5_YT8521_ADDR                             0x04
#define  PHY6_YT8521_ADDR                             0x05
#define  PHY7_YT8521_ADDR                             0x06
#define  PHY8_YT8521_ADDR                             0x07
#define  PHY9_YT8521_ADDR                             0x00

#define  PHY_YT8521_ID_REG_ADDR                      0x03
#define  PHY_YT8521_REG_DEBUG_ADDR_OFFSET            0x1E
#define  PHY_YT8521_REG_DEBUG_DATA                   0x1F
#define  PHY_YT8521_EXT_REG_ADDR                     0xa00d

#define MDC2_GPIO_ADDR 0x412B0000
#define MDC3_GPIO_ADDR 0x412D0000
#define MDC5_GPIO_ADDR 0x412F0000
#define MDC6_GPIO_ADDR 0x41310000
#define MDC7_GPIO_ADDR 0x41330000
#define MDC8_GPIO_ADDR 0x41350000
#define MDC9_GPIO_ADDR 0x41370000

#define MDIO2_GPIO_ADDR 0x412C0000
#define MDIO3_GPIO_ADDR 0x412E0000
#define MDIO5_GPIO_ADDR 0x41300000
#define MDIO6_GPIO_ADDR 0x41320000
#define MDIO7_GPIO_ADDR 0x41340000
#define MDIO8_GPIO_ADDR 0x41360000
#define MDIO9_GPIO_ADDR 0x41380000



#define PHY2_SOFT_SMI_MDIO_READ Xil_In32(MDIO2_GPIO_ADDR)
#define PHY3_SOFT_SMI_MDIO_READ Xil_In32(MDIO3_GPIO_ADDR)
#define PHY5_SOFT_SMI_MDIO_READ Xil_In32(MDIO5_GPIO_ADDR)
#define PHY6_SOFT_SMI_MDIO_READ Xil_In32(MDIO6_GPIO_ADDR)
#define PHY7_SOFT_SMI_MDIO_READ Xil_In32(MDIO7_GPIO_ADDR)
#define PHY8_SOFT_SMI_MDIO_READ Xil_In32(MDIO8_GPIO_ADDR)
#define PHY9_SOFT_SMI_MDIO_READ Xil_In32(MDIO9_GPIO_ADDR)

typedef unsigned char u8;
typedef unsigned short u16;

void mdio_out(int index)
{
	switch(index)
	{
	case 2:
		Xil_Out32(MDIO2_GPIO_ADDR+0x4,0x0);
		break;
	case 3:
		Xil_Out32(MDIO3_GPIO_ADDR+0x4,0x0);
		break;
	case 5:
		Xil_Out32(MDIO5_GPIO_ADDR+0x4,0x0);
		break;
	case 6:
		Xil_Out32(MDIO6_GPIO_ADDR+0x4,0x0);
		break;
	case 7:
		Xil_Out32(MDIO7_GPIO_ADDR+0x4,0x0);
		break;
	case 8:
		Xil_Out32(MDIO8_GPIO_ADDR+0x4,0x0);
		break;
	case 9:
		Xil_Out32(MDIO9_GPIO_ADDR+0x4,0x0);
		break;
	default:
		break;
	}

}

void mdio_in(int index)
{
	switch(index)
	{
	case 2:
		Xil_Out32(MDIO2_GPIO_ADDR+0x4,0x1);
		break;
	case 3:
		Xil_Out32(MDIO3_GPIO_ADDR+0x4,0x1);
		break;
	case 5:
		Xil_Out32(MDIO5_GPIO_ADDR+0x4,0x1);
		break;
	case 6:
		Xil_Out32(MDIO6_GPIO_ADDR+0x4,0x1);
		break;
	case 7:
		Xil_Out32(MDIO7_GPIO_ADDR+0x4,0x1);
		break;
	case 8:
		Xil_Out32(MDIO8_GPIO_ADDR+0x4,0x1);
		break;
	case 9:
		Xil_Out32(MDIO9_GPIO_ADDR+0x4,0x1);
		break;
	default:
		break;
	}

}

void mdc_low(int index)
{
	switch(index)
	{
	case 2:
		Xil_Out32(MDC2_GPIO_ADDR,0x0);
		break;
	case 3:
		Xil_Out32(MDC3_GPIO_ADDR,0x0);
		break;
	case 5:
		Xil_Out32(MDC5_GPIO_ADDR,0x0);
		break;
	case 6:
		Xil_Out32(MDC6_GPIO_ADDR,0x0);
		break;
	case 7:
		Xil_Out32(MDC7_GPIO_ADDR,0x0);
		break;
	case 8:
		Xil_Out32(MDC8_GPIO_ADDR,0x0);
		break;
	case 9:
		Xil_Out32(MDC9_GPIO_ADDR,0x0);
		break;
	default:
		break;
	}

}

void mdc_high(int index)
{
	switch(index)
	{
	case 2:
		Xil_Out32(MDC2_GPIO_ADDR,0xffffffff);
		break;
	case 3:
		Xil_Out32(MDC3_GPIO_ADDR,0xffffffff);
		break;
	case 5:
		Xil_Out32(MDC5_GPIO_ADDR,0xffffffff);
		break;
	case 6:
		Xil_Out32(MDC6_GPIO_ADDR,0xffffffff);
		break;
	case 7:
		Xil_Out32(MDC7_GPIO_ADDR,0xffffffff);
		break;
	case 8:
		Xil_Out32(MDC8_GPIO_ADDR,0xffffffff);
		break;
	case 9:
		Xil_Out32(MDC9_GPIO_ADDR,0xffffffff);
		break;
	default:
		break;
	}

}

void mdio_low(int index)
{
	switch(index)
	{
	case 2:
		Xil_Out32(MDIO2_GPIO_ADDR,0x0);
		break;
	case 3:
		Xil_Out32(MDIO3_GPIO_ADDR,0x0);
		break;
	case 5:
		Xil_Out32(MDIO5_GPIO_ADDR,0x0);
		break;
	case 6:
		Xil_Out32(MDIO6_GPIO_ADDR,0x0);
		break;
	case 7:
		Xil_Out32(MDIO7_GPIO_ADDR,0x0);
		break;
	case 8:
		Xil_Out32(MDIO8_GPIO_ADDR,0x0);
		break;
	case 9:
		Xil_Out32(MDIO9_GPIO_ADDR,0x0);
		break;
	default:
		break;
	}

}

void mdio_high(int index)
{
	switch(index)
	{
	case 2:
		Xil_Out32(MDIO2_GPIO_ADDR,0xffffffff);
		break;
	case 3:
		Xil_Out32(MDIO3_GPIO_ADDR,0xffffffff);
		break;
	case 5:
		Xil_Out32(MDIO5_GPIO_ADDR,0xffffffff);
		break;
	case 6:
		Xil_Out32(MDIO6_GPIO_ADDR,0xffffffff);
		break;
	case 7:
		Xil_Out32(MDIO7_GPIO_ADDR,0xffffffff);
		break;
	case 8:
		Xil_Out32(MDIO8_GPIO_ADDR,0xffffffff);
		break;
	case 9:
		Xil_Out32(MDIO9_GPIO_ADDR,0xffffffff);
		break;
	default:
		break;
	}


}


void Mcu_Yt8521_Soft_Smi_Bit_Set(int index,u8 bit)
{
    // set mdio dir out
    // set mdio
	mdio_out(index);
	if(bit) mdio_high(index);
	else mdio_low(index);

    // set clk.
	mdc_low(index);
	mdc_high(index);
}

void Mcu_Yt8521_Soft_Smi_Bit_Get(int index,u8 *bit)
{
    // set mdio dir in
    // get mdio
	mdio_in(index);      //MDIO线设置为输入

	switch(index)
	{
	case 2:
		*bit = !!PHY2_SOFT_SMI_MDIO_READ;
		break;
	case 3:
		*bit = !!PHY3_SOFT_SMI_MDIO_READ;
		break;
	case 5:
		*bit = !!PHY5_SOFT_SMI_MDIO_READ;
		break;
	case 6:
		*bit = !!PHY6_SOFT_SMI_MDIO_READ;
		break;
	case 7:
		*bit = !!PHY7_SOFT_SMI_MDIO_READ;
		break;
	case 8:
		*bit = !!PHY8_SOFT_SMI_MDIO_READ;
		break;
	case 9:
		*bit = !!PHY9_SOFT_SMI_MDIO_READ;
		break;
	default:
		break;
	}


    // set clk.
	mdc_low(index);
	mdc_high(index);

}

u16 Srv_Yt8521_Soft_I2c_Device_Write(int index,u8 phy_addr, u8 reg_addr, u16 data)
{
	u16 i = 0;

    //idel
	for(i = 0; i < 32; i++)
	{
		Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
	}

	//start
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);

	//op code
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);

	//phy address
	for(i = 0; i < 5; i++)
	{
		if( phy_addr & (0x10 >> i) )
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
		}
		else
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);
		}
	}

	//register address
	for(i = 0; i < 5; i++)
	{
		if( reg_addr & (0x10 >> i) )
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
		}
		else
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);
		}
	}

	//TA翻转状态(ack)
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);

	//register data
	for(i = 0; i < 16; i++)
	{
		if( data & (0x8000 >> i) )
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
		}
		else
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);
		}
	}

	return 0;
}

u16 Srv_Yt8521_Soft_I2c_Device_Read(int index,u8 phy_addr, u8 reg_addr)
{
	u16 i = 0;
	u16 data = 0;     //待获取的数据
	u8  bit  = 0;

	//idel
	for(i = 0; i < 32; i++)
	{
		Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
	}

	//start
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);

	//op code
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
	Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);

	//phy address
	for(i = 0; i < 5; i++)
	{
		if( phy_addr & (0x10 >> i) )
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
		}
		else
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);
		}
	}

	//register address
	for(i = 0; i < 5; i++)
	{
		if( reg_addr & (0x10 >> i) )
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,1);
		}
		else
		{
			Mcu_Yt8521_Soft_Smi_Bit_Set(index,0);
		}
	}

	//TA翻转状态(ack)
	Mcu_Yt8521_Soft_Smi_Bit_Get(index,&bit);
	Mcu_Yt8521_Soft_Smi_Bit_Get(index,&bit);

	//register data
	for(i = 0; i < 16; i++)
	{
		data<<=1;
		Mcu_Yt8521_Soft_Smi_Bit_Get(index,&bit);

		if(bit)
		{
			data |= 0x1;
		}
	}

	return data;
}

int main(int argc, char *argv[])
{
	int phy_index=0;
	int reg_addr=0;
	int value=0;
	u16 Reg_Value;
	if(argc<4)
	{
		printf("Usage mdio_test w/r phy_index[2,3,5,6,7,8,9] reg_addr [value]\n ");
		return 0;
	}

	if(argc==4)
	{
		phy_index=(uint16_t) strtoul(argv[2], NULL, 0);
		reg_addr=(uint16_t) strtoul(argv[3], NULL, 0);

		switch(phy_index)
		{
		case 2:
			Reg_Value=Srv_Yt8521_Soft_I2c_Device_Read(2,PHY2_YT8521_ADDR, reg_addr);
			printf("[READ]phy_index %d reg_addr 0x%x value is 0x%x\n",phy_index,reg_addr,Reg_Value);
			break;
		case 3:
			Reg_Value=Srv_Yt8521_Soft_I2c_Device_Read(3,PHY3_YT8521_ADDR, reg_addr);
			printf("[READ]phy_index %d reg_addr 0x%x value is 0x%x\n",phy_index,reg_addr,Reg_Value);
			break;
		case 5:
			Reg_Value=Srv_Yt8521_Soft_I2c_Device_Read(5,PHY5_YT8521_ADDR, reg_addr);
			printf("[READ]phy_index %d reg_addr 0x%x value is 0x%x\n",phy_index,reg_addr,Reg_Value);
			break;
		case 6:
			Reg_Value=Srv_Yt8521_Soft_I2c_Device_Read(6,PHY6_YT8521_ADDR, reg_addr);
			printf("[READ]phy_index %d reg_addr 0x%x value is 0x%x\n",phy_index,reg_addr,Reg_Value);
			break;
		case 7:
			Reg_Value=Srv_Yt8521_Soft_I2c_Device_Read(7,PHY7_YT8521_ADDR, reg_addr);
			printf("[READ]phy_index %d reg_addr 0x%x value is 0x%x\n",phy_index,reg_addr,Reg_Value);
			break;
		case 8:
			Reg_Value=Srv_Yt8521_Soft_I2c_Device_Read(8,PHY8_YT8521_ADDR, reg_addr);
			printf("[READ]phy_index %d reg_addr 0x%x value is 0x%x\n",phy_index,reg_addr,Reg_Value);
			break;
		case 9:
			Reg_Value=Srv_Yt8521_Soft_I2c_Device_Read(9,PHY9_YT8521_ADDR, reg_addr);
			printf("[READ]phy_index %d reg_addr 0x%x value is 0x%x\n",phy_index,reg_addr,Reg_Value);
			break;
		default:
			break;
		}


	}
	else if(argc==5)
	{
		phy_index=(uint16_t) strtoul(argv[2], NULL, 0);
		reg_addr=(uint16_t) strtoul(argv[3], NULL, 0);
		value=(uint16_t) strtoul(argv[4], NULL, 0);
		printf("[WRITE] phy_index is %d reg_addr is 0x%x value is 0x%x\n",phy_index,reg_addr,value);
		switch(phy_index)
		{
		case 2:
			Srv_Yt8521_Soft_I2c_Device_Write(2,PHY2_YT8521_ADDR, reg_addr,value);
			break;
		case 3:
			Srv_Yt8521_Soft_I2c_Device_Write(3,PHY3_YT8521_ADDR, reg_addr,value);
			break;
		case 5:
			Srv_Yt8521_Soft_I2c_Device_Write(5,PHY5_YT8521_ADDR, reg_addr,value);
			break;
		case 6:
			Srv_Yt8521_Soft_I2c_Device_Write(6,PHY6_YT8521_ADDR, reg_addr,value);
			break;
		case 7:
			Srv_Yt8521_Soft_I2c_Device_Write(7,PHY7_YT8521_ADDR, reg_addr,value);
			break;
		case 8:
			Srv_Yt8521_Soft_I2c_Device_Write(8,PHY8_YT8521_ADDR, reg_addr,value);
			break;
		case 9:
			Srv_Yt8521_Soft_I2c_Device_Write(9,PHY9_YT8521_ADDR, reg_addr,value);
			break;
		default:
			break;
		}
	}






#if 0
	u16 id = 0;

	printf("//***************** Read SMI Reg of YT8521 ******************//\r\n");
	printf("------ PHY Identification Registers ------\r\n");

	id = Srv_Yt8521_Soft_I2c_Device_Read(2,PHY2_YT8521_ADDR, PHY_YT8521_ID_REG_ADDR);   //reg_addr:0x03  读取的值应为0x11a
	printf("PHY2_YT8521 id = 0x%x\n", id);


	id = Srv_Yt8521_Soft_I2c_Device_Read(3,PHY3_YT8521_ADDR, PHY_YT8521_ID_REG_ADDR);   //reg_addr:0x03  读取的值应为0x11a
	printf("PHY3_YT8521 id = 0x%x\n", id);

	id = Srv_Yt8521_Soft_I2c_Device_Read(5,PHY5_YT8521_ADDR, PHY_YT8521_ID_REG_ADDR);   //reg_addr:0x03  读取的值应为0x11a
	printf("PHY5_YT8521 id = 0x%x\n", id);

	id = Srv_Yt8521_Soft_I2c_Device_Read(6,PHY6_YT8521_ADDR, PHY_YT8521_ID_REG_ADDR);   //reg_addr:0x03  读取的值应为0x11a
	printf("PHY6_YT8521 id = 0x%x\n", id);

	id = Srv_Yt8521_Soft_I2c_Device_Read(7,PHY7_YT8521_ADDR, PHY_YT8521_ID_REG_ADDR);   //reg_addr:0x03  读取的值应为0x11a
	printf("PHY7_YT8521 id = 0x%x\n", id);

	id = Srv_Yt8521_Soft_I2c_Device_Read(8,PHY8_YT8521_ADDR, PHY_YT8521_ID_REG_ADDR);   //reg_addr:0x03  读取的值应为0x11a
	printf("PHY8_YT8521 id = 0x%x\n", id);

	id = Srv_Yt8521_Soft_I2c_Device_Read(9,PHY9_YT8521_ADDR, PHY_YT8521_ID_REG_ADDR);   //reg_addr:0x03  读取的值应为0x11a
	printf("PHY9_YT8521 id = 0x%x\n", id);


    printf("Setting PHY2\n");
    Srv_Yt8521_Soft_I2c_Device_Write(2,PHY2_YT8521_ADDR, PHY_YT8521_REG_DEBUG_ADDR_OFFSET, PHY_YT8521_EXT_REG_ADDR);
    Srv_Yt8521_Soft_I2c_Device_Write(2,PHY2_YT8521_ADDR, PHY_YT8521_REG_DEBUG_DATA,0x604);

    printf("Setting PHY3\n");
    Srv_Yt8521_Soft_I2c_Device_Write(3,PHY3_YT8521_ADDR, PHY_YT8521_REG_DEBUG_ADDR_OFFSET, PHY_YT8521_EXT_REG_ADDR);
    Srv_Yt8521_Soft_I2c_Device_Write(3,PHY3_YT8521_ADDR, PHY_YT8521_REG_DEBUG_DATA,0x604);

    printf("Setting PHY5\n");
    Srv_Yt8521_Soft_I2c_Device_Write(5,PHY5_YT8521_ADDR, PHY_YT8521_REG_DEBUG_ADDR_OFFSET, PHY_YT8521_EXT_REG_ADDR);
    Srv_Yt8521_Soft_I2c_Device_Write(5,PHY5_YT8521_ADDR, PHY_YT8521_REG_DEBUG_DATA,0x604);

    printf("Setting PHY6\n");
    Srv_Yt8521_Soft_I2c_Device_Write(6,PHY6_YT8521_ADDR, PHY_YT8521_REG_DEBUG_ADDR_OFFSET, PHY_YT8521_EXT_REG_ADDR);
    Srv_Yt8521_Soft_I2c_Device_Write(6,PHY6_YT8521_ADDR, PHY_YT8521_REG_DEBUG_DATA,0x604);

    printf("Setting PHY7\n");
    Srv_Yt8521_Soft_I2c_Device_Write(7,PHY7_YT8521_ADDR, PHY_YT8521_REG_DEBUG_ADDR_OFFSET, PHY_YT8521_EXT_REG_ADDR);
    Srv_Yt8521_Soft_I2c_Device_Write(7,PHY7_YT8521_ADDR, PHY_YT8521_REG_DEBUG_DATA,0x604);

    printf("Setting PHY8\n");
    Srv_Yt8521_Soft_I2c_Device_Write(8,PHY8_YT8521_ADDR, PHY_YT8521_REG_DEBUG_ADDR_OFFSET, PHY_YT8521_EXT_REG_ADDR);
    Srv_Yt8521_Soft_I2c_Device_Write(8,PHY8_YT8521_ADDR, PHY_YT8521_REG_DEBUG_DATA,0x604);

    printf("Setting PHY9\n");
    Srv_Yt8521_Soft_I2c_Device_Write(9,PHY9_YT8521_ADDR, PHY_YT8521_REG_DEBUG_ADDR_OFFSET, PHY_YT8521_EXT_REG_ADDR);
    Srv_Yt8521_Soft_I2c_Device_Write(9,PHY9_YT8521_ADDR, PHY_YT8521_REG_DEBUG_DATA,0x604);
#endif


    return 0;
}

5、测试验证

读取裕太8521的PHY ID

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/186458.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Arduino库之 LedControl 库说明文档

LedControl 库最初是为基于 8 位 AVR 处理器的 Arduino 板编写的。用于通过MAX7219芯片控制LED矩阵和7段数码管。但由于该代码不使用处理器的任何复杂的内部功能&#xff0c;因此具有高度可移植性&#xff0c;并且应该在任何支持 和 功能的 Arduino&#xff08;类似&#xff09…

​3ds Max插件CG MAGIC图形板块为您提升线条效率!

​通过3ds Max软件进行绘图操作时&#xff0c;大多绊住各位设计师们作图速度的往往都是一些细微的琐事&#xff0c;重复一变一变的调整修改等问题。 今天说到这个绘图线条来回调整解决方法就是3ds Max插件CG MAGIC。 Max插件CG MAGIC作为一款智能化的辅助插件&#xff0c;致力于…

DS图_传递信息

Description 小明在和他的小伙伴们玩传消息游戏&#xff0c;游戏规则如下&#xff1a; 1. 有n名玩家&#xff0c;所有玩家编号分别为0~n-1&#xff0c;其中小明编号为0&#xff1b; 2. 每个玩家都有固定的若干个可传信息的其他玩家(也可能没有)。传消息的关系是单向的(即&am…

探究Kafka原理-3.生产者消费者API原理解析

&#x1f44f;作者简介&#xff1a;大家好&#xff0c;我是爱吃芝士的土豆倪&#xff0c;24届校招生Java选手&#xff0c;很高兴认识大家&#x1f4d5;系列专栏&#xff1a;Spring源码、JUC源码、Kafka原理&#x1f525;如果感觉博主的文章还不错的话&#xff0c;请&#x1f44…

HBase数据模型杂谈

1.概述 HBase是一个稀疏、多维度、排序的映射表&#xff0c;这张表的索引是行键、列族、列限定符和时间戳。 每个值是一个未经解释的字符串&#xff0c;没有数据类型。用户在表中存储数据&#xff0c;每一行都有一个可排序的行键和任意多的列。表在水平方向由一个或者多个列族…

01_原理-事件循环

01_原理-事件循环 文章目录 01_原理-事件循环一、浏览器的进程模型①&#xff1a;何为进程&#xff1f;②&#xff1a;何为线程&#xff1f;③&#xff1a;浏览器有哪些进程和线程&#xff1f; 二、渲染主线程是如何工作的&#xff1f;三、若干解释①&#xff1a;何为异步&…

metersphere 设置定时任务和查看报告

设置定时任务 设置时间 查看执行后的测试报告 查看报告详情

【从浅识到熟知Linux】基本指令之mkdir

&#x1f388;归属专栏&#xff1a;从浅学到熟知Linux &#x1f697;个人主页&#xff1a;Jammingpro &#x1f41f;每日一句&#xff1a;加油努力&#xff0c;这次写完真的要去干饭了&#xff01; 文章前言&#xff1a;本文介绍mkdir指令用法并给出示例和截图。 文章目录 基本…

基于广义正态分布算法优化概率神经网络PNN的分类预测 - 附代码

基于广义正态分布算法优化概率神经网络PNN的分类预测 - 附代码 文章目录 基于广义正态分布算法优化概率神经网络PNN的分类预测 - 附代码1.PNN网络概述2.变压器故障诊街系统相关背景2.1 模型建立 3.基于广义正态分布优化的PNN网络5.测试结果6.参考文献7.Matlab代码 摘要&#xf…

2023亚太杯数学建模B题完整原创论文讲解

大家好呀&#xff0c;从发布赛题一直到现在&#xff0c;总算完成了2023亚太地区数学建模竞赛B题玻璃温室的微气候调控完整的成品论文。 本论文可以保证原创&#xff0c;保证高质量。绝不是随便引用一大堆模型和代码复制粘贴进来完全没有应用糊弄人的垃圾半成品论文。 论文共6…

通过内网穿透本地MariaDB数据库,实现在公网环境下使用navicat图形化工具

公网远程连接MariaDB数据库【cpolar内网穿透】 文章目录 公网远程连接MariaDB数据库【cpolar内网穿透】1. 配置MariaDB数据库1.1 安装MariaDB数据库1.2 测试局域网内远程连接 2. 内网穿透2.1 创建隧道映射2.2 测试随机地址公网远程访问3. 配置固定TCP端口地址3.1 保留一个固定的…

鼠标点击位置获取几何体对象_vtkAreaPicker_vtkInteractorStyleRubberBandPick

开发环境&#xff1a; Windows 11 家庭中文版Microsoft Visual Studio Community 2019VTK-9.3.0.rc0vtk-example参考代码 demo解决问题&#xff1a;框选或者点选某一区域&#xff0c;并获取区域prop3D对象&#xff08;红线内为有效区域&#xff0c;polydata组成的3d几何对象&a…

VSCode 连接远程服务器问题及解决办法

端口号不一样&#xff0c;需要在配置文件中添加Port Host 27.223.26.46HostName 27.223.*.*User userForwardAgent yesPort 14111输入密码后可以连接 在vscode界面&#xff0c;终端&#xff0c;生成公钥&私钥 ssh-keygen可以看到有id_rsa和id_rsa.pub两个文件生成&#…

Linux:Ubuntu实现远程登陆

1、查看sshd服务是否存在 Ubuntu默认是没有安装sshd服务的&#xff0c;所以&#xff0c;无法远程登陆。 检查22端口是否存在 netstat -anp 该命令执行后&#xff0c;查看不到22端口的进程。 如果netstat无法使用&#xff0c;我们需要安装一下netstat服务 sudo apt-get install…

基于Springboot的冬奥会科普平台(有报告),Javaee项目,springboot项目。

演示视频&#xff1a; 基于Springboot的冬奥会科普平台&#xff08;有报告&#xff09;&#xff0c;Javaee项目&#xff0c;springboot项目。 项目介绍&#xff1a; 采用M&#xff08;model&#xff09;V&#xff08;view&#xff09;C&#xff08;controller&#xff09;三层…

SSL握手失败的解决方案

一、SSL握手失败的原因&#xff1a; 1&#xff0c;证书过期&#xff1a;SSL证书有一个有效期限&#xff0c;如果证书过期&#xff0c;就会导致SSL握手失败。 2&#xff0c;证书不被信任&#xff1a;如果网站的SSL证书不被浏览器或操作系统信任&#xff0c;也会导致SSL握手失败…

【深度学习】P1 数据缺失值预处理

数据缺失值预处理 创建数据集展示数据集缺失值处理 创建数据集 首先创建一个人工数据集&#xff0c;作为下文对数据缺失值预处理的案例&#xff0c; import osos.makedirs(os.path.join(.., data), exist_okTrue) data_file os.path.join(.., data, house_tiny.csv) with op…

系列十、声明式事务(注解方式)

一、概述 声明式事务(declarative transaction management)是Spring提供的对程序事务管理的一种方式&#xff0c;Spring的声明式事务顾名思义就是采用声明的方式来处理事务。这里所说的声明&#xff0c;是指在配置文件中声明&#xff0c;用在Spring配置文件中声明式的处理事务来…

浏览器是什么

浏览器是什么 本文简要介绍浏览器的功能和组成。 浏览器&#xff08;Web Browser&#xff09;是一种用于访问和浏览互联网上的网页和资源的软件应用程序。它是用户与互联网交互的主要工具之一。 浏览器通过使用网络协议&#xff08;如HTTP、HTTPS等&#xff09;与远程服务器通…

AD9361纯逻辑控制从0到1连载10-多芯片同步MCS以及射频同步方法

本文基于ZC706FMCOMMS5的平台&#xff0c;介绍了AD9361的多芯片同步设计方法。这里的“同步”包含了基带同步以及射频同步。AD9361原生只支持基带同步&#xff0c;官方的名称叫MCS&#xff08;Multi-chip Baseband Synchronization &#xff09;&#xff0c;实际上配合外围的射…