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