1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
/*
* ALSA sequencer /proc interface
* Copyright (c) 1998 by Frank van de Pol <F.K.W.van.de.Pol@inter.nl.net>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "driver.h"
#include "seq_info.h"
#include "seq_clientmgr.h"
#include "seq_timer.h"
static snd_info_entry_t *snd_seq_info_queues_entry;
static snd_info_entry_t *snd_seq_info_clients_entry;
static snd_info_entry_t *snd_seq_info_memory_entry;
static snd_info_entry_t *snd_seq_info_timer_entry;
/*---------------------------------------------------------------------------*/
static int snd_seq_info_timer_init(char *name)
{
snd_info_entry_t *entry;
entry = snd_info_create_entry(NULL, name);
if (!entry)
return -ENOMEM;
entry->t.text.read_size = 1024;
entry->t.text.read = snd_seq_info_timer_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
return -ENOMEM;
}
snd_seq_info_timer_entry = entry;
return 0;
}
static int snd_seq_info_timer_done(void)
{
if (snd_seq_info_timer_entry)
snd_info_unregister(snd_seq_info_timer_entry);
return 0;
}
/*---------------------------------------------------------------------------*/
static int snd_seq_info_memory_init(char *name)
{
snd_info_entry_t *entry;
entry = snd_info_create_entry(NULL, name);
if (!entry)
return -ENOMEM;
entry->t.text.read_size = 1024;
entry->t.text.read = snd_seq_info_memory_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
return -ENOMEM;
}
snd_seq_info_memory_entry = entry;
return 0;
}
static int snd_seq_info_memory_done(void)
{
if (snd_seq_info_memory_entry)
snd_info_unregister(snd_seq_info_memory_entry);
return 0;
}
/*---------------------------------------------------------------------------*/
static int snd_seq_info_clients_init(char *name)
{
snd_info_entry_t *entry;
entry = snd_info_create_entry(NULL, name);
if (!entry)
return -ENOMEM;
entry->t.text.read_size = 512 + (256 * SND_SEQ_MAX_CLIENTS);
entry->t.text.read = snd_seq_info_clients_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
return -ENOMEM;
}
snd_seq_info_clients_entry = entry;
return 0;
}
static int snd_seq_info_clients_done(void)
{
if (snd_seq_info_clients_entry)
snd_info_unregister(snd_seq_info_clients_entry);
return 0;
}
/*---------------------------------------------------------------------------*/
static int snd_seq_info_queues_init(char *name)
{
snd_info_entry_t *entry;
entry = snd_info_create_entry(NULL, name);
if (!entry)
return -ENOMEM;
entry->t.text.read_size = 512 + (512 * SND_SEQ_MAX_QUEUES);
entry->t.text.read = snd_seq_info_queues_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
return -ENOMEM;
}
snd_seq_info_queues_entry = entry;
return 0;
}
static int snd_seq_info_queues_done(void)
{
if (snd_seq_info_queues_entry)
snd_info_unregister(snd_seq_info_queues_entry);
return 0;
}
/*---------------------------------------------------------------------------*/
/* create all our /proc entries */
int snd_seq_info_init(void)
{
/* FIXME: better put these items in directory /proc/asound/sequencer/... but how ???? */
snd_seq_info_queues_init("sequencer-queues");
snd_seq_info_clients_init("sequencer-clients");
snd_seq_info_memory_init("sequencer-memory");
snd_seq_info_timer_init("sequencer-timer");
return 0;
}
int snd_seq_info_done(void)
{
snd_seq_info_memory_done();
snd_seq_info_clients_done();
snd_seq_info_queues_done();
snd_seq_info_timer_done();
return 0;
}
|