📄 binding1.html
字号:
<!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="binding.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="binding2.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="101547">3.1 Introduction </a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="101616"> </a>The purpose of this chapter is to provide you with a description of the interface between your flash memory hardware, TrueFFS for Tornado, and VxWorks. Thus, this chapter describes all the standard functions and structures essential to a socket component driver and an MTD. The two structures that are your main concern are the <b class="symbol_lc">FLFlash</b> structure and the <b class="symbol_lc">FLSocket</b> structure. </p><dd><p class="Body"><a name="92258"> </a>Internally, TrueFFS for Tornado allocates an array containing five <b class="symbol_lc">FLFlash</b> structures, one for each possible flash device. TrueFFS uses the <b class="symbol_lc">FLFlash</b> structure to store the data and function pointers it needs to manage the flash device. For example, it is the <b class="symbol_lc">FLFlash</b> structure that contains the MTD function pointers that TrueFFS uses to handle the low-level details of reading and writing the flash medium. These function pointers are installed by running an MTD identify routine. </p><dd><p class="Body"><a name="102078"> </a>The <b class="symbol_lc">FLFlash</b> structure also contains a pointer to an <b class="symbol_lc">FLSocket</b> structure. TrueFFS uses this <b class="symbol_lc">FLSocket</b> structure to store the data and function pointers it uses to handle the hardware (socket) interface to the flash device. These functions are installed by calls from your <b class="routine"><i class="routine">sysTffsInit</i></b><b>( )</b> to the <i class="textVariable">xxx</i><b class="routine"><i class="routine">Register</i></b><b>( )</b> routines. </p></dl></dl><dl class="margin"><dd><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><a name="102086"><br></a><img border="0" alt="*" src="icons/note.gif"> </td><td><div class="Note"><hr><b class="symbol_UC">NOTE: </b>TrueFFS for Tornado ships with a set of MTDs that supports a wide variety of flash devices. Thus, it is likely that you do not need to write your own MTD, although you are always free to do so. For a list of the flash devices currently supported, see <a href="binding5.html#101310"><i class="title">3.5 MTD-Supported Flash Devices</i></a>. <hr></div></td></tr></table></dl><dl class="margin"><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="88181">Registering Your Socket Component Driver with TrueFFS </a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="88293"> </a>Including TrueFFS in VxWorks configures <b class="routine"><i class="routine">usrRoot</i></b><b>( )</b> to call <b class="routine"><i class="routine">tffsDrv</i></b><b>( )</b>. This starts the chain of function calls shown in <a href="binding1.html#92117">Figure 3-1</a>. One of the goals of these function calls is to register the functions of your socket component driver with TrueFFS. </p><dd><p class="Body"><a name="92387"> </a>For the most part, the bulk of the work takes place in <i class="textVariable">xxx</i><b class="routine"><i class="routine">Register</i></b><b>( )</b>, a function defined in <b class="file">sysTffs.c</b>. The <i class="textVariable">xxx</i><b class="routine"><i class="routine">Register</i></b><b>( )</b>function updates the <b class="symbol_lc">FLSocket </b>structure that TrueFFS has assigned to a drive number (volume) with references to the socket services available in the socket component driver. TrueFFS calls the functions referenced in the <b class="symbol_lc">FLSocket</b> structure to handle the hardware interface to the flash device. <div class="frame"><h4 class="EntityTitle"><a name="92117"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 3-1: Registering a Socket Component Driver </font></a></h4><dl class="margin"><div class="Anchor"><a name="92140"> </a><img class="figure" border="0" src="images/binding0.gif"></div></dl></div> </p></dl><dd><font face="Helvetica, sans-serif" size="-1" class="sans"><h5 class="HU"><i><a name="92147">Identifying an MTD for the Flash Technology </a></i></h5></font><dl class="margin"><dd><p class="Body"><a name="92071"> </a>To create a TrueFFS block device, you must call <b class="routine"><i class="routine">tffsDevCreate</i></b><b>( )</b>. Internally, the call to <b class="routine"><i class="routine">tffsDevCreate</i></b><b>( )</b> gives rise to the chain of function calls shown in <a href="binding1.html#92342">Figure 3-2</a>. One of the goals of these function calls is the identification of the MTD appropriate to the flash technology. This identification takes place in <b class="routine"><i class="routine">flIdentifyFlash</i></b><b>( )</b>. This function steps through a table of <i class="textVariable">xxx</i><b class="routine"><i class="routine">Identify</i></b><b>( )</b> routines, executing each routine until one succeeds. <sup><a href="#foot"><b class="FootnoteMarker">1</b></a></sup></p><dd><p class="Body"><a name="92386"> </a>Upon success, the identify routine updates the <b class="symbol_lc">FLFlash</b> structure with data and pointers to the MTDs routines for reading, writing, erasing, and mapping the flash media. Identification also completes the initialization of the <b class="symbol_lc">FLSocket</b> structure referenced within this <b class="symbol_lc">FLFlash</b> structure. <div class="frame"><h4 class="EntityTitle"><a name="92342"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 3-2: Identifying an MTD </font></a></h4><dl class="margin"><div class="Anchor"><a name="92368"> </a><img class="figure" border="0" src="images/bindinga1.gif"></div></dl></div> </p></dl></dl><dl class="margin"><dd><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><a name="88217"><br></a><img border="0" alt="*" src="icons/note.gif"> </td><td><div class="Note"><hr><b class="symbol_UC">NOTE: </b>Included with TrueFFS for Tornado are sources for several MTDs and socket component drivers. The MTDs are in <b class="file">target/src/drv/tffs</b>. The socket component drivers are defined in the <b class="file">sysTffs.c</b> files provided in the <b class="file">target/config/</b><i class="textVariable">bspname</i> directory for each BSP that supports TrueFFS. <hr></div></td></tr></table></dl><a name="foot"><hr></a><p class="FootnoteNumberMarker">1: <span class="Footnote"><a name="102205"> </a>The same MTD could be simultaneously active on multiple flash volumes. </span><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="binding.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="binding2.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -