void pcm_play_dma_init(void) { freq_ent = pcm_freq_parms[pcm_fsel]; AUDIOGLOB = AUDIOGLOB_DEFPARM; DIVR0 = 54; /* DMA0 is mapped into vector 54 in system.c */ and_l(0xffffff00, &DMAROUTE); or_l(DMA0_REQ_AUDIO_1, &DMAROUTE); DMACONFIG = 1; /* DMA0Req = PDOR3, DMA1Req = PDIR2 */ BCR0 = 0; /* No bytes waiting */ ICR6 = (6 << 2); /* Enable interrupt at level 6, priority 0 */ /* Setup Coldfire I2S before initializing hardware or changing other settings. */ or_l(IIS_FIFO_RESET, &IIS_PLAY); IIS_PLAY = IIS_PLAY_DEFPARM | IIS_FIFO_RESET; audio_set_output_source(AUDIO_SRC_PLAYBACK); /* Initialize default register values. */ audiohw_init(); audio_input_mux(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); audiohw_set_frequency(pcm_fsel); coldfire_set_pllcr_audio_bits(PLLCR_SET_AUDIO_BITS_DEFPARM); #if defined(HAVE_SPDIF_REC) || defined(HAVE_SPDIF_OUT) spdif_init(); #endif } /* pcm_play_dma_init */
/** * Selects an audio source for recording or playback * powers/unpowers related devices and sets up monitoring. */ void audio_set_input_source(int source, unsigned flags) { /** Do power up/down of associated device(s) **/ /** SPDIF **/ #ifdef AUDIO_CPU_BOOST /* Always boost for SPDIF */ audio_cpu_boost(source == AUDIO_SRC_SPDIF); #endif /* AUDIO_CPU_BOOST */ #ifdef HAVE_SPDIF_POWER /* Check if S/PDIF output power should be switched off or on. NOTE: assumes both optical in and out is controlled by the same power source, which is the case on H1x0. */ spdif_power_enable((source == AUDIO_SRC_SPDIF) || global_settings.spdif_enable); #endif /* HAVE_SPDIF_POWER */ /* Set the appropriate feed for spdif output */ #ifdef HAVE_SPDIF_OUT spdif_set_output_source(source IF_SPDIF_POWER_(, global_settings.spdif_enable)); #endif /* HAVE_SPDIF_OUT */ /** Tuner **/ #if CONFIG_TUNER /* Switch radio off or on per source and flags. */ if (source != AUDIO_SRC_FMRADIO) radio_stop(); else if (flags & SRCF_FMRADIO_PAUSED) radio_pause(); else radio_start(); #endif #if defined(IPOD_ACCESSORY_PROTOCOL) && defined(HAVE_LINE_REC) static bool last_rec_onoff = false; bool onoff = (source == AUDIO_SRC_LINEIN) ? true : false; if (last_rec_onoff != onoff) last_rec_onoff = iap_record(onoff); #endif /* set hardware inputs */ audio_input_mux(source, flags); } /* audio_set_source */