@@ -190,7 +190,7 @@ static void ether_enable_icu(ether_instance_ctrl_t * const p_instance_ctrl)
190190static void ether_disable_icu (ether_instance_ctrl_t * const p_instance_ctrl );
191191static void ether_reset_mac (R_ETHERC_EDMAC_Type * const p_reg );
192192static 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 );
194194static fsp_err_t ether_buffer_get (ether_instance_ctrl_t * const p_instance_ctrl ,
195195 void * * const p_buffer ,
196196 uint32_t * p_buffer_size );
@@ -199,10 +199,10 @@ static void ether_pause_resolution(uint32_t const local_ability,
199199 uint32_t const partner_ability ,
200200 uint32_t * ptx_pause ,
201201 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 ,
203203 const uint8_t mac_addr [],
204204 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 );
206206static fsp_err_t ether_link_status_check (ether_instance_ctrl_t const * const p_instance_ctrl );
207207static uint8_t ether_check_magic_packet_detection_bit (ether_instance_ctrl_t const * const p_instance_ctrl );
208208static 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
346346 p_instance_ctrl -> p_context = p_cfg -> p_context ;
347347 p_instance_ctrl -> p_callback_memory = NULL ;
348348
349- R_BSP_MODULE_START (FSP_IP_ETHER , p_instance_ctrl -> p_ether_cfg -> channel );
350-
351349 /* Software reset */
352350 ether_reset_mac (p_instance_ctrl -> p_reg_edmac );
353351
354352 /* Setting the padding function */
355353 ether_configure_padding (p_instance_ctrl );
356354
355+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
357356 /* Software reset the PHY */
358357 phy_ret = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> open (
359358 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
369368 p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_cfg );
370369 }
371370#endif
371+ #else
372+ phy_ret = FSP_SUCCESS ;
373+ #endif
372374
373375 if (FSP_SUCCESS == phy_ret )
374376 {
377+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
375378 p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> startAutoNegotiate (
376379 p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
380+ #endif
377381
378382 /* Clear all ETHERC status BFR, PSRTO, LCHNG, MPD, ICD */
379383 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)
437441 /* Disable Ethernet interrupt. */
438442 ether_disable_icu (p_instance_ctrl );
439443
444+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
440445 p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> close (
441446 p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
447+ #endif
442448
443449 p_reg_etherc -> ECSIPR_b .LCHNGIP = 0 ;
444450 p_reg_edmac -> EESIPR_b .ECIIP = 0 ;
@@ -1367,7 +1373,7 @@ static void ether_init_descriptors (ether_instance_ctrl_t * const p_instance_ctr
13671373 * ETHERC control block.
13681374 * Return Value : none
13691375 ***********************************************************************************************************************/
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 )
13711377{
13721378 uint32_t i ;
13731379 uint32_t buffer_num ;
@@ -1586,7 +1592,7 @@ static void ether_pause_resolution (uint32_t const local_ability,
15861592 * USE_MAGIC_PACKET_DETECT (1) - Magic packet detection mode
15871593 * Return Value : none
15881594 ***********************************************************************************************************************/
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 ,
15901596 const uint8_t mac_addr [],
15911597 const uint8_t mode )
15921598{
@@ -1642,7 +1648,7 @@ static void ether_configure_mac (ether_instance_ctrl_t * const p_instance_ctrl,
16421648 * or result of Auto-negotiation is abnormal.
16431649 *
16441650 ***********************************************************************************************************************/
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 )
16461652{
16471653 fsp_err_t err ;
16481654 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
16641670 p_reg_etherc = (R_ETHERC0_Type * ) p_instance_ctrl -> p_reg_etherc ;
16651671 p_reg_edmac = (R_ETHERC_EDMAC_Type * ) p_instance_ctrl -> p_reg_edmac ;
16661672
1673+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
16671674 /* Set the link status */
16681675 link_result = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> linkPartnerAbilityGet (
16691676 p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl ,
16701677 & link_speed_duplex ,
16711678 & local_pause_bits ,
16721679 & partner_pause_bits );
1680+ #else
1681+ link_result = FSP_SUCCESS ;
1682+ link_speed_duplex = p_instance_ctrl -> link_speed_duplex ;
1683+ #endif
16731684
16741685 if (FSP_SUCCESS == link_result )
16751686 {
@@ -1846,11 +1857,15 @@ static uint8_t ether_check_magic_packet_detection_bit (ether_instance_ctrl_t con
18461857 **********************************************************************************************************************/
18471858static fsp_err_t ether_link_status_check (ether_instance_ctrl_t const * const p_instance_ctrl )
18481859{
1849- fsp_err_t err = FSP_SUCCESS ;
1860+ fsp_err_t err ;
18501861 fsp_err_t link_status ;
18511862
1863+ #if !ETHER_CFG_USE_CUSTOM_PHY_DRIVER
18521864 link_status = p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_api -> linkStatusGet (
18531865 p_instance_ctrl -> p_ether_cfg -> p_ether_phy_instance -> p_ctrl );
1866+ #else
1867+ link_status = FSP_SUCCESS ;
1868+ #endif
18541869
18551870 if (FSP_ERR_ETHER_PHY_ERROR_LINK == link_status )
18561871 {
0 commit comments