/* ---------------------------------------------------------------------------- * * main() * * ---------------------------------------------------------------------------- * * Runs all initial setup functions to initialise the audio codec and IP * peripherals, before calling the interactive menu system. * ---------------------------------------------------------------------------- */ int main(void) { xil_printf("Entering Main\r\n"); //Configure the IIC data structure IicConfig(XPAR_XIICPS_0_DEVICE_ID); //Configure the Audio Codec's PLL AudioPllConfig(); //Configure the Line in and Line out ports. //Call LineInLineOutConfig() for a configuration that //enables the HP jack too. AudioConfigureJacks(); xil_printf("ADAU1761 configured\n\r"); /* Initialise GPIO and NCO peripherals */ gpio_init(); nco_init(&Nco); xil_printf("GPIO and NCO peripheral configured\r\n"); /* Display interactive menu interface via terminal */ menu(); return 1; }
int main() { Xint16 audio_data[128]; int i; u8 *oled_equalizer_buf=(u8 *)malloc(128*sizeof(u8)); Xil_Out32(OLED_BASE_ADDR,0xff); OLED_Init(); //oled init IicConfig(XPAR_XIICPS_0_DEVICE_ID); AudioPllConfig(); //enable core clock for ADAU1761 AudioConfigure(); xil_printf("ADAU1761 configured\n\r"); /* * perform continuous read and writes from the codec that result in a loopback * from Line in to Line out */ while(1) { get_audio(audio_data); for(i=0;i<128;i++) { oled_equalizer_buf[i]=audio_data[i]>>18; } OLED_Clear(); OLED_Equalizer_128(oled_equalizer_buf); } return 0; }
/* \brief LED and AUDIO initialization * */ void system_init() { Xil_Out32(OLED_BASE_ADDR,0xff); OLED_Init(); //OLED initialization IicConfig(XPAR_XIICPS_0_DEVICE_ID); AudioPllConfig(); //enable core clock for ADAU1761 AudioConfigure(); DMA_Congfig(DMA_DEV_ID); //Disable cache on OCM Xil_SetTlbAttributes(0x00000000,0x14de2); }
int main(void) { int status; //Configure the IIC data structure IicConfig(XPAR_XIICPS_0_DEVICE_ID); //Configure the Audio Codec's PLL AudioPllConfig(); //Configure the Line in and Line out ports. //Call LineInLineOutConfig() for a configuration that //enables the HP jack too. AudioConfigureJacks(); xil_printf("ADAU1761 configured\n\r"); // Setup the FIR instances status=hls_voicerec_init(&HlsVoiceRec); if(status != XST_SUCCESS){ print("HLS peripheral setup failed\n\r"); return(-1); } //Setup the interrupt status = setup_interrupt(); if(status != XST_SUCCESS){ print("Interrupt setup failed\n\r"); return(-1); } // Enable Global and instance interrupts XVoicerec_InterruptEnable(&HlsVoiceRec,1); XVoicerec_InterruptGlobalEnable(&HlsVoiceRec); ResultAvailHlsVoiceRec = 0; run_voice_recognition(); // switch SW0 to record 2 second command return 0; }
int main() { //init_platform(); u32 i; u32 ret[128]; Xint16 audio_data[128]; u8 *oled_equalizer_buf=(u8 *)malloc(128*sizeof(u8));//WARNING bro...: -Wimplicit-function-declaration /* -------- LED and HW related -------- */ Xil_Out32(OLED_BASE_ADDR,0xff); OLED_Init(); //oled init IicConfig(XPAR_XIICPS_0_DEVICE_ID); AudioPllConfig(); //enable core clock for ADAU1761 AudioConfigure(); xil_printf("ADAU1761 configured\n\r"); while(1) { //DEBUG: xil_printf("*"); // capture audio data get_audio(audio_data); #if (MEASURE_TIME==1) // Your total latency (FFT + Magnitude + Noise cancellation + Averaging + to & fro PS-PL communication) ... // should be less than 103us. init_timer(timer_ctrl, timer_counter_l, timer_counter_h); start_timer(timer_ctrl); #endif for(i=0;i<128;i++) { Xil_Out32(XPAR_AXI4BURST_PS2PL_0_S_AXI_MEM0_BASEADDR, audio_data[i]); //DEBUG: xil_printf("sent data %0x\n\r", audio_data[i]); } //TODO: find more elegant way, checking some "completed status" signal maybe... usleep(10);// less than 10usec doesn't work for(i=0;i<128;i++) { ret[i] = Xil_In32(XPAR_AXI4BURST_PS2PL_0_S_AXI_MEM0_BASEADDR); //TODO: put these post-process in FPGA oled_equalizer_buf[i] = (u8)(ret[i] >> 4); //DEBUG: xil_printf("oled[%d]=%d\n\r", i, oled_equalizer_buf[i]); if (oled_equalizer_buf[i] >= 40) { oled_equalizer_buf[i] = 40; } } #if (MEASURE_TIME==1) stop_timer(timer_ctrl); //Calculate the time for the operation xil_printf("Communication time %d us\n\r", (*timer_counter_l) / 333); #endif OLED_Clear(); OLED_Equalizer_128(oled_equalizer_buf); } return 0; }