snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, frames_to_bytes(runtime, runtime->period_size)<<16); 
 snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, 0); 
static int snd_p16v_pcm_prepare_playback(snd_pcm_substream_t *substream){	emu10k1_t *emu = snd_pcm_substream_chip(substream);	snd_pcm_runtime_t *runtime = substream->runtime;	int channel = substream->pcm->device - emu->p16v_device_offset;	u32 *table_base = (u32 *)(emu->p16v_buffer.area+(8*16*channel));	u32 period_size_bytes = frames_to_bytes(runtime, runtime->period_size);	int i;	u32 tmp;	        //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1));        //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base);	//snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->p16v_buffer.addr, emu->p16v_buffer.area, emu->p16v_buffer.bytes);	tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel);        switch (runtime->rate) {	case 44100:	  snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x8080);	  break;	case 96000:	  snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x4040);	  break;	case 192000:	  snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x2020);	  break;	case 48000:	default:	  snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x0000);	  break;	}	/* FIXME: Check emu->buffer.size before actually writing to it. */	for(i=0; i < runtime->periods; i++) {		table_base[i*2]=runtime->dma_addr+(i*period_size_bytes);		table_base[(i*2)+1]=period_size_bytes<<16;	} 	snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_ADDR, channel, emu->p16v_buffer.addr+(8*16*channel));	snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_SIZE, channel, (runtime->periods - 1) << 19);	snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_PTR, channel, 0);	snd_emu10k1_ptr20_write(emu, PLAYBACK_DMA_ADDR, channel, runtime->dma_addr);	snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, frames_to_bytes(runtime, runtime->period_size)<<16); // buffer size in bytes	snd_emu10k1_ptr20_write(emu, PLAYBACK_POINTER, channel, 0);	snd_emu10k1_ptr20_write(emu, 0x07, channel, 0x0);	snd_emu10k1_ptr20_write(emu, 0x08, channel, 0);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/310bacd29230abf5f2a230159e48e983171e0f26/p16v.c/buggy/sound/pci/emu10k1/p16v.c