OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [sound/] [dev_table.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 *      dev_table.h
3
 *
4
 *      Global definitions for device call tables
5
 *
6
 *
7
 * Copyright (C) by Hannu Savolainen 1993-1997
8
 *
9
 * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
10
 * Version 2 (June 1991). See the "COPYING" file distributed with this software
11
 * for more info.
12
 */
13
 
14
 
15
#ifndef _DEV_TABLE_H_
16
#define _DEV_TABLE_H_
17
 
18
/*
19
 * Sound card numbers 27 to 999. (1 to 26 are defined in soundcard.h)
20
 * Numbers 1000 to N are reserved for driver's internal use.
21
 */
22
 
23
#define SNDCARD_DESKPROXL               27      /* Compaq Deskpro XL */
24
#define SNDCARD_VIDC                    28      /* ARMs VIDC */
25
#define SNDCARD_SBPNP                   29
26
#define SNDCARD_SOFTOSS                 36
27
#define SNDCARD_VMIDI                   37
28
#define SNDCARD_OPL3SA1                 38      /* Note: clash in msnd.h */
29
#define SNDCARD_OPL3SA1_SB              39
30
#define SNDCARD_OPL3SA1_MPU             40
31
#define SNDCARD_WAVEFRONT               41
32
#define SNDCARD_OPL3SA2                 42
33
#define SNDCARD_OPL3SA2_MPU             43
34
#define SNDCARD_WAVEARTIST              44      /* Waveartist */
35
#define SNDCARD_OPL3SA2_MSS             45      /* Originally missed */
36
#define SNDCARD_AD1816                  88
37
 
38
/*
39
 *      NOTE!   NOTE!   NOTE!   NOTE!
40
 *
41
 *      If you modify this file, please check the dev_table.c also.
42
 *
43
 *      NOTE!   NOTE!   NOTE!   NOTE!
44
 */
45
 
46
struct driver_info
47
{
48
        char *driver_id;
49
        int card_subtype;       /* Driver specific. Usually 0 */
50
        int card_type;          /*      From soundcard.h        */
51
        char *name;
52
        void (*attach) (struct address_info *hw_config);
53
        int (*probe) (struct address_info *hw_config);
54
        void (*unload) (struct address_info *hw_config);
55
};
56
 
57
struct card_info
58
{
59
        int card_type;  /* Link (search key) to the driver list */
60
        struct address_info config;
61
        int enabled;
62
        void *for_driver_use;
63
};
64
 
65
 
66
/*
67
 * Device specific parameters (used only by dmabuf.c)
68
 */
69
#define MAX_SUB_BUFFERS         (32*MAX_REALTIME_FACTOR)
70
 
71
#define DMODE_NONE              0
72
#define DMODE_OUTPUT            PCM_ENABLE_OUTPUT
73
#define DMODE_INPUT             PCM_ENABLE_INPUT
74
 
75
struct dma_buffparms
76
{
77
        int      dma_mode;      /* DMODE_INPUT, DMODE_OUTPUT or DMODE_NONE */
78
        int      closing;
79
 
80
        /*
81
         * Pointers to raw buffers
82
         */
83
 
84
        char     *raw_buf;
85
        unsigned long   raw_buf_phys;
86
        int buffsize;
87
 
88
        /*
89
         * Device state tables
90
         */
91
 
92
        unsigned long flags;
93
#define DMA_BUSY        0x00000001
94
#define DMA_RESTART     0x00000002
95
#define DMA_ACTIVE      0x00000004
96
#define DMA_STARTED     0x00000008
97
#define DMA_EMPTY       0x00000010      
98
#define DMA_ALLOC_DONE  0x00000020
99
#define DMA_SYNCING     0x00000040
100
#define DMA_DIRTY       0x00000080
101
#define DMA_POST        0x00000100
102
#define DMA_NODMA       0x00000200
103
#define DMA_NOTIMEOUT   0x00000400
104
 
105
        int      open_mode;
106
 
107
        /*
108
         * Queue parameters.
109
         */
110
        int      qlen;
111
        int      qhead;
112
        int      qtail;
113
        int      cfrag; /* Current incomplete fragment (write) */
114
 
115
        int      nbufs;
116
        int      counts[MAX_SUB_BUFFERS];
117
        int      subdivision;
118
 
119
        int      fragment_size;
120
        int      needs_reorg;
121
        int      max_fragments;
122
 
123
        int      bytes_in_use;
124
 
125
        int      underrun_count;
126
        unsigned long    byte_counter;
127
        unsigned long    user_counter;
128
        unsigned long    max_byte_counter;
129
        int      data_rate; /* Bytes/second */
130
 
131
        int      mapping_flags;
132
#define                 DMA_MAP_MAPPED          0x00000001
133
        char    neutral_byte;
134
        int     dma;            /* DMA channel */
135
 
136
        int     applic_profile; /* Application profile (APF_*) */
137
        /* Interrupt callback stuff */
138
        void (*audio_callback) (int dev, int parm);
139
        int callback_parm;
140
 
141
        int      buf_flags[MAX_SUB_BUFFERS];
142
#define          BUFF_EOF               0x00000001 /* Increment eof count */
143
#define          BUFF_DIRTY             0x00000002 /* Buffer written */
144
};
145
 
146
/*
147
 * Structure for use with various microcontrollers and DSP processors
148
 * in the recent sound cards.
149
 */
150
typedef struct coproc_operations
151
{
152
        char name[64];
153
        struct module *owner;
154
        int (*open) (void *devc, int sub_device);
155
        void (*close) (void *devc, int sub_device);
156
        int (*ioctl) (void *devc, unsigned int cmd, caddr_t arg, int local);
157
        void (*reset) (void *devc);
158
 
159
        void *devc;             /* Driver specific info */
160
} coproc_operations;
161
 
162
struct audio_driver
163
{
164
        struct module *owner;
165
        int (*open) (int dev, int mode);
166
        void (*close) (int dev);
167
        void (*output_block) (int dev, unsigned long buf,
168
                              int count, int intrflag);
169
        void (*start_input) (int dev, unsigned long buf,
170
                             int count, int intrflag);
171
        int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
172
        int (*prepare_for_input) (int dev, int bufsize, int nbufs);
173
        int (*prepare_for_output) (int dev, int bufsize, int nbufs);
174
        void (*halt_io) (int dev);
175
        int (*local_qlen)(int dev);
176
        void (*copy_user) (int dev,
177
                        char *localbuf, int localoffs,
178
                        const char *userbuf, int useroffs,
179
                        int max_in, int max_out,
180
                        int *used, int *returned,
181
                        int len);
182
        void (*halt_input) (int dev);
183
        void (*halt_output) (int dev);
184
        void (*trigger) (int dev, int bits);
185
        int (*set_speed)(int dev, int speed);
186
        unsigned int (*set_bits)(int dev, unsigned int bits);
187
        short (*set_channels)(int dev, short channels);
188
        void (*postprocess_write)(int dev);     /* Device spesific postprocessing for written data */
189
        void (*preprocess_read)(int dev);       /* Device spesific preprocessing for read data */
190
        void (*mmap)(int dev);
191
};
192
 
193
struct audio_operations
194
{
195
        char name[128];
196
        int flags;
197
#define NOTHING_SPECIAL         0x00
198
#define NEEDS_RESTART           0x01
199
#define DMA_AUTOMODE            0x02
200
#define DMA_DUPLEX              0x04
201
#define DMA_PSEUDO_AUTOMODE     0x08
202
#define DMA_HARDSTOP            0x10
203
#define DMA_EXACT               0x40
204
#define DMA_NORESET             0x80
205
        int  format_mask;       /* Bitmask for supported audio formats */
206
        void *devc;             /* Driver specific info */
207
        struct audio_driver *d;
208
        void *portc;            /* Driver spesific info */
209
        struct dma_buffparms *dmap_in, *dmap_out;
210
        struct coproc_operations *coproc;
211
        int mixer_dev;
212
        int enable_bits;
213
        int open_mode;
214
        int go;
215
        int min_fragment;       /* 0 == unlimited */
216
        int max_fragment;       /* 0 == unlimited */
217
        int parent_dev;         /* 0 -> no parent, 1 to n -> parent=parent_dev+1 */
218
 
219
        /* fields formerly in dmabuf.c */
220
        wait_queue_head_t in_sleeper;
221
        wait_queue_head_t out_sleeper;
222
        wait_queue_head_t poll_sleeper;
223
 
224
        /* fields formerly in audio.c */
225
        int audio_mode;
226
 
227
#define         AM_NONE         0
228
#define         AM_WRITE        OPEN_WRITE
229
#define         AM_READ         OPEN_READ
230
 
231
        int local_format;
232
        int audio_format;
233
        int local_conversion;
234
#define CNV_MU_LAW      0x00000001
235
 
236
        /* large structures at the end to keep offsets small */
237
        struct dma_buffparms dmaps[2];
238
};
239
 
240
int *load_mixer_volumes(char *name, int *levels, int present);
241
 
242
struct mixer_operations
243
{
244
        struct module *owner;
245
        char id[16];
246
        char name[64];
247
        int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
248
 
249
        void *devc;
250
        int modify_counter;
251
};
252
 
253
struct synth_operations
254
{
255
        struct module *owner;
256
        char *id;       /* Unique identifier (ASCII) max 29 char */
257
        struct synth_info *info;
258
        int midi_dev;
259
        int synth_type;
260
        int synth_subtype;
261
 
262
        int (*open) (int dev, int mode);
263
        void (*close) (int dev);
264
        int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
265
        int (*kill_note) (int dev, int voice, int note, int velocity);
266
        int (*start_note) (int dev, int voice, int note, int velocity);
267
        int (*set_instr) (int dev, int voice, int instr);
268
        void (*reset) (int dev);
269
        void (*hw_control) (int dev, unsigned char *event);
270
        int (*load_patch) (int dev, int format, const char *addr,
271
             int offs, int count, int pmgr_flag);
272
        void (*aftertouch) (int dev, int voice, int pressure);
273
        void (*controller) (int dev, int voice, int ctrl_num, int value);
274
        void (*panning) (int dev, int voice, int value);
275
        void (*volume_method) (int dev, int mode);
276
        void (*bender) (int dev, int chn, int value);
277
        int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info *alloc);
278
        void (*setup_voice) (int dev, int voice, int chn);
279
        int (*send_sysex)(int dev, unsigned char *bytes, int len);
280
 
281
        struct voice_alloc_info alloc;
282
        struct channel_info chn_info[16];
283
        int emulation;
284
#define EMU_GM                  1       /* General MIDI */
285
#define EMU_XG                  2       /* Yamaha XG */
286
#define MAX_SYSEX_BUF   64
287
        unsigned char sysex_buf[MAX_SYSEX_BUF];
288
        int sysex_ptr;
289
};
290
 
