summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2016-12-13 11:42:17 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2016-12-13 11:42:17 (GMT)
commitd599c1f993a775e01e347a68ed2674f41a0fd9b1 (patch)
treec6de87dd133f9660a23c2dcca493804afc9c1cf4
parenteff2959c420c555d4dc5617fbb15cac12c0666fa (diff)
downloadbspam335x-d599c1f993a775e01e347a68ed2674f41a0fd9b1.zip
bspam335x-d599c1f993a775e01e347a68ed2674f41a0fd9b1.tar.gz
bspam335x-d599c1f993a775e01e347a68ed2674f41a0fd9b1.tar.bz2
Updated net card driver.
-rw-r--r--SylixOS/bsp/beaglebone/bspBeaglebone.c2
-rw-r--r--SylixOS/bsp/forlinx/bspForlinx.c8
-rw-r--r--SylixOS/driver/netif/am335x_cpsw.c170
-rw-r--r--SylixOS/driver/netif/am335x_cpsw.h8
-rw-r--r--SylixOS/driver/netif/cpswif.c49
-rw-r--r--SylixOS/driver/netif/cpswif.h5
-rw-r--r--SylixOS/driver/netif/cpswlib.h (renamed from SylixOS/driver/netif/lwiplib.h)73
7 files changed, 35 insertions, 280 deletions
diff --git a/SylixOS/bsp/beaglebone/bspBeaglebone.c b/SylixOS/bsp/beaglebone/bspBeaglebone.c
index 60aaed0..ef9b1e8 100644
--- a/SylixOS/bsp/beaglebone/bspBeaglebone.c
+++ b/SylixOS/bsp/beaglebone/bspBeaglebone.c
@@ -236,7 +236,7 @@ VOID bspNetifAttch (VOID)
netIfCfg.NETIFCFG_uiInterfaceMode = NETIF_GMII_MII_MODE;
netIfCfg.NETIFCFG_bInternalDelay = LW_TRUE;
- arm335xCpswNetIfAdd(&netIfCfg, mii1_pin_mux);
+ arm335xCpswNetDevAdd(&netIfCfg, mii1_pin_mux);
}
/*********************************************************************************************************
** 函数名称: bspDebugInit
diff --git a/SylixOS/bsp/forlinx/bspForlinx.c b/SylixOS/bsp/forlinx/bspForlinx.c
index 17fb5d6..edc081f 100644
--- a/SylixOS/bsp/forlinx/bspForlinx.c
+++ b/SylixOS/bsp/forlinx/bspForlinx.c
@@ -1008,11 +1008,11 @@ VOID bspNetifAttch (VOID)
#if defined(ok335xd) || defined(ok335xs)
netIfCfg.NETIFCFG_uiInterfaceMode = NETIF_RGMII_MODE;
netIfCfg.NETIFCFG_bInternalDelay = LW_FALSE;
- arm335xCpswNetIfAdd(&netIfCfg, rgmii1_pin_mux);
+ arm335xCpswNetDevAdd(&netIfCfg, rgmii1_pin_mux);
#elif defined(ok335xs2)
netIfCfg.NETIFCFG_uiInterfaceMode = NETIF_RMII_MODE;
netIfCfg.NETIFCFG_bInternalDelay = LW_FALSE;
- arm335xCpswNetIfAdd(&netIfCfg, rmii1_pin_mux);
+ arm335xCpswNetDevAdd(&netIfCfg, rmii1_pin_mux);
#endif
#if defined(ok335xs)
@@ -1032,13 +1032,13 @@ VOID bspNetifAttch (VOID)
netIfCfg.NETIFCFG_bInternalDelay = LW_FALSE;
netIfCfg.NETIFCFG_uiInterfaceMode = NETIF_RGMII_MODE;
- arm335xCpswNetIfAdd(&netIfCfg, rgmii2_pin_mux);
+ arm335xCpswNetDevAdd(&netIfCfg, rgmii2_pin_mux);
#elif defined(CPSW_SWITCH_CONFIG)
netIfCfg.NETIFCFG_uiInstNum = 0;
netIfCfg.NETIFCFG_uiSlavePortNum = 2;
netIfCfg.NETIFCFG_bInternalDelay = LW_FALSE;
netIfCfg.NETIFCFG_uiInterfaceMode = NETIF_RGMII_MODE;
- arm335xCpswSwitchIfAdd(&netIfCfg, rgmii2_pin_mux);
+ arm335xCpswSwitchAdd(&netIfCfg, rgmii2_pin_mux);
#endif
#endif
}
diff --git a/SylixOS/driver/netif/am335x_cpsw.c b/SylixOS/driver/netif/am335x_cpsw.c
index 4fc17bb..24c3469 100644
--- a/SylixOS/driver/netif/am335x_cpsw.c
+++ b/SylixOS/driver/netif/am335x_cpsw.c
@@ -28,7 +28,7 @@ Debug:
#include "../am335x_common.h"
#include "cpswif.h"
-#include "lwiplib.h"
+#include "cpswlib.h"
#include "am335x_cpsw.h"
#include "debug.h"
/*********************************************************************************************************
@@ -50,6 +50,7 @@ static INT __am335xCpswTx(struct netdev *pNetdev, struct pbuf *pbuf);
宏定义
*********************************************************************************************************/
#define CPSW_IF_NAME "cpsw0"
+#define CPSW_LINKUP (0x01)
/*********************************************************************************************************
全局变量
*********************************************************************************************************/
@@ -74,7 +75,6 @@ __AM335X_CPSW_CONTROLER _G_am335xCpswControlers[MAX_CPSW_INST] = {
.CPSWC_uiMiscIntPriority = BSP_CFG_NETIF_MISC_INT_PRIO,
}
};
-
/*********************************************************************************************************
The lwIP network interface structure for CPSW ports.
*********************************************************************************************************/
@@ -116,98 +116,8 @@ extern err_t cpswif_autoneg_config(u32_t inst_num,
u32_t port_num,
UINT32 *puiSpeed);
/*********************************************************************************************************
- 网络工作队列
-*********************************************************************************************************/
-static LW_JOB_QUEUE _G_am335xTxNetJobQ;
-static LW_JOB_MSG _G_am335xTxNetJobMsgs[LW_CFG_LWIP_JOBQUEUE_SIZE];
-/*********************************************************************************************************
INTERNAL FUNC
*********************************************************************************************************/
-static VOID __am335xTxNetJobThread(VOID); /* 作业处理程序 */
-/*********************************************************************************************************
-** 函数名称: __am335xTxNetJobqueueInit
-** 功能描述: 初始化 Net jobqueue 处理 机制
-** 输 入 : NONE
-** 输 出 : 是否初始化成功
-** 全局变量:
-** 调用模块:
-*********************************************************************************************************/
-static INT __am335xTxNetJobqueueInit (VOID)
-{
- LW_OBJECT_HANDLE hNetJobThread;
- LW_CLASS_THREADATTR threadattr;
-
- if (_jobQueueInit(&_G_am335xTxNetJobQ,
- &_G_am335xTxNetJobMsgs[0], LW_CFG_LWIP_JOBQUEUE_SIZE, LW_FALSE)) {
- return (PX_ERROR);
- }
-
- API_ThreadAttrBuild(&threadattr,
- LW_CFG_LWIP_STK_SIZE,
- LW_PRIO_T_NETJOB,
- (LW_OPTION_THREAD_STK_CHK | LW_OPTION_THREAD_SAFE | LW_OPTION_OBJECT_GLOBAL),
- LW_NULL);
-
- hNetJobThread = API_ThreadCreate("t_txnetjob",
- (PTHREAD_START_ROUTINE)__am335xTxNetJobThread,
- (PLW_CLASS_THREADATTR)&threadattr,
- LW_NULL); /* 建立 job 处理线程 */
- if (!hNetJobThread) {
- _jobQueueFinit(&_G_am335xTxNetJobQ);
- return (PX_ERROR);
- }
-
- return (ERROR_NONE);
-}
-/*********************************************************************************************************
-** 函数名称: __am335xTxNetJobAdd
-** 功能描述: 加入网络异步处理作业队列
-** 输 入 : pfunc 函数指针
-** pvArg0 函数参数
-** pvArg1 函数参数
-** pvArg2 函数参数
-** pvArg3 函数参数
-** pvArg4 函数参数
-** pvArg5 函数参数
-** 输 出 : 操作是否成功
-** 全局变量:
-** 调用模块:
- API 函数
-*********************************************************************************************************/
-static INT __am335xTxNetJobAdd (VOIDFUNCPTR pfunc,
- PVOID pvArg0,
- PVOID pvArg1,
- PVOID pvArg2,
- PVOID pvArg3,
- PVOID pvArg4,
- PVOID pvArg5)
-{
- if (!pfunc) {
- _ErrorHandle(EINVAL);
- return (PX_ERROR);
- }
-
- if (_jobQueueAdd(&_G_am335xTxNetJobQ, pfunc, pvArg0, pvArg1, pvArg2, pvArg3, pvArg4, pvArg5)) {
- _ErrorHandle(ERROR_EXCE_LOST);
- return (PX_ERROR);
- }
-
- return (ERROR_NONE);
-}
-/*********************************************************************************************************
-** 函数名称: _NetJobThread
-** 功能描述: 网络工作队列处理线程
-** 输 入 : NONE
-** 输 出 : NONE
-** 全局变量:
-** 调用模块:
-*********************************************************************************************************/
-static VOID __am335xTxNetJobThread (VOID)
-{
- for (;;) {
- _jobQueueExec(&_G_am335xTxNetJobQ, LW_OPTION_WAIT_INFINITE);
- }
-}
/*********************************************************************************************************
** 函数名称: __am335xCpswTx
** 功能描述: CPSW 发送
@@ -219,7 +129,7 @@ static VOID __am335xTxNetJobThread (VOID)
*********************************************************************************************************/
static INT __am335xCpswTx(struct netdev *pNetdev, struct pbuf *pbuf)
{
- return cpswif_output(pNetdev, pbuf);
+ return (cpswif_output(pNetdev, pbuf));
}
/*********************************************************************************************************
** 函数名称: __am335xCpswRx
@@ -280,7 +190,7 @@ static irqreturn_t __am335xCpswTxIsr (PVOID pvArg, ULONG ulVector)
{
API_InterVectorDisable(ulVector);
- __am335xTxNetJobAdd((VOIDFUNCPTR)__am335xCpswTxJob, 0, 0, 0, 0, 0, 0);
+ netJobAdd(__am335xCpswTxJob, &_G_am335xCpswNetDev[0], 0, 0, 0, 0, 0);
return (LW_IRQ_HANDLED_DISV);
}
@@ -331,9 +241,9 @@ static VOID __am335xCpswLinkStatusCheck (struct netdev *pNetdev)
return;
}
- if (!(pCpswPortIf->flags & NETIF_FLAG_LINK_UP)) {
+ if (!(pCpswPortIf->flags & CPSW_LINKUP)) {
if (ERR_OK == cpswif_autoneg_config(uiInstNum, uiSlavePortNum, &uiSpeed)) {
- pCpswPortIf->flags |= NETIF_FLAG_LINK_UP;
+ pCpswPortIf->flags |= CPSW_LINKUP;
#ifdef CPSW_SWITCH_CONFIG
printk(KERN_ALERT "netif %c%c%d port %d link up\n",
pNetdev->if_name[0], pNetdev->if_name[1], pCpswPortIf->inst_num + 1, uiSlavePortNum);
@@ -358,9 +268,9 @@ static VOID __am335xCpswLinkStatusCheck (struct netdev *pNetdev)
if (cpswif_link_status(uiInstNum, uiSlavePortNum)) {
return;
}
- if (pCpswPortIf->flags & NETIF_FLAG_LINK_UP) {
+ if (pCpswPortIf->flags & CPSW_LINKUP) {
- pCpswPortIf->flags &= ~NETIF_FLAG_LINK_UP;
+ pCpswPortIf->flags &= ~CPSW_LINKUP;
#ifdef CPSW_SWITCH_CONFIG
printk(KERN_ALERT "netif %c%c%d port %d link down\n",
@@ -383,25 +293,7 @@ static VOID __am335xCpswLinkStatusCheck (struct netdev *pNetdev)
}
}
/*********************************************************************************************************
-** 函数名称: __am335xCpswLinkStatusCheckThread
-** 功能描述: CPSW 连接状态检查线程
-** 输 入 : NONE
-** 输 出 : NONE
-** 全局变量:
-** 调用模块:
-*********************************************************************************************************/
-static PVOID __am335xCpswLinkStatusCheckThread (struct netdev *pNetdev)
-{
- while (1) {
- __am335xCpswLinkStatusCheck(pNetdev);
-
- API_TimeMSleep(250);
- }
-
- return (LW_NULL);
-}
-/*********************************************************************************************************
-** 函数名称: arm335xCpswNetIfAdd
+** 函数名称: arm335xCpswNetDevAdd
** 功能描述: 增加 CPSW 网络接口
** 输 入 : pNetIfCfg 网络接口配置
** pPinMux 管脚复用
@@ -409,13 +301,11 @@ static PVOID __am335xCpswLinkStatusCheckThread (struct netdev *pNetdev)
** 全局变量:
** 调用模块:
*********************************************************************************************************/
-INT arm335xCpswNetIfAdd (AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux)
+INT arm335xCpswNetDevAdd (AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux)
{
__PAM335X_CPSW_PORTIF pCpswPortIf;
UINT uiNetIfNum;
UINT32 uiValue;
- LW_OBJECT_HANDLE hThread;
- LW_CLASS_THREADATTR threadAttr;
struct netdev *pNetdev;
INT i;
CHAR cDevName[10] = CPSW_IF_NAME;
@@ -503,26 +393,12 @@ INT arm335xCpswNetIfAdd (AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux)
return (PX_ERROR);
}
- threadAttr = API_ThreadAttrGetDefault();
-
- threadAttr.THREADATTR_ulOption |= LW_OPTION_OBJECT_GLOBAL;
- threadAttr.THREADATTR_pvArg = (PVOID)pNetdev;
- threadAttr.THREADATTR_ucPriority = LW_PRIO_LOW;
-
- hThread = API_ThreadCreate("t_cpsw",
- (PTHREAD_START_ROUTINE)__am335xCpswLinkStatusCheckThread,
- &threadAttr,
- LW_NULL);
- if (hThread == LW_OBJECT_HANDLE_INVALID) {
- printk(KERN_ERR "arm335xCpswNetIfAdd(): failed to create t_cpsw%d thread!\n",
- pNetIfCfg->NETIFCFG_uiSlavePortNum);
- return (PX_ERROR);
- }
+ netdev_linkup_poll_add(pNetdev, __am335xCpswLinkStatusCheck);
return (ERROR_NONE);
}
/*********************************************************************************************************
-** 函数名称: arm335xCpswSwitchIfAdd
+** 函数名称: arm335xCpswSwitchAdd
** 功能描述: 增加 CPSW 交换机接口
** 输 入 : pNetIfCfg 网络接口配置
** pPinMux 管脚复用
@@ -531,14 +407,12 @@ INT arm335xCpswNetIfAdd (AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux)
** 调用模块:
*********************************************************************************************************/
#ifdef CPSW_SWITCH_CONFIG
-INT arm335xCpswSwitchIfAdd (AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux)
+INT arm335xCpswSwitchAdd (AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux)
{
UINT32 uiValue;
struct netdev *pNetdev;
UINT uiNetIfNum;
__PAM335X_CPSW_PORTIF pCpswPortIf;
- LW_OBJECT_HANDLE hThread;
- LW_CLASS_THREADATTR threadAttr;
if (!pNetIfCfg ||
pNetIfCfg->NETIFCFG_uiInstNum >= MAX_CPSW_INST ||
@@ -579,21 +453,7 @@ INT arm335xCpswSwitchIfAdd (AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinM
pCpswPortIf->inst_num = pNetIfCfg->NETIFCFG_uiInstNum;
pCpswPortIf->port_num = pNetIfCfg->NETIFCFG_uiSlavePortNum;
- threadAttr = API_ThreadAttrGetDefault();
-
- threadAttr.THREADATTR_ulOption |= LW_OPTION_OBJECT_GLOBAL;
- threadAttr.THREADATTR_pvArg = (PVOID)pNetdev;
- threadAttr.THREADATTR_ucPriority = LW_PRIO_LOW;
-
- hThread = API_ThreadCreate("t_cpsw",
- (PTHREAD_START_ROUTINE)__am335xCpswLinkStatusCheckThread,
- &threadAttr,
- LW_NULL);
- if (hThread == LW_OBJECT_HANDLE_INVALID) {
- printk(KERN_ERR "arm335xCpswNetIfAdd(): failed to create t_cpsw%d thread!\n",
- pNetIfCfg->NETIFCFG_uiSlavePortNum);
- return (PX_ERROR);
- }
+ netdev_linkup_poll_add(pNetdev, __am335xCpswLinkStatusCheck);
return (ERROR_NONE);
}
@@ -642,8 +502,6 @@ INT arm335xCpswInit (VOID)
if (!pCpswControler->CPSWC_bIsInit) {
- __am335xTxNetJobqueueInit();
-
am335xEnableModule(am335xModuleIdGet("CPGMAC0"));
pCpswControler->CPSWC_ulCpswSsVirtAddrBase = (addr_t)API_VmmIoRemapNocache(
diff --git a/SylixOS/driver/netif/am335x_cpsw.h b/SylixOS/driver/netif/am335x_cpsw.h
index 9928f7d..8faf808 100644
--- a/SylixOS/driver/netif/am335x_cpsw.h
+++ b/SylixOS/driver/netif/am335x_cpsw.h
@@ -62,7 +62,7 @@ INT arm335xCpswInit(VOID);
*********************************************************************************************************/
INT arm335xCpswMacAddrGet(UINT uiMacId, UCHAR *pucMacAddr);
/*********************************************************************************************************
-** 函数名称: arm335xCpswNetIfAdd
+** 函数名称: arm335xCpswNetDevAdd
** 功能描述: 增加 CPSW 网络接口
** 输 入 : pNetIfCfg 网络接口配置
** pPinMux 管脚复用
@@ -70,9 +70,9 @@ INT arm335xCpswMacAddrGet(UINT uiMacId, UCHAR *pucMacAddr);
** 全局变量:
** 调用模块:
*********************************************************************************************************/
-INT arm335xCpswNetIfAdd(AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux);
+INT arm335xCpswNetDevAdd(AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux);
/*********************************************************************************************************
-** 函数名称: arm335xCpswSwitchIfAdd
+** 函数名称: arm335xCpswSwitchAdd
** 功能描述: 增加 CPSW 交换机接口
** 输 入 : pNetIfCfg 网络接口配置
** pPinMux 管脚复用
@@ -81,7 +81,7 @@ INT arm335xCpswNetIfAdd(AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux);
** 调用模块:
*********************************************************************************************************/
#ifdef CPSW_SWITCH_CONFIG
-INT arm335xCpswSwitchIfAdd(AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux);
+INT arm335xCpswSwitchAdd(AM335X_NETIF_CFG *pNetIfCfg, PAM335X_PINMUX pPinMux);
#endif
#endif /* AM335X_CPSW_H_ */
diff --git a/SylixOS/driver/netif/cpswif.c b/SylixOS/driver/netif/cpswif.c
index 099d8cb..7294b39 100644
--- a/SylixOS/driver/netif/cpswif.c
+++ b/SylixOS/driver/netif/cpswif.c
@@ -42,44 +42,20 @@
* This file is dervied from the "ethernetif.c" skeleton Ethernet network
* interface driver for lwIP.
*/
-#ifndef SYLIXOS
-#include "src/include/lwip/opt.h"
-#include "src/include/lwip/def.h"
-#include "src/include/lwip/mem.h"
-#include "src/include/lwip/pbuf.h"
-#include "src/include/lwip/sys.h"
-#include "src/include/lwip/stats.h"
-#include "src/include/lwip/snmp.h"
-#include "src/include/netif/etharp.h"
-#include "src/include/netif/ppp_oe.h"
-#include "src/include/lwip/err.h"
-#include "ports/cpsw/include/netif/cpswif.h"
-#include "ports/cpsw/include/arch/cc.h"
-#else
#define __SYLIXOS_KERNEL
#include "config.h"
#include "SylixOS.h"
#include "netdev.h"
-#include "network/lwip/opt.h"
-#include "network/lwip/def.h"
-#include "network/lwip/mem.h"
-#include "network/lwip/pbuf.h"
-#include "network/lwip/sys.h"
-#include "network/lwip/stats.h"
-#include "network/lwip/snmp.h"
-#include "network/lwip/err.h"
#include "cpswif.h"
-#include "lwiplib.h"
-#include "network/lwip/ethip6.h"
-#include "pthread.h"
+#include "cpswlib.h"
#include "debug.h"
+
#define SIZEOF_STRUCT_PBUF LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf))
/*
* The below macro should be defined for using lwIP with cache.
*/
#define LWIP_CACHE_ENABLED 1
-#endif
#if defined(CPSW0_PORT_1_PHY_ADDR) || defined(CPSW0_PORT_2_PHY_ADDR)
#define CPSW_PHY_MDIO_EN 1
@@ -2459,7 +2435,6 @@ cpswif_rx_inthandler(u32_t inst_num, struct netdev *pnetdev, int (*input)(struct
volatile struct pbuf *pbuf;
u32_t tot_len;
u32_t if_num;
- INT i = 0;
#ifdef CPSW_DUAL_MAC_MODE
u32_t from_port;
@@ -2505,31 +2480,15 @@ cpswif_rx_inthandler(u32_t inst_num, struct netdev *pnetdev, int (*input)(struct
pbuf->len = (u16_t)(tot_len);
pbuf->tot_len = (u16_t)(tot_len);
-
-
- netif_debug("\r\n");
- for (i = 0; i < tot_len;) {
- netif_debug("%02x ", ((unsigned char*)pbuf->payload)[i]);
- i++;
- if (!(i % 8)) {
- if (!(i % 16)) {
- netif_debug("\r\n");
- } else {
- netif_debug(" ");
- }
- }
- }
- netif_debug("\r\n");
-
curr_bd->flags_pktlen = CPDMA_BUF_DESC_OWNER;
/* Adjust the link statistics */
- netdev_linkinfo_recv_inc(pnetdev + if_num);
#ifdef CPSW_DUAL_MAC_MODE
if_num = (inst_num * MAX_SLAVEPORT_PER_INST) + from_port - 1;
#else
if_num = inst_num;
#endif
+ netdev_linkinfo_recv_inc(pnetdev + if_num);
#ifdef SYLIXOS
netdev_statinfo_total_add(pnetdev + if_num, LINK_INPUT, tot_len);
netdev_statinfo_ucasts_inc(pnetdev + if_num, LINK_INPUT);
@@ -2709,7 +2668,7 @@ cpswif_tx_inthandler(u32_t inst_num, struct netdev *pnetdev) {
API_SemaphoreBPost(cpswinst->txlock);
#endif
}
-
+
#if CPSW_PHY_MDIO_EN > 0
/**
diff --git a/SylixOS/driver/netif/cpswif.h b/SylixOS/driver/netif/cpswif.h
index e1bf353..8644b29 100644
--- a/SylixOS/driver/netif/cpswif.h
+++ b/SylixOS/driver/netif/cpswif.h
@@ -40,11 +40,6 @@
* Copyright (c) 2010 Texas Instruments Incorporated
*
*/
-#ifndef SYLIXOS
-#include "src/include/lwip/netif.h"
-#else
-#include "config.h"
-#endif
#ifndef __CPSWIF_H__
#define __CPSWIF_H__
diff --git a/SylixOS/driver/netif/lwiplib.h b/SylixOS/driver/netif/cpswlib.h
index 13ceadd..566c3fa 100644
--- a/SylixOS/driver/netif/lwiplib.h
+++ b/SylixOS/driver/netif/cpswlib.h
@@ -1,5 +1,5 @@
/**
-* \file lwiplib.h
+* \file cpswlib.h
*
* \brief lwip abstraction layer related declarations
*/
@@ -38,39 +38,8 @@
/* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*/
-#ifndef __LWIPLIB_H__
-#define __LWIPLIB_H__
-
-#ifndef SYLIXOS
-#include "src/include/lwip/opt.h"
-#else
-#include "config.h"
-#include "network/lwip/opt.h"
-#endif
-
-/* Ensure that AUTOIP COOP option is configured correctly.*/
-#undef LWIP_DHCP_AUTOIP_COOP
-#define LWIP_DHCP_AUTOIP_COOP ((LWIP_DHCP) && (LWIP_AUTOIP))
-
-#ifndef SYLIXOS
-#include "src/include/lwip/api.h"
-#include "src/include/lwip/netifapi.h"
-#include "src/include/lwip/tcp.h"
-#include "src/include/lwip/udp.h"
-#include "src/include/lwip/tcpip.h"
-#include "src/include/lwip/sockets.h"
-#include "src/include/lwip/mem.h"
-#include "src/include/lwip/stats.h"
-#else
-#include "network/lwip/api.h"
-#include "network/lwip/netifapi.h"
-#include "network/lwip/tcp.h"
-#include "network/lwip/udp.h"
-#include "network/lwip/tcpip.h"
-#include "network/lwip/sockets.h"
-#include "network/lwip/mem.h"
-#include "network/lwip/stats.h"
-#endif
+#ifndef __CPSWLIB_H
+#define __CPSWLIB_H
/******************************************************************************
** Macro Definitions
@@ -79,6 +48,10 @@
#define IPADDR_USE_DHCP (1)
#define IPADDR_USE_AUTOIP (2)
+#ifndef ETHARP_HWADDR_LEN
+#define ETHARP_HWADDR_LEN (6)
+#endif
+
#ifndef LEN_MAC_ADDRESS
#define LEN_MAC_ADDRESS (6)
#endif
@@ -272,34 +245,4 @@ typedef struct cpsw_config {
#endif
s32_t ret; /* Return Success/Failure */
}CPSW_CONF_IF;
-
-typedef struct lwipIf
-{
- unsigned int instNum; /* Instance Number */
- unsigned int slvPortNum; /* CPSW Slave Port Number */
- unsigned int ipAddr; /* IP Address */
- unsigned int netMask; /* Net Mask */
- unsigned int gwAddr; /* Gate Way Address */
- unsigned int ipMode; /* IP Address mode
- IPADDR_USE_STATIC - force static IP
- addressing to be used \n
- IPADDR_USE_DHCP - force DHCP with fallback
- to Link Local \n
- IPADDR_USE_AUTOIP */
- unsigned char macArray[LEN_MAC_ADDRESS]; /* MAC Address to be used*/
-}LWIP_IF;
-
-/******************************************************************************
-** lwIP Abstraction Layer API
-******************************************************************************/
-extern unsigned int lwIPLinkStatusGet(unsigned int instNum,
- unsigned int slvPortNum);
-extern unsigned int lwIPNetIfStatusGet(unsigned int instNum,
- unsigned int slvPortNum);
-extern unsigned int lwIPInit(LWIP_IF *lwipIf);
-extern void lwIPRxIntHandler(unsigned int instNum);
-extern void lwIPTxIntHandler(unsigned int instNum);
-extern unsigned int lwIPDHCPStart(unsigned int instNum,
- unsigned int slvPortNum);
-extern void cpsw_switch_configuration(struct cpsw_config *cpsw_config);
-#endif /* __LWIPLIB_H__ */
+#endif /* __CPSWLIB_H */