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

📄 ds sw.htm

📁 What is this ``device driver stuff anyway? Here s a very short introduction to the concept.
💻 HTM
📖 第 1 页 / 共 5 页
字号:
</td>
<td align="left" valign="top">
<strong><tt>
int
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
alive
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
int
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
pname
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
char *
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
port
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
struct port *
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
intr
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
int (**intr)()
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
addr
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
caddr_t
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
addr2
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
caddr_t
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
flags
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
int
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
bus_priority
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
int
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
ivnum
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
int
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
priority
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
int
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
cmd
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
int
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
physaddr
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
caddr_t
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
physaddr2
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
caddr_t
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
private
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
void * [8]
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
conn_priv
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
void * [8]
</tt></strong>
</td>
</tr>
<tr>
<td align="left" valign="top">
<strong><tt>
rsvd
</tt></strong>
</td>
<td align="left" valign="top">
<strong><tt>
void * [8]
</tt></strong>
</td>
</tr>
</tbody></table><p>
</p><p>
The following sections discuss all of these members.
<a name="ctlrmbox"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="DS%20sw_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="DS%20sw_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#DeviceAutoconfig"><img src="DS%20sw_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#ControlStruct"><img src="DS%20sw_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#ctlrbus_hdetal"><img src="DS%20sw_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut25.html"><img src="DS%20sw_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="DS%20sw_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="DS%20sw_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
17.2.1&nbsp;&nbsp;&nbsp;&nbsp;The ctlr_mbox Member
</h3>
<p>
<a name="nx_id_740"></a>
The
<tt>ctlr_mbox</tt>
member specifies
a pointer to the mailbox data structure for hardware platforms that
access I/O space through hardware mailboxes.
The bus adapter code sets this member.
As the adapter code probes the buses, the first bus that has a mailbox
allocates the initial software mailbox data structure and sets its
<tt>bus_mbox</tt>
pointer to that data structure.
As the adapter code continues to probe for buses and controllers,
the
<tt>MBOX_GET</tt>
macro allocates the
<tt>ctlr_mbox</tt>
members for devices accessed by mailboxes.
Typically, this macro is called in the controller configuration
interface after the
<tt>controller</tt>
data structure has been found, but before probing the controller.
</p><p>
<br>
The following code fragment gives an idea of the tasks that occur prior
to calling the
<tt>MBOX_GET</tt>
macro:
</p><p>
</p><p>
</p><pre>config_con(name, node, bus)
{
   register struct controller *ctlr;

   if((ctlr = get_ctlr(name, node, bus-&gt;bus_name, bus-&gt;bus_num)) ||
          /* other wildcards here */
      (ctlr = get_ctlr(name, -1, "*", -99))) {
<br>.<br>.<br>.<br>
       }

/***************************************************
 * Found the controller                            *
 ***************************************************/

           int savebusnum;
           char *savebusname;
           int saveslot;

           if(ctlr-&gt;alive &amp; ALV_ALIVE) {
                   printf("config_con: %s%d alive\n",
                          ctlr-&gt;ctlr_name, ctlr-&gt;ctlr_num);
                   return(stat);
           }
           savebusnum = ctlr-&gt;bus_num;
           savebusname = ctlr-&gt;bus_name;
           saveslot = ctlr-&gt;slot;
           ctlr-&gt;bus_name = bus-&gt;bus_name;
           ctlr-&gt;bus_num = bus-&gt;bus_num;
           ctlr-&gt;slot = node;

/***************************************************
 *            Allocate and initialize a software   *
 *            mailbox data structure for the       *
 *            controller if it is attached to a    *
 *            bus that is accessed by mailboxes    *
 ***************************************************/
           MBOX_GET(bus, ctlr);

/***************************************************
 * Now get the controller's driver structure       *
 * and probe                                       *
 ***************************************************/
<br>.<br>.<br>.<br>
}
</pre>
<p>
<a name="ctlrbus_hdetal"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="DS%20sw_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="DS%20sw_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#DeviceAutoconfig"><img src="DS%20sw_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#ctlrmbox"><img src="DS%20sw_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#driver"><img src="DS%20sw_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut25.html"><img src="DS%20sw_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="DS%20sw_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="DS%20sw_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
17.2.2&nbsp;&nbsp;&nbsp;&nbsp;The bus_hd, nxt_ctlr, and dev_list Members
</h3>
<p>
<a name="nx_id_741"></a>
<a name="nx_id_742"></a>
<a name="nx_id_743"></a>
The
<tt>bus_hd</tt>
member specifies
a pointer to the
<tt>bus</tt>
structure that this controller is connected to.
The
<tt>nxt_ctlr</tt>
member specifies
a pointer to the next controller at this level.
The
<tt>dev_list</tt>
member specifies
a linked list of devices connected to this controller.
<a name="driver"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="DS%20sw_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="DS%20sw_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#DeviceAutoconfig"><img src="DS%20sw_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#ctlrbus_hdetal"><img src="DS%20sw_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#ctlrtype"><img src="DS%20sw_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut25.html"><img src="DS%20sw_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="DS%20sw_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="DS%20sw_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
17.2.3&nbsp;&nbsp;&nbsp;&nbsp;The driver Member
</h3>
<p>
<a name="nx_id_744"></a>
The
<tt>driver</tt>
member specifies
a pointer to the
<tt>driver</tt>
structure for this controller.
The device driver writer initializes a
<tt>driver</tt>
structure, usually in the declarations section of the driver.
<a name="ctlrtype"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="DS%20sw_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="DS%20sw_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#DeviceAutoconfig"><img src="DS%20sw_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#driver"><img src="DS%20sw_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#busname1"><img src="DS%20sw_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut25.html"><img src="DS%20sw_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="DS%20sw_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="DS%20sw_files/HELP.GIF" alt="[Help]" border="0"></a>

⌨️ 快捷键说明

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