📄 binding2.html
字号:
</dl><dd><div class="Item"><a name="93445"> </a><b class="symbol_lc">setPowerOnCallback <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent4"><a name="97020"> </a>A pointer to the function TrueFFS should execute after the flash hardware device powers up. TrueFFS calls this routine when it tries to mount a flash device. Do not confuse this member of <b class="symbol_lc">FLFlash</b> with the <b class="symbol_lc">powerOnCallback</b> member of the <b class="symbol_lc">FLSocket</b> structure. For many flash memory devices, no such function is necessary. However, this member is used by the MTD defined in <b class="file">target/src/drv/tffs/nfdc2048.c</b>. </div><br></dl></dl></dl></dl></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="97022">3.2.2 <b class="symbol_lc">FLSocket</b> </a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="91208"> </a>As a writer of a socket component driver, your primary concern is the initialization of an <b class="symbol_lc">FLSocket</b> structure. This structure provides TrueFFS with pointers to the functions that you have written to handle the interface with the flash hardware. For the most part, the specifics of how you implement these functions are rather hardware specific. </p><dd><p class="Body"><a name="101509"> </a>When relevant, the member descriptions point out WRS-supplied BSPs that you can use as examples. However, your greatest asset in this situation is your intimate knowledge of your particular hardware. The <b class="symbol_lc">FLSocket</b> structure is defined in <b class="file">h/tffs/flsocket.h</b> as follows: </p></dl><dl class="margin"><dd><pre class="Code"><b><a name="86421">typedef struct tSocket FLSocket; /* forward definition */ struct tSocket { unsigned volNo; /* volume no. of socket */ unsigned serialNo; /* serial no. of socket on controller */ FLBoolean cardChanged; /* need media change notification */ int VccUsers; /* no. of current VCC users */ int VppUsers; /* No. of current VPP users */ PowerState VccState; /* actual VCC state */ PowerState VppState; /* actual VPP state */ FLBoolean remapped; /* set to TRUE if the socket window is moved */ void (*powerOnCallback)(void *flash); /* notification routine for Vcc on */ void * flash; /* flash object for callback */ struct { /* window state */ unsigned int baseAddress; /* physical base as a 4K page */ unsigned int currentPage; /* our current window page mapping */ void FAR0 * base; /* pointer to window base */ long int size; /* window size (must by power of 2) */ unsigned speed; /* in nsec. */ unsigned busWidth; /* 8 or 16 bits */ } window; FLBoolean (*cardDetected)(FLSocket vol); void (*VccOn)(FLSocket vol); void (*VccOff)(FLSocket vol); #ifdef SOCKET_12_VOLTS FLStatus (*VppOn)(FLSocket vol); void (*VppOff)(FLSocket vol); #endif /* SOCKET_12_VOLTS */ FLStatus (*initSocket)(FLSocket vol); void (*setWindow)(FLSocket vol); void (*setMappingContext)(FLSocket vol, unsigned page); FLBoolean (*getAndClearCardChangeIndicator)(FLSocket vol); FLBoolean (*writeProtected)(FLSocket vol); #ifdef EXIT void (*freeSocket)(FLSocket vol); #endif };</a></b></pre></dl></dl><dl class="margin"><dd><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><a name="100860"><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 always defines both <b class="symbol_UC">SOCKET_12_VOLTS</b> and <b class="symbol_UC">EXIT</b>. Thus, all the members shown above are always included in the TrueFFS for Tornado version of this structure. <hr></div></td></tr></table><dl class="margin"><dd><div class="Item"><a name="86685"> </a><b class="symbol_lc">volNo</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="87791"> </a>For internal use. Do not change the value of this member except through an MTD identification routine. This member stores the volume number (drive number) associated with this socket component driver. Each socket component is assigned a driver number based on its order of registration. Thus, the first driver to register itself is assigned a 0, the second is assigned a 1, and so on up to 4. If you are using PCMCIA slots to add flash memory cards to your system, TrueFFS for Tornado creates a unique driver for each slot. Thus, each slot has its own <b class="symbol_lc">volNo</b>. </><br></dl></dl></dl><dd><div class="Item"><a name="86689"> </a><b class="symbol_lc">serialNo</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="91250"> </a>A free-use member. This member is not used by any function internal to TrueFFS and is typically set to zero. Its name implies that it was intended as a convenient place to store the serial number associated with the flash device. Thus, you are free, for the most part, to use this member as you see fit. For example, the PCIC driver supplied with some WRS BSPs use this member to store slot numbers (0 and 1). </><br></dl></dl></dl><dd><div class="Item"><a name="87751"> </a><b class="symbol_lc">cardChanged <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="97988"> </a>The intended purpose of this member is to track whether there was a change of flash card. To detect a change of card, TrueFFS polls the card every 100 milliseconds by calling the function you specify in the <b class="symbol_lc">cardDetected</b> member of this structure. If that function returns FALSE, TrueFFS sets this member to TRUE. This member is also set by the function referenced in <b class="symbol_lc">getAndClearCardChangeIndicator</b>. </><br><dd><div class="Indent3"><a name="97996"> </a>For non-removable flash media, this member should always be set to FALSE. If this member is TRUE, when TrueFFS tries to access flash, it triggers a remount for the flash device. </><br></dl></dl></dl><dd><div class="Item"><a name="91265"> </a><b class="symbol_lc">VccUsers</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="91270"> </a>For internal use. Do not change the value of this member. Each call to <b class="routine"><i class="routine">flNeedVcc</i></b><b>( )</b> increments this counter internally in TrueFFS. The 100 millisecond timer routine uses this counter to verify that it is safe to call the <b class="routine"><i class="routine">VccOff</i></b><b>( )</b> routine in the socket driver.</><br></dl></dl></dl><dd><div class="Item"><a name="86698"> </a><b class="symbol_lc">VppUsers</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="86699"> </a>For internal use. Do not change the value of this member. Each call to <b class="routine"><i class="routine">flNeedVpp</i></b><b>( )</b> increments this counter internally in TrueFFS. The 100 millisecond timer routine uses this counter to verify that it is safe to call the <b class="routine"><i class="routine">VppOff</i></b><b>( )</b> routine in the socket driver. </><br></dl></dl></dl><dd><div class="Item"><a name="86704"> </a><b class="symbol_lc">VccState</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="86708"> </a>For internal use. Do not change the value of this member outside the function supplied in <b class="symbol_lc">FLSocket.VccOn</b>. This member reports whether Vcc is in a <b class="symbol_lc">PowerOn</b>, a <b class="symbol_lc">PowerGoingOff</b>, or a <b class="symbol_lc">PowerOff</b> state. </><br></dl></dl></dl><dd><div class="Item"><a name="86709"> </a><b class="symbol_lc">VppState</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="86710"> </a>For internal use. Do not change the value of this member outside the function supplied in <b class="symbol_lc">FLSocket.VccOn</b>. This member reports whether Vcc is in a <b class="symbol_lc">PowerOn</b>, a <b class="symbol_lc">PowerGoingOff</b>, or a <b class="symbol_lc">PowerOff</b> state. </><br></dl></dl></dl><dd><div class="Item"><a name="86711"> </a><b class="symbol_lc">remapped</b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="86943"> </a>For internal use. Do not change the value of this member except from within an MTD map function. True FFS uses this member to track whether or not the window was just remapped (moved). If you write your own MTD map function, that function should set this member before returning. </><br></dl></dl></dl><dd><div class="Item"><a name="86944"> </a><b class="symbol_lc">powerOnCallback <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="86945"> </a>Set by your <i class="textVariable">xxx</i><b class="routine"><i class="routine">Register</i></b><b>( )</b>function. TrueFFS calls the function referenced here after calling the function referenced in the <b class="symbol_lc">VccOn</b> member of this structure. If you have no need of this feature, set this member to a null pointer. </><br></dl></dl></dl><dd><div class="Item"><a name="86715"> </a><b class="symbol_lc">flash</b> </div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="86716"> </a>For internal use. Do not change the value of this member. This member contains a pointer to the <b class="symbol_lc">FLSocket</b> structure associated with this socket component driver. It is needed to support removable flash media and is set dynamically by TrueFFS. </><br></dl></dl></dl><dd><div class="Item"><a name="86717"> </a><b class="symbol_lc">window.baseAddress <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="86718"> </a>Set by your <i class="textVariable">xxx</i><b class="routine"><i class="routine">Register</i></b><b>( )</b>function. In this context, a window is a part of host system memory through which a part of the media memory is directly visible and addressable. The <b class="symbol_lc">window.baseAddress </b>member stores the memory address of this host-system memory in terms of 4K pages (that is, the base address of the window divided by 4K). The value is stored in this way in order to guarantee that the base address (when reconstructed) is page aligned. </><br></dl></dl></dl><dd><div class="Item"><a name="86719"> </a><b class="symbol_lc">window.currentPage <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="97398"> </a>For internal use. Do not change the value of this member. Stores the currently mapped window page (in 4KB units). </><br></dl></dl></dl><dd><div class="Item"><a name="97399"> </a><b class="symbol_lc">window.base <br></b></div><dl class="margin"><dl class="margin"><dl class="margin"><dd><div class="Indent3"><a name="97400"> </a>Set by the function you supply in the <b class="symbol_lc">setWindow</b> member of this structure. TrueFFS uses this member to store the base address of the memory window on flash memory. </><br></dl>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -