@@ -190,7 +190,7 @@ static void ether_enable_icu(ether_instance_ctrl_t * const p_instance_ctrl)
190
190
static void ether_disable_icu (ether_instance_ctrl_t * const p_instance_ctrl );
191
191
static void ether_reset_mac (R_ETHERC_EDMAC_Type * const p_reg );
192
192
static void ether_init_descriptors (ether_instance_ctrl_t * const p_instance_ctrl );
193
- static void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl );
193
+ void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl );
194
194
static fsp_err_t ether_buffer_get (ether_instance_ctrl_t * const p_instance_ctrl ,
195
195
void * * const p_buffer ,
196
196
uint32_t * p_buffer_size );
@@ -199,10 +199,10 @@ static void ether_pause_resolution(uint32_t const local_ability,
199
199
uint32_t const partner_ability ,
200
200
uint32_t * ptx_pause ,
201
201
uint32_t * prx_pause );
202
- static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
202
+ void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
203
203
const uint8_t mac_addr [],
204
204
const uint8_t mode );
205
- static fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode );
205
+ fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode );
206
206
static fsp_err_t ether_link_status_check (ether_instance_ctrl_t const * const p_instance_ctrl );
207
207
static uint8_t ether_check_magic_packet_detection_bit (ether_instance_ctrl_t const * const p_instance_ctrl );
208
208
static void ether_configure_padding (ether_instance_ctrl_t * const p_instance_ctrl );
@@ -346,14 +346,14 @@ fsp_err_t R_ETHER_Open (ether_ctrl_t * const p_ctrl, ether_cfg_t const * const p
346
346
p_instance_ctrl -> p_context = p_cfg -> p_context ;
347
347
p_instance_ctrl -> p_callback_memory = NULL ;
348
348
349
- R_BSP_MODULE_START (FSP_IP_ETHER , p_instance_ctrl -> p_ether_cfg -> channel );
350
349
351
350
/* Software reset */
352
351
ether_reset_mac (p_instance_ctrl -> p_reg_edmac );
353
352
354
353
/* Setting the padding function */
355
354
ether_configure_padding (p_instance_ctrl );
356
355
356
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
357
357
/* Software reset the PHY */
358
358
phy_ret = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> open (
359
359
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl ,
@@ -369,11 +369,16 @@ fsp_err_t R_ETHER_Open (ether_ctrl_t * const p_ctrl, ether_cfg_t const * const p
369
369
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_cfg );
370
370
}
371
371
#endif
372
+ #else
373
+ phy_ret = FSP_SUCCESS ;
374
+ #endif
372
375
373
376
if (FSP_SUCCESS == phy_ret )
374
377
{
378
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
375
379
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> startAutoNegotiate (
376
380
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
381
+ #endif
377
382
378
383
/* Clear all ETHERC status BFR, PSRTO, LCHNG, MPD, ICD */
379
384
p_reg_etherc -> ECSR = ETHER_ETHERC_INTERRUPT_FACTOR_ALL ;
@@ -437,8 +442,10 @@ fsp_err_t R_ETHER_Close (ether_ctrl_t * const p_ctrl)
437
442
/* Disable Ethernet interrupt. */
438
443
ether_disable_icu (p_instance_ctrl );
439
444
445
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
440
446
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> close (
441
447
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
448
+ #endif
442
449
443
450
p_reg_etherc -> ECSIPR_b .LCHNGIP = 0 ;
444
451
p_reg_edmac -> EESIPR_b .ECIIP = 0 ;
@@ -1367,7 +1374,7 @@ static void ether_init_descriptors (ether_instance_ctrl_t * const p_instance_ctr
1367
1374
* ETHERC control block.
1368
1375
* Return Value : none
1369
1376
***********************************************************************************************************************/
1370
- static void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl )
1377
+ void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl )
1371
1378
{
1372
1379
uint32_t i ;
1373
1380
uint32_t buffer_num ;
@@ -1586,7 +1593,7 @@ static void ether_pause_resolution (uint32_t const local_ability,
1586
1593
* USE_MAGIC_PACKET_DETECT (1) - Magic packet detection mode
1587
1594
* Return Value : none
1588
1595
***********************************************************************************************************************/
1589
- static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
1596
+ void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
1590
1597
const uint8_t mac_addr [],
1591
1598
const uint8_t mode )
1592
1599
{
@@ -1642,7 +1649,7 @@ static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl,
1642
1649
* or result of Auto-negotiation is abnormal.
1643
1650
*
1644
1651
***********************************************************************************************************************/
1645
- static fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode )
1652
+ fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode )
1646
1653
{
1647
1654
fsp_err_t err ;
1648
1655
R_ETHERC0_Type * p_reg_etherc ;
@@ -1664,12 +1671,17 @@ static fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl, c
1664
1671
p_reg_etherc = (R_ETHERC0_Type * ) p_instance_ctrl -> p_reg_etherc ;
1665
1672
p_reg_edmac = (R_ETHERC_EDMAC_Type * ) p_instance_ctrl -> p_reg_edmac ;
1666
1673
1674
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
1667
1675
/* Set the link status */
1668
1676
link_result = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> linkPartnerAbilityGet (
1669
1677
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl ,
1670
1678
& link_speed_duplex ,
1671
1679
& local_pause_bits ,
1672
1680
& partner_pause_bits );
1681
+ #else
1682
+ link_result = FSP_SUCCESS ;
1683
+ link_speed_duplex = p_instance_ctrl -> link_speed_duplex ;
1684
+ #endif
1673
1685
1674
1686
if (FSP_SUCCESS == link_result )
1675
1687
{
@@ -1846,11 +1858,15 @@ static uint8_t ether_check_magic_packet_detection_bit (ether_instance_ctrl_t con
1846
1858
**********************************************************************************************************************/
1847
1859
static fsp_err_t ether_link_status_check (ether_instance_ctrl_t const * const p_instance_ctrl )
1848
1860
{
1849
- fsp_err_t err = FSP_SUCCESS ;
1861
+ fsp_err_t err ;
1850
1862
fsp_err_t link_status ;
1851
1863
1864
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
1852
1865
link_status = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> linkStatusGet (
1853
1866
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
1867
+ #else
1868
+ link_status = FSP_SUCCESS ;
1869
+ #endif
1854
1870
1855
1871
if (FSP_ERR_ETHER_PHY_ERROR_LINK == link_status )
1856
1872
{
0 commit comments