📄 isr.asm
字号:
/////////////////////////////////////////////////////////////
// //
// Interrupt Service Routine //
// acknowledge received audio sample //
// //
/////////////////////////////////////////////////////////////
#include "def21262.h"
.extern _Cascaded_IIR_Filter_SIMD;
.extern inbuf;
.extern outbuf;
.extern delaybuf;
.extern coefficients;
.section /pm seg_pmco;
.global _SPORT_ISR;
_SPORT_ISR:
r8=dm(RXSP0A); // read sample from ADC
r8=lshift r8 by 8; // convert to 32-bit floating point
f8=float r8;
f0=0.0067730926; // Total filter gain A
// reduce level by 24 dB to allow some
f8=f0*f8; // headroom for processing -- a high Q
// filter might clip the output
r15 = dm(DAI_PIN_STAT);
btst r15 by 7; // 1=left, 0=right
if not sz jump right_ch; // In I2S, low on left. When left
// sample is received and triggers ISR
// frame sync = 1 (receiving right)
left_ch:
dm(inbuf)=f8;
f8=dm(outbuf);
jump send_out;
right_ch:
dm(inbuf+1)=f8;
call _Cascaded_IIR_Filter_SIMD (db);
b0=delaybuf;
b8=coefficients;
f8=dm(outbuf+1);
// r8=pass r8;
// if not sz rts;
send_out:
r8=fix f8; // covert to fixed point
r8=lshift r8 by -8; // left-align 24-bit audio in 32-bit word
dm(TXSP1A)=r8; // write to DAC1
dm(TXSP1B)=r8; // write to DAC2
dm(TXSP2A)=r8; // write to DAC3
dm(TXSP2B)=r8; // write to DAC4
rti;
_SPORT_ISR.end:
//--------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -