Exemplo n.º 1
0
int main() {
	ioinit();
	timer2_init();
	timer2_overflow_hook = timer2_hook;
	timer1_init();
	
	_delay_ms(100);
	spi_init();

	sound_reset();
	
	usart_init(1);//	usart_init(23); 	// 9600bps

  	spdif_configure();
	ad1955_configure();
	ad1955_mute();
#define NO_NOISE_MEASURE
#ifdef NOISE_MEASURE
	ad1955_unmute();
	cli();
	set_sleep_mode(SLEEP_MODE_PWR_DOWN);
	for(;;) {
	sleep_mode();
	}
#endif	
	
	spdif_selectChannel(1);
	
   	spdif_dumpRegisters();
	
	printf("\n\nSVODAC V%s\n", idstring);

	for (;;) {
		if (main_state_machine() == STATE_READY) {
			if ((REQUEST_STATUS & _BV(REQUEST_MUTE)) != 0) {
				ad1955_mute();
			} else 	if ((REQUEST_STATUS & _BV(REQUEST_UNMUTE)) != 0) {
				ad1955_unmute();
			} 
			
			if ((REQUEST_STATUS & _BV(REQUEST_STOP)) != 0) {
				//printf("STOP");
				spdif_stop();
			} else if ((REQUEST_STATUS & _BV(REQUEST_RUN)) != 0) {
				//printf("RUN");
				spdif_run();
			}
			REQUEST_STATUS = 0;
			sleep_mode();
		}
	}

	return 0; // make happy
}
Exemplo n.º 2
0
static int nxp_spdif_trigger(struct snd_pcm_substream *substream,
				int cmd, struct snd_soc_dai *dai)
{
	struct nxp_spdif_snd_param *par = snd_soc_dai_get_drvdata(dai);
	int stream = substream->stream;
	pr_debug("%s: %s cmd=%d\n", __func__, STREAM_STR(stream), cmd);

	switch (cmd) {
	case SNDRV_PCM_TRIGGER_RESUME:
	case SNDRV_PCM_TRIGGER_START:
		spdif_start(par, stream);
		break;
	case SNDRV_PCM_TRIGGER_SUSPEND:
	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
	case SNDRV_PCM_TRIGGER_STOP:
		spdif_stop(par, stream);
		break;

	default:
		return -EINVAL;
	}
	return 0;
}
Exemplo n.º 3
0
static void nxp_spdif_shutdown(struct snd_pcm_substream *substream,
				struct snd_soc_dai *dai)
{
	struct nxp_spdif_snd_param *par = snd_soc_dai_get_drvdata(dai);
	spdif_stop(par, substream->stream);
}