LWIP network interface 网卡 初始化 以 STM32 为例子 后面会有 用 2G 或者4G 模块 用 PPP拨号的 形式 虚拟出网卡 所以先以 这个为 前提
LWIP network interface 网卡 初始化 以 STM32 为例子 后面会有 用 2G 或者4G 模块 用 PPP拨号的 形式 虚拟出网卡 所以先以 这个为 前提
LWIP 有 一个 结构体 是 描述 物理 接口 的 即 netif Struct, 大神朱工 对这个 有个 详细的 解释 :http://blog.csdn.net/zhzht19861011/article/details/6690534
LWIP 官网 对 这个 结构体 也有 详细 的 描述 :http://www.nongnu.org/lwip/2_0_x/structnetif.html

我 使用 的 代码 是 ST 官方 提供 的 演示例程 , 可以在 这里下载到 STM32F407 + DP83848
工程 打开路径 : C:\Users\admin\Desktop\STM32F4x7_ETH_LwIP_V1.1.0\Project\FreeRTOS\udptcp_echo_server_netconn\MDK-ARM
看看 ST 是怎么 定义 一个 网卡 变量 并 初始化的
首先看 定义 的 地方 :

然后 看看 对 这个变量 怎么 初始化 的 。。
/* - netif_add(struct netif *netif, struct ip_addr *ipaddr,
struct ip_addr *netmask, struct ip_addr *gw,
void *state, err_t (* init)(struct netif *netif),
err_t (* input)(struct pbuf *p, struct netif *netif))
Adds your network interface to the netif_list. Allocate a struct
netif and pass a pointer to this structure as the first argument.
Give pointers to cleared ip_addr structures when using DHCP,
or fill them with sane numbers otherwise. The state pointer may be NULL.
The init function pointer must point to a initialization function for
your ethernet netif interface. The following code illustrates it's use.*/
netif_add(&xnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, &tcpip_input);
使用 了 netif_add(&xnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, &tcpip_input); 这个 函数 对 这个 网卡 进行 了 初始化 。
这个 函数 是 LWIP 提供的 函数 ,我们 看一下 官方 的 解释 :http://www.nongnu.org/lwip/2_0_x/group__netif.html#gade5498543e74067f28cc6bef0209e3be

第一步 : 我 们 需要 先 定义 一个 netif Struct 类型 的变量
LWIP network interface 网卡 初始化 以 STM32 为例子 后面会有 用 2G 或者4G 模块 用 PPP拨号的 形式 虚拟出网卡 所以先以 这个为 前提的更多相关文章
- LWIP network interface 即 LWIP 的 硬件 数据 接口 移植 详解 STM32 以太网数据 到达 的第二站: void ethernetif_input( void * pvParameters )
根据 上一篇 文章 , ETH DMA 数据中断 会 发送 一个信号量 ,我使用 全局 搜索 这个信号量 s_xSemaphore 得到 一下 几个 值 根据 这个 分析 我们找到了 数据 的 ...
- LWIP network interface 即 LWIP 的 硬件 数据 接口 移植 首先 详解 STM32 以太网数据 到达 的第一站: ETH DMA 中断函数
要 运行 LWIP 不光 要实现 OS 的 一些 接口 ,还要 有 硬件 数据 接口 移植 ,即 网线上 来的 数据 怎么个形式 传递给 LWIP ,去解析 做出相应的 应答 ,2017 ...
- docker的网络-Container network interface(CNI)与Container network model(CNM)
Overview 目前围绕着docker的网络,目前有两种比较主流的声音,docker主导的Container network model(CNM)和社区主导的Container network in ...
- [INS-40724] No locally defined network interface matches the SCAN subnet.
环境如下 OS:AIX 7.1 DB:11.2.0.4 2节点RAC 报错信息 在安装11.2.0.4 RAC的时候报如下错误 INS-40724] No locally defined networ ...
- Linux-debian系统 /etc/network/interface 文件解读
原文 http://wiki.slimdevices.com/index.php/SqueezeOS_networking 话说Debian系的网卡配置跟Redhat系很不一样,Redhat是放在/e ...
- 更换oracle 集群网卡(Changing a Network Interface)
更换oracle 集群网卡(Changing a Network Interface) 假设换网卡前后 网卡名.ip,网关,子网掩码都不变的话,集群层面不许要做额外的操作. 一下操作为更换网卡后 ...
- Configure a bridged network interface for KVM using RHEL 5.4 or later?
environment Red Hat Enterprise Linux 5.4 or later Red Hat Enterprise Linux 6.0 or later KVM virtual ...
- [INS-41112] Specified network interface doesnt maintain connectivi
OS: Oracle Linux Server release 6.3 DB: Oracle 11.2.0.3 安装11.2.0.3.0的RAC,在安装GRID时报错: [INS-41112] Spe ...
- [Solved] install Gentoo in VBox: network interface eth0 does not exist
ERROR:interface eth0 does not exist; ensure that you have loaded the correct kernel moudle for your ...
随机推荐
- js获取日期:昨天今天和明天、后天 [转贴记录]
<html> <head> <meta http-equiv="Content-Type" content="textml; charset ...
- 自动生成了一本ES6的书
—— 实例属性,类属性,类方法,静态方法
1 实例属性和类属性 类和实例都是名字空间,类是类属性的名字空间,实例则是实例属性的名字空间. 类属性可通过类或实例来访问.只有通过类名访问时,才能修改类属性的值. 例外的一种情况是,当类属性是一个 ...
- Microsoft Visual Studio 遇到了问题需要关闭
新年刚来Microsoft Visual Studio就找麻烦,debug的时候如果不打断点可以正常跑过,一打断点就崩溃,重启.报的问题是:Microsoft Visual Studio 遇到了问题需 ...
- Current urgent plan(3/30)
1. resume improving 1.1 project from Udacity 1.2 project from class 1.3 find career center's help 1. ...
- API接口数据自检
这个周末的娱乐,通用模块,让后端自检,严格客户端按照文档的要求来,妈妈再也不担心我加班了,对某些团队来说,可能根本用不着,本是想到就尝试一把而已. 哎,傻X的客户端程序员,时间都去推辞扯淡打扮啦,好好 ...