📄 基于嵌入式linux的移动终端的软件设计 - 嵌入系统 - ic狗新闻中心.htm
字号:
其中,N_PPP层就是PPP协议层。PPP协议模块不仅提供简单的数据链路层功能,它还提供诸如鉴权(如PAP/CHAP),数据压缩/解压(如CCP)和数据加密/解密(如ECP)等扩展功能。由于GPRS通信程序要求透明化地使用这些扩展功能,而PPP协议模块本身无法对各种策略进行选择,于是pppd应运而生。PPP协议模块中策略性的内容都移到了pppd中,由pppd完成对鉴权、压缩/解压和加密/解密等扩展功能的选用。</FONT></P>
<P><FONT face=Verdana>
在运行pppd的时候,pppd首先读取配置文件中的配置信息,其中包含了设置PPP协议模块的参数、GPRS通信模块连接的端口(/dev/ttyS1)以及对chat进行调用的语句,等等。随后pppd调用chat,chat也会读取相应的配置文件(其中包含一些应答语句对和AT命令),然后使用默认的行规程N_TTY向GPRS通信模块发送AT命令,接着chat将控制权返还给pppd。pppd将行规程切换为N_PPP,而pppd与PPP协议模块之间采用了设备文件来进行通信,设备文件名是/dev/ppp。通过read系统调用,pppd可以读取PPP协议模块的数据包(当然,PPP协议模块只会把应该由pppd处理的数据包发给pppd)。通过write系统调用,pppd可以把要发送的数据包传递给PPP协议模块,而通过ioctl系统调用,pppd可以设置PPP协议模块的参数,可以建立/关闭连接。</FONT></P>
<P><FONT face=Verdana>
此后,pppd执行了PDP上下文激活过程的第②、③、④步。等PDP上下文激活过程的第⑤-⑨步(与移动终端不直接相关)完成之后,pppd执行第⑩步,在函数make_ppp_unit()中调用ioctl(PPPIOCNEWUNIT)创建一个网络接口(如ppp0)。当PPP协议模块在处理PPPIOCNEWUNIT时,调用函数register_netdev()向内核注册PPP网络接口,该网络接口的传输函数指向函数ppp_start_xmit()。值得注意的一点是,如果关闭进程pppd,行规程会由N_PPP切换回默认的N_TTY,因此,在移动终端与监控中心通信的过程中不能关闭pppd进程。</FONT></P>
<P><FONT face=Verdana>
至此,移动终端完成了向GPRS网络的拨号,这样它就拥有了一个可以用于与监控中心进行通信的网络接口(如ppp0)。</FONT></P>
<P><FONT face=Verdana> <STRONG>
3.4.3移动终端与监控中心的数据交互</STRONG></FONT></P>
<P><FONT face=Verdana>
前面,移动终端已经与监控中心建立了网络链接。接下来,移动终端就可以与监控中心进行通信了。GPRS通信程序的层次结构如图1的右半部分所示。</FONT></P>
<P><FONT face=Verdana>
在移动终端向监控中心发送定位信息的过程中,移动终端上的GPRS通信程序通过socket接口发送TCP/IP数据包,内核根据IP地址和路由表,找到PPP网络接口,然后调用函数ppp_start_xmit(),此时控制权就转移到了PPP协议模块。函数ppp_start_xmit()调用函数ppp_xmit_process()去发送队列中的所有数据包,而函数ppp_xmit_process()会进一步调用函数ppp_send_frame()去发送单个数据包。函数ppp_send_frame()根据前面pppd对PPP协议模块的设置调用压缩等扩展功能之后,又经函数ppp_push()调用函数pch->chan->ops->start_xmit()发送数据包。函数pch->chan->ops->start_xmit()是具体的传输方式,对于串口发送方式,则是ppp_async.c:ppp_asynctty_open中注册的函数ppp_async_send(),函数ppp_async_send()经函数ppp_async_push()调用函数tty->driver->write()(定义在低层驱动程序中)把数据发送到串口2(GPRS通信模块接在串口2上)。</FONT></P>
<P><FONT face=Verdana>
ppp_async.c在初始化时(ppp_async_init),调用函数tty_register_ldisc()向tty注册了行规程N_PPP的处理接口,也就是一组回调函数。在移动终端接收监控中心指令的过程中,当GPRS通信模块收到数据时,就会回调N_PPP行规程中的函数ppp_asynctty_receive()来接收数据。函数ppp_asynctty_receive()调用函数ppp_async_input()把数据buffer转换成sk_buff,并放入接收队列ap->rqueue中。ppp_async另外有一个tasklet(ppp_async_process)专门处理接收队列ap->rqueue中的数据包,ppp_async_process一直挂在接收队列ap->rqueue上,一旦被唤醒,它就调用函数ppp_input()让PPP协议模块处理该数据包。在函数ppp_input()中,数据被分成两路,一路是协议控制数据包,放入队列pch->file.rqb中,交给pppd处理。另外一路是用户数据包,经函数ppp_do_recv()、ppp_receive_frame()进行PPP协议相关的处理后,再由函数netif_rx()提交给上层的TCP/IP协议模块进行处理,最后经socket接口传递给应用层的GPRS通信程序。</FONT></P>
<P><FONT face=Verdana><STRONG>
4总结</STRONG></FONT></P>
<P><FONT face=Verdana>
近几年,智能交通系统(包括车辆监控系统)发展非常迅速,因此,移动终端将会有非常广泛的应用前景。随着市场需求的不断扩大,更加丰富的功能将会被集成到移动终端上,而嵌入式Linux系统凭借其自身的优势将会被越来越多地应用到这个领域。</FONT></P></DIV></TD></TR></TBODY></TABLE></DIV>
<DIV class=n4>字体大小:<A id=b15
href="http://news.icgle.net/news/2008/10/10/IcNews21219.htm#">[大]</A><A
id=b13
href="http://news.icgle.net/news/2008/10/10/IcNews21219.htm#">[中]</A><A
id=b11
href="http://news.icgle.net/news/2008/10/10/IcNews21219.htm#">[小]</A></DIV>
<DIV class=n5>[上一篇文章]<A
href="http://news.icgle.net/news/2008/10/11/IcNews21218.htm">PCI Express桥接
PCI 的读取性能</A><BR>[下一篇文章]<A
href="http://news.icgle.net/news/2008/10/9/IcNews21220.htm">高质量嵌入式系统开发的集成测试技术</A><BR></DIV>
<DIV class=n6>以上文章全部由从网络上收集,并不代表 IC狗 的立场,
若该文章不小心侵犯了您的权益,请您联系本网站并提供相应的信息,工作人员确认信息后将在3个工作日内删除.谢谢您的支持</DIV>
<DIV class=n7>热门图片:<A
href="http://pic.icgle.net/pic/444/480/349/ICpic122251157.htm"
target=_blank>FCE17-A15SE-210</A><A
href="http://pic.icgle.net/pic/549/533/370/ICpic122261409.htm"
target=_blank>FCE17-B25AD-210</A><A
href="http://pic.icgle.net/pic/581/335/445/ICpic122281089.htm"
target=_blank>FCE17-B25PM-240</A><A
href="http://pic.icgle.net/pic/553/543/424/ICpic122291518.htm"
target=_blank>FCE17-B25SA-410</A><A
href="http://pic.icgle.net/pic/344/413/456/ICpic122311015.htm"
target=_blank>FCE17-B25SE-240</A><A
href="http://pic.icgle.net/pic/436/395/414/ICpic122321660.htm"
target=_blank>FCE17-B25SM-210</A><A
href="http://pic.icgle.net/pic/324/595/594/ICpic122331317.htm"
target=_blank>FCE17-B25SM-240</A><A
href="http://pic.icgle.net/pic/303/523/385/ICpic122341885.htm"
target=_blank>FCE17-C37SA-410</A><A
href="http://pic.icgle.net/pic/329/407/324/ICpic122351832.htm"
target=_blank>FCE17-C37SM-240</A><A
href="http://pic.icgle.net/pic/453/487/312/ICpic122361943.htm"
target=_blank>FCE17-E09AD-290</A><A
href="http://pic.icgle.net/pic/433/377/318/ICpic122371350.htm"
target=_blank>FCE17-E09PA-440</A><A
href="http://pic.icgle.net/pic/323/317/550/ICpic122381787.htm"
target=_blank>FCE17-E09PM-210</A><A
href="http://pic.icgle.net/pic/528/380/502/ICpic122391114.htm"
target=_blank>FCE17-E09PM-240</A><A
href="http://pic.icgle.net/pic/445/369/482/ICpic122401075.htm"
target=_blank>FCE17-E09SA-410</A><A
href="http://pic.icgle.net/pic/473/387/506/ICpic122421319.htm"
target=_blank>FCE17-E09SM-210</A><A
href="http://pic.icgle.net/pic/494/572/473/ICpic122431664.htm"
target=_blank>FCE17-E09SM-240</A></DIV>
<DIV class=n8>相关IC新闻</DIV>
<DIV class=n9>·<A
href="http://news.icgle.net/news/2008/10/11/IcNews21218.htm">PCI Express桥接
PCI 的读取性能</A><BR>·<A
href="http://news.icgle.net/news/2008/10/13/IcNews21217.htm">基于SPCE3200的彩色液晶显示系统设计</A><BR>·<A
href="http://news.icgle.net/news/2008/10/14/IcNews21216.htm">以Linux为系统基于DSP的视频检测方案</A><BR>·<A
href="http://news.icgle.net/news/2008/10/15/IcNews21215.htm">基于ARM
Linux的Gameboy模拟器移植和优化研究</A><BR>·<A
href="http://news.icgle.net/news/2008/10/6/IcNews21019.htm">基于嵌入式Internet技术的电网远程监测系统</A><BR>·<A
href="http://news.icgle.net/news/2008/10/7/IcNews21018.htm">数字化智能小区系统控制解决方案</A><BR>·<A
href="http://news.icgle.net/news/2008/10/8/IcNews21017.htm">基于586-Engine的无人机飞行控制器设计</A><BR>·<A
href="http://news.icgle.net/news/2008/9/19/IcNews20965.htm">GPS和嵌入式数据库</A><BR>·<A
href="http://news.icgle.net/news/2008/9/20/IcNews20964.htm">DSP的并行处理方法</A><BR>·<A
href="http://news.icgle.net/news/2008/9/22/IcNews20963.htm">TMS320VC5416并行自举的巧妙实现</A><BR>·<A
href="http://news.icgle.net/news/2008/9/23/IcNews20962.htm">运用流处理技术的新架构DSP瞄准视频处理等应用</A><BR>·<A
href="http://news.icgle.net/news/2008/9/24/IcNews20961.htm">利用可编程逻辑实现灵活高效的多媒体信号处理</A><BR>·<A
href="http://news.icgle.net/news/2008/9/25/IcNews20960.htm">基于嵌入式系统的汽车行驶记录仪的设计</A><BR>·<A
href="http://news.icgle.net/news/2008/9/26/IcNews20959.htm">基于WinCE的液位遥测系统软件设计</A><BR>·<A
href="http://news.icgle.net/news/2008/9/27/IcNews20958.htm">WindowsCE下基于TSC2101的音频系统设计</A><BR></DIV>
<DIV class=n8>IC新闻推荐</DIV>
<DIV class=n9><A href="http://news.icgle.net/type.asp?tp=5">[模拟技术]</A><A
href="http://news.icgle.net/news/2008/10/9/IcNews21214.htm">集成混频和放大功能的低价电路</A><BR><A
href="http://news.icgle.net/type.asp?tp=5">[模拟技术]</A><A
href="http://news.icgle.net/news/2008/10/10/IcNews21213.htm">基于单片机控制的程控有源滤波器电路</A><BR><A
href="http://news.icgle.net/type.asp?tp=5">[模拟技术]</A><A
href="http://news.icgle.net/news/2008/10/11/IcNews21212.htm">基于C8051F060单片机控制AD9833实现FSK调制</A><BR><A
href="http://news.icgle.net/type.asp?tp=5">[模拟技术]</A><A
href="http://news.icgle.net/news/2008/10/13/IcNews21211.htm">高速应用中电流反馈运放电路设计分析</A><BR><A
href="http://news.icgle.net/type.asp?tp=5">[模拟技术]</A><A
href="http://news.icgle.net/news/2008/10/14/IcNews21210.htm">如何设计可支持差分和单端信号的便携式产品音频接口</A><BR><A
href="http://news.icgle.net/type.asp?tp=5">[模拟技术]</A><A
href="http://news.icgle.net/news/2008/10/15/IcNews21209.htm">高压大功率放大器PA42及其应用</A><BR><A
href="http://news.icgle.net/type.asp?tp=4">[科技成果]</A><A
href="http://news.icgle.net/news/2008/10/9/IcNews21208.htm">延长电池寿命的触敏定时器开关</A><BR><A
href="http://news.icgle.net/type.asp?tp=4">[科技成果]</A><A
href="http://news.icgle.net/news/2008/10/10/IcNews21207.htm">节能型交流驱动系统在电动车中的应用</A><BR><A
href="http://news.icgle.net/type.asp?tp=4">[科技成果]</A><A
href="http://news.icgle.net/news/2008/10/11/IcNews21206.htm">“村田遥控棒”——遥控村田顽童的魔术棒</A><BR><A
href="http://news.icgle.net/type.asp?tp=4">[科技成果]</A><A
href="http://news.icgle.net/news/2008/10/13/IcNews21205.htm">AT91RM9200处理器同步串口SSC的特性分析与应用</A><BR><A
href="http://news.icgle.net/type.asp?tp=4">[科技成果]</A><A
href="http://news.icgle.net/news/2008/10/14/IcNews21204.htm">基于LabVIEW的智能开关综合保护装置的数据获取与处理</A><BR><A
href="http://news.icgle.net/type.asp?tp=4">[科技成果]</A><A
href="http://news.icgle.net/news/2008/10/15/IcNews21203.htm">一种新型微波射频开关(4×2)的设计与应用</A><BR><A
href="http://news.icgle.net/type.asp?tp=2">[新品发布]</A><A
href="http://news.icgle.net/news/2008/10/9/IcNews21202.htm">Catalyst推出12位数字输出式温度传感器CAT6095</A><BR><A
href="http://news.icgle.net/type.asp?tp=2">[新品发布]</A><A
href="http://news.icgle.net/news/2008/10/9/IcNews21201.htm">富士通微电子推出针对SLR相机的图像处理系统方案</A><BR><A
href="http://news.icgle.net/type.asp?tp=2">[新品发布]</A><A
href="http://news.icgle.net/news/2008/10/10/IcNews21200.htm">安森美推出两款新的串行外设接口(SPI)版本电机驱动器</A><BR></DIV></DIV></TD>
<TD class=r1>
<DIV id=a1></DIV>
<DIV class=hk>
<DIV class=hl>IC新闻分类</DIV>
<DIV class=hj>
<UL>
<LI><A href="http://news.icgle.net/type.asp?tp=1">行业动态</A></LI>
<LI><A href="http://news.icgle.net/type.asp?tp=2">新品发布</A></LI>
<LI><A href="http://news.icgle.net/type.asp?tp=3">政策法规</A></LI>
<LI><A href="http://news.icgle.net/type.asp?tp=4">科技成果</A></LI>
<LI><A href="http://news.icgle.net/type.asp?tp=5">模拟技术</A></LI>
<LI><A href="http://news.icgle.net/type.asp?tp=6">嵌入系统</A></LI>
<LI><A href="http://news.icgle.net/type.asp?tp=7">传感控制</A></LI>
<LI><A href="http://news.icgle.net/type.asp?tp=8">存储设计</A></LI>
<LI></LI></UL><IMG height=1
src="基于嵌入式Linux的移动终端的软件设计 - 嵌入系统 - IC狗新闻中心.files/line.gif"
width=210></DIV></DIV>
<DIV id=a2></DIV></TD></TR></TBODY></TABLE>
<DIV id=b></DIV>
<SCRIPT language=javascript>d_h()</SCRIPT>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -