staticint emu8000_reset_addr;
module_param(emu8000_reset_addr, int, 0444);
MODULE_PARM_DESC(emu8000_reset_addr, "reset write address at each time (makes slowdown)");
/* *Openupchannels.
*/ staticint
snd_emu8000_open_dma(struct snd_emu8000 *emu, int write)
{ int i;
/* reserve all 30 voices for loading */ for (i = 0; i < EMU8000_DRAM_VOICES; i++) {
snd_emux_lock_voice(emu->emu, i);
snd_emu8000_dma_chan(emu, i, write);
}
/* *WritethesampletoEMU800memory.Thisroutineisinvokedoutof *thegenericsoundfontroutinesasacallback.
*/ int
snd_emu8000_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, struct snd_util_memhdr *hdr, constvoid __user *data, long count)
{ int i; int rc; int offset; int truesize; int dram_offset, dram_start; struct snd_emu8000 *emu;
emu = rec->hw; if (snd_BUG_ON(!sp)) return -EINVAL;
/* compute true data size to be loaded */
truesize = sp->v.size; if (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP))
truesize += sp->v.loopend - sp->v.loopstart; if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK)
truesize += BLANK_LOOP_SIZE;
sp->block = snd_util_mem_alloc(hdr, truesize * 2); if (sp->block == NULL) { /* not ENOMEM (for compatibility) */ return -ENOSPC;
}
if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS) { if (!access_ok(data, sp->v.size)) return -EFAULT;
} else { if (!access_ok(data, sp->v.size * 2)) return -EFAULT;
}
/* dram position (in word) -- mem_offset is byte */
dram_offset = EMU8000_DRAM_OFFSET + (sp->block->offset >> 1);
dram_start = dram_offset;
/* set the total size (store onto obsolete checksum value) */
sp->v.truesize = truesize * 2; /* in bytes */
snd_emux_terminate_all(emu->emu);
rc = snd_emu8000_open_dma(emu, EMU8000_RAM_WRITE); if (rc) return rc;
/* Set the address to start writing at */
snd_emu8000_write_wait(emu);
EMU8000_SMALW_WRITE(emu, dram_offset);
/*snd_emu8000_init_fm(emu);*/
#if0 /* first block - write 48 samples for silence */ if (! sp->block->offset) { for (i = 0; i < BLANK_HEAD_SIZE; i++) {
write_word(emu, &dram_offset, 0);
}
} #endif
offset = 0; for (i = 0; i < sp->v.size; i++) { unsignedshort s;
s = read_word(data, offset, sp->v.mode_flags);
offset++;
write_word(emu, &dram_offset, s);
/* we may take too long time in this loop. *sogivecontrolsbacktokernelifneeded.
*/
cond_resched();
if (i == sp->v.loopend &&
(sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)))
{ int looplen = sp->v.loopend - sp->v.loopstart; int k;
/* if no blank loop is attached in the sample, add it */ if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) { for (i = 0; i < BLANK_LOOP_SIZE; i++) {
write_word(emu, &dram_offset, 0);
} if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_SINGLESHOT) {
sp->v.loopstart = sp->v.end + BLANK_LOOP_START;
sp->v.loopend = sp->v.end + BLANK_LOOP_END;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.