291
struct midi_input_info
292
{
293
        /* MIDI input scanner variables */
294
#define MI_MAX  10
295
        int             m_busy;
296
        unsigned char   m_buf[MI_MAX];
297
        unsigned char   m_prev_status;  /* For running status */
298
        int             m_ptr;
299
#define MST_INIT                        0
300
#define MST_DATA                        1
301
#define MST_SYSEX                       2
302
        int             m_state;
303
        int             m_left;
304
};
305
 
306
struct midi_operations
307
{
308
        struct module *owner;
309
        struct midi_info info;
310
        struct synth_operations *converter;
311
        struct midi_input_info in_info;
312
        int (*open) (int dev, int mode,
313
                void (*inputintr)(int dev, unsigned char data),
314
                void (*outputintr)(int dev)
315
                );
316
        void (*close) (int dev);
317
        int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
318
        int (*outputc) (int dev, unsigned char data);
319
        int (*start_read) (int dev);
320
        int (*end_read) (int dev);
321
        void (*kick)(int dev);
322
        int (*command) (int dev, unsigned char *data);
323
        int (*buffer_status) (int dev);
324
        int (*prefix_cmd) (int dev, unsigned char status);
325
        struct coproc_operations *coproc;
326
        void *devc;
327
};
328
 
329
struct sound_lowlev_timer
330
{
331
        int dev;
332
        int priority;
333
        unsigned int (*tmr_start)(int dev, unsigned int usecs);
334
        void (*tmr_disable)(int dev);
335
        void (*tmr_restart)(int dev);
336
};
337
 
