/* This should only be called at startup before any audio playback or recording is attempted */ void pcm_init(void) { logf("pcm_init"); pcm_set_frequency(HW_SAMPR_DEFAULT); logf(" pcm_play_dma_init"); pcm_play_dma_init(); }
void pcm_init(void) { pcm_playing = false; pcm_paused = false; BUSMASTER_CTRL = 0x81; /* PARK[1,0]=10 + BCR24BIT */ DIVR0 = 54; /* DMA0 is mapped into vector 54 in system.c */ DMAROUTE = (DMAROUTE & 0xffffff00) | DMA0_REQ_AUDIO_1; DMACONFIG = 1; /* DMA0Req = PDOR3 */ /* Reset the audio FIFO */ IIS2CONFIG = IIS_RESET; /* Enable interrupt at level 7, priority 0 */ ICR4 = (ICR4 & 0xffff00ff) | 0x00001c00; IMR &= ~(1<<14); /* bit 14 is DMA0 */ pcm_set_frequency(44100); /* Prevent pops (resets DAC to zero point) */ IIS2CONFIG = IIS_DEFPARM(pcm_freq) | IIS_RESET; #if defined(HAVE_UDA1380) /* Initialize default register values. */ uda1380_init(); /* Sleep a while so the power can stabilize (especially a long delay is needed for the line out connector). */ sleep(HZ); /* Power on FSDAC and HP amp. */ uda1380_enable_output(true); /* Unmute the master channel (DAC should be at zero point now). */ uda1380_mute(false); #elif defined(HAVE_TLV320) tlv320_init(); tlv320_enable_output(true); sleep(HZ/4); tlv320_mute(false); #endif /* Call dma_stop to initialize everything. */ dma_stop(); }