<?xml version="1.0" encoding="UTF-8"?>
  <feed xmlns="http://www.w3.org/2005/Atom">
  <title type="html"><![CDATA[我是程序员   -Shosh's Blog]]></title>
  <subtitle type="html"><![CDATA[]]></subtitle>
  <id>http://www.wscxy.com/shosh/</id>
  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/" /> 
  <link rel="self" type="application/atom+xml" href="http://www.wscxy.com/shosh/atom.asp" /> 
  <generator uri="http://www.pjhome.net/" version="2.8">PJBlog3</generator> 
  <updated>2009-01-06T11:55:43+08:00</updated>

  <entry>
	  <title type="html"><![CDATA[EVB &amp; EVT Porting Experience Sharing]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=8" label="brew开发" /> 
	  <updated>2009-01-06T11:55:43+08:00</updated>
	  <published>2009-01-06T11:55:43+08:00</published>
		  <summary type="html"><![CDATA[<p>前一阵子在做EVB/EVT的Porting，碰到了不少问题，多亏各路高手（platform的，PS的，MMI的都有）各施绝技，才帮助我最终完成任务。在此感谢他们！</p>
<p>EVB：其实我也不知道这三个字母是哪些单词的缩写，不过这个不重要，其实就是手机里面的硬件设备放到一块板子上，在写入正确的software load之后能够运行代码。该板子比最后我们要生产出来的手机要大不少，因为这样可以简化硬件布局设计和生产时间，使用起来也比较方便。它包含了一个手机需要包含的大多数硬件设备，但是某些能能模块可能没有完成，在该板子上，我们主要测试正常开机和一些比较简单的APP。有特殊要求的一些APP，比如call,bt,往往会因为硬件环境没准备好而无法执行。</p>
<p><br />
EVT：EVT其实和EVB一样，只是这块板在大小上和布局上，更像手机了。我曾戏称&ldquo;EVT就是更像手机的EVB&rdquo;来解释EVT。因为EVT更小，但是同样没有手机外壳的支撑保护，所以使用的时候要特别小心，不然它的哪根&ldquo;神经&rdquo;(线路)断了都不一定知道。</p>
<p><br />
EVB/EVT Porting：刚才介绍的EVB/EVT是从硬件层面上的，有些计算机里的&ldquo;裸机&rdquo;的概念。其实我要完成的EVB/EVT Porting任务，就是将特定的project source编译出来的image（主要是那些mbn文件）load到EVB/EVT中，然后开机，让它正确地跑到Idle（可以理解成计算机里的桌面），进而进入各个App。所以这里有两个关键的任务：1.能够正确build出来；2.开机流程正确，可以正确跑进Idle。</p>
<p><br />
第一步：build通过</p>
<p>其实只是让它编译链接通过，没有什么特别的，只是很费时间而已。build主要的两个阶段编译和链接，编译阶段的错误多数只是语法上的，将发现的错误一个个改正再编译就没有问题了，只是需要时间而已；链接阶段的错误多数是要么找不到某个符号，要么有多个符号，导致不知道用哪个来链接（这里的符号指一些函数和全局的变量）。这里倒有几个经验技巧和大家分享。</p>
<p>1. 如果在编译阶段中途手动停掉编译，需要注意将正在编译的源文件生成的对应对象文件（.o文件）删除，否则下一次编译成功后很可能会链接不过。这是编译原理决定的：在编译阶段，每个源文件(c/cpp)会对应生成一个.o文件，在链接阶段，会将这些.o文件链接在一起。而默认情况下，为了缩短编译时间，并不会直接去将每个源文件都编译生成.o文件，而是先去找同名的.o文件，如果没有找到或者.o文件的最后修改时间比源文件的最后修改时间早，则会去编译该源文件，生成.o文件，否则就认为原来的.o文件是可用的，不需要编译，则跳过。所以在手动停止编译的时候，真给编译的源文件的.o文件可能已经生成，但是并没有编译完成，也就是说该.o文件是不完整的；如果以后并没有修改该源文件，因为对应的.o文件已经生成且比该源文件新，就不会去重新编译，生成正确的.o文件。所以最后链接的时候就会出错了。出错的时候还很诡异，当你发现对应的链接错误，你会定位到该文件，结果你会发现这个文件中的代码并没有问题，然后你就丈二和尚摸不着头脑了。</p>
<p>2. 文件内的全局变量或函数使用static关键字，使起只在文件内其作用：因为工程中文件个数上万，而开发者也有几百，很难保证你使用的全局变量别人在其他文件不会声明使用，尤其是名字比较common的，大家都容易想到的，这样一来就会有重定义的错误。所以：要尽量缩小变量或函数的作用域，文件内的全局函数或变量使用static使其限定在文件内。</p>
<p>3. 如果在链接是发现有找不到的符号，去搜索源文件有没有对应的函数会变量，如果有，则需要去检查所在文件对应的.o文件有没有生成。因为代码中加了，不一定就是编译了的。如果.o也生成了，可以看看是不是被宏包起来了；如果.o文件没有生成，看看该源文件有没有放入正确的.min文件，并确定该min文件是不是起作用。归纳起来就是两件事：一是源文件有没有被正确编译，二是代码有没有被宏包起来导致没有编译到。</p>
<p><br />
第二步：调试开机</p>
<p>调试开机之前，你根本不会想到会有哪些问题，甚至会认为会比较顺利，一开机，就不小心进了Idle。事实往往比想象得复杂，基本上花在调试开机上的时间会占总时间的60%以上。</p>
<p>调试的工具是大家都比较熟悉的trace32，不过刚开始的时候，我只会使用trace32 download，并不会使用它来调试，连设置最简单的断点都不会。所以如果不大熟悉，需要先学会简单的使用。（哈哈，还好，platform那边的兄弟个个是高手，教我不少，感谢他们！）</p>
<p>大体上，我们是按照&ldquo;公交线路式&rdquo;的方法进行调试的。刚开机是起始点（公交始发站），进入Idle是终止点（公交终点站），在之间设置了多个中点（中间站点）。调试的过程就是让一辆公交车（程序指令）从始发站出发，经过各个中间站点，最后到达终点站的过程。因为司机是第一次在该路线上驾车，所以在中间的时候总会迷路，我们需要帮助他一个站点一个站点的往下走。</p>
<p>下面来分享一些经验技巧，不过也是比较初级的，高手们请不要见笑：</p>
<p>1. 使用trace32打断点：因为这个是使用trace32调试时最经常使用到的，所以在这里简单说一下。使用trace32打断点有很多途径，可以通过菜单项先找到函数，也可以先找到文件再找函数。不过为了节约时间，可以使用命令来快速完成：<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>break.set <span style="color: #0000ff">functionName</span> /onchip</strong><br />
如果functionName指示错误，会有提示的，functionName不管是在debug版本还是非debug版本都可以使用的（只是在非debug版本里看不到原始的code而已）。onchip类型的断点只能同时enable两个，而且onchip的断点比较可靠，所以基本上我们只使用onchip类型的断点，所以同时只能使用两个断点。另外点击高级按钮，可以打开高级的断点设置，包括设置一定的条件，设置计数器等。</p>
<p>2. 在EVB Porting的时候，我们碰到了一个比较麻烦的问题，第一次开机能够显示画面，但是之后开机就只能看到白屏（屏幕发白光），尽管已经确认Form已经创建成功，并顺利push到了rootform，而且display也确实有调用update的函数。我们知道在BREW中，刷屏实际上是使用IDisplay_Update来完成的，尽管我们使用的是BUIW，其实也不例外。所以我们希望能够找到display update的函数处打个断点，确定有没有跑到--这就是我要说的在这些地方打断点，需要对Brew中接口的实现要有一定的了解，不然很可能找不到函数名而不知道在哪里打断点。类似的还有IShell_CreateInstance, IShell_StartApplet等。这些是需要我们去猜测的，尽管我们可以看到这些函数名在对象结构体中的成员名，但是并不是函数名，我们可以使用部分搜索的方法来找到。BREW提供给我们使用的&ldquo;函数&rdquo;叫接口，用I左右前缀，而在内部实现它叫类，用&ldquo;C&rdquo;做为前缀。比如IShell_StartApplet函数，真正的实现函数名为CShell_StartApplet。也有的代码并没有&ldquo;C&rdquo;来做前缀，只是把&quot;I&quot;前缀去掉而已。回到屏幕不能显示画面的问题，最后幸亏platform的人发现LCD的电压为0（尽管开着背光灯，两者两码事）。</p>
<p>3. 在BREW3上，我们知道applet的handle event函数收到的第一个事件是EVT_APP_START，不过这次在调试时，发现在BREW4上，handle event函数收到的第一个事件是EVT_APP_START_WINDOW(后来得知这个事件是专门给运行在background的applet用的)。 <br />
&nbsp;</p>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=80" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=80</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[3 Key Coding Tips for BREW Developers]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=8" label="brew开发" /> 
	  <updated>2008-12-26T17:57:20+08:00</updated>
	  <published>2008-12-26T17:57:20+08:00</published>
		  <summary type="html"><![CDATA[<div>
<p><b>Tip #1: Code for the phone, not the emulator. </b><br />
Handsets are small form factor, constrained devices &mdash; so relative to what you're used to on the desktop, phones have limited speed, limited resources, small screens, and a limited ARM processor. You have to remember that the emulator has amazing speed (your 2GHz desktop machine at full speed, for example), emulated resources, incorrect use of screen size for many of the skins, and an x86 processor. The emulator is just that; it's not a phone.</p>
<p>Here's a closer look at each of the four main development issues when using an emulator to code for a BREW phone:</p>
<p>&nbsp;</p>
<ul>
    <li><i>Speed.</i> Phones have fairly slow processors. Don't expect to be able to do complex math calculations in real-time for a simulation.
    <p>&nbsp;</p>
    </li>
    <li><i>Limited resources.</i> Phones have a small amount of storage, and policy of specific phones (such as the Z-800) can make that even more limiting than it seems at first. Also, an application's code is loaded into RAM from storage (just like a traditional PC, but unlike many PDAs). This means even less RAM is available than you may have originally expected. A good case in point is the Kyocera 3035; it has 60 kilobytes of RAM available. If your application is 35 kilobytes, then only 25 kilobytes remain for processing.
    <p>&nbsp;&nbsp;</p>
    </li>
    <li><i>Screen size.</i> These are small screens, even by PDA standards. Design the UI the way you see them on other phones: That is &mdash; keep it simple. Don't try to do too much on one screen. Instead, break a screen up and have a menu to access the various portions of it so everything is clean and uncluttered.
    <p>&nbsp;&nbsp;</p>
    </li>
    <li><i>Don't forget that the target for the application is an ARM processor. </i>The application must compile for the ARM processor. Start with this example: make files. Although they aren't the best design, they have the settings that are required for this particular ARM processor. Don't try to change them to compile your application; that won't work. Instead, fix the code. Common mistakes include doing division, using global or static variables, and, when compiling in Visual Studio, ignoring Level 4 warnings, which often become errors using the ARM compiler.</li>
</ul>
<p>&nbsp;</p>
<p>Make sure to build often with the ARM compiler and test often on the phone. QUALCOMM has recently made this much easier by providing the BREW Logger for download. This allows you to see the DBGPRINTF messages on your PC while you're debugging on the phone. This beats grabbing debug files on the phone!</p>
<b>Tip #2: Remember that BREW is Asynchronous. </b><br />
Writing software for BREW means writing fully asynchronous, event-driven software. This is even more pronounced than early Mac OS programming or Palm OS programming. In those systems, there was usually a way for the application to create its own event loop wherever it wanted by grabbing the next event off the system queue and seeing if that event was for it or not. If it was, it could handle it and go on; otherwise, it would dispatch it back to the system. This is not possible in BREW.
<p>Most IO calls in BREW are non-blocking. What this means is that the action doesn't actually take place right when the call is made. That would have made it synchronous. For instance, if you make a call to ISOCKET_Connect(), you have to provide a callback routine. What happens here, at least as far as we are concerned, is the action to do the ISOCKET_Connect() is placed on a system stack, and the call returns immediately, returning control to the application. If we want the action to actually occur, we must return to the system before it can happen.</p>
<p>All of this means that the best BREW applications will need to be designed from the ground up to work well within an asynchronous system. Sure, there are ways of somewhat mechanically converting a synchronous application to work in an asynchronous system, but for anything but the simplest of applications, this can get very complex very quickly.</p>
<p>Another effect of this is that when an application is busy, nothing else is occurring on the phone. Since this is a phone, that's a bad thing. A phone is still primarily for voice calls. If your application is busy doing something, a voice call can't occur (at least the part of notifying the user that a voice call is incoming) until your application returns to the system. Because of this, there is a watchdog timer. If an application spends too much time without returning to the system, the phone will reset. This means that if an application is going to do some processing, some of the flow of control should be passed via sending events to itself. This is easily accomplished by using EVT_USER events with ISHELL_PostEvent(). (I don't recommend ISHELL_SendEvent() as that causes the event to happen synchronously, which is not what we want.)</p>
<p>There are a number of BREW system calls that require the application to be waiting for a callback before flow will continue. What if this never occurs? Well, the obvious effect is that control will never return to your application, and the user will think it has hung. This is actually quite a common occurrence (for example, a phone indoors may not have very good network coverage). This is easily solved by using ISHELL_SetTimer() with your own callback. Don't worry: If the event occurs before the timer, you can easily cancel the timer by using ISHELL_CancelTimer().</p>
<p><b>Tip #3: Know How to Handle Your Events. </b><br />
As mentioned in the previous tip, BREW is very event-driven. As such, an application will get many events that it may not be expecting. Controls talk to themselves using events. The system sends events to the application to tell it a variety of things about the state of the phone. All of these need some action taken by the application. Because of this, a well-designed event handler is required for a stable application.</p>
<p>It is the application's responsibility to make sure all controls being used get the messages they require to function properly. It is not defined what all of the events are, so the best way to handle this is to take special action on those events you know about and may want to intercept occasionally (such as the arrow keys or CLR key) and have a default handler that passes everything else to any active controls to see if they can handle the event.</p>
<p>Handling the CLR key (event code of EVT_KEY with a wParam of AVK_CLR) is a special case in BREW. A well-designed application will have the CLR key behaving as a backspace when in text entry controls, as a back key to go back a screen, and exiting the application when on the main screen. This means an application needs to watch for it and perhaps do something special. If FALSE is ever returned from handling the CLR key, the application will exit. Except at the main screen, this is likely not the action you want the application to take.</p>
<p>One of the most important events to handle properly in any application is the suspend event (EVT_APP_SUSPEND). If an application receives this, it means that the phone wants to do something, such as notifying the user of a voice call or maybe an SMS message. QUALCOMM defines a bunch of things that an application must do before returning from a suspend event. These things including closing down all used sockets, stopping all timers, and deactivating all controls, among many other things. An application will not pass testing if these aren't done.</p>
<p><i>Originally published in the BREW Wireless Resource Center</i></p>
</div>
<p>&nbsp;</p>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=79" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=79</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[Palm 操作系统]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=24" label="操作系统" /> 
	  <updated>2008-12-23T13:11:41+08:00</updated>
	  <published>2008-12-23T13:11:41+08:00</published>
		  <summary type="html"><![CDATA[<p>&nbsp;Palm OS操作系统</p>
<p>　　PalmOS是Palm公司的是一种32位的嵌入式操作系统，它的操作界面采用触控式，差不多所有的控制选项都排列在屏幕上，使用触控笔便可进行所有操作。作为一套极具开放性的系统，开发商向用户免费提供Palm操作系统的开发工具，允许用户利用该工具在Palm操作系统的基础上编写、修改相关软件，使支持Palm的应用程序丰富多彩、应有尽有。</p>
<p>　　 PalmOS是Palm公司开发的专用于PDA上的一种操作系统，这是PDA上的霸主，一度普占据了90%的PDA市场的份额。虽然其并不专门针对于手机设计，但是PalmOS的优秀性和对移动设备的支持同样使其能够成为一个优秀的手机操作系统。其最新的版本为PalmOS5.2。目前具有手机功能的PalmPDA如Palm公司的TungstenW。而Handspring公司（目前已被Palm公司收购）的Treo系列则是专门使用Palm OS的手机，如Treo 270以及最新的倍受瞩目的Treo 650。</p>
<p>　　Palm OS操作系统特性</p>
<p>　　Palm操作系统最明显的优势还在于其本身是一套专门为掌上电脑编写的操作系统，在编写时充分考虑到了掌上电脑内存相对较小的情况，所以Palm操作系统本身所占的内存极小，基于Palm操作系统编写的应用程序所占的空间也很小，通常只有几十KB，所以基于Palm操作系统的掌上电脑虽然只有几兆内存却可以运行众多的应用程序。</p>
<p>　　Palm在其它方面还存在一些不足，Palm操作系统本身不具有录音、MP3播放功能等，如果你需要使用这些功能，就需要另外加入第三方软件或硬件设备方可实现。对于中国用户而言，另一个不足之处在于Palm操作系统起初在中国销售的产品仍然要使用中文外挂平台，有相当部分依然是以英文界面为主，在一定程度上影响了基于Palm操作系统的产品在中国市场的大面积进入。其代表性的产品有Palmm505、Palmm500、PalmIII等。</p>
<p><!-- 分页 --><!-- 分页end --></p>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=78" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=78</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[IBM计算机专家称Vista需要4GB内存]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=21" label="电脑综合" /> 
	  <updated>2008-12-13T17:18:30+08:00</updated>
	  <published>2008-12-13T17:18:30+08:00</published>
		  <summary type="html"><![CDATA[<p>　　北京时间（2007年，Shosh注）2月22日消息，据国外媒体报道，IBM计算机专家大卫&middot;绍特(David Short)近日表示，要想将微软下一代操作系统Vista的性能发挥至最佳，用户需要为自己的PC配备4GB内存。早在两年之前，绍特就开始关注和研究Vista。</p>
<p>　　绍特表示，对他而言，2GB内存是Windows XP的最佳配置，而Vista则需要4GB内存。Vista之所以需要如此大的内存，主要原因是Windows SuperFetch。SuperFetch的主要作用是从硬盘读取数据，并保存在可用内存中，以便于处理器访问。如果操作系统认为用户将在特定时间访问特定软件，就会预先将该软件加载到可用内存之中。这一设定的好处在于，如果用户拥有足够大的内存，就可以加快处理器访问速度，缩短软件响应时间。不利之处在于，它需要大量的内存。</p>
<p>　　根据微软提供的资料，主频800MHz的处理器和512MB内存是运行Vista的最低配置。但显而易见，这样的配置无法流畅地运行Vista。绍特表示，很多硬件厂商推出的PC虽然号称支持Vista，但配置较低，消费者应当注意到这一点。事实上，微软此前推出的Vista PC样机已经配备了4GB内存。(奥托)</p>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=77" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=77</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[定义全局变量时应尽量加static]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=15" label="C/C++" /> 
	  <updated>2008-12-12T09:10:11+08:00</updated>
	  <published>2008-12-12T09:10:11+08:00</published>
		  <summary type="html"><![CDATA[<div>为什么定义全局变量时应尽量加static呢？</div>
<div>&nbsp;</div>
<div>这是我在工程中碰到实际问题时才想到的。工程的编译阶段已经顺利通过，但是在链接时，发生了一些错误，其中的两条Error提示为：<br />
<font face="宋体" color="#0000ff" size="1"><span lang="EN-US" style="font-size: 9pt; color: blue">Error: L6200E: Symbol gpListeners multiply defined (by OEMLogicalDisplayCfg.o and opc_history_store.o).<br />
</span></font><font face="宋体" color="#0000ff" size="1"><span lang="EN-US" style="font-size: 9pt; color: blue">Error: L6200E: Symbol gpListeners multiply defined (by opc_history_store.o and OEMLogicalDisplayCfg.o).<o:p></o:p></span></font></div>
<div>明显是在两个文件里使用了同一个变量名。</div>
<div>我第一眼看到这个错误的时候，想到的是重复定义，使用的是同一个变量，应该用extern解决。不过找到相应代码仔细一看，发现它们的类型并不一致，才想起来，原来应该限定他们的作用域。</div>
<div>这两个变量都是只在文件内使用的，所以我给他们定义的前面都加了static，再编译链接，以上两条错误提示消去。</div>
<div>&nbsp;</div>
<div>所以，如果要使用全局变量，且只在文件内使用，在定义时使用static限定其作用域，防止上述的错误发生。</div>
<div>如果有全局变量的适用范围不仅只在一个文件内部，则需要避免与其他文件使用同样的命名。</div>
<div>&nbsp;</div>
<div>其实函数名也是如此，只是大家对待函数的习惯已经很好了，将只在文件内使用的函数都声明为static的了。</div>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=76" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=76</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[ARP协议解码详解]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=21" label="电脑综合" /> 
	  <updated>2008-12-09T22:08:32+08:00</updated>
	  <published>2008-12-09T22:08:32+08:00</published>
		  <summary type="html"><![CDATA[<p><strong>一、ARP协议简介<br />
<br />
</strong>ARP，全称Address Resolution Protocol，中文名为地址解析协议，它工作在数据链路层，在本层和硬件接口联系，同时对上层提供服务。<br />
IP数据包常通过以太网发送，以太网设备并不识别32位IP地址，它们是以48位以太网地址传输以太网数据包。因此，必须把IP目的地址转换成以太网目的地址。在以太网中，一个主机要和另一个主机进行直接通
<script language="javascript" src="/CMS/JS/newsad.js" type="text/javascript"></script>
信，必须要知道目标主机的MAC地址。但这个目标MAC地址是如何获得的呢？它就是通过地址解析协议获得的。ARP协议用于将网络中的IP地址解析为的硬件地址（MAC地址），以保证通信的顺利进行。<br />
<br />
<b>1.&nbsp;&nbsp;ARP和RARP报头结构</b><br />
<br />
ARP和RARP使用相同的报头结构，如图1所示。<br />
<br />
<br />
<img onmousewheel="return imgzoom(this);" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('attachments/sajNt73hubk=_sR2O0EwS1hkv.gif');}" src="http://www.net130.com/CMS/Files/Uploadimages/sajNt73hubk=_sR2O0EwS1hkv.gif" onload="if(this.width&gt;screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口查看全图\nCTRL+鼠标滚轮放大或缩小';}" border="0" alt="" /> <br />
<br />
（图1　ARP/RARP报头结构）</p>
<p>硬件类型字段：指明了发送方想知道的硬件接口类型，以太网的值为1；<br />
<br />
协议类型字段：指明了发送方提供的高层协议类型，IP为0800（16进制）；<br />
<br />
硬件地址长度和协议长度：指明了硬件地址和高层协议地址的长度，这样ARP报文就可以在任意硬件和任意协议的网络中使用；<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
操作字段：用来表示这个报文的类型，ARP请求为1，ARP响应为2，RARP请求为3，RARP响应为4；<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
发送方的硬件地址（0-3字节）：源主机硬件地址的前3个字节；<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
发送方的硬件地址（4-5字节）：源主机硬件地址的后3个字节；<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
发送方IP（0-1字节）：源主机硬件地址的前2个字节；<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
发送方IP（2-3字节）：源主机硬件地址的后2个字节；<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
目的硬件地址（0-1字节）：目的主机硬件地址的前2个字节；<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
目的硬件地址（2-5字节）：目的主机硬件地址的后4个字节；<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
目的IP（0-3字节）：目的主机的IP地址。<br />
<br />
<b>2.&nbsp;&nbsp;ARP和RARP的工作原理</b><br />
<br />
ARP的工作原理如下：<br />
<br />
1.&nbsp;&nbsp;首先，每台主机都会在自己的ARP缓冲区 (ARP Cache)中建立一个 ARP列表，以表示IP地址和MAC地址的对应关系。 <br />
<br />
2.&nbsp;&nbsp;当源主机需要将一个数据包要发送到目的主机时，会首先检查自己 ARP列表中是否存在该 IP地址对应的MAC地址，如果有﹐就直接将数据包发送到这个MAC地址；如果没有，就向本地网段发起一个ARP请求的广播包，查询此目的主机对应的MAC地址。此ARP请求数据包里包括源主机的IP地址、硬件地址、以及目的主机的IP地址。<br />
<br />
3.&nbsp;&nbsp;网络中所有的主机收到这个ARP请求后，会检查数据包中的目的IP是否和自己的IP地址一致。如果不相同就忽略此数据包；如果相同，该主机首先将发送端的MAC地址和IP地址添加到自己的ARP列表中，如果ARP表中已经存在该IP的信息，则将其覆盖，然后给源主机发送一个 ARP响应数据包，告诉对方自己是它需要查找的MAC地址； <br />
4.&nbsp; &nbsp; &nbsp; &nbsp; 源主机收到这个ARP响应数据包后，将得到的目的主机的IP地址和MAC地址添加到自己的ARP列表中，并利用此信息开始数据的传输。如果源主机一直没有收到ARP响应数据包，表示ARP查询失败。<br />
<br />
<b>RARP的工作原理：</b><br />
<br />
<b>1.&nbsp;&nbsp;</b>发送主机发送一个本地的RARP广播，在此广播包中，声明自己的MAC地址并且请求任何收到此请求的RARP服务器分配一个IP地址；<br />
<br />
<b>2. </b>本地网段上的RARP服务器收到此请求后，检查其RARP列表，查找该MAC地址对应的IP地址；<br />
<br />
<b>3. </b>如果存在，RARP服务器就给源主机发送一个响应数据包并将此IP地址提供给对方主机使用；<br />
<br />
<b>4. </b>如果不存在，RARP服务器对此不做任何的响应；<br />
<br />
<b>5. </b>源主机收到从RARP服务器的响应信息，就利用得到的IP地址进行通讯；如果一直没有收到RARP服务器的响应信息，表示初始化失败。<br />
&nbsp;</p>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=75" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=75</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[看完题目3秒钟内给出正确答案，微软向你敞开大门]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=11" label="人生励志" /> 
	  <updated>2008-12-05T19:32:11+08:00</updated>
	  <published>2008-12-05T19:32:11+08:00</published>
		  <summary type="html"><![CDATA[<p>看完下面的题目，若能在3 秒钟内给出正确答案，微软向你敞开大门！</p>
<p>准备好了吗？</p>
<p>请听题：<span style="color: #0000ff"><span>一副扑克抽取掉大小司令（大小鬼）后还剩52张，从中随机取出2张，请问取到的两张刚好是一红一黑的概率是多少？</span></span></p>
<p>三！二！一！</p>
<p>时间到！！！</p>
<p>请问你回答出来了吗？如果已经有答案了，请赶快留言报名（还有你的答案）哦！</p>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=74" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=74</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[HDMI]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=10" label="词汇充电" /> 
	  <updated>2008-12-04T19:45:15+08:00</updated>
	  <published>2008-12-04T19:45:15+08:00</published>
		  <summary type="html"><![CDATA[<p>HDMI，英文全称是High Definition Multimedia Interface，中文名称是高清晰多媒体接口的缩写。2002年4月，日立、松下、飞利浦、索尼、汤姆逊、东芝和Silicon Image七家公司联合组成HDMI组织。HDMI能高品质地传输未经压缩的高清视频和多声道音频数据，最高数据传输速度为5Gbps。同时无需在信号传送前进行数/模或者模/数转换，可以保证最高质量的影音信号传送。</p>
<p><br />
HDMI不仅可以满足目前最高画质1080P的分辨率，还能支持DVD Audio等最先进的数字音频格式，支持八声道96kHz或立体声192kHz数码音频传送，而且只用一条HDMI线连接，免除数字音频接线。同时HDMI标准所具备的额外空间可以应用在日后升级的音视频格式中。足以应付一个1080p的视频和一个8声道的音频信号。而因为一个1080p的视频和一个8声道的音频信号需求少于4GB/s，因此HDMI还有很大余量。这允许它可以用一个电缆分别连接DVD播放器，接收器和PRR。此外HDMI支持EDID、DDC2B，因此具有HDMI的设备具有&ldquo;即插即用&rdquo;的特点，信号源和显示设备之间会自动进行&ldquo;协商&rdquo;，自动选择最合适的视频/音频格式。</p>
<p><br />
与DVI相比HDMI接口的体积更小，而且可同时传输音频及视频信号。DVI的线缆长度不能超过8米，否则将影响画面质量，而HDMI最远可传输15米。只要一条HDMI缆线，就可以取代最多13条模拟传输线，能有效解决家庭娱乐系统背后连线杂乱纠结的问题。</p>
<p><br />
优点： <br />
HDMI规格的接口在保持高品质的情况下能够以数码的形式传输未经压缩的高分辨率视频和多声道音频的数据。 其卓越性能超越了以往所有的产品。 <br />
HDMI规格的连接器采用单线连接，取代了产品背后的复杂的线缆。 <br />
采用HDMI规格接口的线缆没有长度的限制。比如：DVI的线缆长度不能超过8米，否则将影响画面质量，而符合HDMI规格的产品则没有这个问题。 <br />
HDMI规格可搭配宽带数字内容保护（HDCP），以防止具有著作权的影音内容遭到未经授权的复制。</p>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=73" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=73</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[真正的最新的IdeaPad Y530-PEI]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=21" label="电脑综合" /> 
	  <updated>2008-12-03T22:05:56+08:00</updated>
	  <published>2008-12-03T22:05:56+08:00</published>
		  <summary type="html"><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;最近非常看好IdeaPad的PEI&amp;PSE，这两款都配置了512M DDR2显存的 NV GeForce 9500M G 独立显卡、2G DDR3的内存、LED背光无边墨晶防护屏。<br/>不同的只是采用的分别是p8400和p7350的cpu、320GB和250GB的硬盘以及1000左右的差价。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;两天前刚在网上订购了pei这款笔记本，已经通过商户的确认了。晚上进入联想官方网站发现 Y530 又推出新品来吸引消费者了。原来的PSE和PEI更名为PSE(L)和PEI(L), L估计是Low的缩写，也就是成为低配版了。具体配置上，PSE的显卡从原来的 NV GeForce 9500M G 升级为 NV GeForce 9600M G、CPU从原来的P7350(2.00GHz)升级为P7450(2.13GHz，之前都没有见到过，不知道Intel是什么时候决定推出的这一款CPU的)，其他不变；PEI变化较大，CPU从原来的主频为2.26GHz的P8400升级为2.4GHz的P8600, 内存从原来的2GB DDR3(应该是2 * 1GB)升级为4GB DDR3（应该是2 * 2GB）；显卡同样从NV GeForce 9500M G 升级为 NV GeForce 9600M GS（两者最大的区别在于后者的流处理器数为32联合，比前者的16联合高出一倍，而核心频率、显存频率和显存带宽等参数，后者也略高过前者）；而价格上，现在的PEI(L)从原来的官方报价8999降为现在的8499，现在的PEI则刚好是原来的PEI的8999元（实际售价往往比网上此处的网上报价低很多，因为网站一般很少去更新，刚出来的时候报价会比较准确）。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;DELL的网上购物做得很出色，允许客户自行在网上配置电脑参数。从那里可以了解到，从2G内存升级到4G内存（DDR2）需要加价800元，CPU从P8400升级到P8600需要加价800，显卡我还没要找到。这样算下来，Y530-PEI的这次升级，在DELL那里至少需要加价1600元（因为显卡还没算进来）。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;其实这是一次通过提高配置的方式而进行的降价举动，从而继续保持Y530的生命力，和Intel所走的创新技术促进消费的路线类似。现在希望那边还没有发货，将订单取消掉，这样可以不用赔上100元的运送费（即使已经发货，我也要选择退货了，可怜的运送费啊！！！）。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;不过由于产品刚出来，还不能够在联想网站购买到新出的那几款，所以要等上几天才可以（按照上一段的计算，配上运费换现在的PEI也不亏，不幸中的大幸是，本本还没到我手上，还可以退掉）。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;有看好Y530-PEI的朋友看来最好也再等几天出手了，这样就可以买到真正的最新的IdeaPad Y530-PEI 了（应该很快就有售了）。]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=72" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=72</id>
  </entry>	
		
  <entry>
	  <title type="html"><![CDATA[特殊方法判断字符串长度是否为零引起的问题]]></title>
	  <author>
		 <name>shosh</name>
		 <uri>http://www.wscxy.com/shosh/</uri>
		 <email>shosh.zhu@qisda.com</email>
	  </author>
	  <category term="" scheme="http://www.wscxy.com/shosh/default.asp?cateID=19" label="代码应用" /> 
	  <updated>2008-11-26T23:13:20+08:00</updated>
	  <published>2008-11-26T23:13:20+08:00</published>
		  <summary type="html"><![CDATA[<div>　　最近在做EVB的Porting,碰到了不少问题。最近碰到的问题是：刚把software load到EVB上去第一次开机的时候，可以顺利的开机进入MMI的各种Applet，可以在屏幕上看到各个Form的画面；不过之后关机后重新开机，各个开机必须跑的applet还是能够正常跑到，Form也能够正常创建，并成功push到rootform中去，但是屏幕上就是见不到有Form显示出来。目前已经经过多方确认第一次开机和之后的第n次开机，开机的流程是一样的，而因为第一次开机的时候一切正常，说明硬件方面也是没有问题的，但是手机里会有一些配置信息，applet可以读取或着写入，他们就是一些Item（variant的一部分），我们成为NV Item（NV就是非易失性的意思），使用IQConfig接口读写的，和windows的ini配置文件或注册表类似。按照如此的判断，第一次开机和之后开机比较可能引起差异的地方便是这些配置信息了，但是目前没有一款tool可以将手机或EVB上的NV Item快速导入到一个或几个文件中，所以今天写了下面的代码，让SetItem或GetItem的时候调用我写的那个函数，将写入或读出的数据、Item的ID和类型按照一定的格式写入到特定的文件中。</div>
<div>&nbsp;</div>
<div>
<div id="shoCodeAreaWscxy">
<ol id="shoCodeMain38ID" style="border-right: gray 1px solid; padding-right: 2px; border-top: gray 1px solid; padding-left: 2px; padding-bottom: 2px; margin: 0px; border-left: gray 1px solid; color: #2f4f4f; word-break: break-all; padding-top: 2px; border-bottom: gray 1px solid; font-family: Courier New; list-style-type: decimal; background-color: #dcf5dc">
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">#define</font>&nbsp;SETITEMFILE&nbsp;<font color="#800000">&quot;fs:/mod/setitem%d.dat&quot;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">#define</font>&nbsp;GETITEMFILE&nbsp;<font color="#800000">&quot;fs:/mod/getitem%d.dat&quot;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">#define</font>&nbsp;MAXPATHLEN&nbsp;<font color="#ff0000">30</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">char</font>&nbsp;pGetFile<font color="#800080"><b>[</b></font>MAXPATHLEN<font color="#800080"><b>]</b></font>&nbsp;<font color="#4b0082">=</font>&nbsp;<font color="#800080"><b>{</b></font><font color="#ff0000">0</font><font color="#800080"><b>}</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">char</font>&nbsp;pSetFile<font color="#800080"><b>[</b></font>MAXPATHLEN<font color="#800080"><b>]</b></font>&nbsp;<font color="#4b0082">=</font>&nbsp;<font color="#800080"><b>{</b></font><font color="#ff0000">0</font><font color="#800080"><b>}</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">char</font><font color="#4b0082">*</font>&nbsp;pSep&nbsp;<font color="#4b0082">=</font>&nbsp;<font color="#800000">&quot;\r\n\r\n[%s:%d]---------------------size&nbsp;=&nbsp;%d:\r\n&quot;</font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">#ifndef</font>&nbsp;RELEASEIF</span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">#define</font>&nbsp;RELEASEIF<font color="#800080"><b>(</b></font>p<font color="#800080"><b>)</b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">if</font>&nbsp;<font color="#800080"><b>(</b></font>p<font color="#800080"><b>)</b></font>&nbsp;<font color="#800080"><b>{</b></font>&nbsp;IBASE_Release<font color="#800080"><b>((</b></font>IBase<font color="#4b0082">*</font><font color="#800080"><b>)(</b></font>p<font color="#800080"><b>))</b></font><font color="#4b0082">;</font>&nbsp;<font color="#800080"><b>(</b></font>p<font color="#800080"><b>)</b></font>&nbsp;<font color="#4b0082">=</font>&nbsp;NULL<font color="#4b0082">;</font>&nbsp;<font color="#800080"><b>}</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">#endif</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#0000ff">static</font>&nbsp;<font color="#0000ff">int</font>&nbsp;WriteItemToFile<font color="#800080"><b>(</b></font>boolean&nbsp;bSetItem<font color="#4b0082">,</font>&nbsp;uint32&nbsp;itemID<font color="#4b0082">,</font>&nbsp;<font color="#0000ff">char</font>&nbsp;<font color="#4b0082">*</font>pType<font color="#4b0082">,</font>&nbsp;<font color="#0000ff">void</font>&nbsp;<font color="#4b0082">*</font>pData<font color="#4b0082">,</font>&nbsp;<font color="#0000ff">int</font>&nbsp;length<font color="#800080"><b>)</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#800080"><b>{</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;IShell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#4b0082">*</font>pIShell&nbsp;<font color="#4b0082">=</font>&nbsp;AEE_GetShell<font color="#800080"><b>()</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;IFile&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#4b0082">*</font>pIFile&nbsp;<font color="#4b0082">=</font>&nbsp;NULL<font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;IFileMgr&nbsp;&nbsp;&nbsp;&nbsp;<font color="#4b0082">*</font>pIFileMgr&nbsp;<font color="#4b0082">=</font>&nbsp;NULL<font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">char</font><font color="#4b0082">*</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pFilePath&nbsp;<font color="#4b0082">=</font>&nbsp;NULL<font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">char</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tempData<font color="#800080"><b>[</b></font><font color="#ff0000">100</font><font color="#800080"><b>]</b></font>&nbsp;<font color="#4b0082">=</font>&nbsp;<font color="#800080"><b>{</b></font><font color="#ff0000">0</font><font color="#800080"><b>}</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">do</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>{</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pFilePath&nbsp;<font color="#4b0082">=</font>&nbsp;bSetItem&nbsp;<font color="#4b0082">?</font>&nbsp;pSetFile&nbsp;<font color="#4b0082">:</font>&nbsp;pGetFile<font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#008000">//&nbsp;Create&nbsp;File&nbsp;Manager</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ISHELL_CreateInstance<font color="#800080"><b>(</b></font>pIShell<font color="#4b0082">,</font>&nbsp;AEECLSID_FILEMGR<font color="#4b0082">,</font>&nbsp;<font color="#800080"><b>(</b></font><font color="#0000ff">void</font>&nbsp;<font color="#4b0082">**</font><font color="#800080"><b>)</b></font><font color="#4b0082">&amp;</font>pIFileMgr<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">if</font>&nbsp;<font color="#800080"><b>(</b></font>NULL&nbsp;<font color="#4b0082">==</font>&nbsp;pIFileMgr<font color="#800080"><b>)</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">return</font>&nbsp;EFAILED<font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">if</font>&nbsp;<font color="#800080"><b>(</b></font><font color="#ff0000">0</font>&nbsp;<font color="#4b0082">==</font>&nbsp;<font color="#4b0082">*</font><font color="#800080"><b>(</b></font><font color="#0000ff">int</font><font color="#4b0082">*</font><font color="#800080"><b>)</b></font>pFilePath<font color="#800080"><b>)</b></font>&nbsp;<font color="#008000">//the&nbsp;same&nbsp;as&nbsp;0&nbsp;==&nbsp;STRLEN(pFilePath)</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>{</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">int</font>&nbsp;i&nbsp;<font color="#4b0082">=</font>&nbsp;<font color="#ff0000">0</font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">while</font>&nbsp;<font color="#800080"><b>(</b></font>i<font color="#4b0082">++</font>&nbsp;<font color="#4b0082">&lt;</font>&nbsp;<font color="#ff0000">10</font><font color="#800080"><b>)</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>{</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SPRINTF<font color="#800080"><b>(</b></font>tempData<font color="#4b0082">,</font>&nbsp;<font color="#800080"><b>(</b></font><font color="#0000ff">const</font>&nbsp;<font color="#0000ff">char</font><font color="#4b0082">*</font><font color="#800080"><b>)(</b></font>bSetItem&nbsp;<font color="#4b0082">?</font>&nbsp;SETITEMFILE&nbsp;<font color="#4b0082">:</font>&nbsp;GETITEMFILE<font color="#800080"><b>)</b></font><font color="#4b0082">,</font>&nbsp;i<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#008000">//not&nbsp;there,so&nbsp;we&nbsp;can&nbsp;create&nbsp;it</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">if</font><font color="#800080"><b>(</b></font>SUCCESS&nbsp;<font color="#4b0082">!=</font>&nbsp;IFILEMGR_Test<font color="#800080"><b>(</b></font>pIFileMgr<font color="#4b0082">,</font>&nbsp;<font color="#800080"><b>(</b></font><font color="#0000ff">const</font>&nbsp;<font color="#0000ff">char</font>&nbsp;<font color="#4b0082">*</font><font color="#800080"><b>)</b></font>tempData<font color="#800080"><b>))</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>{</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DBGPRINTF<font color="#800080"><b>(</b></font><font color="#800000">&quot;%s&quot;</font><font color="#4b0082">,</font>&nbsp;tempData<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pIFile&nbsp;<font color="#4b0082">=</font>&nbsp;IFILEMGR_OpenFile<font color="#800080"><b>(</b></font>pIFileMgr<font color="#4b0082">,</font>&nbsp;tempData<font color="#4b0082">,</font>&nbsp;_OFM_Create<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">if</font>&nbsp;<font color="#800080"><b>(</b></font>NULL&nbsp;<font color="#4b0082">!=</font>&nbsp;pIFile<font color="#800080"><b>)</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>{</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;STRNCPY<font color="#800080"><b>(</b></font>pFilePath<font color="#4b0082">,</font>&nbsp;tempData<font color="#4b0082">,</font>&nbsp;MAXPATHLEN<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RELEASEIF<font color="#800080"><b>(</b></font>pIFile<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>}</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">break</font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>}</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>}</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">if</font>&nbsp;<font color="#800080"><b>(</b></font><font color="#ff0000">0</font>&nbsp;<font color="#4b0082">==</font>&nbsp;<font color="#4b0082">*</font><font color="#800080"><b>(</b></font><font color="#0000ff">int</font><font color="#4b0082">*</font><font color="#800080"><b>)</b></font>pFilePath<font color="#800080"><b>)</b></font>&nbsp;<font color="#008000">//the&nbsp;same&nbsp;as&nbsp;0&nbsp;==&nbsp;STRLEN(pFilePath)</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>{</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">return</font>&nbsp;EFAILED<font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>}</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>}</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#008000">//start&nbsp;to&nbsp;write&nbsp;to&nbsp;the&nbsp;file</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pIFile&nbsp;<font color="#4b0082">=</font>&nbsp;IFILEMGR_OpenFile<font color="#800080"><b>(</b></font>pIFileMgr<font color="#4b0082">,</font>&nbsp;pFilePath<font color="#4b0082">,</font>&nbsp;_OFM_APPEND<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">if</font>&nbsp;<font color="#800080"><b>(</b></font>NULL&nbsp;<font color="#4b0082">==</font>&nbsp;pIFile<font color="#800080"><b>)</b></font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">break</font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SPRINTF<font color="#800080"><b>(</b></font>tempData<font color="#4b0082">,</font>&nbsp;pSep<font color="#4b0082">,</font>&nbsp;pType<font color="#4b0082">,</font>&nbsp;itemID<font color="#4b0082">,</font>&nbsp;length<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IFILE_Write<font color="#800080"><b>(</b></font>pIFile<font color="#4b0082">,</font>&nbsp;tempData<font color="#4b0082">,</font>&nbsp;STRLEN<font color="#800080"><b>(</b></font>tempData<font color="#800080"><b>))</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IFILE_Write<font color="#800080"><b>(</b></font>pIFile<font color="#4b0082">,</font>&nbsp;pData<font color="#4b0082">,</font>&nbsp;length<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;<font color="#800080"><b>}</b></font>&nbsp;<font color="#0000ff">while</font><font color="#800080"><b>(</b></font><font color="#ff0000">0</font><font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;</span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;RELEASEIF<font color="#800080"><b>(</b></font>pIFile<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;RELEASEIF<font color="#800080"><b>(</b></font>pIFileMgr<font color="#800080"><b>)</b></font><font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black">&nbsp;&nbsp;&nbsp;&nbsp;<font color="#0000ff">return</font>&nbsp;SUCCESS<font color="#4b0082">;</font></span></li>
    <li style="padding-left: 6px; margin: 0px 0px 0px 50px; border-left: silver 2px ridge; line-height: 18px; background-color: #f5fffa"><span style="color: black"><font color="#800080"><b>}</b></font>&nbsp;</span></li>
</ol>
</div>
</div>
<div>&nbsp;</div>
<div>　　因为每次开机都会生成一个读取的item数据文件和写入的item数据文件（要开机到一定程度，不是刚开就关），从上面的28行代码可以看出，一共可以支持10次以内的开机记录。在PC上使用simulator调试，也确实可以很正常的工作。不过在EVB上，发现会导致宕机，宕机的原因在Trace32上可以看到是由于第25行导致的。</div>
<div>&nbsp;</div>
<div>　　这里说一下第25行的目的，意思是要检测pFilePath的内容（实际对应全局变量<span style="color: black"><font color="#0000ff">char</font>&nbsp;pGetFile<font color="#800080"><b>[</b></font>MAXPATHLEN<font color="#800080"><strong>]</strong></font></span>或<span style="color: black"><font color="#0000ff">char</font>&nbsp;pSetFile<font color="#800080"><strong>[</strong></font>MAXPATHLEN<font color="#800080"><strong>]</strong></font></span>）不是空字符串。正常的做法正如注释所注，使用<font color="#008000"><span style="color: black">0&nbsp;<font color="#4b0082">==</font>&nbsp;STRLEN<font color="#4b0082"><b>(</b></font>pFilePath<font color="#4b0082"><strong>)</strong></font></span></font>的，不过当时觉得这样做的效率不高，所以使用了另一种做法，也就是现在的做法：<span style="color: black"><font color="#0000ff">if</font>&nbsp;<font color="#800080"><b>(</b></font><font color="#ff0000">0</font>&nbsp;<font color="#4b0082">==</font>&nbsp;<font color="#4b0082">*</font><font color="#800080"><b>(</b></font><font color="#0000ff">int</font><font color="#4b0082">*</font><font color="#800080"><b>)</b></font>pFilePath<font color="#800080"><strong>)</strong></font></span>，他会检测前面sizeof(int)个字节的内容是否都是0，如果都是0，则说明该字符串是空字符串，需要创建文件，否则不需要。虽然他在PC上跑得很正常，但是在EVB上，却宕掉了。</div>
<div>&nbsp;</div>
<div><span style="color: black">　　谁能够给我解释他宕机的原因？</span></div>
<div>&nbsp;</div>
<div>　　顺便简单介绍一下这个函数：这个函数每次在GetItem或SetItem的时候都会调用到，该函数会将相关的数据写到特定的文件上。</div>
<blockquote dir="ltr" style="margin-right: 0px">
<div>boolean&nbsp;bSetItem<font color="#4b0082">, 表明本次是在GetItem还是SetItem时调用的</font></div>
<div>uint32&nbsp;itemID<font color="#4b0082">, 当前GetItem或SetItem的Item的ID值</font></div>
</blockquote><blockquote>
<div><font color="#0000ff">char</font>&nbsp;<font color="#4b0082">*</font>pType<font color="#4b0082">,&nbsp;当前Item的类型（分为好几种类型的，比如Flash Item/EFS Item/NV Item等）</font></div>
</blockquote><blockquote dir="ltr" style="margin-right: 0px">
<div><font color="#0000ff">void</font>&nbsp;<font color="#4b0082">*</font>pData<font color="#4b0082">, 当前设置到Item或从Item得到的数据，可以是各种类型（包括复杂的结构体类型，也包括简单的字符串、布尔值、整型等）</font></div>
<div><font color="#0000ff">int</font>&nbsp;length<font color="#4b0082">, pData的字节数</font></div>
</blockquote>
<div>　　代码第四行<span style="color: black"><font color="#0000ff">char</font>&nbsp;pGetFile<font color="#800080"><b>[</b></font>MAXPATHLEN<font color="#800080"><b>]</b></font>&nbsp;<font color="#4b0082">=</font>&nbsp;<font color="#800080"><b>{</b></font><font color="#ff0000">0</font><font color="#800080"><b>}</b></font><font color="#4b0082">;</font></span>用来存放当前GetItem的时候需要将数据写入的文件完整路径。</div>
<div>　　代码第五行<span style="color: black"><font color="#0000ff">char</font>&nbsp;pSetFile<font color="#800080"><b>[</b></font>MAXPATHLEN<font color="#800080"><b>]</b></font>&nbsp;<font color="#4b0082">=</font>&nbsp;<font color="#800080"><b>{</b></font><font color="#ff0000">0</font><font color="#800080"><b>}</b></font><font color="#4b0082">;</font></span>用来存放当前SetItem的时候需要将数据写入的文件完整路径。</div>
<div>　　在有需要将Item数据保存到文件的时候，对应地通过判断这两个变量是否已经保存有路径信息（只要strlen()&gt; 0就说明有路径信息了），直接将数据保存到对应的文件即可，否则会在代码26-48行去创建新的文件。代码第28行规定了EFS中这类文件的最大个数。</div>
<div>　　代码第51行到56行将数据写入到对应的文件中去，其中第6行的<span style="color: black"><font color="#0000ff">char</font><font color="#4b0082">*</font>&nbsp;pSep&nbsp;<font color="#4b0082">=</font>&nbsp;<font color="#800000">&quot;\r\n\r\n[%s:%d]---------------------size&nbsp;=&nbsp;%d:\r\n&quot;</font><font color="#4b0082">;</font></span>规定了Item数据之间的格式。</div>
<div>　　56行纯粹地将读到的Item的数据写入到文件（这部分可能是无法用文本编辑器看到的，除非刚好是字符串数据）。</div>
<div>　　60行将打开的文件关闭。其他地方打开文件之后都会使用Close，这里只需要将pIFile release掉即可。</div>]]></summary>
	  <link rel="alternate" type="text/html" href="http://www.wscxy.com/shosh/article.asp?id=71" /> 
	  <id>http://www.wscxy.com/shosh/default.asp?id=71</id>
  </entry>	
		
</feed>
