1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter 2. Basic Flow for PCI Drivers</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Writing an ALSA Driver"><link rel="up" href="index.html" title="Writing an ALSA Driver"><link rel="prev" href="file-tree-oss-directory.html" title="oss directory"><link rel="next" href="basic-flow-example.html" title="Full Code Example"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 2. Basic Flow for PCI Drivers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="file-tree-oss-directory.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="basic-flow-example.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="basic-flow"></a>Chapter 2. Basic Flow for PCI Drivers</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="basic-flow.html#basic-flow-outline">Outline</a></span></dt><dt><span class="section"><a href="basic-flow-example.html">Full Code Example</a></span></dt><dt><span class="section"><a href="basic-flow-constructor.html">Constructor</a></span></dt><dd><dl><dt><span class="section"><a href="basic-flow-constructor.html#basic-flow-constructor-device-index">1) Check and increment the device index.</a></span></dt><dt><span class="section"><a href="basic-flow-constructor.html#basic-flow-constructor-create-card">2) Create a card instance</a></span></dt><dt><span class="section"><a href="basic-flow-constructor.html#basic-flow-constructor-create-main">3) Create a main component</a></span></dt><dt><span class="section"><a href="basic-flow-constructor.html#basic-flow-constructor-main-component">4) Set the driver ID and name strings.</a></span></dt><dt><span class="section"><a href="basic-flow-constructor.html#basic-flow-constructor-create-other">5) Create other components, such as mixer, MIDI, etc.</a></span></dt><dt><span class="section"><a href="basic-flow-constructor.html#basic-flow-constructor-register-card">6) Register the card instance.</a></span></dt><dt><span class="section"><a href="basic-flow-constructor.html#basic-flow-constructor-set-pci">7) Set the PCI driver data and return zero.</a></span></dt></dl></dd><dt><span class="section"><a href="basic-flow-destructor.html">Destructor</a></span></dt><dt><span class="section"><a href="basic-flow-header-files.html">Header Files</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="basic-flow-outline"></a>Outline</h2></div></div></div><p> 2 The minimum flow for PCI soundcards is as follows: 3 4 </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>define the PCI ID table (see the section 5 <a class="link" href="pci-resource-entries.html" title="PCI Entries"><em class="citetitle">PCI Entries 6 </em></a>).</p></li><li class="listitem"><p>create <code class="function">probe()</code> callback.</p></li><li class="listitem"><p>create <code class="function">remove()</code> callback.</p></li><li class="listitem"><p>create a <span class="structname">pci_driver</span> structure 7 containing the three pointers above.</p></li><li class="listitem"><p>create an <code class="function">init()</code> function just calling 8 the <code class="function">pci_register_driver()</code> to register the pci_driver table 9 defined above.</p></li><li class="listitem"><p>create an <code class="function">exit()</code> function to call 10 the <code class="function">pci_unregister_driver()</code> function.</p></li></ul></div><p> 11 </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="file-tree-oss-directory.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="basic-flow-example.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">oss directory </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Full Code Example</td></tr></table></div></body></html> 12