diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/dmasound/Makefile linux-2.5/sound/oss/dmasound/Makefile --- bk-linus/sound/oss/dmasound/Makefile 2002-11-21 02:26:14.000000000 +0000 +++ linux-2.5/sound/oss/dmasound/Makefile 2002-11-21 18:06:27.000000000 +0000 @@ -4,9 +4,17 @@ export-objs := dmasound_core.o -obj-$(CONFIG_DMASOUND_ATARI) += dmasound_core.o dmasound_atari.o -obj-$(CONFIG_DMASOUND_AWACS) += dmasound_core.o dmasound_awacs.o -obj-$(CONFIG_DMASOUND_PAULA) += dmasound_core.o dmasound_paula.o -obj-$(CONFIG_DMASOUND_Q40) += dmasound_core.o dmasound_q40.o +list-multi := dmasound_pmac.o + +dmasound_pmac-objs := dmasound_awacs.o trans_16.o tas3001c.o dac3550a.o + +obj-$(CONFIG_DMASOUND) += dmasound_core.o +obj-$(CONFIG_DMASOUND_ATARI) += dmasound_atari.o +obj-$(CONFIG_DMASOUND_PMAC) += dmasound_pmac.o +obj-$(CONFIG_DMASOUND_PAULA) += dmasound_paula.o +obj-$(CONFIG_DMASOUND_Q40) += dmasound_q40.o include $(TOPDIR)/Rules.make + +dmasound_pmac.o: $(dmasound_pmac-objs) + $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(dmasound_pmac-objs) diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/dmasound/awacs_defs.h linux-2.5/sound/oss/dmasound/awacs_defs.h --- bk-linus/sound/oss/dmasound/awacs_defs.h 2002-11-21 02:26:14.000000000 +0000 +++ linux-2.5/sound/oss/dmasound/awacs_defs.h 2002-11-21 18:06:27.000000000 +0000 @@ -71,17 +71,20 @@ struct awacs_regs { /* ------- - --- ----- - ------ */ #define MASK_GAINRIGHT (0xf) /* Gain Right Mask */ #define MASK_GAINLEFT (0xf << 4) /* Gain Left Mask */ -#define MASK_GAINLINE (0x1 << 8) /* Change Gain for Line??? */ -#define MASK_GAINMIC (0x0 << 8) /* Change Gain for Mic??? */ +#define MASK_GAINLINE (0x1 << 8) /* Disable Mic preamp */ +#define MASK_GAINMIC (0x0 << 8) /* Enable Mic preamp */ #define MASK_MUX_CD (0x1 << 9) /* Select CD in MUX */ -#define MASK_MUX_AUDIN (0x1 << 10) /* Select Audio In in MUX */ -#define MASK_MUX_MIC (0x1 << 11) /* Select Mic in MUX */ +#define MASK_MUX_MIC (0x1 << 10) /* Select Mic in MUX */ +#define MASK_MUX_AUDIN (0x1 << 11) /* Select Audio In in MUX */ #define MASK_MUX_LINE MASK_MUX_AUDIN #define GAINRIGHT(x) ((x) & MASK_GAINRIGHT) #define GAINLEFT(x) (((x) << 4) & MASK_GAINLEFT) +#define DEF_CD_GAIN 0x00bb +#define DEF_MIC_GAIN 0x00cc + /* Address 1 Bit Masks */ /* ------- - --- ----- */ #define MASK_ADDR1RES1 (0x3) /* Reserved */ @@ -93,7 +96,10 @@ struct awacs_regs { #define MASK_ADDR1RES2 (0x1 << 8) /* Reserved */ #define MASK_AMUTE (0x1 << 9) /* Output A (Headphone) Mute when 1 */ #define MASK_HDMUTE MASK_AMUTE -#define MASK_PAROUT (0x3 << 10) /* Parallel Out (???) */ +#define MASK_PAROUT0 (0x1 << 10) /* Parallel Output 0 */ +#define MASK_PAROUT1 (0x2 << 10) /* Parallel Output 1 */ + +#define MASK_MIC_BOOST (0x4) /* screamer mic boost */ #define SAMPLERATE_48000 (0x0 << 3) /* 48 or 44.1 kHz */ #define SAMPLERATE_32000 (0x1 << 3) /* 32 or 29.4 kHz */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/dmasound/dmasound.h linux-2.5/sound/oss/dmasound/dmasound.h --- bk-linus/sound/oss/dmasound/dmasound.h 2002-11-21 02:26:14.000000000 +0000 +++ linux-2.5/sound/oss/dmasound/dmasound.h 2002-11-21 18:06:27.000000000 +0000 @@ -1,4 +1,4 @@ - +#ifndef _dmasound_h_ /* * linux/drivers/sound/dmasound/dmasound.h * @@ -10,11 +10,11 @@ * device for true DSP processors but it will be called something else. * In v3.0 it's /dev/sndproc but this could be a temporary solution. */ +#define _dmasound_h_ - +#include #include - #define SND_NDEVS 256 /* Number of supported devices */ #define SND_DEV_CTL 0 /* Control port /dev/mixer */ #define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM @@ -29,23 +29,16 @@ #define SND_DEV_SNDPROC 9 /* /dev/sndproc for programmable devices */ #define SND_DEV_PSS SND_DEV_SNDPROC -#define DSP_DEFAULT_SPEED 8000 - -#define ON 1 -#define OFF 0 +/* switch on various prinks */ +#define DEBUG_DMASOUND 1 #define MAX_AUDIO_DEV 5 -#define MAX_MIXER_DEV 2 +#define MAX_MIXER_DEV 4 #define MAX_SYNTH_DEV 3 #define MAX_MIDI_DEV 6 #define MAX_TIMER_DEV 3 - #define MAX_CATCH_RADIUS 10 -#define MIN_BUFFERS 4 -#define MIN_BUFSIZE 4 /* in KB */ -#define MAX_BUFSIZE 128 /* Limit for Amiga in KB */ - #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff)) #define le2be16dbl(x) (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff)) @@ -67,21 +60,34 @@ static inline int ioctl_return(int *addr */ #undef HAS_8BIT_TABLES -#undef HAS_14BIT_TABLES -#undef HAS_16BIT_TABLES #undef HAS_RECORD #if defined(CONFIG_DMASOUND_ATARI) || defined(CONFIG_DMASOUND_ATARI_MODULE) ||\ defined(CONFIG_DMASOUND_PAULA) || defined(CONFIG_DMASOUND_PAULA_MODULE) ||\ defined(CONFIG_DMASOUND_Q40) || defined(CONFIG_DMASOUND_Q40_MODULE) #define HAS_8BIT_TABLES +#define MIN_BUFFERS 4 +#define MIN_BUFSIZE (1<<12) /* in bytes (- where does this come from ?) */ +#define MIN_FRAG_SIZE 8 /* not 100% sure about this */ +#define MAX_BUFSIZE (1<<17) /* Limit for Amiga is 128 kb */ +#define MAX_FRAG_SIZE 15 /* allow *4 for mono-8 => stereo-16 (for multi) */ + +#else /* is pmac and multi is off */ + +#define MIN_BUFFERS 2 +#define MIN_BUFSIZE (1<<8) /* in bytes */ +#define MIN_FRAG_SIZE 8 +#define MAX_BUFSIZE (1<<18) /* this is somewhat arbitrary for pmac */ +#define MAX_FRAG_SIZE 16 /* need to allow *4 for mono-8 => stereo-16 */ #endif -#if defined(CONFIG_DMASOUND_AWACS) || defined(CONFIG_DMASOUND_AWACS_MODULE) -#define HAS_16BIT_TABLES + +#define DEFAULT_N_BUFFERS 4 +#define DEFAULT_BUFF_SIZE (1<<15) + +#if defined(CONFIG_DMASOUND_PMAC) || defined(CONFIG_DMASOUND_PMAC_MODULE) #define HAS_RECORD #endif - /* * Initialization */ @@ -93,6 +99,14 @@ extern void dmasound_deinit(void); #define dmasound_deinit() do { } while (0) #endif +/* description of the set-up applies to either hard or soft settings */ + +typedef struct { + int format; /* AFMT_* */ + int stereo; /* 0 = mono, 1 = stereo */ + int size; /* 8/16 bit*/ + int speed; /* speed */ +} SETTINGS; /* * Machine definitions @@ -117,30 +131,29 @@ typedef struct { int (*setTreble)(int); int (*setGain)(int); void (*play)(void); - void (*record)(void); /* optional */ - void (*mixer_init)(void); /* optional */ - int (*mixer_ioctl)(u_int, u_long); /* optional */ - void (*write_sq_setup)(void); /* optional */ - void (*read_sq_setup)(void); /* optional */ - void (*sq_open)(void); /* optional */ - int (*state_info)(char *); /* optional */ - void (*abort_read)(void); /* optional */ + void (*record)(void); /* optional */ + void (*mixer_init)(void); /* optional */ + int (*mixer_ioctl)(u_int, u_long); /* optional */ + int (*write_sq_setup)(void); /* optional */ + int (*read_sq_setup)(void); /* optional */ + int (*sq_open)(mode_t); /* optional */ + int (*state_info)(char *, size_t); /* optional */ + void (*abort_read)(void); /* optional */ int min_dsp_speed; + int max_dsp_speed; + int version ; + int hardware_afmts ; /* OSS says we only return h'ware info */ + /* when queried via SNDCTL_DSP_GETFMTS */ + int capabilities ; /* low-level reply to SNDCTL_DSP_GETCAPS */ + SETTINGS default_hard ; /* open() or init() should set something valid */ + SETTINGS default_soft ; /* you can make it look like old OSS, if you want to */ } MACHINE; - /* * Low level stuff */ typedef struct { - int format; /* AFMT_* */ - int stereo; /* 0 = mono, 1 = stereo */ - int size; /* 8/16 bit*/ - int speed; /* speed */ -} SETTINGS; - -typedef struct { ssize_t (*ct_ulaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); ssize_t (*ct_alaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); ssize_t (*ct_s8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t); @@ -171,11 +184,10 @@ struct sound_settings { extern struct sound_settings dmasound; +#ifdef HAS_8BIT_TABLES extern char dmasound_ulaw2dma8[]; extern char dmasound_alaw2dma8[]; -extern short dmasound_ulaw2dma16[]; -extern short dmasound_alaw2dma16[]; - +#endif /* * Mid level stuff @@ -208,14 +220,17 @@ static inline int dmasound_set_gain(int struct sound_queue { /* buffers allocated for this queue */ - int numBufs; - int bufSize; /* in bytes */ + int numBufs; /* real limits on what the user can have */ + int bufSize; /* in bytes */ char **buffers; /* current parameters */ - int max_count; - int block_size; /* in bytes */ - int max_active; + int locked ; /* params cannot be modified when != 0 */ + int user_frags ; /* user requests this many */ + int user_frag_size ; /* of this size */ + int max_count; /* actual # fragments <= numBufs */ + int block_size; /* internal block size in bytes */ + int max_active; /* in-use fragments <= max_count */ /* it shouldn't be necessary to declare any of these volatile */ int front, rear, count; @@ -231,19 +246,32 @@ struct sound_queue { int active; wait_queue_head_t action_queue, open_queue, sync_queue; int open_mode; - int busy, syncing; + int busy, syncing, xruns, died; }; #define SLEEP(queue) interruptible_sleep_on_timeout(&queue, HZ) #define WAKE_UP(queue) (wake_up_interruptible(&queue)) extern struct sound_queue dmasound_write_sq; -extern struct sound_queue dmasound_read_sq; - #define write_sq dmasound_write_sq + +#ifdef HAS_RECORD +extern struct sound_queue dmasound_read_sq; #define read_sq dmasound_read_sq +#endif extern int dmasound_catchRadius; - #define catchRadius dmasound_catchRadius +/* define the value to be put in the byte-swap reg in mac-io + when we want it to swap for us. +*/ +#define BS_VAL 1 + +static inline void wait_ms(unsigned int ms) +{ + current->state = TASK_UNINTERRUPTIBLE; + schedule_timeout(1 + ms * HZ / 1000); +} + +#endif /* _dmasound_h_ */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/dmasound/dmasound_core.c linux-2.5/sound/oss/dmasound/dmasound_core.c --- bk-linus/sound/oss/dmasound/dmasound_core.c 2002-11-21 02:26:14.000000000 +0000 +++ linux-2.5/sound/oss/dmasound/dmasound_core.c 2002-11-21 18:06:28.000000000 +0000 @@ -1250,6 +1250,8 @@ static int sq_ioctl(struct inode *inode, } else return -EINVAL ; break ; + case SOUND_PCM_READ_CHANNELS: + return IOCTL_OUT(arg, dmasound.soft.stereo+1); case SNDCTL_DSP_SETFMT: if (shared_resources_are_mine(file->f_mode) && queues_are_quiescent()) { @@ -1260,8 +1262,6 @@ static int sq_ioctl(struct inode *inode, result = IOCTL_OUT(arg, format); if (result < 0) return result; - if (format != data) - return -EINVAL; return 0; } else return -EINVAL ;