//! The main function int main(int argc, char *argv[]) { unsigned int cycle_count; // Switch to external Oscillator 0. pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); // Initialize the DSP debug module dsp_debug_initialization(FOSC0); // Get the actual cycle count cycle_count = Get_sys_count(); // Perform a convolution dsp32_vect_conv(vect1, vect2, VECT2_SIZE, vect3, VECT3_SIZE); // Calculate the number of cycles cycle_count = Get_sys_count() - cycle_count; // Print the number of cycles dsp32_debug_printf("Cycle count: %d\n", cycle_count); // Print the output signal dsp32_debug_print_vect(vect1, VECT2_SIZE + VECT3_SIZE - 1); while(1); }
//! The main function int main(int argc, char *argv[]) { dsp32_t sample_x,sample_d; dsp32_t y, e; int i; // Switch to external Oscillator 0. pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); // Initialize the DSP debug module dsp_debug_initialization(FOSC0); // Initialization of the buffers for(i=0; i<FIR_COEF_SIZE; i++) { w[i] = 0; x[i] = 0; } for(i=0; i<SIZE; i++) { // Compute a new sample sample_x = input_x[i]; sample_d = input_d[i]; // Compute the LMS filter dsp32_filt_lms(x, w, FIR_COEF_SIZE, sample_x, sample_d, &y, &e); } // Print the output signal dsp32_debug_print_vect(&w[0], FIR_COEF_SIZE); while(1); }
//! The main function int main(int argc, char *argv[]) { dsp32_t vect1[SIZE]; int cycle_count; int frequency, sample_rate; dsp32_t phase, amplitude; // Switch to external Oscillator 0. pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); // Initialize the DSP debug module dsp_debug_initialization(FOSC0); // 1 KHz frequency = 1000; // 10 KHz sample_rate = 100000; // phase = PI/2 phase = DSP32_Q(0.5); // amplitude amplitude = DSP32_Q(1.); dsp32_debug_printf("32-bit signal generation program test\n"); // Compute the signal to generate switch(SIGNAL_TO_USE) { // Sinusoidal case SIGNAL_SIN: dsp32_debug_printf("Sine\n"); dsp32_debug_printf("Frequency: %d, Fs: %d, Phase: %f\n", frequency, sample_rate, phase); cycle_count = Get_sys_count(); dsp32_gen_sin(vect1, SIZE, frequency, sample_rate, phase); cycle_count = Get_sys_count() - cycle_count; break; // Cosinusoidal case SIGNAL_COS: dsp32_debug_printf("Cosine\n"); dsp32_debug_printf("Frequency: %d, Fs: %d, Phase: %f\n", frequency, sample_rate, phase); cycle_count = Get_sys_count(); dsp32_gen_cos(vect1, SIZE, frequency, sample_rate, phase); cycle_count = Get_sys_count() - cycle_count; break; // Noise case SIGNAL_NOISE: dsp32_debug_printf("Noise\n"); dsp32_debug_printf("Amplitude: %d\n", amplitude); cycle_count = Get_sys_count(); dsp32_gen_noise(vect1, SIZE, amplitude); cycle_count = Get_sys_count() - cycle_count; break; } // Print the number of cycles dsp32_debug_printf("Cycle count: %d\n", cycle_count); // Print the signal dsp32_debug_print_vect(vect1, SIZE); while(1); }
//! The main function int main(int argc, char *argv[]) { unsigned int cycle_count; // Switch to external Oscillator 0. pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); // Initialize the DSP debug module dsp_debug_initialization(FOSC0); // Get the actual cycle count cycle_count = Get_sys_count(); // Perform a 25-taps FIR dsp32_filt_iirpart(y, x, SIZE, num, NUM_SIZE, den, DEN_SIZE, PREDIV, PREDIV); // Calculate the number of cycles cycle_count = Get_sys_count() - cycle_count; // Print the number of cycles dsp32_debug_printf("Cycle count: %d\n", cycle_count); // Print the output signal dsp32_debug_print_vect(y, SIZE - NUM_SIZE + 1); while(1); }
//! The main function int main(int argc, char *argv[]) { int i; // Switch to external Oscillator 0. pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); // Initialize the DSP debug module dsp_debug_initialization(FOSC0); // Number of recursions for(i=0; i<100000; i++) { // Perform a IIR filter dsp32_filt_iir(&y[DEN_SIZE], &x[NUM_SIZE-1], SIZE, num, NUM_SIZE, den, DEN_SIZE, NUM_PREDIV, DEN_PREDIV); // Update the output signal memmove(y, &y[SIZE], (DEN_SIZE)*sizeof(dsp32_t)); } // Print the output signal dsp32_debug_print_vect(&y[DEN_SIZE], SIZE); while(1); }