338
struct sound_timer_operations
339
{
340
        struct module *owner;
341
        struct sound_timer_info info;
342
        int priority;
343
        int devlink;
344
        int (*open)(int dev, int mode);
345
        void (*close)(int dev);
346
        int (*event)(int dev, unsigned char *ev);
347
        unsigned long (*get_time)(int dev);
348
        int (*ioctl) (int dev, unsigned int cmd, caddr_t arg);
349
        void (*arm_timer)(int dev, long time);
350
};
351
 
352
#ifdef _DEV_TABLE_C_   
353
struct audio_operations *audio_devs[MAX_AUDIO_DEV];
354
int num_audiodevs;
355
struct mixer_operations *mixer_devs[MAX_MIXER_DEV];
356
int num_mixers;
357
struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV];
358
int num_synths;
359
struct midi_operations *midi_devs[MAX_MIDI_DEV];
360
int num_midis;
361
 
362
extern struct sound_timer_operations default_sound_timer;
363
struct sound_timer_operations *sound_timer_devs[MAX_TIMER_DEV] = {
364
        &default_sound_timer, NULL
365
};
366
int num_sound_timers = 1;
367
#else
368
extern struct audio_operations *audio_devs[MAX_AUDIO_DEV];
369
extern int num_audiodevs;
370
extern struct mixer_operations *mixer_devs[MAX_MIXER_DEV];
371
extern int num_mixers;
372
extern struct synth_operations *synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV];
373
extern int num_synths;
374
extern struct midi_operations *midi_devs[MAX_MIDI_DEV];
375
extern int num_midis;
376
extern struct sound_timer_operations * sound_timer_devs[MAX_TIMER_DEV];
377
extern int num_sound_timers;
378
#endif  /* _DEV_TABLE_C_ */
379
 
380
extern int sound_map_buffer (int dev, struct dma_buffparms *dmap, buffmem_desc *info);
381
void sound_timer_init (struct sound_lowlev_timer *t, char *name);
382
void sound_dma_intr (int dev, struct dma_buffparms *dmap, int chan);
383
 
384
#define AUDIO_DRIVER_VERSION    2
385
#define MIXER_DRIVER_VERSION    2
386
int sound_install_audiodrv(int vers, char *name, struct audio_driver *driver,
387
                        int driver_size, int flags, unsigned int format_mask,
388
                        void *devc, int dma1, int dma2);
389
int sound_install_mixer(int vers, char *name, struct mixer_operations *driver,
390
                        int driver_size, void *devc);
391
 
392
void sound_unload_audiodev(int dev);
393
void sound_unload_mixerdev(int dev);
394
void sound_unload_mididev(int dev);
395
void sound_unload_synthdev(int dev);
396
void sound_unload_timerdev(int dev);
397
int sound_alloc_audiodev(void);
398
int sound_alloc_mixerdev(void);
399
int sound_alloc_timerdev(void);
400
int sound_alloc_synthdev(void);
401
int sound_alloc_mididev(void);
402
#endif  /* _DEV_TABLE_H_ */
403
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.