DP83640 IEEE1588 IntWriteReg求解释。

1 篇文章 0 订阅
1 篇文章 0 订阅
求高人解释下 

void   IntWriteReg( //===================//===================//===========//===========

        IN PEPL_PORT_HANDLE portHandle,

        IN NS_UINT registerIndex,

        IN NS_UINT value)

//  Internal procedure that performs the actual write operation.  See below for details of parameters

//****************************************************************************

{

PPORT_OBJ portHdl = (PPORT_OBJ)portHandle;

NS_UINT32 tPCF;

    // See if we need to do a page select, but not if we are using PCFs

    if( ((registerIndex & ~0x8000) > PHY_PAGESEL) && !portHdl->usePhyControlFrames )

       {   // Make sure correct register page is selected        

        IntWriteReg( portHdl, (PHY_PAGESEL | (registerIndex & 0x8000)), (registerIndex & 0xE0) >> 5);

        registerIndex &= ~0xE0;

    }

    switch( portHdl->ifType ) {

    case EPL_ENUM_CYUSB_MDIO://--------------------------------------------------------------

              // Send data out Cypress USB MDIO interface     如果使用Cypress USB MDIO与PHY通信 请问Cypress USB MDIO是什么呢?MDIO不就是一根线吗?

        ifCyUSB_WriteMDIO( portHdl, registerIndex, value);

        break;    

    case EPL_ENUM_DIRECT://------------------------------------------------------------------

        // Using direct interface.  See if we should use PCFs如果使用direct接口与PHY通信  什么算是direct接口?

//Use OK MAC interface.

        if( portHdl->usePhyControlFrames )

 {

            // Send data out "MAC" interface using PHY Control Frames

            // Create PCF packet

            tPCF = 0x40000000;                             // [31:30] 01'b for write command

            tPCF |= ((portHdl->portMdioAddress & 0x1F) << 25);  // [29:25] PHY Address

            tPCF |= ((registerIndex>>5 & 0x0F) << 21);          // [24:21] Page

            tPCF |= ((registerIndex & 0x1F) << 16);             // [20:16] Register

 

            // PCFs are in network order, need to swap the bytes around

            tPCF = (((tPCF) >> 24) & 0x000000ff) | (((tPCF) >> 8 ) & 0x0000ff00) |

                   (((tPCF) << 8 ) & 0x00ff0000) | (((tPCF) << 24) & 0xff000000);

 

            MACMIIWriteReg( portHdl, (NS_UINT8 *)&tPCF, sizeof(tPCF) );

        }

        else

{ // Send data out direct "MAC" interface

            MACWriteReg( portHdl, registerIndex, value);

        }

        break;

    default://--------------------------------------------------------------------------------

        // Send data out bit bang interface on LPT 如果使用MDIO与PHY通信

        ifLPTWriteReg( portHdl, registerIndex, value);

        break;

    }  // switch( portHdl->ifType )

}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值