📄 rnspcmcia6.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title>PC Card Device Driver PCMCIA for x86 </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 href="rnsPcmcia5.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="rnsPcmcia7.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h2 class="H1"><i><a name="86530" class="autotag">6. PC Card Device Driver</a></i></h2></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="85242" class="autotag"> </a><a href="rnsPcmcia6.html#85171">Figure 1</a> shows the PCMCIA PC card architecture. <div class="frame"><h4 class="EntityTitle"><a name="85171" class="autotag"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 1 PCMCIA Architecture</font></a></h4><div class="CellBody"><a name="85241" class="autotag"> </a><img class="figure" border="0" src="images/rnsPcmciaa.gif"></div></div></p><dd><p class="Body"><a name="85243" class="autotag"> </a>To include the PC card device drivers in your configuration, define the macro <b class="symbol_UC">INCLUDE_PCMCIA</b> in <b class="file">config.h</b>. When <b class="symbol_UC">INCLUDE_PCMCIA</b> is defined, <b class="library">pccardLib.c</b> and <b class="library">pccardShow.c</b> are included in sysLib.c. If <b class="symbol_UC">INCLUDE_SHOW_ROUTINES</b> is defined in <b class="file">config.h</b>, the show routine for the PC card is included in <b class="library">pccardShow.c</b>.</p><dd><p class="Body"><a name="85244" class="autotag"> </a>The PC card device driver consists of three components in addition to a standard VxWorks device driver: a resource table, an enabler, and a Card Status Change (CSC) interrupt handler.</p><dd><p class="Body"><a name="85245" class="autotag"> </a>The PC card device driver has its own resource structure. For the SRAM card the structure is called <b class="symbol_lc">sramResource</b><b class="file"> </b>and for the Ethernet card it is <b class="symbol_lc">eltResource</b>; this structure resides in <b class="library">pccardLib.c</b>. For the ATA card, the structure is called <b class="symbol_lc">ataResource</b> and is located in <b class="library">sysLib.c</b> (see the <i class="title">VxWorks Programmer's Guide: Intel x86</i>). For example, the resource table for an SRAM card, <b class="symbol_lc">sramResources[ ]</b> in <b class="library">pccardLib.c</b>, is as follows:</p><dl class="margin"><dd><pre class="Code2"><a name="85246" class="autotag">typedef struct sramResource /* PCCARD SRAM resources */ { PCCARD_RESOURCE resource; /* must be the first member */ } SRAM_RESOURCE;</a><dd> <a name="85251" class="autotag">SRAM_RESOURCE sramResources[] = { { { 5, 0, {0, 0}, {0, 0}, 0, SRAM0_MEM_START, SRAM0_MEM_STOP, 1, 0x0, SRAM0_MEM_LENGTH } }, { { 5, 0, {0, 0}, {0, 0}, 0, SRAM1_MEM_START, SRAM1_MEM_STOP, 1, 0x0, SRAM1_MEM_LENGTH } }, { { 5, 0, {0, 0}, {0, 0}, 0, SRAM2_MEM_START, SRAM2_MEM_STOP, 1, 0x0, SRAM2_MEM_LENGTH } }, { { 5, 0, {0, 0}, {0, 0}, 0, SRAM3_MEM_START, SRAM3_MEM_STOP, 1, 0x0, SRAM3_MEM_LENGTH } } };</a></pre></dl><dd><p class="Body"><a name="85282" class="autotag"> </a>The first member of each entry in the PC card's resource table is a common resource structure for all PC cards, which is called <b class="symbol_UC">PCCARD_RESOURCE</b>. Resources such as memory addresses, I/O addresses, and IRQ are defined here. This structure is defined as follows:</p><dl class="margin"><dd><pre class="Code2"><a name="85283" class="autotag">typedef struct pccardResource { int vcc; /* 3, 5: Vcc */ int vpp; /* 5, 12: Vpp */ int ioStart[2]; /* start IO address */ int ioStop[2]; /* stop IO address */ int ioExtraws; /* 0-2: extra wait state */ int memStart; /* start host address */ int memStop; /* stop host address */ int memExtraws; /* 0-2: extra wait state */ int memOffset; /* offset card address */ int memLength; /* size of the memory */ } PCCARD_RESOURCE;</a></pre></dl><dd><p class="Body"><a name="85296" class="autotag"> </a>The enabler initializes the PC card. The enabler routine is in the enabler table, <b class="symbol_lc">pcccardEnabler[ ]</b>. The enabler checks the Card Information Structure (CIS) to determine what type of PC card is installed. If it finds a match, it allocates the resources defined for that card resource structure and initializes the card. If the card is a block device (an ATA, SRAM, or Flash PC card), it completes all initialization including creation of the block device. If the card is a network device (an Ethernet PC card), the enabler stores the parameters the <b class="routine"><i class="routine">eltattach</i></b><b>( )</b> routine requires for completing initialization.</p><dd><p class="Body"><a name="85297" class="autotag"> </a>The CSC interrupt handler (supplied by the specific device driver) is called by <b class="routine"><i class="routine">pcmciaCscIntr</i></b><b>( )</b> when a CSC event occurs. CSC events are hot insertion/removal, battery dead, battery warn, write protect, and ready. The CSC interrupt routine manages the resources allocated to the socket. If the CSC interrupt handler returns an error, <b class="routine"><i class="routine">pcmciaCscIntr</i></b><b>( )</b> goes to the next socket without releasing the resources.</p></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="rnsPcmcia5.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="rnsPcmcia7.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 + -