Linux v2.6.13-rc3
[pohmelfs.git] / sound / core / seq / seq.c
blob7449d2a6262902277abecdcf32726850d436a15b
1 /*
2 * ALSA sequencer main module
3 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
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.
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.
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
22 #include <sound/driver.h>
23 #include <linux/init.h>
24 #include <linux/moduleparam.h>
25 #include <sound/core.h>
26 #include <sound/initval.h>
28 #include <sound/seq_kernel.h>
29 #include "seq_clientmgr.h"
30 #include "seq_memory.h"
31 #include "seq_queue.h"
32 #include "seq_lock.h"
33 #include "seq_timer.h"
34 #include "seq_system.h"
35 #include "seq_info.h"
36 #include <sound/seq_device.h>
38 #if defined(CONFIG_SND_SEQ_DUMMY_MODULE)
39 int seq_client_load[64] = {[0] = SNDRV_SEQ_CLIENT_DUMMY, [1 ... 63] = -1};
40 #else
41 int seq_client_load[64] = {[0 ... 63] = -1};
42 #endif
43 int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
44 int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
45 int seq_default_timer_card = -1;
46 int seq_default_timer_device = SNDRV_TIMER_GLOBAL_SYSTEM;
47 int seq_default_timer_subdevice = 0;
48 int seq_default_timer_resolution = 0; /* Hz */
50 MODULE_AUTHOR("Frank van de Pol <fvdpol@coil.demon.nl>, Jaroslav Kysela <perex@suse.cz>");
51 MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer.");
52 MODULE_LICENSE("GPL");
54 module_param_array(seq_client_load, int, NULL, 0444);
55 MODULE_PARM_DESC(seq_client_load, "The numbers of global (system) clients to load through kmod.");
56 module_param(seq_default_timer_class, int, 0644);
57 MODULE_PARM_DESC(seq_default_timer_class, "The default timer class.");
58 module_param(seq_default_timer_sclass, int, 0644);
59 MODULE_PARM_DESC(seq_default_timer_sclass, "The default timer slave class.");
60 module_param(seq_default_timer_card, int, 0644);
61 MODULE_PARM_DESC(seq_default_timer_card, "The default timer card number.");
62 module_param(seq_default_timer_device, int, 0644);
63 MODULE_PARM_DESC(seq_default_timer_device, "The default timer device number.");
64 module_param(seq_default_timer_subdevice, int, 0644);
65 MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice number.");
66 module_param(seq_default_timer_resolution, int, 0644);
67 MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz.");
70 * INIT PART
73 static int __init alsa_seq_init(void)
75 int err;
77 snd_seq_autoload_lock();
78 if ((err = client_init_data()) < 0)
79 goto error;
81 /* init memory, room for selected events */
82 if ((err = snd_sequencer_memory_init()) < 0)
83 goto error;
85 /* init event queues */
86 if ((err = snd_seq_queues_init()) < 0)
87 goto error;
89 /* register sequencer device */
90 if ((err = snd_sequencer_device_init()) < 0)
91 goto error;
93 /* register proc interface */
94 if ((err = snd_seq_info_init()) < 0)
95 goto error;
97 /* register our internal client */
98 if ((err = snd_seq_system_client_init()) < 0)
99 goto error;
101 error:
102 snd_seq_autoload_unlock();
103 return err;
106 static void __exit alsa_seq_exit(void)
108 /* unregister our internal client */
109 snd_seq_system_client_done();
111 /* unregister proc interface */
112 snd_seq_info_done();
114 /* delete timing queues */
115 snd_seq_queues_delete();
117 /* unregister sequencer device */
118 snd_sequencer_device_done();
120 /* release event memory */
121 snd_sequencer_memory_done();
124 module_init(alsa_seq_init)
125 module_exit(alsa_seq_exit)
127 /* seq_clientmgr.c */
128 EXPORT_SYMBOL(snd_seq_create_kernel_client);
129 EXPORT_SYMBOL(snd_seq_delete_kernel_client);
130 EXPORT_SYMBOL(snd_seq_kernel_client_enqueue);
131 EXPORT_SYMBOL(snd_seq_kernel_client_enqueue_blocking);
132 EXPORT_SYMBOL(snd_seq_kernel_client_dispatch);
133 EXPORT_SYMBOL(snd_seq_kernel_client_ctl);
134 EXPORT_SYMBOL(snd_seq_kernel_client_write_poll);
135 EXPORT_SYMBOL(snd_seq_set_queue_tempo);
136 /* seq_memory.c */
137 EXPORT_SYMBOL(snd_seq_expand_var_event);
138 EXPORT_SYMBOL(snd_seq_dump_var_event);
139 /* seq_ports.c */
140 EXPORT_SYMBOL(snd_seq_event_port_attach);
141 EXPORT_SYMBOL(snd_seq_event_port_detach);
142 /* seq_lock.c */
143 #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
144 /*EXPORT_SYMBOL(snd_seq_sleep_in_lock);*/
145 /*EXPORT_SYMBOL(snd_seq_sleep_timeout_in_lock);*/
146 EXPORT_SYMBOL(snd_use_lock_sync_helper);
147 #endif