@@ -161,7 +161,7 @@ static void ether_enable_icu(ether_instance_ctrl_t * const p_instance_ctrl)
161
161
static void ether_disable_icu (ether_instance_ctrl_t * const p_instance_ctrl );
162
162
static void ether_reset_mac (R_ETHERC_EDMAC_Type * const p_reg );
163
163
static void ether_init_descriptors (ether_instance_ctrl_t * const p_instance_ctrl );
164
- static void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl );
164
+ void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl );
165
165
static fsp_err_t ether_buffer_get (ether_instance_ctrl_t * const p_instance_ctrl ,
166
166
void * * const p_buffer ,
167
167
uint32_t * p_buffer_size );
@@ -170,10 +170,10 @@ static void ether_pause_resolution(uint32_t const local_ability,
170
170
uint32_t const partner_ability ,
171
171
uint32_t * ptx_pause ,
172
172
uint32_t * prx_pause );
173
- static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
173
+ void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
174
174
const uint8_t mac_addr [],
175
175
const uint8_t mode );
176
- static fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode );
176
+ fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode );
177
177
static fsp_err_t ether_link_status_check (ether_instance_ctrl_t const * const p_instance_ctrl );
178
178
static uint8_t ether_check_magic_packet_detection_bit (ether_instance_ctrl_t const * const p_instance_ctrl );
179
179
static void ether_configure_padding (ether_instance_ctrl_t * const p_instance_ctrl );
@@ -307,14 +307,14 @@ fsp_err_t R_ETHER_Open (ether_ctrl_t * const p_ctrl, ether_cfg_t const * const p
307
307
p_instance_ctrl -> p_context = p_cfg -> p_context ;
308
308
p_instance_ctrl -> p_callback_memory = NULL ;
309
309
310
- R_BSP_MODULE_START (FSP_IP_ETHER , p_instance_ctrl -> p_ether_cfg -> channel );
311
310
312
311
/* Software reset */
313
312
ether_reset_mac (p_instance_ctrl -> p_reg_edmac );
314
313
315
314
/* Setting the padding function */
316
315
ether_configure_padding (p_instance_ctrl );
317
316
317
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
318
318
/* Software reset the PHY */
319
319
phy_ret = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> open (
320
320
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl ,
@@ -330,11 +330,16 @@ fsp_err_t R_ETHER_Open (ether_ctrl_t * const p_ctrl, ether_cfg_t const * const p
330
330
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_cfg );
331
331
}
332
332
#endif
333
+ #else
334
+ phy_ret = FSP_SUCCESS ;
335
+ #endif
333
336
334
337
if (FSP_SUCCESS == phy_ret )
335
338
{
339
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
336
340
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> startAutoNegotiate (
337
341
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
342
+ #endif
338
343
339
344
/* Clear all ETHERC status BFR, PSRTO, LCHNG, MPD, ICD */
340
345
p_reg_etherc -> ECSR = ETHER_ETHERC_INTERRUPT_FACTOR_ALL ;
@@ -398,8 +403,10 @@ fsp_err_t R_ETHER_Close (ether_ctrl_t * const p_ctrl)
398
403
/* Disable Ethernet interrupt. */
399
404
ether_disable_icu (p_instance_ctrl );
400
405
406
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
401
407
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> close (
402
408
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
409
+ #endif
403
410
404
411
p_reg_etherc -> ECSIPR_b .LCHNGIP = 0 ;
405
412
p_reg_edmac -> EESIPR_b .ECIIP = 0 ;
@@ -1328,7 +1335,7 @@ static void ether_init_descriptors (ether_instance_ctrl_t * const p_instance_ctr
1328
1335
* ETHERC control block.
1329
1336
* Return Value : none
1330
1337
***********************************************************************************************************************/
1331
- static void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl )
1338
+ void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl )
1332
1339
{
1333
1340
uint32_t i ;
1334
1341
uint32_t buffer_num ;
@@ -1547,7 +1554,7 @@ static void ether_pause_resolution (uint32_t const local_ability,
1547
1554
* USE_MAGIC_PACKET_DETECT (1) - Magic packet detection mode
1548
1555
* Return Value : none
1549
1556
***********************************************************************************************************************/
1550
- static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
1557
+ void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
1551
1558
const uint8_t mac_addr [],
1552
1559
const uint8_t mode )
1553
1560
{
@@ -1603,7 +1610,7 @@ static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl,
1603
1610
* or result of Auto-negotiation is abnormal.
1604
1611
*
1605
1612
***********************************************************************************************************************/
1606
- static fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode )
1613
+ fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode )
1607
1614
{
1608
1615
fsp_err_t err ;
1609
1616
R_ETHERC0_Type * p_reg_etherc ;
@@ -1625,12 +1632,17 @@ static fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl, c
1625
1632
p_reg_etherc = (R_ETHERC0_Type * ) p_instance_ctrl -> p_reg_etherc ;
1626
1633
p_reg_edmac = (R_ETHERC_EDMAC_Type * ) p_instance_ctrl -> p_reg_edmac ;
1627
1634
1635
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
1628
1636
/* Set the link status */
1629
1637
link_result = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> linkPartnerAbilityGet (
1630
1638
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl ,
1631
1639
& link_speed_duplex ,
1632
1640
& local_pause_bits ,
1633
1641
& partner_pause_bits );
1642
+ #else
1643
+ link_result = FSP_SUCCESS ;
1644
+ link_speed_duplex = p_instance_ctrl -> link_speed_duplex ;
1645
+ #endif
1634
1646
1635
1647
if (FSP_SUCCESS == link_result )
1636
1648
{
@@ -1807,11 +1819,15 @@ static uint8_t ether_check_magic_packet_detection_bit (ether_instance_ctrl_t con
1807
1819
**********************************************************************************************************************/
1808
1820
static fsp_err_t ether_link_status_check (ether_instance_ctrl_t const * const p_instance_ctrl )
1809
1821
{
1810
- fsp_err_t err = FSP_SUCCESS ;
1822
+ fsp_err_t err ;
1811
1823
fsp_err_t link_status ;
1812
1824
1825
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
1813
1826
link_status = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> linkStatusGet (
1814
1827
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
1828
+ #else
1829
+ link_status = FSP_SUCCESS ;
1830
+ #endif
1815
1831
1816
1832
if (FSP_ERR_ETHER_PHY_ERROR_LINK == link_status )
1817
1833
{
0 commit comments