| 1 |
|
| 2 | |
| 3 | * ALSA sequencer Client Manager
|
| 4 | * Copyright (c) 1998-1999 by Frank van de Pol <[email protected]>
|
| 5 |
|
| 6 | #ifndef __SND_SEQ_CLIENTMGR_H
|
| 7 | #define __SND_SEQ_CLIENTMGR_H
|
| 8 |
|
| 9 | #include <sound/seq_kernel.h>
|
| 10 | #include <linux/bitops.h>
|
| 11 | #include "seq_fifo.h"
|
| 12 | #include "seq_ports.h"
|
| 13 | #include "seq_lock.h"
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 | #define SND_SEQ_GROUP_FILTER_MASK GENMASK(SNDRV_UMP_MAX_GROUPS, 0)
|
| 18 | #define SND_SEQ_GROUP_FILTER_GROUPS GENMASK(SNDRV_UMP_MAX_GROUPS, 1)
|
| 19 |
|
| 20 | struct snd_seq_user_client {
|
| 21 | struct file *file;
|
| 22 |
|
| 23 | struct pid *owner;
|
| 24 |
|
| 25 |
|
| 26 | struct snd_seq_fifo *fifo;
|
| 27 | int fifo_pool_size;
|
| 28 | };
|
| 29 |
|
| 30 | struct snd_seq_kernel_client {
|
| 31 |
|
| 32 | struct snd_card *card;
|
| 33 | };
|
| 34 |
|
| 35 |
|
| 36 | struct snd_seq_client {
|
| 37 | snd_seq_client_type_t type;
|
| 38 | unsigned int accept_input: 1,
|
| 39 | accept_output: 1;
|
| 40 | unsigned int midi_version;
|
| 41 | unsigned int user_pversion;
|
| 42 | char name[64];
|
| 43 | int number;
|
| 44 | unsigned int filter;
|
| 45 | DECLARE_BITMAP(event_filter, 256);
|
| 46 | unsigned int group_filter;
|
| 47 | snd_use_lock_t use_lock;
|
| 48 | int event_lost;
|
| 49 |
|
| 50 | int num_ports;
|
| 51 | struct list_head ports_list_head;
|
| 52 | struct mutex ports_mutex;
|
| 53 | struct mutex ioctl_mutex;
|
| 54 | int convert32;
|
| 55 | int ump_endpoint_port;
|
| 56 |
|
| 57 |
|
| 58 | struct snd_seq_pool *pool;
|
| 59 |
|
| 60 | union {
|
| 61 | struct snd_seq_user_client user;
|
| 62 | struct snd_seq_kernel_client kernel;
|
| 63 | } data;
|
| 64 |
|
| 65 |
|
| 66 | void **ump_info;
|
| 67 | };
|
| 68 |
|
| 69 |
|
| 70 | struct snd_seq_usage {
|
| 71 | int cur;
|
| 72 | int peak;
|
| 73 | };
|
| 74 |
|
| 75 |
|
| 76 | int client_init_data(void);
|
| 77 | int snd_sequencer_device_init(void);
|
| 78 | void snd_sequencer_device_done(void);
|
| 79 |
|
| 80 |
|
| 81 | struct snd_seq_client *snd_seq_client_use_ptr(int clientid);
|
| 82 |
|
| 83 | static inline struct snd_seq_client *
|
| 84 | snd_seq_client_ref(struct snd_seq_client *client)
|
| 85 | {
|
| 86 | snd_use_lock_use(&client->use_lock);
|
| 87 | return client;
|
| 88 | }
|
| 89 |
|
| 90 |
|
| 91 | static inline void snd_seq_client_unref(struct snd_seq_client *client)
|
| 92 | {
|
| 93 | snd_use_lock_free(&client->use_lock);
|
| 94 | }
|
| 95 |
|
| 96 | DEFINE_FREE(snd_seq_client, struct snd_seq_client *, if (!IS_ERR_OR_NULL(_T)) snd_seq_client_unref(_T))
|
| 97 |
|
| 98 |
|
| 99 | int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop);
|
| 100 |
|
| 101 | int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_table *wait);
|
| 102 | int snd_seq_client_notify_subscription(int client, int port,
|
| 103 | struct snd_seq_port_subscribe *info, int evtype);
|
| 104 |
|
| 105 | int __snd_seq_deliver_single_event(struct snd_seq_client *dest,
|
| 106 | struct snd_seq_client_port *dest_port,
|
| 107 | struct snd_seq_event *event,
|
| 108 | int atomic, int hop);
|
| 109 |
|
| 110 |
|
| 111 | int snd_seq_kernel_client_ioctl(int clientid, unsigned int cmd, void *arg);
|
| 112 |
|
| 113 | extern int seq_client_load[15];
|
| 114 |
|
| 115 |
|
| 116 | struct snd_seq_client *snd_seq_kernel_client_get(int client);
|
| 117 | void snd_seq_kernel_client_put(struct snd_seq_client *cptr);
|
| 118 |
|
| 119 | static inline bool snd_seq_client_is_ump(struct snd_seq_client *c)
|
| 120 | {
|
| 121 | return c->midi_version != SNDRV_SEQ_CLIENT_LEGACY_MIDI;
|
| 122 | }
|
| 123 |
|
| 124 | static inline bool snd_seq_client_is_midi2(struct snd_seq_client *c)
|
| 125 | {
|
| 126 | return c->midi_version == SNDRV_SEQ_CLIENT_UMP_MIDI_2_0;
|
| 127 | }
|
| 128 |
|
| 129 | #endif
|