示例#1
0
文件: ite.c 项目: lacombar/netbsd-alc
/* audio bell stuff */
void
init_bell(void)
{
	if (bsamplep != NULL)
		return;
	bsamplep = alloc_chipmem(20);
	if (bsamplep == NULL)
		panic("no chipmem for ite_bell");

	bcopy(sample, bsamplep, 20);
}
示例#2
0
static int
init_aucc(struct aucc_softc *sc)
{
	int i, err;

	err = 0;
	/* init values per channel */
	for (i = 0; i < 4; i++) {
		sc->sc_channel[i].nd_freq = 8000;
		sc->sc_channel[i].nd_per = freqtoper(8000);
		sc->sc_channel[i].nd_busy = 0;
		sc->sc_channel[i].nd_dma = alloc_chipmem(AUDIO_BUF_SIZE*2);
		if (sc->sc_channel[i].nd_dma == NULL)
			err = 1;
		sc->sc_channel[i].nd_dmalength = 0;
		sc->sc_channel[i].nd_volume = 64;
		sc->sc_channel[i].nd_intr = NULL;
		sc->sc_channel[i].nd_intrdata = NULL;
		sc->sc_channel[i].nd_doublebuf = 0;
		DPRINTF(("DMA buffer for channel %d is %p\n", i,
		    sc->sc_channel[i].nd_dma));
	}

	if (err) {
		for (i = 0; i < 4; i++)
			if (sc->sc_channel[i].nd_dma)
				free_chipmem(sc->sc_channel[i].nd_dma);
	}

	sc->sc_channels = 1;
	sc->sc_channelmask = 0xf;
	sc->sc_precision = 8;
	sc->sc_14bit = 0;
	sc->sc_encoding = AUDIO_ENCODING_ULAW;
	sc->sc_decodefunc = aucc_decode_mulaw_1ch;

	/* clear interrupts and DMA: */
	custom.intena = AUCC_ALLINTF;
	custom.dmacon = AUCC_ALLDMAF;

	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);

	return err;
}
/*
 * Used by certain drivers currently to allocate zorro II or chip mem
 * for bounce buffers. For amigappc we will only return chip memory.
 */
void *
alloc_z2mem(long amount)
{

	return (alloc_chipmem(amount));
}