/*---------------------------------------------------------------------- File: irr_sa.c Description: Perform 1-stage and 4-stage quad IIR filter and output to left and right channel of line-out respectively. * Note: cutoff of single stage is 6 kHz @ 20 kHz. *************************************************************************/ #include #include #include #include #include #include #include #include #include #include #define SAMPLING_RATE 20000 extern int inicodec (int sampling_rate); #pragma CODE_SECTION(isr_rint0,".iprog") unsigned int x_ptr = 0x18c0000; unsigned int y_ptr = 0x18c0004; short delays[2]={0x0,0x0}; int mask = 0x0000ffff; short an1 = 0xd0b4; short an2 = 0xe6fe; short bn0 = 0x3217; short bn1 = 0x642e; short bn2 = 0x3217; interrupt void isr_rint0 (void) { iir_sa(an1,an2,bn0,bn1,bn2,delays,x_ptr,y_ptr,mask); return; } void Init_Interrupts () { intr_reset(); // Reset the interrupt system, // disable all interrupts. INTR_CLR_FLAG (CPU_INT15); // Clear previous interrupt request INTR_ENABLE (CPU_INT15); // Enable cpu interrupt line 15 intr_map(CPU_INT15,ISN_RINT0); // Link receive interrupt of serial // port 0 to interrupt line 15. intr_hook (isr_rint0,CPU_INT15); // Assign the interrupt service routine } void main(void) { evm_init(); // Initialise EVM board. inicodec (SAMPLING_RATE); // Initialise codec, adjust sampling rate. Init_Interrupts (); // Initialise interrupts and hook isr. INTR_GLOBAL_ENABLE(); // Enable global interrupt. for (;;); // Main loop, does nothing. }