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 ...
随机推荐
- Django,ajax实现表格增删查改,Django内置分页功能。
1.工程目录 2.urls.py """Django_ajax URL Configuration The `urlpatterns` list routes URLs ...
- BZOJ4589: Hard Nim(FWT 快速幂)
题意 题目链接 Sol 神仙题Orzzzz 题目可以转化为从\(\leqslant M\)的质数中选出\(N\)个\(xor\)和为\(0\)的方案数 这样就好做多了 设\(f(x) = [x \te ...
- C# 字符串中英文对齐
StringBuilder str = new StringBuilder(); str.AppendFormat( - Encoding.Default.GetBytes(); str.Append ...
- 转:Linux中tomcat服务成功发布但局域网浏览器无法访问
转自:http://blog.csdn.net/mooncom/article/details/53168143 昨天,我在搭建Linux中服务器环境时,碰见一个问题,这里和大家分享一下. 问题描述: ...
- Java基础之引用(String,char[],Integer)总结于牛客网的专项练习题
1.String的引用: 下列代码执行后的结果为: public class Test { public static void main(String[] args) { StringBuffer ...
- JavaScript中map函数和filter的简单举例
JavaScript的数组迭代器函数map和filter,可以遍历数组时产生新的数组,和python的map函数很类似 1> filter是满足条件的留下,是对原数组的过滤:2> map则 ...
- MySQL两个表联合查询并按时间排序
有一张资金记录表,一张金币记录表,想以时间为单位,降序合并排列他们之间的信息,查询SQL如下: select * from (select * from t_money_logs union sele ...
- socket概念 套接字
理解socket soxket因为TCP是面向流的,你发的信息如果很多很快,TCP这样就会形成黏包 Socket是应用层与TCP/IP协议族通信的中间软件抽象层,它是一组接口.在设计模式中,Socke ...
- linux,强大的history命令
如果你经常使用 Linux 命令行,那么使用 history(历史)命令可以有效地提升你的效率.本文将通过实例的方式向你介绍 history 命令的 15 个用法. 使用 HISTTIMEFORMAT ...
- ArcGIS的网络分析
ArcGIS的网络分析分为两类:传输网络(Network Analyst)和效用网络(Utility Network Analyst). 一.从应用上来考虑: 1.传输网络常用于道路.地铁等交通网络分 ...