📄 isr.c
字号:
///////////////////////////////////////////////////////////////////////////////
//
//
// Experiment 6.11_BF533 Implement FIR filter using BF533 EZ-KIT
// FILE name: ISR.c
//
// Description: Perform real-time FIR filtering on stereo signals.
// Interrupt service routine to handle real-world signal.
//
// For the book "Embedded Signal Processing with the Micro Signal Architecture"
// By Woon-Seng Gan and Sen M. Kuo
// Publisher: John Wiley and Sons, Inc.
//
// Tools used: VisualDSP++ v4.0 (running on BF533 EZ-KIT)
//
///////////////////////////////////////////////////////////////////////////////
#include "fir.h"
//--------------------------------------------------------------------------//
// Function: Sport0_RX_ISR //
// //
// Description: This ISR is executed after a complete frame of input data //
// has been received. The new samples are stored in //
// iCh0LeftIn and iCh0RightIn. Then the function //
// Process_Data() is called in which the fir filtering //
// routine can be executed. //
// After that the processed values are copied from the //
// variables iCh0LeftOut and iCh0RightOut into the dma //
// transmit buffer. //
//--------------------------------------------------------------------------//
EX_INTERRUPT_HANDLER(Sport0_RX_ISR)
{
int i;
static short j=0,k=0;
// confirm interrupt handling
//BF533 Hardware Reference pg 9-32
*pDMA1_IRQ_STATUS = 0x0001;
// Move data from receive buffer to local buffer
#pragma no_alias
for (i = 0; i < IP_SIZE; i++)
{
// Retrieve all the samples from receive buffer to process buffer
iCh0LeftIn[i] = iRxBuffer1[INTERNAL_ADC_L0+j];
iCh0RightIn[i] = iRxBuffer1[INTERNAL_ADC_R0+j];
// use the builtin circular buffer to update the index
j = __builtin_circindex(j, 4, 4*IP_SIZE*FRAME_SIZE);
}
Process_Data();
#pragma no_alias
for (i=0; i<IP_SIZE; i++)
{
iTxBuffer1[INTERNAL_DAC_L0+k] = iCh0LeftOut[i];
iTxBuffer1[INTERNAL_DAC_R0+k] = iCh0RightOut[i];
// use the builtin circular buffer to update the index
k = __builtin_circindex(k, 4, 4*IP_SIZE*FRAME_SIZE);
}
}
//--------------------------------------------------------------------------//
// Function: Timer_ISR //
// //
// Description: Every time the ISR is invoked, the routine would read the //
// value of the switches SW[7:6]. This is to solve the problem //
// of any switch bouncing problem - switch deboucing solution! //
// //
//--------------------------------------------------------------------------//
EX_INTERRUPT_HANDLER(Switch_ISR)
{
if (*pFIO_FLAG_D & PF10)
{
pushbt_flag = 1;
*pFIO_FLAG_C = PF10;
}
if (*pFIO_FLAG_D & PF11)
{
pushbt_flag = 0;
*pFIO_FLAG_C = PF11;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -