|
71 | 71 | #include "FreeRTOS_IP_Private.h" |
72 | 72 | #include "NetworkBufferManagement.h" |
73 | 73 |
|
74 | | -#define NOP() asm ( "nop" ); |
75 | | - |
76 | 74 | #define phyMIN_PHY_ADDRESS 0 |
77 | 75 | #define phyMAX_PHY_ADDRESS 31 |
78 | 76 |
|
79 | | -void test_sleep( uint32_t uxTicks ) |
80 | | -{ |
81 | | - for( uint32_t j = 0U; j < uxTicks; j++ ) |
82 | | - { |
83 | | - for( uint32_t i = 0U; i < 100000000U; i++ ) |
84 | | - { |
85 | | - NOP(); |
86 | | - } |
87 | | - } |
88 | | -} |
89 | | - |
90 | | -void my_sleep( uint32_t uxTicks ) |
91 | | -{ |
92 | | - sleep( uxTicks ); |
93 | | -} |
| 77 | +#define MINIMUM_SLEEP_TIME ( ( TickType_t ) 1 * configTICK_RATE_HZ ) |
94 | 78 |
|
95 | 79 | /*** IMPORTANT: Define PEEP in xemacpsif.h and sys_arch_raw.c |
96 | 80 | *** to run it on a PEEP board |
@@ -474,7 +458,7 @@ static uint32_t get_TI_phy_speed( XEmacPs * xemacpsp, |
474 | 458 |
|
475 | 459 | while( !( status & IEEE_STAT_AUTONEGOTIATE_COMPLETE ) ) |
476 | 460 | { |
477 | | - my_sleep( 1 ); |
| 461 | + vTaskDelay( MINIMUM_SLEEP_TIME ); |
478 | 462 | timeout_counter++; |
479 | 463 |
|
480 | 464 | if( timeout_counter == 30 ) |
@@ -572,7 +556,7 @@ static uint32_t get_Marvell_phy_speed( XEmacPs * xemacpsp, |
572 | 556 |
|
573 | 557 | while( !( status & IEEE_STAT_AUTONEGOTIATE_COMPLETE ) ) |
574 | 558 | { |
575 | | - my_sleep( 1 ); |
| 559 | + vTaskDelay( MINIMUM_SLEEP_TIME ); |
576 | 560 | XEmacPs_PhyRead( xemacpsp, phy_addr, |
577 | 561 | IEEE_COPPER_SPECIFIC_STATUS_REG_2, &temp ); |
578 | 562 | timeout_counter++; |
@@ -663,7 +647,7 @@ static uint32_t get_Realtek_phy_speed( XEmacPs * xemacpsp, |
663 | 647 |
|
664 | 648 | while( !( status & IEEE_STAT_AUTONEGOTIATE_COMPLETE ) ) |
665 | 649 | { |
666 | | - my_sleep( 1 ); |
| 650 | + vTaskDelay( MINIMUM_SLEEP_TIME ); |
667 | 651 | timeout_counter++; |
668 | 652 |
|
669 | 653 | if( timeout_counter == 30 ) |
@@ -804,7 +788,7 @@ static uint32_t get_AR8035_phy_speed( XEmacPs * xemacpsp, |
804 | 788 | while( pdTRUE ) |
805 | 789 | { |
806 | 790 | uint32_t status; |
807 | | - my_sleep( 1 ); |
| 791 | + vTaskDelay( MINIMUM_SLEEP_TIME ); |
808 | 792 |
|
809 | 793 | timeout_counter++; |
810 | 794 |
|
@@ -967,6 +951,7 @@ static uint32_t get_IEEE_phy_speed_US( XEmacPs * xemacpsp, |
967 | 951 | &phy_identity ); |
968 | 952 |
|
969 | 953 | const char * pcPHYName = pcGetPHIName( phy_identity ); |
| 954 | + |
970 | 955 | FreeRTOS_printf( ( "Start %s PHY autonegotiation. ID = 0x%04X\n", pcPHYName, phy_identity ) ); |
971 | 956 |
|
972 | 957 | /* Just to prevent compiler warnings about unused variablies. */ |
@@ -1377,19 +1362,19 @@ u32 Phy_Setup_US( XEmacPs * xemacpsp, |
1377 | 1362 | link_speed = 1000; |
1378 | 1363 | configure_IEEE_phy_speed_US( xemacpsp, link_speed ); |
1379 | 1364 | convspeeddupsetting = XEMACPS_GMII2RGMII_SPEED1000_FD; |
1380 | | - my_sleep( 1 ); |
| 1365 | + vTaskDelay( MINIMUM_SLEEP_TIME ); |
1381 | 1366 | #elif defined( ipconfigNIC_LINKSPEED100 ) |
1382 | 1367 | SetUpSLCRDivisors( xemacpsp->Config.BaseAddress, 100 ); |
1383 | 1368 | link_speed = 100; |
1384 | 1369 | configure_IEEE_phy_speed_US( xemacpsp, link_speed, phy_addr ); |
1385 | 1370 | convspeeddupsetting = XEMACPS_GMII2RGMII_SPEED100_FD; |
1386 | | - my_sleep( 1 ); |
| 1371 | + vTaskDelay( MINIMUM_SLEEP_TIME ); |
1387 | 1372 | #elif defined( ipconfigNIC_LINKSPEED10 ) |
1388 | 1373 | SetUpSLCRDivisors( xemacpsp->Config.BaseAddress, 10 ); |
1389 | 1374 | link_speed = 10; |
1390 | 1375 | configure_IEEE_phy_speed_US( xemacpsp, link_speed, , phy_addr ); |
1391 | 1376 | convspeeddupsetting = XEMACPS_GMII2RGMII_SPEED10_FD; |
1392 | | - my_sleep( 1 ); |
| 1377 | + vTaskDelay( MINIMUM_SLEEP_TIME ); |
1393 | 1378 | #endif /* ifdef ipconfigNIC_LINKSPEED_AUTODETECT */ |
1394 | 1379 |
|
1395 | 1380 | if( conv_present ) |
|
0 commit comments