⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 binding2.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title>    Writing Socket Component Drivers and MTDs   </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a></a><a href="binding.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="binding1.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="binding3.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="101649">3.2  &nbsp;&nbsp;About the <b class="symbol_lc">FLFlash</b> and <b class="symbol_lc">FLSocket</b> Structures </a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="92410"> </a>TrueFFS for Tornado is designed to handle a maximum of five TrueFFS block devices. Internally, TrueFFS allocates an <b class="symbol_lc">FLFlash </b>structure and an <b class="symbol_lc">FLSocket</b> structure for each of the five possible flash devices. The initialization of these structures starts with the registration of your socket component driver functions with TrueFFS. </p><dd><p class="Body"><a name="101490"> </a>For the most part, this registration updates the <b class="symbol_lc">FLSocket</b> structure referenced by the <b class="symbol_lc">socket</b> member of <b class="symbol_lc">FLFlash</b>. The initialization of the <b class="symbol_lc">FLFlash</b> structure is completed by running an MTD identify routine. Because this identify routine depends on functions referenced in the <b class="symbol_lc">FLSocket</b> structure, you must install your socket component driver before you can run an MTD identify routine. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="92415">3.2.1  &nbsp;&nbsp;<b class="symbol_lc">FLFlash</b> </a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="94134"> </a>Almost all members of the <b class="symbol_lc">FLFlash</b> structure are set by the MTD identify routine, which gets most of the data it needs by probing the flash hardware. The only exception is the <b class="symbol_lc">socket</b> member, which is set by functions internal to TrueFFS. The <b class="symbol_lc">FLFlash </b>structure is defined in <b class="file">h/tffs/flflash.h</b> as follows:<sup><a href="#foot"><b class="FootnoteMarker">1</b></a></sup></p><dl class="margin"><dd><pre class="Code2"><b><a name="101506">typedef&nbsp;struct&nbsp;tFlash&nbsp;FLFlash;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;forward&nbsp;definition&nbsp;*/ struct&nbsp;tFlash&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;FlashType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;flash&nbsp;device&nbsp;type&nbsp;(JEDEC&nbsp;id)&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;long&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;erasableBlockSize;&nbsp;&nbsp;/*&nbsp;smallest&nbsp;erasable&nbsp;area&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;long&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;chipSize;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;chip&nbsp;size&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;noOfChips;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;no.&nbsp;of&nbsp;chips&nbsp;in&nbsp;array&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interleaving;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;chip&nbsp;interleaving&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flags;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;special&nbsp;options&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;void&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mtdVars;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;MTD&nbsp;private&nbsp;area&nbsp;for&nbsp;socket&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;FLSocket&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;socket;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;FLSocket&nbsp;for&nbsp;this&nbsp;drive&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;MTD-supplied&nbsp;flash&nbsp;map&nbsp;function&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;void&nbsp;FAR0&nbsp;*&nbsp;(*map)(FLFlash&nbsp;*,&nbsp;CardAddress,&nbsp;int); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;MTD-supplied&nbsp;flash&nbsp;read&nbsp;function&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;FLStatus&nbsp;&nbsp;&nbsp;&nbsp;(*read)(FLFlash&nbsp;*,&nbsp;CardAddress,&nbsp;void&nbsp;FAR1&nbsp;*,&nbsp;int,&nbsp;int); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;MTD-supplied&nbsp;flash&nbsp;write&nbsp;function&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;FLStatus&nbsp;&nbsp;&nbsp;&nbsp;(*write)(FLFlash&nbsp;*,CardAddress,const&nbsp;void&nbsp;FAR1&nbsp;*,int,int) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;MTD-supplied&nbsp;flash&nbsp;erase&nbsp;function&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;FLStatus&nbsp;&nbsp;&nbsp;&nbsp;(*erase)(FLFlash&nbsp;*,&nbsp;int,&nbsp;int); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;callback&nbsp;to&nbsp;execute&nbsp;after&nbsp;power&nbsp;up&nbsp;*/ &nbsp;&nbsp;&nbsp;&nbsp;void&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(*setPowerOnCallback)(FLFlash&nbsp;*); };</a></b></pre></dl></dl><dl class="margin"><dd><div class="Item"><a name="93277"> </a><b class="symbol_lc">type</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="94106"> </a>The JEDEC ID for the flash memory hardware. This member is set by the MTD's identification routine. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93303"> </a><b class="symbol_lc">erasableBlockSize <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="94120"> </a>The size, in bytes, of an erase block for the attached flash memory hardware. This value takes interleaving into account. Thus, when setting this value in an MTD, the code is often of the form:</div><br><dd><div class="Indent4"><a name="95525"> </a><tt class="output">vol.erasableBlockSize = </tt><i class="textVariable">aValue</i><tt class="output"> * vol.interleaving;</tt></div><br><dd><div class="Indent4"><a name="95531"> </a>Where <i class="textVariable">aValue</i> is the erasable block size of a flash chip that is not interleaved with another. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="94121"> </a><b class="symbol_lc">chipSize</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="93317"> </a>The size (storage capacity), in bytes, of one of the flash memory chips used to construct the flash memory array. Set by the MTD using your <b class="routine"><i class="routine">flFitInSocketWindow</i></b><b>(&nbsp;)</b> global routine. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93510"> </a><b class="symbol_lc">noOfChips</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="94550"> </a>The number of flash memory chips used to construct the flash memory array. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="94551"> </a><b class="symbol_lc">interleaving</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="94552"> </a>The interleaving factor of the flash memory array. This must be a power of 2 (for example, 1, 2, 4). The interleaving is defined as the address difference on the media of two consecutive bytes on a chip. For most PCMCIA cards the interleaving is 2.</div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93379"> </a><b class="symbol_lc">flags</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="95226"> </a>Bits 0-7 are reserved for the use of TrueFFS (it uses these flags to track things such as the volume mount state). Bits 8-15 are reserved for the use of the MTDs. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93399"> </a><b class="symbol_lc">mtdVars</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="95364"> </a>This field, if used by the MTD, is initialized by the MTD identification routine to point to a private storage area. For example, the WRS-supplied MTD for the 16-bit AMD devices uses this member to store a pointer to an area containing AMD-specific flash parameters. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93417"> </a><b class="symbol_lc">socket</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="93420"> </a>A pointer to the <b class="symbol_lc">FLSocket</b> structure for this hardware device. This structure contains data and pointers to the socket layer functions that TrueFFS needs to manage the board interface for the flash memory hardware. The functions referenced in this structure are installed when you register your socket component driver. Further, because TrueFFS uses these socket component driver functions to access the flash memory hardware, you must register your socket component driver before you try to run the MTD identify routine that initializes the bulk of this structure. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93431"> </a><b class="symbol_lc">map</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="93433"> </a>A pointer to the flash memory map function, the function that maps flash into an area of memory. Internally, TrueFFS initializes this member to point to a default map function appropriate for all NOR (linear) flash memory types. This default routine maps flash memory through simple socket mapping. NAND or other type Flash should replace this pointer to the default routine with a reference to a routine that uses map-through-copy emulation. For more information on this function, see <a href="binding4.html#100024"><i class="title">3.4.2&nbsp;Writing a Map Function for an MTD</i></a>. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93432"> </a><b class="symbol_lc">read</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="93434"> </a>A pointer to the flash memory read function. On entry to the MTD identification routine, this member has already been initialized to point to a default read function that is appropriate for all NOR (linear) flash memory types. This routine reads from flash memory by copying from a mapped window. If this is appropriate for your flash device, leave <b class="symbol_lc">read </b>unchanged. Otherwise, the MTD identify routine should update this member to point to a more appropriate function. For more information on this function, see <a href="binding4.html#100209"><i class="title">3.4.3&nbsp;Writing a Read Function for an MTD</i></a>. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93435"> </a><b class="symbol_lc">write</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="93436"> </a>A pointer to the flash memory write function. Because of the dangers associated with an inappropriate write function, the default routine for this member returns a write-protect error. The MTD identification routine must supply an appropriate function pointer for this member. For more information on this function, see <a href="binding4.html#100542"><i class="title">3.4.4&nbsp;Writing Write and Erase Functions for an MTD</i></a>. </div><br></dl></dl></dl></dl><dd><div class="Item"><a name="93444"> </a><b class="symbol_lc">erase</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="94182"> </a>A pointer to the flash memory erase function. Because of the dangers associated with an inappropriate erase function, the default routine for this member returns a write-protect error. The MTD identification routine must supply an appropriate function pointer for this member. For more information on this function, see <a href="binding4.html#100542"><i class="title">3.4.4&nbsp;Writing Write and Erase Functions for an MTD</i></a>. </div><br></dl></dl></dl>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -