blob: 20f954bc7aa0c0c98d51f169cfac7f2ca8bed3d0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
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>
27
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>
37
38#if defined(CONFIG_SND_SEQ_DUMMY_MODULE)
Clemens Ladischaa1e77e2005-12-12 09:36:01 +010039int seq_client_load[15] = {[0] = SNDRV_SEQ_CLIENT_DUMMY, [1 ... 14] = -1};
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#else
Clemens Ladischaa1e77e2005-12-12 09:36:01 +010041int seq_client_load[15] = {[0 ... 14] = -1};
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#endif
43int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
44int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
45int seq_default_timer_card = -1;
Clemens Ladischa4f508b2005-09-06 08:00:19 +020046int seq_default_timer_device =
47#ifdef CONFIG_SND_SEQ_RTCTIMER_DEFAULT
48 SNDRV_TIMER_GLOBAL_RTC
49#else
50 SNDRV_TIMER_GLOBAL_SYSTEM
51#endif
52 ;
Linus Torvalds1da177e2005-04-16 15:20:36 -070053int seq_default_timer_subdevice = 0;
54int seq_default_timer_resolution = 0; /* Hz */
55
56MODULE_AUTHOR("Frank van de Pol <fvdpol@coil.demon.nl>, Jaroslav Kysela <perex@suse.cz>");
57MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer.");
58MODULE_LICENSE("GPL");
59
60module_param_array(seq_client_load, int, NULL, 0444);
61MODULE_PARM_DESC(seq_client_load, "The numbers of global (system) clients to load through kmod.");
62module_param(seq_default_timer_class, int, 0644);
63MODULE_PARM_DESC(seq_default_timer_class, "The default timer class.");
64module_param(seq_default_timer_sclass, int, 0644);
65MODULE_PARM_DESC(seq_default_timer_sclass, "The default timer slave class.");
66module_param(seq_default_timer_card, int, 0644);
67MODULE_PARM_DESC(seq_default_timer_card, "The default timer card number.");
68module_param(seq_default_timer_device, int, 0644);
69MODULE_PARM_DESC(seq_default_timer_device, "The default timer device number.");
70module_param(seq_default_timer_subdevice, int, 0644);
71MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice number.");
72module_param(seq_default_timer_resolution, int, 0644);
73MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz.");
74
75/*
76 * INIT PART
77 */
78
79static int __init alsa_seq_init(void)
80{
81 int err;
82
83 snd_seq_autoload_lock();
84 if ((err = client_init_data()) < 0)
85 goto error;
86
87 /* init memory, room for selected events */
88 if ((err = snd_sequencer_memory_init()) < 0)
89 goto error;
90
91 /* init event queues */
92 if ((err = snd_seq_queues_init()) < 0)
93 goto error;
94
95 /* register sequencer device */
96 if ((err = snd_sequencer_device_init()) < 0)
97 goto error;
98
99 /* register proc interface */
100 if ((err = snd_seq_info_init()) < 0)
101 goto error;
102
103 /* register our internal client */
104 if ((err = snd_seq_system_client_init()) < 0)
105 goto error;
106
107 error:
108 snd_seq_autoload_unlock();
109 return err;
110}
111
112static void __exit alsa_seq_exit(void)
113{
114 /* unregister our internal client */
115 snd_seq_system_client_done();
116
117 /* unregister proc interface */
118 snd_seq_info_done();
119
120 /* delete timing queues */
121 snd_seq_queues_delete();
122
123 /* unregister sequencer device */
124 snd_sequencer_device_done();
125
126 /* release event memory */
127 snd_sequencer_memory_done();
128}
129
130module_init(alsa_seq_init)
131module_exit(alsa_seq_exit)
132
133 /* seq_clientmgr.c */
134EXPORT_SYMBOL(snd_seq_create_kernel_client);
135EXPORT_SYMBOL(snd_seq_delete_kernel_client);
136EXPORT_SYMBOL(snd_seq_kernel_client_enqueue);
137EXPORT_SYMBOL(snd_seq_kernel_client_enqueue_blocking);
138EXPORT_SYMBOL(snd_seq_kernel_client_dispatch);
139EXPORT_SYMBOL(snd_seq_kernel_client_ctl);
140EXPORT_SYMBOL(snd_seq_kernel_client_write_poll);
141EXPORT_SYMBOL(snd_seq_set_queue_tempo);
142 /* seq_memory.c */
143EXPORT_SYMBOL(snd_seq_expand_var_event);
144EXPORT_SYMBOL(snd_seq_dump_var_event);
145 /* seq_ports.c */
146EXPORT_SYMBOL(snd_seq_event_port_attach);
147EXPORT_SYMBOL(snd_seq_event_port_detach);
148 /* seq_lock.c */
149#if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
150/*EXPORT_SYMBOL(snd_seq_sleep_in_lock);*/
151/*EXPORT_SYMBOL(snd_seq_sleep_timeout_in_lock);*/
152EXPORT_SYMBOL(snd_use_lock_sync_helper);
153#endif