亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? writing-an-alsa-driver.tmpl

?? 優龍2410linux2.6.8內核源代碼
?? TMPL
?? 第 1 頁 / 共 5 頁
字號:
          snd_card_t *card;          // rest of implementation will be in the section          // "PCI Resource Managements"  };  // this should be go into <sound/sndmagic.h>  // (see "Management of Cards and Components")  #define mychip_t_magic        0xa15a4501  // chip-specific destructor  // (see "PCI Resource Managements")  static int snd_mychip_free(mychip_t *chip)  {          // will be implemented later...  }  // component-destructor  // (see "Management of Cards and Components")  static int snd_mychip_dev_free(snd_device_t *device)  {          mychip_t *chip = snd_magic_cast(mychip_t,                  device->device_data, return -ENXIO);          return snd_mychip_free(chip);  }  // chip-specific constructor  // (see "Management of Cards and Components")  static int __devinit snd_mychip_create(snd_card_t *card,                                         struct pci_dev *pci,                                         mychip_t **rchip)  {          mychip_t *chip;          int err;          static snd_device_ops_t ops = {                 .dev_free = snd_mychip_dev_free,          };          *rchip = NULL;          // check PCI availability here          // (see "PCI Resource Managements")          // allocate a chip-specific data with magic-alloc          chip = snd_magic_kcalloc(mychip_t, 0, GFP_KERNEL);          if (chip == NULL)                  return -ENOMEM;          chip->card = card;          // rest of initialization here; will be implemented          // later, see "PCI Resource Managements"          if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,                                    chip, &ops)) < 0) {                  snd_mychip_free(chip);                  return err;          }          *rchip = chip;          return 0;  }  // constructor -- see "Constructor" sub-section  static int __devinit snd_mychip_probe(struct pci_dev *pci,                               const struct pci_device_id *pci_id)  {          static int dev;          snd_card_t *card;          mychip_t *chip;          int err;          // (1)          if (dev >= SNDRV_CARDS)                  return -ENODEV;          if (!enable[dev]) {                  dev++;                  return -ENOENT;          }          // (2)          card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);          if (card == NULL)                  return -ENOMEM;          // (3)          if ((err = snd_mychip_create(card, pci, &chip)) < 0) {                  snd_card_free(card);                  return err;          }          // (4)          strcpy(card->driver, "My Chip");          strcpy(card->shortname, "My Own Chip 123");          sprintf(card->longname, "%s at 0x%lx irq %i",                  card->shortname, chip->ioport, chip->irq);          // (5)          // implemented later          // (6)          if ((err = snd_card_register(card)) < 0) {                  snd_card_free(card);                  return err;          }          // (7)          pci_set_drvdata(pci, card);          dev++;          return 0;  }  // destructor -- see "Destructor" sub-section  static void __devexit snd_mychip_remove(struct pci_dev *pci)  {          snd_card_free(pci_get_drvdata(pci));          pci_set_drvdata(pci, NULL);  }]]>          </programlisting>        </example>      </para>    </section>    <section id="basic-flow-constructor">      <title>Constructor</title>      <para>        The real constructor of PCI drivers is probe callback. The      probe callback and other component-constructors which are called      from probe callback should be defined with      <parameter>__devinit</parameter> prefix. You       cannot use <parameter>__init</parameter> prefix for them,      because any PCI device could be a hotplug device.       </para>      <para>        In the probe callback, the following scheme is often used.      </para>      <section id="basic-flow-constructor-device-index">        <title>1) Check and increment the device index.</title>        <para>          <informalexample>            <programlisting><![CDATA[  static int dev;  ....  if (dev >= SNDRV_CARDS)          return -ENODEV;  if (!enable[dev]) {          dev++;          return -ENOENT;  }]]>            </programlisting>          </informalexample>        where enable[dev] is the module option.        </para>        <para>          At each time probe callback is called, check the        availability of the device. If not available, simply increment        the device index and returns. dev will be incremented also        later (<link        linkend="basic-flow-constructor-set-pci"><citetitle>step        7</citetitle></link>).         </para>      </section>      <section id="basic-flow-constructor-create-card">        <title>2) Create a card instance</title>        <para>          <informalexample>            <programlisting><![CDATA[  snd_card_t *card;  ....  card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);]]>            </programlisting>          </informalexample>        </para>        <para>          The detail will be explained in the section          <link linkend="card-management-card-instance"><citetitle>          Management of Cards and Components</citetitle></link>.        </para>      </section>      <section id="basic-flow-constructor-create-main">        <title>3) Create a main component</title>        <para>          In this part, the PCI resources are allocated.          <informalexample>            <programlisting><![CDATA[  mychip_t *chip;  ....  if ((err = snd_mychip_create(card, pci, &chip)) < 0) {          snd_card_free(card);          return err;  }]]>            </programlisting>          </informalexample>          The detail will be explained in the section <link        linkend="pci-resource"><citetitle>PCI Resource        Managements</citetitle></link>.        </para>      </section>      <section id="basic-flow-constructor-main-component">        <title>4) Set the driver ID and name strings.</title>        <para>          <informalexample>            <programlisting><![CDATA[  strcpy(card->driver, "My Chip");  strcpy(card->shortname, "My Own Chip 123");  sprintf(card->longname, "%s at 0x%lx irq %i",          card->shortname, chip->ioport, chip->irq);]]>            </programlisting>          </informalexample>          The driver field holds the minimal ID string of the        chip. This is referred by alsa-lib's configurator, so keep it        simple but unique.           Even the same driver can have different driver IDs to        distinguish the functionality of each chip type.         </para>        <para>          The shortname field is a string shown as more verbose        name. The longname field contains the information which is        shown in <filename>/proc/asound/cards</filename>.         </para>      </section>      <section id="basic-flow-constructor-create-other">        <title>5) Create other components, such as mixer, MIDI, etc.</title>        <para>          Here you define the basic components such as          <link linkend="pcm-interface"><citetitle>PCM</citetitle></link>,          mixer (e.g. <link linkend="api-ac97"><citetitle>AC97</citetitle></link>),          MIDI (e.g. <link linkend="midi-interface"><citetitle>MPU-401</citetitle></link>),          and other interfaces.          Also, if you want a <link linkend="proc-interface"><citetitle>proc        file</citetitle></link>, define it here, too.        </para>      </section>      <section id="basic-flow-constructor-register-card">        <title>6) Register the card instance.</title>        <para>          <informalexample>            <programlisting><![CDATA[  if ((err = snd_card_register(card)) < 0) {          snd_card_free(card);          return err;  }]]>            </programlisting>          </informalexample>        </para>        <para>          Will be explained in the section <link        linkend="card-management-registration"><citetitle>Management        of Cards and Components</citetitle></link>, too.         </para>      </section>      <section id="basic-flow-constructor-set-pci">        <title>7) Set the PCI driver data and return zero.</title>        <para>          <informalexample>            <programlisting><![CDATA[        pci_set_drvdata(pci, card);        dev++;        return 0;]]>            </programlisting>          </informalexample>          In the above, the card record is stored. This pointer is        referred in the remove callback and power-management        callbacks, too.         </para>      </section>    </section>    <section id="basic-flow-destructor">      <title>Destructor</title>      <para>        The destructor, remove callback, simply releases the card      instance. Then the ALSA middle layer will release all the      attached components automatically.       </para>      <para>        It would be typically like the following:        <informalexample>          <programlisting><![CDATA[  static void __devexit snd_mychip_remove(struct pci_dev *pci)  {          snd_card_free(pci_get_drvdata(pci));          pci_set_drvdata(pci, NULL);  }]]>          </programlisting>        </informalexample>        The above code assumes that the card pointer is set to the PCI	driver data.      </para>    </section>    <section id="basic-flow-header-files">      <title>Header Files</title>      <para>        For the above example, at least the following include files      are necessary.         <informalexample>          <programlisting><![CDATA[  #include <sound/driver.h>  #include <linux/init.h>  #include <linux/pci.h>  #include <linux/slab.h>  #include <sound/core.h>  #define SNDRV_GET_ID  #include <sound/initval.h>]]>          </programlisting>        </informalexample>	where the last twos are necessary only when module options are      defined in the source file.  If the codes are split to several      files, the file without module options don't need them.      </para>      <para>        In addition to them, you'll need      <filename>&lt;linux/interrupt.h&gt;</filename> for the interrupt      handling, and <filename>&lt;asm/io.h&gt;</filename> for the i/o      access. If you use <function>mdelay()</function> or      <function>udelay()</function> functions, you'll need to include      <filename>&lt;linux/delay.h&gt;</filename>, too.       </para>      <para>      The ALSA interfaces like PCM or control API are define in other      header files as <filename>&lt;sound/xxx.h&gt;</filename>.      They have to be included after      <filename>&lt;sound/core.h&gt;</filename>.      </para>    </section>  </chapter><!-- ****************************************************** --><!-- Management of Cards and Components  --><!-- ****************************************************** -->  <chapter id="card-management">    <title>Management of Cards and Components</title>    <section id="card-management-card-instance">      <title>Card Instance</title>      <para>      For each soundcard, a <quote>card</quote> record must be allocated.      </para>      <para>      A card record is the headquarters of the soundcard.  It manages      the list of whole devices (components) on the soundcard, such as      PCM, mixers, MIDI, synthesizer, and so on.  Also, the card      record holds the ID and the name strings of the card, manages      the root of proc files, and controls the power-management states      and hotplug disconnections.  The component list on the card      record is used to manage the proper releases of resources at      destruction.       </para>      <para>        As mentioned above, to create a card instance, call      <function>snd_card_new()</function>.        <informalexample>          <programlisting><![CDATA[  snd_card_t *card;  card = snd_card_new(index, id, module, extra_size);]]>          </programlisting>        </informalexample>      </para>      <para>        The function takes four arguments, the card-index number, the

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美在线观看| 丁香六月综合激情| 欧美日产在线观看| 国产成人免费9x9x人网站视频| 亚洲欧美在线高清| 日韩精品最新网址| 欧美日韩一区视频| 9久草视频在线视频精品| 日本麻豆一区二区三区视频| 国产婷婷色一区二区三区四区| 精品免费一区二区三区| 韩国中文字幕2020精品| 国产成人亚洲综合a∨婷婷| 国产高清久久久久| 99久久精品免费精品国产| 日韩av午夜在线观看| 亚洲成人资源网| 懂色中文一区二区在线播放| 精品久久一区二区| 色视频欧美一区二区三区| 国产成人自拍网| 成人天堂资源www在线| 欧美sm极限捆绑bd| 欧美嫩在线观看| 欧美性色综合网| 日韩丝袜情趣美女图片| 国产亚洲制服色| 亚洲免费资源在线播放| 亚洲成av人片www| 免费观看91视频大全| 国产乱码精品一区二区三区av| 99久久综合精品| 欧美主播一区二区三区美女| 91精品国产综合久久精品| 国产亚洲一区字幕| 亚洲一区二区三区四区在线免费观看| 亚洲电影一区二区三区| 久久精品国产成人一区二区三区| 国产成人午夜99999| 91在线视频播放地址| 欧美日韩国产成人在线91| 欧美成人性福生活免费看| 亚洲精品网站在线观看| 国产欧美精品国产国产专区| 日韩欧美视频一区| 欧美国产日韩精品免费观看| 亚洲天堂a在线| 日本视频一区二区| 大白屁股一区二区视频| 欧美专区日韩专区| 精品国产一区a| 国产精品久久久久久久久免费樱桃 | 日精品一区二区| 国产999精品久久久久久| 色久优优欧美色久优优| 2020国产精品久久精品美国| 伊人色综合久久天天人手人婷| 日一区二区三区| www.亚洲色图.com| 日韩精品专区在线影院重磅| 国产亚洲精久久久久久| 色噜噜狠狠一区二区三区果冻| 日韩精品在线看片z| 亚洲人成网站影音先锋播放| 日本少妇一区二区| 成人在线视频一区| 欧美精品久久天天躁| 国产亚洲一区二区三区四区| 日韩不卡免费视频| 91豆麻精品91久久久久久| 日韩精品中文字幕在线不卡尤物 | 中文字幕中文在线不卡住| 亚洲一区二区三区美女| 成人永久aaa| 精品国内片67194| 午夜久久久久久电影| eeuss鲁片一区二区三区在线看| 日韩欧美一二区| 午夜精品在线视频一区| 91福利在线播放| 国产精品久久久久一区| 国产黄色精品网站| 精品精品国产高清一毛片一天堂| 亚洲成人一区二区在线观看| 成人高清视频在线| 国产视频一区二区在线观看| 久久精品国产亚洲高清剧情介绍| 欧美视频在线不卡| 亚洲在线视频免费观看| 99久久99精品久久久久久| 国产婷婷一区二区| 国产一区二区伦理片| 精品国产乱码久久久久久影片| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美揉bbbbb揉bbbbb| 亚洲最快最全在线视频| jizzjizzjizz欧美| 国产精品不卡一区| 成人sese在线| 国产精品成人免费在线| av中文字幕在线不卡| 国产精品久久夜| 播五月开心婷婷综合| 中文字幕在线一区| 99久久精品国产精品久久| 综合激情成人伊人| 在线这里只有精品| 亚洲综合久久久久| 欧美精品在线视频| 日本欧美在线观看| 91精品国产麻豆| 国内精品免费在线观看| 精品国产区一区| 国产高清不卡一区二区| 国产精品国产精品国产专区不蜜| 成人网男人的天堂| 伊人婷婷欧美激情| 欧美日韩电影一区| 日本欧洲一区二区| 久久综合色婷婷| 成人app下载| 91精品一区二区三区在线观看| 丰满白嫩尤物一区二区| 国产最新精品免费| 成人免费av在线| 青青国产91久久久久久| 亚洲欧洲三级电影| 久久精品欧美日韩| 日韩欧美一二三| 在线播放中文一区| 色哟哟在线观看一区二区三区| 精品亚洲免费视频| 日韩不卡在线观看日韩不卡视频| 亚洲成精国产精品女| 国产资源在线一区| 欧美日韩精品免费| 久久97超碰国产精品超碰| 久久先锋影音av鲁色资源网| thepron国产精品| 亚洲图片一区二区| 欧美tk—视频vk| 99久久99精品久久久久久| 亚洲6080在线| 久久综合99re88久久爱| 91亚洲精品久久久蜜桃网站| 午夜国产精品一区| 国产精品人人做人人爽人人添| 91黄色激情网站| 国产一区二区久久| 亚洲最大色网站| 久久久久久久久久久久久夜| 在线视频一区二区三| 国产一区二区三区最好精华液 | 亚洲国产日韩a在线播放性色| 日韩色在线观看| 99久久精品国产麻豆演员表| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产精品看片你懂得| 欧美一区二区三区喷汁尤物| av网站免费线看精品| 久久99精品国产麻豆婷婷洗澡| 中文字幕一区二区三区在线观看| 欧美一三区三区四区免费在线看| 9久草视频在线视频精品| 久久66热re国产| 亚洲va欧美va人人爽| 中文字幕在线一区| 精品粉嫩超白一线天av| 欧美日韩大陆在线| 91一区二区在线观看| 国产制服丝袜一区| 日韩电影免费在线看| 国产精品久久久久久久午夜片 | 天天av天天翘天天综合网| 中日韩av电影| 精品粉嫩超白一线天av| 在线电影一区二区三区| 色视频成人在线观看免| 成人美女视频在线看| 美女视频网站黄色亚洲| 亚洲福中文字幕伊人影院| 中文字幕在线不卡一区| 久久久久久久久伊人| 日韩一区二区免费高清| 欧美日韩激情一区二区| av动漫一区二区| 成人污污视频在线观看| 国产一区啦啦啦在线观看| 青青草国产成人99久久| 亚洲a一区二区| 一区二区三区日韩欧美精品| 国产精品午夜在线观看| 久久先锋影音av鲁色资源| 精品奇米国产一区二区三区| 欧美一区二区三区视频免费| 666欧美在线视频| 欧美另类z0zxhd电影| 在线观看三级视频欧美| 色偷偷久久一区二区三区| 91在线视频18|