fix LwIP ethernetif_input function error and fix Lwip compile error for BOARD imxrt1176/ok1052-c/xidatong-arm32/xiwangtong-arm32

This commit is contained in:
Liu_Weichao
2023-07-19 10:41:57 +08:00
parent 02b676e910
commit 2626acd70c
14 changed files with 61 additions and 18 deletions
@@ -66,7 +66,7 @@
#include "netif/ethernet.h"
#include "enet_ethernetif.h"
#include "enet_ethernetif_priv.h"
#include <board.h>
#include "fsl_enet.h"
#include "fsl_phy.h"
#include "fsl_gpio.h"
@@ -92,6 +92,20 @@ void Time_Update_LwIP(void)
{
}
ethernetif_config_t enet_cfg = {
.phyAddress = BOARD_ENET0_PHY_ADDRESS,
.clockName = kCLOCK_CoreSysClk,
.macAddress = configMAC_ADDR,
#if defined(FSL_FEATURE_SOC_LPC_ENET_COUNT) && (FSL_FEATURE_SOC_LPC_ENET_COUNT > 0)
.non_dma_memory = non_dma_memory,
#endif /* FSL_FEATURE_SOC_LPC_ENET_COUNT */
};
void *ethernetif_config_enet_set(uint8_t enet_port)
{
return (void *)&enet_cfg;
}
void ethernetif_clk_init(void)
{
const clock_enet_pll_config_t config = {.enableClkOutput = true, .enableClkOutput25M = false, .loopDivider = 1};
@@ -113,7 +127,7 @@ void ethernetif_gpio_init(void)
GPIO_WritePinOutput(GPIO1, 3, 1);
}
void ETH_BSP_Config(void)
int ETH_BSP_Config(void)
{
static int flag = 0;
if(flag == 0)
@@ -122,6 +136,7 @@ void ETH_BSP_Config(void)
ethernetif_gpio_init();
flag = 1;
}
return 0;
}
void ethernetif_phy_init(struct ethernetif *ethernetif,
@@ -186,9 +201,10 @@ void ethernetif_phy_init(struct ethernetif *ethernetif,
* @param netif the lwip network interface structure for this ethernetif
*/
void ethernetif_input(struct netif *netif)
void ethernetif_input(void *netif_arg)
{
struct pbuf *p;
struct netif *netif = (struct netif *)netif_arg;
err_t ret = 0;
LWIP_ASSERT("netif != NULL", (netif != NULL));
@@ -21,11 +21,13 @@
#ifndef __CONNECT_ETHERNET_H_
#define __CONNECT_ETHERNET_H_
#include "enet_ethernetif.h"
#include "enet_ethernetif_priv.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef sourceClock
#define sourceClock CLOCK_GetFreq(kCLOCK_CoreSysClk)
#endif
@@ -179,12 +179,14 @@ err_t ethernetif1_init(struct netif *netif);
*
* @param netif the lwip network interface structure for this ethernetif
*/
void ethernetif_input( struct netif *netif);
void ETH_BSP_Config(void);
void ethernetif_input( void *netif_arg);
int ETH_BSP_Config(void);
void *ethernetif_config_enet_set(uint8_t enet_port);
int32 lwip_obtain_semaphore(struct netif *netif);
#define NETIF_ENET0_INIT_FUNC ethernetif0_init
#if defined(__cplusplus)
}
#endif /* __cplusplus */