⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mu21k_hd.asm

📁 dsp AD公司ADSP21的代码,里面有FFT FIR IIR EQULIZER G722_21F 等可以在项目中直接应用的代码.此代码的来源是ADI公司自己出版的书籍,此书在美国购得
💻 ASM
📖 第 1 页 / 共 2 页
字号:
/* This file contains the interrupt table for the ADSP-21020           */

/* When the C program exits either by returning from main() or by an   */
/* explicit or implicit call to exit(), control will transfer to the   */
/* label ___lib_prog_term. If your application needs to perform some   */  
/* operation AFTER the C program has finished executing, remove the    */
/* ___lib_prog_term label from the runtime header, and place it at the */
/* beginning of your code.                                             */

/* modified for EZ-LAB play/record (1 channel) by P. Embree 1-30-93 */
/* updated for version 3.1 tools by P. Embree 1-14-95 */

/* button controls:

IF flag1 is off:

   IRQ2 button toggles between feedthru mode (holds buffer playback) and
                       playback of whatever is in the output buffer
                       (put samples in buffer using sendout).

IF flag1 is on:

   IRQ2 button toggles between simultaneous record/playback mode and
                       playback of whatever is in the output buffer
                       (put samples in output buffer using sendout).

FLAG3 indicates if input data is being used and is toggled by IRQ2.

*/

#include "def21020.h"
#include "rtdsp.h"

/* ports for audio i/o */
.SEGMENT/DM   hip_regs;
.PORT         in_audio_l;   { ADSP-2111 HDR0 = left input from AD1849 }
.PORT         in_audio_r;   { ADSP-2111 HDR1 = right input from AD1849 }
.PORT         out_audio_l;  { ADSP-2111 HDR2 = left output to AD1849 }
.PORT         out_audio_r;  { ADSP-2111 HDR3 = right output to AD1849 }
.PORT         control_0;    { ADSP-2111 HDR4 = AD1849 input and gain }
.PORT         control_1;    { ADSP-2111 HDR5 = AD1849 sample rate select }
.ENDSEG;

/* sample buffers for audio */
.SEGMENT/DM samples;
.VAR        _play_fifo[FIFO_LENGTH];
.VAR        _record_fifo[FIFO_LENGTH];
.ENDSEG;

.GLOBAL     _play_fifo;
.GLOBAL     _record_fifo;

.GLOBAL     ___lib_prog_term;                   /*Termination address   */

.SEGMENT/PM     seg_rth;                    /*Runtime header segment*/

            NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;    /*Reserved interrupt    */

___lib_RSTI:        CALL ___lib_setup_hardware;         /*Reset Interrupt   */
            CALL ___lib_setup_processor;
            CALL ___lib_setup_environment; 
            CALL setup_ezlab;
            JUMP _main;             /*Begin user progam     */
            NOP;
___lib_prog_term:   IDLE;
            JUMP ___lib_prog_term;          /*Stay at idle */

            NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;    /*Reserved interrupt    */

/* Interrupt vector for status stack/loop stack overflow or PC stack full:      */
___lib_SOVFI:       BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+3*6+5);     /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+3*6;       /*Int slot next_mask    */
            I13=dm(___lib_int_table+3*6+2);     /*read addr of handler  */

/* Interrupt vector for high priority timer interrupt: */
___lib_TMZOI:       BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+4*6+5);     /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+4*6;       /*Int slot next_mask    */
            I13=dm(___lib_int_table+4*6+2);     /*read addr of handler  */

/* this interrupt vector is the audio sample clock */

___IRQ3I:
            {.....16 bit audio record/playback.....}
        bit set mode1 SRD1L|SRD1H|SRRFL|SRRFH; { use all secondary registers}
        bit tst astat FLG3; { test the flag 3 LED}
        if tf jump record (DB);
        r3=dm(in_audio_r);  { get AD1849 right channel }
        r4=dm(in_audio_l);  { get AD1849 left channel }
        jump playback (DB);
        r4=dm(i0,0);       { get 2 samples }
        r3=lshift r4 by 16;     { get lower sample }

/* this interupt toggles the flag 3 LED which starts record */

___IRQ2I:
        pop sts;    { get ASTAT from stack, pushed there by IRQ }
        bit tgl astat FLG3; { toggle the flag 3 LED}        
        NOP;
        push sts;   { restore stack so effect happens after rti }
        bit set mode1 SRD1L; { use secondary DAG1 }
        bit set imask IRQ2I|IRQ3I;  { enable interupts 2 and 3 }
        i3=_record_fifo;  { reset record pointer }
        rti;

___lib_IRQ1I:       BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+7*6+5);     /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+7*6;       /*Int slot next_mask    */
            I13=dm(___lib_int_table+7*6+2);     /*read addr of handler  */

___lib_IRQ0I:       BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+8*6+5);     /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+8*6;       /*Int slot next_mask    */
            I13=dm(___lib_int_table+8*6+2);     /*read addr of handler  */

            NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;    /*Reserved interrupt    */
            NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;    /*Reserved interrupt    */

/* Interrupt vector for DAG1 buffer 7 circular buffer overflow              */
___lib_CB7I:        BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+11*6+5);    /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+11*6;      /*Int slot next_mask    */
            I13=dm(___lib_int_table+11*6+2);    /*read addr of handler  */

/* Interrupt vector for DAG2 buffer 15 circular buffer overflow             */
___lib_CB15I:       BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+12*6+5);    /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+12*6;      /*Int slot next_mask    */
            I13=dm(___lib_int_table+12*6+2);    /*read addr of handler  */

            NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;    /*Reserved interrupt    */

/* Interrupt vector for lower priority timer interrupt                  */
___lib_TMZI:        BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+14*6+5);    /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+14*6;      /*Int slot next_mask    */
            I13=dm(___lib_int_table+14*6+2);    /*read addr of handler  */

/* Interrupt vector for fixed point overflow interrupt                  */
___lib_FIXI:        BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+15*6+5);    /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+15*6;      /*Int slot next_mask    */
            I13=dm(___lib_int_table+15*6+2);    /*read addr of handler  */

/* Interrupt vector for floating point overflow interrupt               */
___lib_FLTOI:       BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+16*6+5);    /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+16*6;      /*Int slot next_mask    */
            I13=dm(___lib_int_table+16*6+2);    /*read addr of handler  */

/* Interrupt vector for floating point underflow interrupt              */
___lib_FLTUI:       BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+17*6+5);    /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+17*6;      /*Int slot next_mask    */
            I13=dm(___lib_int_table+17*6+2);    /*read addr of handler  */

/* Interrupt vector for floating point invalid operation interrupt          */
___lib_FLTII:       BIT CLR MODE1 0x1000;           /*Disable interrupts    */
            DM(I7,M7)=I13;              /*Save I13 (scratch reg)*/
            I13=DM(___lib_int_table+18*6+5);    /*addr of dispatch to jump to*/
            BIT SET MODE2 0x80000;          /*Freeze cache      */
            DM(I7,M7)=I15;              /*Save another scratch reg*/
            JUMP (M13, I13) (DB);           /*Jump to dispatcher    */
            I15=___lib_int_table+18*6;      /*Int slot next_mask    */
            I13=dm(___lib_int_table+18*6+2);    /*read addr of handler  */

            NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;    /*Reserved interrupt    */
            NOP;NOP;NOP;NOP;NOP;NOP;NOP;NOP;    /*Reserved interrupt    */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -