Lines Matching refs:gus
12 static void snd_gf1_dma_ack(struct snd_gus_card * gus) in snd_gf1_dma_ack() argument
16 spin_lock_irqsave(&gus->reg_lock, flags); in snd_gf1_dma_ack()
17 snd_gf1_write8(gus, SNDRV_GF1_GB_DRAM_DMA_CONTROL, 0x00); in snd_gf1_dma_ack()
18 snd_gf1_look8(gus, SNDRV_GF1_GB_DRAM_DMA_CONTROL); in snd_gf1_dma_ack()
19 spin_unlock_irqrestore(&gus->reg_lock, flags); in snd_gf1_dma_ack()
22 static void snd_gf1_dma_program(struct snd_gus_card * gus, in snd_gf1_dma_program() argument
36 if (gus->gf1.dma1 > 3) { in snd_gf1_dma_program()
37 if (gus->gf1.enh_mode) { in snd_gf1_dma_program()
58 if (gus->gf1.dma1 > 3) { in snd_gf1_dma_program()
63 snd_gf1_dma_ack(gus); in snd_gf1_dma_program()
64 …snd_dma_program(gus->gf1.dma1, buf_addr, count, dma_cmd & SNDRV_GF1_DMA_READ ? DMA_MODE_READ : DMA… in snd_gf1_dma_program()
69 spin_lock_irqsave(&gus->reg_lock, flags); in snd_gf1_dma_program()
70 if (gus->gf1.enh_mode) { in snd_gf1_dma_program()
72 snd_gf1_write16(gus, SNDRV_GF1_GW_DRAM_DMA_LOW, (unsigned short) (address >> 4)); in snd_gf1_dma_program()
73 snd_gf1_write8(gus, SNDRV_GF1_GB_DRAM_DMA_HIGH, (unsigned char) address_high); in snd_gf1_dma_program()
75 snd_gf1_write16(gus, SNDRV_GF1_GW_DRAM_DMA_LOW, (unsigned short) (address >> 4)); in snd_gf1_dma_program()
76 snd_gf1_write8(gus, SNDRV_GF1_GB_DRAM_DMA_CONTROL, dma_cmd); in snd_gf1_dma_program()
77 spin_unlock_irqrestore(&gus->reg_lock, flags); in snd_gf1_dma_program()
80 static struct snd_gf1_dma_block *snd_gf1_dma_next_block(struct snd_gus_card * gus) in snd_gf1_dma_next_block() argument
85 if (gus->gf1.dma_data_pcm) { in snd_gf1_dma_next_block()
86 block = gus->gf1.dma_data_pcm; in snd_gf1_dma_next_block()
87 if (gus->gf1.dma_data_pcm_last == block) { in snd_gf1_dma_next_block()
88 gus->gf1.dma_data_pcm = in snd_gf1_dma_next_block()
89 gus->gf1.dma_data_pcm_last = NULL; in snd_gf1_dma_next_block()
91 gus->gf1.dma_data_pcm = block->next; in snd_gf1_dma_next_block()
93 } else if (gus->gf1.dma_data_synth) { in snd_gf1_dma_next_block()
94 block = gus->gf1.dma_data_synth; in snd_gf1_dma_next_block()
95 if (gus->gf1.dma_data_synth_last == block) { in snd_gf1_dma_next_block()
96 gus->gf1.dma_data_synth = in snd_gf1_dma_next_block()
97 gus->gf1.dma_data_synth_last = NULL; in snd_gf1_dma_next_block()
99 gus->gf1.dma_data_synth = block->next; in snd_gf1_dma_next_block()
105 gus->gf1.dma_ack = block->ack; in snd_gf1_dma_next_block()
106 gus->gf1.dma_private_data = block->private_data; in snd_gf1_dma_next_block()
112 static void snd_gf1_dma_interrupt(struct snd_gus_card * gus) in snd_gf1_dma_interrupt() argument
116 snd_gf1_dma_ack(gus); in snd_gf1_dma_interrupt()
117 if (gus->gf1.dma_ack) in snd_gf1_dma_interrupt()
118 gus->gf1.dma_ack(gus, gus->gf1.dma_private_data); in snd_gf1_dma_interrupt()
119 spin_lock(&gus->dma_lock); in snd_gf1_dma_interrupt()
120 if (gus->gf1.dma_data_pcm == NULL && in snd_gf1_dma_interrupt()
121 gus->gf1.dma_data_synth == NULL) { in snd_gf1_dma_interrupt()
122 gus->gf1.dma_ack = NULL; in snd_gf1_dma_interrupt()
123 gus->gf1.dma_flags &= ~SNDRV_GF1_DMA_TRIGGER; in snd_gf1_dma_interrupt()
124 spin_unlock(&gus->dma_lock); in snd_gf1_dma_interrupt()
127 block = snd_gf1_dma_next_block(gus); in snd_gf1_dma_interrupt()
128 spin_unlock(&gus->dma_lock); in snd_gf1_dma_interrupt()
131 snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd); in snd_gf1_dma_interrupt()
140 int snd_gf1_dma_init(struct snd_gus_card * gus) in snd_gf1_dma_init() argument
142 mutex_lock(&gus->dma_mutex); in snd_gf1_dma_init()
143 gus->gf1.dma_shared++; in snd_gf1_dma_init()
144 if (gus->gf1.dma_shared > 1) { in snd_gf1_dma_init()
145 mutex_unlock(&gus->dma_mutex); in snd_gf1_dma_init()
148 gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt; in snd_gf1_dma_init()
149 gus->gf1.dma_data_pcm = in snd_gf1_dma_init()
150 gus->gf1.dma_data_pcm_last = in snd_gf1_dma_init()
151 gus->gf1.dma_data_synth = in snd_gf1_dma_init()
152 gus->gf1.dma_data_synth_last = NULL; in snd_gf1_dma_init()
153 mutex_unlock(&gus->dma_mutex); in snd_gf1_dma_init()
157 int snd_gf1_dma_done(struct snd_gus_card * gus) in snd_gf1_dma_done() argument
161 mutex_lock(&gus->dma_mutex); in snd_gf1_dma_done()
162 gus->gf1.dma_shared--; in snd_gf1_dma_done()
163 if (!gus->gf1.dma_shared) { in snd_gf1_dma_done()
164 snd_dma_disable(gus->gf1.dma1); in snd_gf1_dma_done()
165 snd_gf1_set_default_handlers(gus, SNDRV_GF1_HANDLER_DMA_WRITE); in snd_gf1_dma_done()
166 snd_gf1_dma_ack(gus); in snd_gf1_dma_done()
167 while ((block = gus->gf1.dma_data_pcm)) { in snd_gf1_dma_done()
168 gus->gf1.dma_data_pcm = block->next; in snd_gf1_dma_done()
171 while ((block = gus->gf1.dma_data_synth)) { in snd_gf1_dma_done()
172 gus->gf1.dma_data_synth = block->next; in snd_gf1_dma_done()
175 gus->gf1.dma_data_pcm_last = in snd_gf1_dma_done()
176 gus->gf1.dma_data_synth_last = NULL; in snd_gf1_dma_done()
178 mutex_unlock(&gus->dma_mutex); in snd_gf1_dma_done()
182 int snd_gf1_dma_transfer_block(struct snd_gus_card * gus, in snd_gf1_dma_transfer_block() argument
202 (long)gus->gf1.dma_data_pcm_last); in snd_gf1_dma_transfer_block()
204 (long)gus->gf1.dma_data_pcm); in snd_gf1_dma_transfer_block()
206 spin_lock_irqsave(&gus->dma_lock, flags); in snd_gf1_dma_transfer_block()
208 if (gus->gf1.dma_data_synth_last) { in snd_gf1_dma_transfer_block()
209 gus->gf1.dma_data_synth_last->next = block; in snd_gf1_dma_transfer_block()
210 gus->gf1.dma_data_synth_last = block; in snd_gf1_dma_transfer_block()
212 gus->gf1.dma_data_synth = in snd_gf1_dma_transfer_block()
213 gus->gf1.dma_data_synth_last = block; in snd_gf1_dma_transfer_block()
216 if (gus->gf1.dma_data_pcm_last) { in snd_gf1_dma_transfer_block()
217 gus->gf1.dma_data_pcm_last->next = block; in snd_gf1_dma_transfer_block()
218 gus->gf1.dma_data_pcm_last = block; in snd_gf1_dma_transfer_block()
220 gus->gf1.dma_data_pcm = in snd_gf1_dma_transfer_block()
221 gus->gf1.dma_data_pcm_last = block; in snd_gf1_dma_transfer_block()
224 if (!(gus->gf1.dma_flags & SNDRV_GF1_DMA_TRIGGER)) { in snd_gf1_dma_transfer_block()
225 gus->gf1.dma_flags |= SNDRV_GF1_DMA_TRIGGER; in snd_gf1_dma_transfer_block()
226 block = snd_gf1_dma_next_block(gus); in snd_gf1_dma_transfer_block()
227 spin_unlock_irqrestore(&gus->dma_lock, flags); in snd_gf1_dma_transfer_block()
230 snd_gf1_dma_program(gus, block->addr, block->buf_addr, block->count, (unsigned short) block->cmd); in snd_gf1_dma_transfer_block()
234 spin_unlock_irqrestore(&gus->dma_lock, flags); in snd_gf1_dma_transfer_block()