adlib_card.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * sound/adlib_card.c
  3.  *
  4.  * Detection routine for the AdLib card.
  5.  *
  6.  * Copyright (C) by Hannu Savolainen 1993-1997
  7.  *
  8.  * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
  9.  * Version 2 (June 1991). See the "COPYING" file distributed with this software
  10.  * for more info.
  11.  */
  12. #include <linux/module.h>
  13. #include <linux/init.h>
  14. #include "sound_config.h"
  15. #include "opl3.h"
  16. static void __init attach_adlib_card(struct address_info *hw_config)
  17. {
  18. hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp, THIS_MODULE);
  19. }
  20. static int __init probe_adlib(struct address_info *hw_config)
  21. {
  22. return opl3_detect(hw_config->io_base, hw_config->osp);
  23. }
  24. static struct address_info cfg;
  25. static int __initdata io = -1;
  26. MODULE_PARM(io, "i");
  27. static int __init init_adlib(void)
  28. {
  29. cfg.io_base = io;
  30. if (cfg.io_base == -1) {
  31. printk(KERN_ERR "adlib: must specify I/O address.n");
  32. return -EINVAL;
  33. }
  34. if (probe_adlib(&cfg) == 0)
  35. return -ENODEV;
  36. attach_adlib_card(&cfg);
  37. return 0;
  38. }
  39. static void __exit cleanup_adlib(void)
  40. {
  41. sound_unload_synthdev(cfg.slots[0]);
  42. }
  43. module_init(init_adlib);
  44. module_exit(cleanup_adlib);
  45. #ifndef MODULE
  46. static int __init setup_adlib(char *str)
  47. {
  48.         /* io */
  49. int ints[2];
  50. str = get_options(str, ARRAY_SIZE(ints), ints);
  51. io = ints[1];
  52. return 1;
  53. }
  54. __setup("adlib=", setup_adlib);
  55. #endif
  56. MODULE_LICENSE("GPL");