Lines Matching refs:pxPhyObject

148 static uint32_t xPhyReset( EthernetPhy_t * pxPhyObject,
208 void vPhyInitialise( EthernetPhy_t * pxPhyObject, in vPhyInitialise() argument
212 memset( ( void * ) pxPhyObject, 0, sizeof( *pxPhyObject ) ); in vPhyInitialise()
214 pxPhyObject->fnPhyRead = fnPhyRead; in vPhyInitialise()
215 pxPhyObject->fnPhyWrite = fnPhyWrite; in vPhyInitialise()
220 BaseType_t xPhyDiscover( EthernetPhy_t * pxPhyObject ) in xPhyDiscover() argument
224 pxPhyObject->xPortCount = 0; in xPhyDiscover()
230 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_03_PHYSID2, &ulLowerID ); in xPhyDiscover()
238 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_02_PHYSID1, &ulUpperID ); in xPhyDiscover()
241 pxPhyObject->ucPhyIndexes[ pxPhyObject->xPortCount ] = xPhyAddress; in xPhyDiscover()
242 pxPhyObject->ulPhyIDs[ pxPhyObject->xPortCount ] = ulPhyID; in xPhyDiscover()
244 pxPhyObject->xPortCount++; in xPhyDiscover()
247 if( pxPhyObject->xPortCount == ipconfigPHY_MAX_PORTS ) in xPhyDiscover()
254 if( pxPhyObject->xPortCount > 0 ) in xPhyDiscover()
256 FreeRTOS_printf( ( "PHY ID %lX\n", pxPhyObject->ulPhyIDs[ 0 ] ) ); in xPhyDiscover()
259 return pxPhyObject->xPortCount; in xPhyDiscover()
264 static uint32_t xPhyReset( EthernetPhy_t * pxPhyObject, in xPhyReset() argument
276 for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++ ) in xPhyReset()
278 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyReset()
281 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_00_BMCR, &ulConfig ); in xPhyReset()
282 pxPhyObject->fnPhyWrite( xPhyAddress, phyREG_00_BMCR, ulConfig | phyBMCR_RESET ); in xPhyReset()
291 for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++ ) in xPhyReset()
293 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyReset()
295 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_00_BMCR, &ulConfig ); in xPhyReset()
320 for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++ ) in xPhyReset()
324 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyReset()
327 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_00_BMCR, &ulConfig ); in xPhyReset()
328 pxPhyObject->fnPhyWrite( xPhyAddress, phyREG_00_BMCR, ulConfig & ~phyBMCR_RESET ); in xPhyReset()
338 BaseType_t xPhyConfigure( EthernetPhy_t * pxPhyObject, in xPhyConfigure() argument
344 if( pxPhyObject->xPortCount < 1 ) in xPhyConfigure()
412 xPhyReset( pxPhyObject, xPhyGetMask( pxPhyObject ) ); in xPhyConfigure()
414 for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++ ) in xPhyConfigure()
416 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyConfigure()
417 uint32_t ulPhyID = pxPhyObject->ulPhyIDs[ xPhyIndex ]; in xPhyConfigure()
420 pxPhyObject->fnPhyWrite( xPhyAddress, phyREG_04_ADVERTISE, ulAdvertise ); in xPhyConfigure()
438 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_00_BMCR, &ulConfig ); in xPhyConfigure()
466 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_19_PHYCR, &ulPhyControl ); in xPhyConfigure()
487 pxPhyObject->fnPhyWrite( xPhyAddress, phyREG_19_PHYCR, ulPhyControl ); in xPhyConfigure()
494 pxPhyObject->ulBCRValue = ulConfig & ~phyBMCR_ISOLATE; in xPhyConfigure()
495 pxPhyObject->ulACRValue = ulAdvertise; in xPhyConfigure()
505 BaseType_t xPhyFixedValue( EthernetPhy_t * pxPhyObject, in xPhyFixedValue() argument
513 if( pxPhyObject->xPhyPreferences.ucDuplex == PHY_DUPLEX_FULL ) in xPhyFixedValue()
518 if( pxPhyObject->xPhyPreferences.ucSpeed == PHY_SPEED_100 ) in xPhyFixedValue()
523 for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++, ulBitMask <<= 1 ) in xPhyFixedValue()
527 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyFixedValue()
530 pxPhyObject->fnPhyWrite( xPhyAddress, phyREG_00_BMCR, ulValue ); in xPhyFixedValue()
541 BaseType_t xPhyStartAutoNegotiation( EthernetPhy_t * pxPhyObject, in xPhyStartAutoNegotiation() argument
554 for( xPhyIndex = 0; xPhyIndex < ( uint32_t ) pxPhyObject->xPortCount; xPhyIndex++ ) in xPhyStartAutoNegotiation()
558 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyStartAutoNegotiation()
561 pxPhyObject->fnPhyWrite( xPhyAddress, phyREG_04_ADVERTISE, pxPhyObject->ulACRValue ); in xPhyStartAutoNegotiation()
562pxPhyObject->fnPhyWrite( xPhyAddress, phyREG_00_BMCR, pxPhyObject->ulBCRValue | phyBMCR_AN_RESTART… in xPhyStartAutoNegotiation()
575 …for( xPhyIndex = 0; xPhyIndex < ( uint32_t ) pxPhyObject->xPortCount; xPhyIndex++, ulBitMask <<= 1… in xPhyStartAutoNegotiation()
581 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyStartAutoNegotiation()
583 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_01_BMSR, &ulRegValue ); in xPhyStartAutoNegotiation()
610 pxPhyObject->ulLinkStatusMask &= ~( ulDoneMask ); in xPhyStartAutoNegotiation()
612 …for( xPhyIndex = 0; xPhyIndex < ( uint32_t ) pxPhyObject->xPortCount; xPhyIndex++, ulBitMask <<= 1… in xPhyStartAutoNegotiation()
614 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyStartAutoNegotiation()
615 uint32_t ulPhyID = pxPhyObject->ulPhyIDs[ xPhyIndex ]; in xPhyStartAutoNegotiation()
623 pxPhyObject->fnPhyWrite( xPhyAddress, phyREG_00_BMCR, pxPhyObject->ulBCRValue ); in xPhyStartAutoNegotiation()
625 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_01_BMSR, &ulRegValue ); in xPhyStartAutoNegotiation()
630 pxPhyObject->ulLinkStatusMask |= ulBitMask; in xPhyStartAutoNegotiation()
641 pxPhyObject->fnPhyRead( xPhyAddress, 0x1E, &ulControlStatus ); in xPhyStartAutoNegotiation()
688 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_1F_PHYSPCS, &ulControlStatus ); in xPhyStartAutoNegotiation()
710 pxPhyObject->fnPhyRead( xPhyAddress, phyREG_1F_PHYSPCS, &ulControlStatus ); in xPhyStartAutoNegotiation()
726 pxPhyObject->fnPhyRead( xPhyAddress, PHYREG_10_PHYSTS, &ulRegValue ); in xPhyStartAutoNegotiation()
737 pxPhyObject->xPhyProperties.ucDuplex = PHY_DUPLEX_FULL; in xPhyStartAutoNegotiation()
741 pxPhyObject->xPhyProperties.ucDuplex = PHY_DUPLEX_HALF; in xPhyStartAutoNegotiation()
746 pxPhyObject->xPhyProperties.ucSpeed = PHY_SPEED_10; in xPhyStartAutoNegotiation()
750 pxPhyObject->xPhyProperties.ucSpeed = PHY_SPEED_100; in xPhyStartAutoNegotiation()
759 BaseType_t xPhyCheckLinkStatus( EthernetPhy_t * pxPhyObject, in xPhyCheckLinkStatus() argument
770 vTaskSetTimeOutState( &( pxPhyObject->xLinkStatusTimer ) ); in xPhyCheckLinkStatus()
771 pxPhyObject->xLinkStatusRemaining = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS ); in xPhyCheckLinkStatus()
773 for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++, ulBitMask <<= 1 ) in xPhyCheckLinkStatus()
775 if( ( pxPhyObject->ulLinkStatusMask & ulBitMask ) == 0UL ) in xPhyCheckLinkStatus()
777 pxPhyObject->ulLinkStatusMask |= ulBitMask; in xPhyCheckLinkStatus()
778 … FreeRTOS_printf( ( "xPhyCheckLinkStatus: PHY LS now %02lX\n", pxPhyObject->ulLinkStatusMask ) ); in xPhyCheckLinkStatus()
783 …else if( xTaskCheckForTimeOut( &( pxPhyObject->xLinkStatusTimer ), &( pxPhyObject->xLinkStatusRema… in xPhyCheckLinkStatus()
788 for( xPhyIndex = 0; xPhyIndex < pxPhyObject->xPortCount; xPhyIndex++, ulBitMask <<= 1 ) in xPhyCheckLinkStatus()
790 BaseType_t xPhyAddress = pxPhyObject->ucPhyIndexes[ xPhyIndex ]; in xPhyCheckLinkStatus()
792 if( pxPhyObject->fnPhyRead( xPhyAddress, phyREG_01_BMSR, &ulStatus ) == 0 ) in xPhyCheckLinkStatus()
794 … if( !!( pxPhyObject->ulLinkStatusMask & ulBitMask ) != !!( ulStatus & phyBMSR_LINK_STATUS ) ) in xPhyCheckLinkStatus()
798 pxPhyObject->ulLinkStatusMask |= ulBitMask; in xPhyCheckLinkStatus()
802 pxPhyObject->ulLinkStatusMask &= ~( ulBitMask ); in xPhyCheckLinkStatus()
805 … FreeRTOS_printf( ( "xPhyCheckLinkStatus: PHY LS now %02lX\n", pxPhyObject->ulLinkStatusMask ) ); in xPhyCheckLinkStatus()
811 vTaskSetTimeOutState( &( pxPhyObject->xLinkStatusTimer ) ); in xPhyCheckLinkStatus()
813 if( ( pxPhyObject->ulLinkStatusMask & ( ulBitMask >> 1 ) ) != 0 ) in xPhyCheckLinkStatus()
816 pxPhyObject->xLinkStatusRemaining = pdMS_TO_TICKS( ipconfigPHY_LS_HIGH_CHECK_TIME_MS ); in xPhyCheckLinkStatus()
821 pxPhyObject->xLinkStatusRemaining = pdMS_TO_TICKS( ipconfigPHY_LS_LOW_CHECK_TIME_MS ); in xPhyCheckLinkStatus()