0001
0002
0003
0004
0005
0006 #ifndef __SND_SEQ_MEMORYMGR_H
0007 #define __SND_SEQ_MEMORYMGR_H
0008
0009 #include <sound/seq_kernel.h>
0010 #include <linux/poll.h>
0011
0012 struct snd_info_buffer;
0013
0014
0015 struct snd_seq_event_cell {
0016 struct snd_seq_event event;
0017 struct snd_seq_pool *pool;
0018 struct snd_seq_event_cell *next;
0019 };
0020
0021
0022
0023
0024
0025
0026 struct snd_seq_pool {
0027 struct snd_seq_event_cell *ptr;
0028 struct snd_seq_event_cell *free;
0029
0030 int total_elements;
0031 atomic_t counter;
0032
0033 int size;
0034 int room;
0035
0036 int closing;
0037
0038
0039 int max_used;
0040 int event_alloc_nopool;
0041 int event_alloc_failures;
0042 int event_alloc_success;
0043
0044
0045 wait_queue_head_t output_sleep;
0046
0047
0048 spinlock_t lock;
0049 };
0050
0051 void snd_seq_cell_free(struct snd_seq_event_cell *cell);
0052
0053 int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
0054 struct snd_seq_event_cell **cellp, int nonblock,
0055 struct file *file, struct mutex *mutexp);
0056
0057
0058 static inline int snd_seq_unused_cells(struct snd_seq_pool *pool)
0059 {
0060 return pool ? pool->total_elements - atomic_read(&pool->counter) : 0;
0061 }
0062
0063
0064 static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
0065 {
0066 return pool ? pool->total_elements : 0;
0067 }
0068
0069
0070 int snd_seq_pool_init(struct snd_seq_pool *pool);
0071
0072
0073 void snd_seq_pool_mark_closing(struct snd_seq_pool *pool);
0074 int snd_seq_pool_done(struct snd_seq_pool *pool);
0075
0076
0077 struct snd_seq_pool *snd_seq_pool_new(int poolsize);
0078
0079
0080 int snd_seq_pool_delete(struct snd_seq_pool **pool);
0081
0082
0083 int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait);
0084
0085 void snd_seq_info_pool(struct snd_info_buffer *buffer,
0086 struct snd_seq_pool *pool, char *space);
0087
0088 #endif