u32 hcfg_mask = HCFG_CAPTURE_S32_LE; u32 hcfg_set = 0x00000000; u32 hcfg; u32 over_sampling=0x2; u32 reg71_mask = 0x0000c000 ; /* Global. Set ADC rate. */ u32 reg71_set = 0; u32 reg71;     /* reg71 controls ADC rate. */ switch (runtime->rate) { case 44100: reg71_set = 0x00004000; break; case 48000: reg71_set = 0; break; case 96000: reg71_set = 0x00008000; over_sampling=0xa; break; case 192000: reg71_set = 0x0000c000; over_sampling=0xa; break; default: reg71_set = 0; break; } /* Format is a global setting */ /* FIXME: Only let the first channel accessed set this. */ switch (runtime->format) { case SNDRV_PCM_FORMAT_S16_LE: hcfg_set = 0; break; case SNDRV_PCM_FORMAT_S32_LE: hcfg_set = HCFG_CAPTURE_S32_LE; break; default: hcfg_set = 0; break; } hcfg = inl(emu->port + HCFG) ; hcfg = (hcfg & ~hcfg_mask) | hcfg_set; outl(hcfg, emu->port + HCFG); reg71 = snd_ca0106_ptr_read(emu, 0x71, 0); reg71 = (reg71 & ~reg71_mask) | reg71_set; snd_ca0106_ptr_write(emu, 0x71, 0, reg71); if (emu->details->i2c_adc == 1) { /* The SB0410 and SB0413 use I2C to control ADC. */ snd_ca0106_i2c_write(emu, ADC_MASTER, over_sampling); /* Adjust the over sampler to better suit the capture rate. */ }   
static int snd_ca0106_pcm_prepare_capture(snd_pcm_substream_t *substream){	ca0106_t *emu = snd_pcm_substream_chip(substream);	snd_pcm_runtime_t *runtime = substream->runtime;	ca0106_pcm_t *epcm = runtime->private_data;	int channel = epcm->channel_id;        //printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size,  frames_to_bytes(runtime, 1));	snd_ca0106_ptr_write(emu, 0x13, channel, 0);	snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr);	snd_ca0106_ptr_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes	snd_ca0106_ptr_write(emu, CAPTURE_POINTER, channel, 0);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/883130b476e7f8baa608dabe52c455ac351f7c39/ca0106_main.c/buggy/sound/pci/ca0106/ca0106_main.c