📄 isr.c
字号:
///////////////////////////////////////////////////////////////////////////////
//
//
// Experiment 6.11_BF537 Implement FIR filter using BF537 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 BF537 EZ-KIT)
//
///////////////////////////////////////////////////////////////////////////////
#include "fir.h"
EX_INTERRUPT_HANDLER(Sport0_RX_ISR)
{
int i;
static short j=0,k=0;
// confirm interrupt handling
*pDMA3_IRQ_STATUS = 0x0001;
for (i = 0; i < IP_SIZE; i++)
{
// copy input data from dma input buffer into variables
sCh0LeftIn[i] = iRxBuffer1[INTERNAL_ADC_L0+j] >> 8;
sCh0RightIn[i] = iRxBuffer1[INTERNAL_ADC_R0+j] >> 8;
// use the builtin circular buffer to update the index
j = __builtin_circindex(j, 2, 2*IP_SIZE*FRAME_SIZE);
}
// call function that contains user code
Process_Data();
for (i = 0; i < IP_SIZE; i++)
{
// copy processed data from variables into dma output buffer
iTxBuffer1[INTERNAL_DAC_L0+k] = (sCh0LeftOut[i] << 8) ; //<<2
iTxBuffer1[INTERNAL_DAC_R0+k] = (sCh0RightOut[i] << 8); //<< 2;
// use the builtin circular buffer to update the index
k = __builtin_circindex(k, 2, 2*IP_SIZE*FRAME_SIZE);
}
}
EX_INTERRUPT_HANDLER(Switch_ISR)
{
int i;
if (*pPORTFIO & PF2)
{
*pPORTFIO_CLEAR = PF2;
}
if (*pPORTFIO & PF3)
{
*pPORTFIO_CLEAR = PF3;
}
if (*pPORTFIO & PF4)
{
*pPORTFIO_CLEAR = PF4;
pushbt_flag = 1;
ucLED = 0x02;
}
if (*pPORTFIO & PF5)
{
*pPORTFIO_CLEAR = PF5;
pushbt_flag = 0;
ucLED = 0x01;
}
}
EX_INTERRUPT_HANDLER(Timer_ISR)
{
*pTIMER_STATUS = 0x0001;
*pPORTFIO_CLEAR = 0x0FC0;
*pPORTFIO_SET = ucLED << 6;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -