~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-sparc64/audioio.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * include/asm-sparc/audioio.h
  3  *
  4  * Sparc Audio Midlayer
  5  * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu)
  6  */
  7 
  8 #ifndef _AUDIOIO_H_
  9 #define _AUDIOIO_H_
 10 
 11 /*
 12  *      SunOS/Solaris /dev/audio interface
 13  */
 14 
 15 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
 16 #include <linux/types.h>
 17 #include <linux/time.h>
 18 #include <linux/ioctl.h>
 19 #endif
 20 
 21 /*
 22  * This structure contains state information for audio device IO streams.
 23  */
 24 typedef struct audio_prinfo {
 25         /*
 26          * The following values describe the audio data encoding.
 27          */
 28         unsigned int sample_rate;       /* samples per second */
 29         unsigned int channels;  /* number of interleaved channels */
 30         unsigned int precision; /* bit-width of each sample */
 31         unsigned int encoding;  /* data encoding method */
 32 
 33         /*
 34          * The following values control audio device configuration
 35          */
 36         unsigned int gain;              /* gain level: 0 - 255 */
 37         unsigned int port;              /* selected I/O port (see below) */
 38         unsigned int avail_ports;       /* available I/O ports (see below) */
 39         unsigned int _xxx[2];           /* Reserved for future use */
 40 
 41         unsigned int buffer_size;       /* I/O buffer size */
 42 
 43         /*
 44          * The following values describe driver state
 45          */
 46         unsigned int samples;           /* number of samples converted */
 47         unsigned int eof;               /* End Of File counter (play only) */
 48 
 49         unsigned char   pause;          /* non-zero for pause, zero to resume */
 50         unsigned char   error;          /* non-zero if overflow/underflow */
 51         unsigned char   waiting;        /* non-zero if a process wants access */
 52         unsigned char balance;  /* stereo channel balance */
 53 
 54         unsigned short minordev;
 55 
 56         /*
 57          * The following values are read-only state flags
 58          */
 59         unsigned char open;             /* non-zero if open access permitted */
 60         unsigned char active;           /* non-zero if I/O is active */
 61 } audio_prinfo_t;
 62 
 63 
 64 /*
 65  * This structure describes the current state of the audio device.
 66  */
 67 typedef struct audio_info {
 68         /*
 69          * Per-stream information
 70          */
 71         audio_prinfo_t play;    /* output status information */
 72         audio_prinfo_t record;  /* input status information */
 73 
 74         /*
 75          * Per-unit/channel information
 76          */
 77         unsigned int monitor_gain;      /* input to output mix: 0 - 255 */
 78         unsigned char output_muted;     /* non-zero if output is muted */
 79         unsigned char _xxx[3];  /* Reserved for future use */
 80         unsigned int _yyy[3];           /* Reserved for future use */
 81 } audio_info_t;
 82 
 83 
 84 /*
 85  * Audio encoding types
 86  */
 87 #define AUDIO_ENCODING_NONE     (0)     /* no encoding assigned   */
 88 #define AUDIO_ENCODING_ULAW     (1)     /* u-law encoding         */
 89 #define AUDIO_ENCODING_ALAW     (2)     /* A-law encoding         */
 90 #define AUDIO_ENCODING_LINEAR   (3)     /* Linear PCM encoding    */
 91 #define AUDIO_ENCODING_FLOAT    (4)     /* IEEE float (-1. <-> +1.) */
 92 #define AUDIO_ENCODING_DVI      (104)   /* DVI ADPCM              */
 93 #define AUDIO_ENCODING_LINEAR8  (105)   /* 8 bit UNSIGNED         */
 94 #define AUDIO_ENCODING_LINEARLE (106)   /* Linear PCM LE encoding */
 95 
 96 /*
 97  * These ranges apply to record, play, and monitor gain values
 98  */
 99 #define AUDIO_MIN_GAIN  (0)     /* minimum gain value */
100 #define AUDIO_MAX_GAIN  (255)   /* maximum gain value */
101 
102 /*
103  * These values apply to the balance field to adjust channel gain values
104  */
105 #define AUDIO_LEFT_BALANCE      (0)     /* left channel only    */
106 #define AUDIO_MID_BALANCE       (32)    /* equal left/right channel */
107 #define AUDIO_RIGHT_BALANCE     (64)    /* right channel only   */
108 #define AUDIO_BALANCE_SHIFT     (3)
109 
110 /*
111  * Generic minimum/maximum limits for number of channels, both modes
112  */
113 #define AUDIO_MIN_PLAY_CHANNELS (1)
114 #define AUDIO_MAX_PLAY_CHANNELS (4)
115 #define AUDIO_MIN_REC_CHANNELS  (1)
116 #define AUDIO_MAX_REC_CHANNELS  (4)
117 
118 /*
119  * Generic minimum/maximum limits for sample precision
120  */
121 #define AUDIO_MIN_PLAY_PRECISION        (8)
122 #define AUDIO_MAX_PLAY_PRECISION        (32)
123 #define AUDIO_MIN_REC_PRECISION         (8)
124 #define AUDIO_MAX_REC_PRECISION         (32)
125 
126 /*
127  * Define some convenient names for typical audio ports
128  */
129 /*
130  * output ports (several may be enabled simultaneously)
131  */
132 #define AUDIO_SPEAKER           0x01    /* output to built-in speaker */
133 #define AUDIO_HEADPHONE         0x02    /* output to headphone jack */
134 #define AUDIO_LINE_OUT          0x04    /* output to line out    */
135 
136 /*
137  * input ports (usually only one at a time)
138  */
139 #define AUDIO_MICROPHONE        0x01    /* input from microphone */
140 #define AUDIO_LINE_IN           0x02    /* input from line in    */
141 #define AUDIO_CD                0x04    /* input from on-board CD inputs */
142 #define AUDIO_INTERNAL_CD_IN    AUDIO_CD        /* input from internal CDROM */
143 #define AUDIO_ANALOG_LOOPBACK   0x40    /* input from output */
144 
145 
146 /*
147  * This macro initializes an audio_info structure to 'harmless' values.
148  * Note that (~0) might not be a harmless value for a flag that was
149  * a signed int.
150  */
151 #define AUDIO_INITINFO(i)       {                                       \
152         unsigned int    *__x__;                                         \
153         for (__x__ = (unsigned int *)(i);                               \
154             (char *) __x__ < (((char *)(i)) + sizeof (audio_info_t));   \
155             *__x__++ = ~0);                                             \
156 }
157 
158 /*
159  * These allow testing for what the user wants to set 
160  */
161 #define AUD_INITVALUE   (~0)
162 #define Modify(X)       ((unsigned int)(X) != AUD_INITVALUE)
163 #define Modifys(X)      ((X) != (unsigned short)AUD_INITVALUE)
164 #define Modifyc(X)      ((X) != (unsigned char)AUD_INITVALUE)
165 
166 /*
167  * Parameter for the AUDIO_GETDEV ioctl to determine current
168  * audio devices.
169  */
170 #define MAX_AUDIO_DEV_LEN       (16)
171 typedef struct audio_device {
172         char name[MAX_AUDIO_DEV_LEN];
173         char version[MAX_AUDIO_DEV_LEN];
174         char config[MAX_AUDIO_DEV_LEN];
175 } audio_device_t;
176 
177 
178 /*
179  * Ioctl calls for the audio device.
180  */
181 
182 /*
183  * AUDIO_GETINFO retrieves the current state of the audio device.
184  *
185  * AUDIO_SETINFO copies all fields of the audio_info structure whose
186  * values are not set to the initialized value (-1) to the device state.
187  * It performs an implicit AUDIO_GETINFO to return the new state of the
188  * device.  Note that the record.samples and play.samples fields are set
189  * to the last value before the AUDIO_SETINFO took effect.  This allows
190  * an application to reset the counters while atomically retrieving the
191  * last value.
192  *
193  * AUDIO_DRAIN suspends the calling process until the write buffers are
194  * empty.
195  *
196  * AUDIO_GETDEV returns a structure of type audio_device_t which contains
197  * three strings.  The string "name" is a short identifying string (for
198  * example, the SBus Fcode name string), the string "version" identifies
199  * the current version of the device, and the "config" string identifies
200  * the specific configuration of the audio stream.  All fields are
201  * device-dependent -- see the device specific manual pages for details.
202  *
203  * AUDIO_GETDEV_SUNOS returns a number which is an audio device defined 
204  * herein (making it not too portable)
205  *
206  * AUDIO_FLUSH stops all playback and recording, clears all queued buffers, 
207  * resets error counters, and restarts recording and playback as appropriate
208  * for the current sampling mode.
209  */
210 #define AUDIO_GETINFO   _IOR('A', 1, audio_info_t)
211 #define AUDIO_SETINFO   _IOWR('A', 2, audio_info_t)
212 #define AUDIO_DRAIN     _IO('A', 3)
213 #define AUDIO_GETDEV    _IOR('A', 4, audio_device_t)
214 #define AUDIO_GETDEV_SUNOS      _IOR('A', 4, int)
215 #define AUDIO_FLUSH     _IO('A', 5)
216 
217 /* Define possible audio hardware configurations for 
218  * old SunOS-style AUDIO_GETDEV ioctl */
219 #define AUDIO_DEV_UNKNOWN       (0)     /* not defined */
220 #define AUDIO_DEV_AMD           (1)     /* audioamd device */
221 #define AUDIO_DEV_SPEAKERBOX    (2)     /* dbri device with speakerbox */
222 #define AUDIO_DEV_CODEC         (3)     /* dbri device (internal speaker) */
223 #define AUDIO_DEV_CS4231        (5)     /* cs4231 device */
224 
225 /*
226  * The following ioctl sets the audio device into an internal loopback mode,
227  * if the hardware supports this.  The argument is TRUE to set loopback,
228  * FALSE to reset to normal operation.  If the hardware does not support
229  * internal loopback, the ioctl should fail with EINVAL.
230  * Causes ADC data to be digitally mixed in and sent to the DAC.
231  */
232 #define AUDIO_DIAG_LOOPBACK     _IOW('A', 101, int)
233 
234 /*
235  *      Linux kernel internal implementation.
236  */
237 
238 #ifdef __KERNEL__
239 
240 #include <linux/fs.h>
241 #include <linux/tqueue.h>
242 #include <linux/wait.h>
243 
244 #define SDF_OPEN_WRITE  0x00000001
245 #define SDF_OPEN_READ   0x00000002
246 
247 struct sparcaudio_ringbuffer
248 {
249   __u8 *rb_start, *rb_end;              /* start, end of this memory buffer */
250   __u8 *rb_in, *rb_out;                 /* input, output pointers */
251 
252   int rb_fragsize;                      /* size of an audio frag */
253   int rb_numfrags;                      /* number of frags */
254 
255   int rb_count, rb_hiwat, rb_lowat;     /* bytes in use, hi/lo wat points */
256 
257   int rb_bufsize;                       /* total size of buffer */
258 };
259 
260 struct sparcaudio_driver
261 {
262         const char * name;
263         struct sparcaudio_operations *ops;
264         void *private;
265         unsigned long flags;
266         struct strevent *sd_siglist;
267         /* duplex: 0=simplex, 1=duplex, 2=loop */
268         int sd_sigflags, duplex;
269 
270         /* Which audio device are we? */
271         int index; 
272 
273         /* This device */
274         struct sbus_dev *dev;
275 
276         /* Processes blocked on open() sit here. */
277         wait_queue_head_t open_wait;
278 
279         /* Task queue for this driver's bottom half. */
280         struct tq_struct tqueue;
281 
282         /* Start of ring buffer support */
283         __u8 *input_buffer, *output_buffer;
284 
285         /* Support for a circular queue of output buffers. */
286         __u8 **output_buffers;
287         size_t *output_sizes, output_size, output_buffer_size;
288         int num_output_buffers, output_front, output_rear, output_offset;
289         int output_count, output_active, playing_count, output_eof;
290         wait_queue_head_t output_write_wait, output_drain_wait;
291         char *output_notify;
292 
293         /* Support for a circular queue of input buffers. */
294         __u8 **input_buffers;
295         size_t *input_sizes, input_size, input_buffer_size;
296         int num_input_buffers, input_front, input_rear, input_offset;
297         int input_count, input_active, recording_count;
298         wait_queue_head_t input_read_wait;
299 
300         /* Hack to make it look like we support variable size buffers. */
301         int buffer_size;
302 
303         int mixer_modify_counter;
304 };
305 
306 struct sparcaudio_operations
307 {
308         int (*open)(struct inode *, struct file *, struct sparcaudio_driver *);
309         void (*release)(struct inode *, struct file *, struct sparcaudio_driver *);
310         int (*ioctl)(struct inode *, struct file *, unsigned int, unsigned long,
311                      struct sparcaudio_driver *);
312 
313         /* Ask driver to begin playing a buffer. */
314         void (*start_output)(struct sparcaudio_driver *, __u8 *, unsigned long);
315 
316         /* Ask driver to stop playing a buffer. */
317         void (*stop_output)(struct sparcaudio_driver *);
318 
319         /* Ask driver to begin recording into a buffer. */
320         void (*start_input)(struct sparcaudio_driver *, __u8 *, unsigned long);
321 
322         /* Ask driver to stop recording. */
323         void (*stop_input)(struct sparcaudio_driver *);
324 
325         /* Return driver name/version to caller. (/dev/audio specific) */
326         void (*sunaudio_getdev)(struct sparcaudio_driver *, audio_device_t *);
327 
328         /* Get and set the output volume. (0-255) */
329         int (*set_output_volume)(struct sparcaudio_driver *, int);
330         int (*get_output_volume)(struct sparcaudio_driver *);
331 
332         /* Get and set the input volume. (0-255) */
333         int (*set_input_volume)(struct sparcaudio_driver *, int);
334         int (*get_input_volume)(struct sparcaudio_driver *);
335 
336         /* Get and set the monitor volume. (0-255) */
337         int (*set_monitor_volume)(struct sparcaudio_driver *, int);
338         int (*get_monitor_volume)(struct sparcaudio_driver *);
339 
340         /* Get and set the output balance. (0-64) */
341         int (*set_output_balance)(struct sparcaudio_driver *, int);
342         int (*get_output_balance)(struct sparcaudio_driver *);
343 
344         /* Get and set the input balance. (0-64) */
345         int (*set_input_balance)(struct sparcaudio_driver *, int);
346         int (*get_input_balance)(struct sparcaudio_driver *);
347 
348         /* Get and set the output channels. (1-4) */
349         int (*set_output_channels)(struct sparcaudio_driver *, int);
350         int (*get_output_channels)(struct sparcaudio_driver *);
351 
352         /* Get and set the input channels. (1-4) */
353         int (*set_input_channels)(struct sparcaudio_driver *, int);
354         int (*get_input_channels)(struct sparcaudio_driver *);
355 
356         /* Get and set the output precision. (8-32) */
357         int (*set_output_precision)(struct sparcaudio_driver *, int);
358         int (*get_output_precision)(struct sparcaudio_driver *);
359 
360         /* Get and set the input precision. (8-32) */
361         int (*set_input_precision)(struct sparcaudio_driver *, int);
362         int (*get_input_precision)(struct sparcaudio_driver *);
363 
364         /* Get and set the output port. () */
365         int (*set_output_port)(struct sparcaudio_driver *, int);
366         int (*get_output_port)(struct sparcaudio_driver *);
367 
368         /* Get and set the input port. () */
369         int (*set_input_port)(struct sparcaudio_driver *, int);
370         int (*get_input_port)(struct sparcaudio_driver *);
371 
372         /* Get and set the output encoding. () */
373         int (*set_output_encoding)(struct sparcaudio_driver *, int);
374         int (*get_output_encoding)(struct sparcaudio_driver *);
375 
376         /* Get and set the input encoding. () */
377         int (*set_input_encoding)(struct sparcaudio_driver *, int);
378         int (*get_input_encoding)(struct sparcaudio_driver *);
379 
380         /* Get and set the output rate. () */
381         int (*set_output_rate)(struct sparcaudio_driver *, int);
382         int (*get_output_rate)(struct sparcaudio_driver *);
383 
384         /* Get and set the input rate. () */
385         int (*set_input_rate)(struct sparcaudio_driver *, int);
386         int (*get_input_rate)(struct sparcaudio_driver *);
387 
388         /* Return driver number to caller. (SunOS /dev/audio specific) */
389         int (*sunaudio_getdev_sunos)(struct sparcaudio_driver *);
390 
391         /* Get available ports */
392         int (*get_output_ports)(struct sparcaudio_driver *);
393         int (*get_input_ports)(struct sparcaudio_driver *);
394 
395         /* Get and set output mute */
396         int (*set_output_muted)(struct sparcaudio_driver *, int);
397         int (*get_output_muted)(struct sparcaudio_driver *);
398 
399         /* Get and set output pause */
400         int (*set_output_pause)(struct sparcaudio_driver *, int);
401         int (*get_output_pause)(struct sparcaudio_driver *);
402 
403         /* Get and set input pause */
404         int (*set_input_pause)(struct sparcaudio_driver *, int);
405         int (*get_input_pause)(struct sparcaudio_driver *);
406 
407         /* Get and set output samples */
408         int (*set_output_samples)(struct sparcaudio_driver *, int);
409         int (*get_output_samples)(struct sparcaudio_driver *);
410 
411         /* Get and set input samples */
412         int (*set_input_samples)(struct sparcaudio_driver *, int);
413         int (*get_input_samples)(struct sparcaudio_driver *);
414 
415         /* Get and set output error */
416         int (*set_output_error)(struct sparcaudio_driver *, int);
417         int (*get_output_error)(struct sparcaudio_driver *);
418 
419         /* Get and set input error */
420         int (*set_input_error)(struct sparcaudio_driver *, int);
421         int (*get_input_error)(struct sparcaudio_driver *);
422 
423         /* Get supported encodings */
424         int (*get_formats)(struct sparcaudio_driver *);
425 };
426 
427 extern int register_sparcaudio_driver(struct sparcaudio_driver *, int);
428 extern int unregister_sparcaudio_driver(struct sparcaudio_driver *, int);
429 extern void sparcaudio_output_done(struct sparcaudio_driver *, int);
430 extern void sparcaudio_input_done(struct sparcaudio_driver *, int);
431 extern int amd7930_init(void);
432 extern int cs4231_init(void);
433 
434 #endif
435 
436 /* Device minor numbers */
437 
438 #define SPARCAUDIO_MIXER_MINOR 0
439 /* No sequencer (1) */
440 /* No midi (2) */
441 #define SPARCAUDIO_DSP_MINOR   3
442 #define SPARCAUDIO_AUDIO_MINOR 4
443 #define SPARCAUDIO_DSP16_MINOR 5
444 #define SPARCAUDIO_STATUS_MINOR 6
445 #define SPARCAUDIO_AUDIOCTL_MINOR 7
446 /* No sequencer l2 (8) */
447 /* No sound processor (9) */
448 
449 /* allocate 2^SPARCAUDIO_DEVICE_SHIFT minors per audio device */
450 #define SPARCAUDIO_DEVICE_SHIFT 4
451 
452 /* With the coming of dummy devices this should perhaps be as high as 5? */
453 #define SPARCAUDIO_MAX_DEVICES 3
454 
455 /* Streams crap for realaudio */
456 
457 typedef
458 struct strevent {
459     struct strevent *se_next;   /* next event for this stream or NULL*/
460     struct strevent *se_prev;   /* previous event for this stream or last
461                                  * event if this is the first one*/
462     pid_t se_pid;               /* process to be signaled */
463     short se_evs;               /* events wanted */
464 } strevent_t;
465 
466 typedef
467 struct stdata
468 {
469         struct stdata    *sd_next ;     /* all stdatas are linked together */
470         struct stdata    *sd_prev ;
471         struct strevent   *sd_siglist;  /* processes to be sent SIGPOLL */
472         int  sd_sigflags;               /* logical OR of all siglist events */
473 } stdata_t;
474 
475 #define I_NREAD _IOR('S',01, int)
476 #define I_NREAD_SOLARIS (('S'<<8)|1)
477 
478 #define I_FLUSH _IO('S',05)
479 #define I_FLUSH_SOLARIS (('S'<<8)|5)
480 #define FLUSHR  1                       /* flush read queue */
481 #define FLUSHW  2                       /* flush write queue */
482 #define FLUSHRW 3                       /* flush both queues */
483 
484 #define I_SETSIG _IO('S',011)
485 #define I_SETSIG_SOLARIS (('S'<<8)|11)
486 #define S_INPUT         0x01
487 #define S_HIPRI         0x02           
488 #define S_OUTPUT        0x04           
489 #define S_MSG           0x08           
490 #define S_ERROR         0x0010         
491 #define S_HANGUP        0x0020         
492 #define S_RDNORM        0x0040         
493 #define S_WRNORM        S_OUTPUT
494 #define S_RDBAND        0x0080         
495 #define S_WRBAND        0x0100         
496 #define S_BANDURG       0x0200         
497 #define S_ALL           0x03FF
498 
499 #define I_GETSIG _IOR('S',012,int)
500 #define I_GETSIG_SOLARIS (('S'<<8)|12)
501 
502 /* Conversion between Sun and OSS volume settings */
503 static __inline__ 
504 int OSS_LEFT(int value)
505 {
506   return ((value & 0xff) % 101);
507 }
508 
509 static __inline__ 
510 int OSS_RIGHT(int value)
511 {
512   return  (((value >> 8) & 0xff) % 101);
513 }
514 
515 static __inline__ 
516 int O_TO_S(int value)
517 {
518   return value * 255 / 100;
519 }
520 
521 static __inline__ 
522 int S_TO_O(int value)
523 {
524   return value * 100 / 255;
525 }
526 
527 static __inline__ 
528 int OSS_TO_GAIN(int value)
529 {
530   int l = O_TO_S(OSS_LEFT(value));
531   int r = O_TO_S(OSS_RIGHT(value));
532   return ((l > r) ? l : r);
533 }
534 
535 static __inline__ 
536 int OSS_TO_LGAIN(int value)
537 {
538   int l = O_TO_S(OSS_LEFT(value));
539   int r = O_TO_S(OSS_RIGHT(value));
540   return ((l < r) ? l : r);
541 }
542 
543 static __inline__ 
544 int OSS_TO_BAL(int value) 
545 {
546   if (!OSS_TO_GAIN(value))
547     return AUDIO_MID_BALANCE;
548   if (!OSS_TO_LGAIN(value)) {
549     if (OSS_TO_GAIN(value) == OSS_TO_GAIN(OSS_RIGHT(value)))
550       return AUDIO_RIGHT_BALANCE;
551     else
552       return AUDIO_LEFT_BALANCE;
553   }
554   if (OSS_TO_GAIN(value) == OSS_TO_GAIN(OSS_RIGHT(value)))
555     return ((OSS_TO_GAIN(value) - OSS_TO_LGAIN(value)) >> AUDIO_BALANCE_SHIFT)
556       + AUDIO_MID_BALANCE;
557   else
558     return AUDIO_MID_BALANCE - ((OSS_TO_GAIN(value) - OSS_TO_LGAIN(value)) 
559                                 >> AUDIO_BALANCE_SHIFT);
560 }
561 
562 static __inline__ 
563 int BAL_TO_OSS(int value, unsigned char balance)
564 {
565   int l, r, adj;
566   if (balance > 63) balance = 63;
567   if (balance < AUDIO_MID_BALANCE) {
568     l = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
569     adj = ((AUDIO_MID_BALANCE - balance) << AUDIO_BALANCE_SHIFT);
570     if (adj < value)
571       r = (int)(value - adj)
572         * 100 / 255;
573     else r = 0;
574   } else if (balance > AUDIO_MID_BALANCE) {
575     r = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
576     adj = ((balance - AUDIO_MID_BALANCE) << AUDIO_BALANCE_SHIFT);
577     if (adj < value)
578       l = (int)(value - adj)
579         * 100 / 255;
580     else l = 0;
581   } else {
582     l = r = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
583   }
584 
585   return ((r << 8) + l);
586 }
587 
588 #ifdef __KERNEL__
589 /* OSS mixer ioctl port handling */
590 static __inline__
591 int OSS_PORT_AUDIO(struct sparcaudio_driver *drv, unsigned int set) 
592 {
593   int p;
594   if (drv->ops->get_output_port) {
595     p = drv->ops->get_output_port(drv);
596     if (p & set)
597       return 0x6464;
598   }  
599   return 0;
600 }
601 
602 static __inline__
603 int OSS_IPORT_AUDIO(struct sparcaudio_driver *drv, unsigned int set) 
604 {
605   int p;
606   if (drv->ops->get_input_port) {
607     p = drv->ops->get_input_port(drv);
608     if (p & set)
609       return 0x6464;
610   }  
611   return 0;
612 }
613 
614 static __inline__ 
615 void OSS_TWIDDLE_PORT(struct sparcaudio_driver *drv, unsigned int ioctl, 
616                       unsigned int port, unsigned int set, unsigned int value) 
617 {
618   if (ioctl == port) {
619     int p;
620     if (drv->ops->get_output_port && drv->ops->set_output_port) {
621       p = drv->ops->get_output_port(drv);
622       if ((value == 0) || ((p & set) && (OSS_LEFT(value) < 100)))
623         drv->ops->set_output_port(drv, p & ~(set));
624       else
625         drv->ops->set_output_port(drv, p | set);
626     }
627   }
628 }
629 
630 static __inline__ 
631 void OSS_TWIDDLE_IPORT(struct sparcaudio_driver *drv, unsigned int ioctl, 
632                       unsigned int port, unsigned int set, unsigned int value) 
633 {
634   if (ioctl == port) {
635     int p;
636     if (drv->ops->get_input_port && drv->ops->set_input_port) {
637       p = drv->ops->get_input_port(drv);
638       if ((value == 0) || ((p & set) && (OSS_LEFT(value) < 100)))
639         drv->ops->set_input_port(drv, p & ~(set));
640       else
641         drv->ops->set_input_port(drv, p | set);
642     }
643   }
644 }
645 #endif /* __KERNEL__ */
646 #endif /* _AUDIOIO_H_ */
647 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.