Hi,
I have some questions about the API of MDIO in the CSL.
In the Chapter 14 of the CSL API for C6472, there is one demo code about MDIO :
#define MDIO_MODEFLG_FD1000 0x0020
#define MDIO_MODEFLG_LOOPBACK 0x0040
volatile Uint32 phyIdx = PHYREG_CONTROL;
volatile Uint32 phyReg;
Uint16 pData;
MDIO_Device mdioDev;
int instNum = 0;
Uint32 mdioModeFlags = MDIO_MODEFLG_FD1000 | MDIO_MODEFLG_LOOPBACK;
Uint32 mdioPhyAddr = 0;
//Open the MDIO module
MDIO_open(instNum, mdioModeFlags, mdioPhyAddr, &mdioDev);
MDIO_initPHY( &mdioDev, mdioPhyAddr );
MDIO_phyRegRead( phyIdx, ((MDIO_Device *)&mdioDev)->phyReg,pData );
But there is no member "phyReg" of the structrue type MDIO_ Device. And in the demo code, the first argument seems to be the REG address of PHY(phyidx ==PHYREG_CONTROL ).
as we can see from the source code of the fuction MDIO_phyRegRead below:
Uint32 MDIO_phyRegRead( volatile Uint32 phyIdx, volatile Uint32 phyReg, Uint16 *pData )
{
Uint16 data,ack;
PHYREG_read(0, phyReg, phyIdx );
PHYREG_waitResultsAck(0, &data, &ack );
if( !ack )
return(0);
if( pData )
*pData = data;
return(1);
}
void PHYREG_read(Uint32 id, Uint32 regadr, Uint32 phyadr )
{
if (id==1)
PHYREG1_read(regadr, phyadr);
else
PHYREG0_read(regadr, phyadr);
}
The first argument passed to the MDIO_phyRegRead fuction seems to be the PHY address of the PHY, the second argument passed to the fuction seens to be the REG address.But in the CSL demo code ,the first argument is the REG address, the second does not exist.
so the question is:
Uint32 MDIO_phyRegRead( volatile Uint32 phyIdx, volatile Uint32 phyReg, Uint16 *pData )
what is phyIdx in this fuction?what is phyReg in this fuction?
If there is problem with the demo code?
My English is not good , so sorry for the grammar error.
Thank you for reading my questions.