ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / sound / core / seq / seq.c
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
22 #include <sound/driver.h>
23 #include <linux/init.h>
24 #include <sound/core.h>
25 #include <sound/initval.h>
26
27 #include <sound/seq_kernel.h>
28 #include "seq_clientmgr.h"
29 #include "seq_memory.h"
30 #include "seq_queue.h"
31 #include "seq_lock.h"
32 #include "seq_timer.h"
33 #include "seq_system.h"
34 #include "seq_info.h"
35 #include <sound/seq_device.h>
36
37 int seq_client_load[64] = {[0 ... 63] = -1};
38 int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
39 int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
40 int seq_default_timer_card = -1;
41 int seq_default_timer_device = SNDRV_TIMER_GLOBAL_SYSTEM;
42 int seq_default_timer_subdevice = 0;
43 int seq_default_timer_resolution = 0;   /* Hz */
44
45 MODULE_AUTHOR("Frank van de Pol <fvdpol@coil.demon.nl>, Jaroslav Kysela <perex@suse.cz>");
46 MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer.");
47 MODULE_LICENSE("GPL");
48 MODULE_CLASSES("{sound}");
49 MODULE_SUPPORTED_DEVICE("sound");
50
51 MODULE_PARM(seq_client_load, "1-64i");
52 MODULE_PARM_DESC(seq_client_load, "The numbers of global (system) clients to load through kmod.");
53 MODULE_PARM(seq_default_timer_class, "i");
54 MODULE_PARM_DESC(seq_default_timer_class, "The default timer class.");
55 MODULE_PARM(seq_default_timer_sclass, "i");
56 MODULE_PARM_DESC(seq_default_timer_sclass, "The default timer slave class.");
57 MODULE_PARM(seq_default_timer_card, "i");
58 MODULE_PARM_DESC(seq_default_timer_card, "The default timer card number.");
59 MODULE_PARM(seq_default_timer_device, "i");
60 MODULE_PARM_DESC(seq_default_timer_device, "The default timer device number.");
61 MODULE_PARM(seq_default_timer_subdevice, "i");
62 MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice number.");
63 MODULE_PARM(seq_default_timer_resolution, "i");
64 MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz.");
65
66 /*
67  *  INIT PART
68  */
69
70
71 static int __init alsa_seq_init(void)
72 {
73         int err;
74
75         if ((err = client_init_data()) < 0)
76                 return err;
77
78         /* init memory, room for selected events */
79         if ((err = snd_sequencer_memory_init()) < 0)
80                 return err;
81
82         /* init event queues */
83         if ((err = snd_seq_queues_init()) < 0)
84                 return err;
85
86         /* register sequencer device */
87         if ((err = snd_sequencer_device_init()) < 0)
88                 return err;
89
90         /* register proc interface */
91         if ((err = snd_seq_info_init()) < 0)
92                 return err;
93
94         /* register our internal client */
95         if ((err = snd_seq_system_client_init()) < 0)
96                 return err;
97
98         return 0;
99 }
100
101 static void __exit alsa_seq_exit(void)
102 {
103         /* unregister our internal client */
104         snd_seq_system_client_done();
105
106         /* unregister proc interface */
107         snd_seq_info_done();
108         
109         /* delete timing queues */
110         snd_seq_queues_delete();
111
112         /* unregister sequencer device */
113         snd_sequencer_device_done();
114
115         /* release event memory */
116         snd_sequencer_memory_done();
117 }
118
119 module_init(alsa_seq_init)
120 module_exit(alsa_seq_exit)
121
122   /* seq_clientmgr.c */
123 EXPORT_SYMBOL(snd_seq_create_kernel_client);
124 EXPORT_SYMBOL(snd_seq_delete_kernel_client);
125 EXPORT_SYMBOL(snd_seq_kernel_client_enqueue);
126 EXPORT_SYMBOL(snd_seq_kernel_client_enqueue_blocking);
127 EXPORT_SYMBOL(snd_seq_kernel_client_dispatch);
128 EXPORT_SYMBOL(snd_seq_kernel_client_ctl);
129 EXPORT_SYMBOL(snd_seq_kernel_client_write_poll);
130   /* seq_memory.c */
131 EXPORT_SYMBOL(snd_seq_expand_var_event);
132 EXPORT_SYMBOL(snd_seq_dump_var_event);
133   /* seq_ports.c */
134 EXPORT_SYMBOL(snd_seq_event_port_attach);
135 EXPORT_SYMBOL(snd_seq_event_port_detach);
136   /* seq_lock.c */
137 #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
138 /*EXPORT_SYMBOL(snd_seq_sleep_in_lock);*/
139 /*EXPORT_SYMBOL(snd_seq_sleep_timeout_in_lock);*/
140 EXPORT_SYMBOL(snd_use_lock_sync_helper);
141 #endif