uC/OS-II 平台下的 LwIP 移植笔记――作者:焦海波 2006-9-1
1 下载LwIP................................................................................................................................................................. 2
2 建立一个最基本的工程.........................................................................................................................................2
3 把LwIP加入工程.....................................................................................................................................................2
4 编写操作系统模拟层相关代码.............................................................................................................................3
4.1 操作系统模拟层移植说明――中文翻译 .................................................................................................3
4.2 编写操作系统模拟层.................................................................................................................................6
4.2.1 准备工作――建立文件、定义数据类型及其它 .........................................................................6
4.2.2 信号量操作函数.............................................................................................................................8
4.2.3 邮箱操作函数...............................................................................................................................13
4.2.4 实现sys_thread_new()函数 .......................................................................................................20
4.2.5 实现sys_arch_timeouts()函数 .................................................................................................22
4.2.6 实现临界保护函数.......................................................................................................................25
4.2.7 扫尾――结束操作系统模拟层的编写 .......................................................................................26
5 LwIP接口――初始设置及网络驱动...................................................................................................................28
5.1 准备工作――建立LwIP入口函数文件 ...................................................................................................28
5.2 __ilvInitLwIP().....................................................................................................................................29
5.3 __ilvSetLwIP().......................................................................................................................................30
5.4 ethernetif_init()――初始化底层接口 .............................................................................................35
5.4.1 ethernetif_init()函数分析.....................................................................................................35
5.4.2 low_level_output()――链路层发送函数 ...............................................................................36
5.4.3 low_level_init()――网卡初始化函数 ...................................................................................38
5.4.4 EMACInit()――网卡初始化工作的实际完成者 .......................................................................40
5.4.5 ethernetif_input()――实现接收线程 ...................................................................................47
5.4.6 low_level_input()――得到一整帧数据 .................................................................................49
5.4.7 GetInputPacketLen()――获得帧长 .........................................................................................50
5.4.8 EMACReadPacket()――复制,从接收缓冲区到pbuf ...............................................................53
5.4.9 EMACSendPacket()――发送一帧数据 .......................................................................................55
5.4.10 编译――ethernetif.c及lib_emac.c ......................................................................................56
6 ping――结束LwIP的移植...................................................................................................................................57
6.1 编译、链接整个工程...............................................................................................................................57
6.2 ping测试...................................................................................................................................................59
后记...............................................................................................................................................................................62
- 1 -