ALSA: seq: Simplify snd_seq_kernel_client_enqueue() helper
[linux-2.6-block.git] / include / sound / seq_kernel.h
CommitLineData
1da177e4
LT
1#ifndef __SOUND_SEQ_KERNEL_H
2#define __SOUND_SEQ_KERNEL_H
3
4/*
5 * Main kernel header file for the ALSA sequencer
6 * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl>
7 *
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24#include <linux/time.h>
a1ce3928 25#include <sound/asequencer.h>
1da177e4 26
c7e0b5bf
TI
27typedef struct snd_seq_real_time snd_seq_real_time_t;
28typedef union snd_seq_timestamp snd_seq_timestamp_t;
1da177e4 29
1da177e4 30/* maximum number of queues */
1001fb81 31#define SNDRV_SEQ_MAX_QUEUES 32
1da177e4
LT
32
33/* max number of concurrent clients */
34#define SNDRV_SEQ_MAX_CLIENTS 192
35
36/* max number of concurrent ports */
37#define SNDRV_SEQ_MAX_PORTS 254
38
39/* max number of events in memory pool */
40#define SNDRV_SEQ_MAX_EVENTS 2000
41
1da177e4
LT
42/* default number of events in memory pool */
43#define SNDRV_SEQ_DEFAULT_EVENTS 500
44
45/* max number of events in memory pool for one client (outqueue) */
46#define SNDRV_SEQ_MAX_CLIENT_EVENTS 2000
47
48/* default number of events in memory pool for one client (outqueue) */
49#define SNDRV_SEQ_DEFAULT_CLIENT_EVENTS 200
50
51/* max delivery path length */
3510c7aa
TI
52/* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */
53#define SNDRV_SEQ_MAX_HOPS 8
1da177e4
LT
54
55/* max size of event size */
56#define SNDRV_SEQ_MAX_EVENT_LEN 0x3fffffff
57
1da177e4 58/* call-backs for kernel port */
c7e0b5bf 59struct snd_seq_port_callback {
1da177e4
LT
60 struct module *owner;
61 void *private_data;
c7e0b5bf
TI
62 int (*subscribe)(void *private_data, struct snd_seq_port_subscribe *info);
63 int (*unsubscribe)(void *private_data, struct snd_seq_port_subscribe *info);
64 int (*use)(void *private_data, struct snd_seq_port_subscribe *info);
65 int (*unuse)(void *private_data, struct snd_seq_port_subscribe *info);
66 int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop);
67 void (*private_free)(void *private_data);
1da177e4 68 /*...*/
c7e0b5bf 69};
1da177e4
LT
70
71/* interface for kernel client */
b9075fa9 72__printf(3, 4)
7b6d9245 73int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
b9075fa9 74 const char *name_fmt, ...);
c7e0b5bf 75int snd_seq_delete_kernel_client(int client);
6740ea67
TI
76int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev,
77 struct file *file, bool blocking);
c7e0b5bf
TI
78int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop);
79int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg);
1da177e4
LT
80
81#define SNDRV_SEQ_EXT_MASK 0xc0000000
82#define SNDRV_SEQ_EXT_USRPTR 0x80000000
83#define SNDRV_SEQ_EXT_CHAINED 0x40000000
84
85typedef int (*snd_seq_dump_func_t)(void *ptr, void *buf, int count);
c7e0b5bf
TI
86int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
87 int in_kernel, int size_aligned);
88int snd_seq_dump_var_event(const struct snd_seq_event *event,
89 snd_seq_dump_func_t func, void *private_data);
1da177e4
LT
90
91/* interface for OSS emulation */
c7e0b5bf 92int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo);
1da177e4
LT
93
94/* port callback routines */
c7e0b5bf
TI
95void snd_port_init_callback(struct snd_seq_port_callback *p);
96struct snd_seq_port_callback *snd_port_alloc_callback(void);
1da177e4
LT
97
98/* port attach/detach */
c7e0b5bf 99int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp,
1da177e4
LT
100 int cap, int type, int midi_channels, int midi_voices, char *portname);
101int snd_seq_event_port_detach(int client, int port);
102
ee2da997 103#ifdef CONFIG_MODULES
68ab6108 104void snd_seq_autoload_init(void);
54a721ab 105void snd_seq_autoload_exit(void);
1da177e4 106#else
68ab6108
TI
107#define snd_seq_autoload_init()
108#define snd_seq_autoload_exit()
1da177e4
LT
109#endif
110
111#endif /* __SOUND_SEQ_KERNEL_H */