@@ -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 );
@@ -350,14 +350,14 @@ fsp_err_t R_ETHER_Open (ether_ctrl_t * const p_ctrl, ether_cfg_t const * const p
350
350
p_instance_ctrl -> p_context = p_cfg -> p_context ;
351
351
p_instance_ctrl -> p_callback_memory = NULL ;
352
352
353
- R_BSP_MODULE_START (FSP_IP_ETHER , p_instance_ctrl -> p_ether_cfg -> channel );
354
353
355
354
/* Software reset */
356
355
ether_reset_mac (p_instance_ctrl -> p_reg_edmac );
357
356
358
357
/* Setting the padding function */
359
358
ether_configure_padding (p_instance_ctrl );
360
359
360
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
361
361
/* Software reset the PHY */
362
362
phy_ret = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> open (
363
363
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl ,
@@ -373,11 +373,16 @@ fsp_err_t R_ETHER_Open (ether_ctrl_t * const p_ctrl, ether_cfg_t const * const p
373
373
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_cfg );
374
374
}
375
375
#endif
376
+ #else
377
+ phy_ret = FSP_SUCCESS ;
378
+ #endif
376
379
377
380
if (FSP_SUCCESS == phy_ret )
378
381
{
382
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
379
383
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> startAutoNegotiate (
380
384
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
385
+ #endif
381
386
382
387
/* Clear all ETHERC status BFR, PSRTO, LCHNG, MPD, ICD */
383
388
p_reg_etherc -> ECSR = ETHER_ETHERC_INTERRUPT_FACTOR_ALL ;
@@ -441,8 +446,10 @@ fsp_err_t R_ETHER_Close (ether_ctrl_t * const p_ctrl)
441
446
/* Disable Ethernet interrupt. */
442
447
ether_disable_icu (p_instance_ctrl );
443
448
449
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
444
450
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> close (
445
451
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
452
+ #endif
446
453
447
454
p_reg_etherc -> ECSIPR_b .LCHNGIP = 0 ;
448
455
p_reg_edmac -> EESIPR_b .ECIIP = 0 ;
@@ -1371,7 +1378,7 @@ static void ether_init_descriptors (ether_instance_ctrl_t * const p_instance_ctr
1371
1378
* ETHERC control block.
1372
1379
* Return Value : none
1373
1380
***********************************************************************************************************************/
1374
- static void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl )
1381
+ void ether_init_buffers (ether_instance_ctrl_t * const p_instance_ctrl )
1375
1382
{
1376
1383
uint32_t i ;
1377
1384
uint32_t buffer_num ;
@@ -1590,7 +1597,7 @@ static void ether_pause_resolution (uint32_t const local_ability,
1590
1597
* USE_MAGIC_PACKET_DETECT (1) - Magic packet detection mode
1591
1598
* Return Value : none
1592
1599
***********************************************************************************************************************/
1593
- static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
1600
+ void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl ,
1594
1601
const uint8_t mac_addr [],
1595
1602
const uint8_t mode )
1596
1603
{
@@ -1646,7 +1653,7 @@ static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl,
1646
1653
* or result of Auto-negotiation is abnormal.
1647
1654
*
1648
1655
***********************************************************************************************************************/
1649
- static fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode )
1656
+ fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl , const uint8_t mode )
1650
1657
{
1651
1658
fsp_err_t err ;
1652
1659
R_ETHERC0_Type * p_reg_etherc ;
@@ -1668,12 +1675,17 @@ static fsp_err_t ether_do_link (ether_instance_ctrl_t * const p_instance_ctrl, c
1668
1675
p_reg_etherc = (R_ETHERC0_Type * ) p_instance_ctrl -> p_reg_etherc ;
1669
1676
p_reg_edmac = (R_ETHERC_EDMAC_Type * ) p_instance_ctrl -> p_reg_edmac ;
1670
1677
1678
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
1671
1679
/* Set the link status */
1672
1680
link_result = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> linkPartnerAbilityGet (
1673
1681
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl ,
1674
1682
& link_speed_duplex ,
1675
1683
& local_pause_bits ,
1676
1684
& partner_pause_bits );
1685
+ #else
1686
+ link_result = FSP_SUCCESS ;
1687
+ link_speed_duplex = p_instance_ctrl -> link_speed_duplex ;
1688
+ #endif
1677
1689
1678
1690
if (FSP_SUCCESS == link_result )
1679
1691
{
@@ -1850,11 +1862,15 @@ static uint8_t ether_check_magic_packet_detection_bit (ether_instance_ctrl_t con
1850
1862
**********************************************************************************************************************/
1851
1863
static fsp_err_t ether_link_status_check (ether_instance_ctrl_t const * const p_instance_ctrl )
1852
1864
{
1853
- fsp_err_t err = FSP_SUCCESS ;
1865
+ fsp_err_t err ;
1854
1866
fsp_err_t link_status ;
1855
1867
1868
+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
1856
1869
link_status = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> linkStatusGet (
1857
1870
p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
1871
+ #else
1872
+ link_status = FSP_SUCCESS ;
1873
+ #endif
1858
1874
1859
1875
if (FSP_ERR_ETHER_PHY_ERROR_LINK == link_status )
1860
1876
{
0 commit comments