seq.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * ALSA sequencer main module
  3. * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
  4. *
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #include <sound/driver.h>
  22. #include <linux/init.h>
  23. #include <linux/moduleparam.h>
  24. #include <sound/core.h>
  25. #include <sound/initval.h>
  26. #include <sound/seq_kernel.h>
  27. #include "seq_clientmgr.h"
  28. #include "seq_memory.h"
  29. #include "seq_queue.h"
  30. #include "seq_lock.h"
  31. #include "seq_timer.h"
  32. #include "seq_system.h"
  33. #include "seq_info.h"
  34. #include <sound/seq_device.h>
  35. #if defined(CONFIG_SND_SEQ_DUMMY_MODULE)
  36. int seq_client_load[64] = {[0] = SNDRV_SEQ_CLIENT_DUMMY, [1 ... 63] = -1};
  37. #else
  38. int seq_client_load[64] = {[0 ... 63] = -1};
  39. #endif
  40. int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
  41. int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
  42. int seq_default_timer_card = -1;
  43. int seq_default_timer_device = SNDRV_TIMER_GLOBAL_SYSTEM;
  44. int seq_default_timer_subdevice = 0;
  45. int seq_default_timer_resolution = 0; /* Hz */
  46. MODULE_AUTHOR("Frank van de Pol <fvdpol@coil.demon.nl>, Jaroslav Kysela <perex@suse.cz>");
  47. MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer.");
  48. MODULE_LICENSE("GPL");
  49. module_param_array(seq_client_load, int, NULL, 0444);
  50. MODULE_PARM_DESC(seq_client_load, "The numbers of global (system) clients to load through kmod.");
  51. module_param(seq_default_timer_class, int, 0644);
  52. MODULE_PARM_DESC(seq_default_timer_class, "The default timer class.");
  53. module_param(seq_default_timer_sclass, int, 0644);
  54. MODULE_PARM_DESC(seq_default_timer_sclass, "The default timer slave class.");
  55. module_param(seq_default_timer_card, int, 0644);
  56. MODULE_PARM_DESC(seq_default_timer_card, "The default timer card number.");
  57. module_param(seq_default_timer_device, int, 0644);
  58. MODULE_PARM_DESC(seq_default_timer_device, "The default timer device number.");
  59. module_param(seq_default_timer_subdevice, int, 0644);
  60. MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice number.");
  61. module_param(seq_default_timer_resolution, int, 0644);
  62. MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz.");
  63. /*
  64. * INIT PART
  65. */
  66. static int __init alsa_seq_init(void)
  67. {
  68. int err;
  69. snd_seq_autoload_lock();
  70. if ((err = client_init_data()) < 0)
  71. goto error;
  72. /* init memory, room for selected events */
  73. if ((err = snd_sequencer_memory_init()) < 0)
  74. goto error;
  75. /* init event queues */
  76. if ((err = snd_seq_queues_init()) < 0)
  77. goto error;
  78. /* register sequencer device */
  79. if ((err = snd_sequencer_device_init()) < 0)
  80. goto error;
  81. /* register proc interface */
  82. if ((err = snd_seq_info_init()) < 0)
  83. goto error;
  84. /* register our internal client */
  85. if ((err = snd_seq_system_client_init()) < 0)
  86. goto error;
  87. error:
  88. snd_seq_autoload_unlock();
  89. return err;
  90. }
  91. static void __exit alsa_seq_exit(void)
  92. {
  93. /* unregister our internal client */
  94. snd_seq_system_client_done();
  95. /* unregister proc interface */
  96. snd_seq_info_done();
  97. /* delete timing queues */
  98. snd_seq_queues_delete();
  99. /* unregister sequencer device */
  100. snd_sequencer_device_done();
  101. /* release event memory */
  102. snd_sequencer_memory_done();
  103. }
  104. module_init(alsa_seq_init)
  105. module_exit(alsa_seq_exit)
  106. /* seq_clientmgr.c */
  107. EXPORT_SYMBOL(snd_seq_create_kernel_client);
  108. EXPORT_SYMBOL(snd_seq_delete_kernel_client);
  109. EXPORT_SYMBOL(snd_seq_kernel_client_enqueue);
  110. EXPORT_SYMBOL(snd_seq_kernel_client_enqueue_blocking);
  111. EXPORT_SYMBOL(snd_seq_kernel_client_dispatch);
  112. EXPORT_SYMBOL(snd_seq_kernel_client_ctl);
  113. EXPORT_SYMBOL(snd_seq_kernel_client_write_poll);
  114. EXPORT_SYMBOL(snd_seq_set_queue_tempo);
  115. /* seq_memory.c */
  116. EXPORT_SYMBOL(snd_seq_expand_var_event);
  117. EXPORT_SYMBOL(snd_seq_dump_var_event);
  118. /* seq_ports.c */
  119. EXPORT_SYMBOL(snd_seq_event_port_attach);
  120. EXPORT_SYMBOL(snd_seq_event_port_detach);
  121. /* seq_lock.c */
  122. #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
  123. /*EXPORT_SYMBOL(snd_seq_sleep_in_lock);*/
  124. /*EXPORT_SYMBOL(snd_seq_sleep_timeout_in_lock);*/
  125. EXPORT_SYMBOL(snd_use_lock_sync_helper);
  126. #endif