TI中文支持网
TI专业的中文技术问题搜集分享网站

dma中断向量表配置不明白

我接手公司项目,有段代码不明白

dma0和dma1为什么这样配置中断,interrupt_init里enable DMA0 interrupt为什么是这样写。如果要增加dma2中断又如何添加呢。

/*****************************************************************************/
/* Define Interrupt Flag and Interrupt Mask Registers */
/*****************************************************************************/
#define IER0_ADDR 0x0000#define IER0 *(volatile unsigned int*)IER0_ADDR

#define IFR0_ADDR 0x0001
#define IFR0 *(volatile unsigned int*)IFR0_ADDR

#define IER1_ADDR 0x0045
#define IER1 *(volatile unsigned int*)IER1_ADDR

#define IFR1_ADDR 0x0046
#define IFR1 *(volatile unsigned int*)IFR1_ADDR

#define IVPD_ADDR 0x0049
#define IVPD *(volatile unsigned int*)IVPD_ADDR

#define IVPH_ADDR 0x004a
#define IVPH *(volatile unsigned int*)IVPH_ADDR

/*****************************************************************************/
/* Symbolic Constants */
/*****************************************************************************/

#define IER0_USBMSK 0x0100 // mask for USB intrpt
#define IFR0_USBMSK 0x0100 // mask for USB intrpt

#define IER1_DMA0MSK 0x0004 // mask for DMA0 intrpt
#define IFR1_DMA0MSK 0x0004 // mask for DMA0 intrpt

#define IER0_DMA1MSK 0x0200 // mask for DMA1 intrpt
#define IFR0_DMA1MSK 0x0200 // mask for DMA1 intrpt

/*****************************************************************************/
/* INTR_ENABLE – enables all masked interrupts by resetting INTM */
/* bit in Status Register 1 */
/*****************************************************************************/
#define INTR_GLOBAL_ENABLE \
asm(" bit(st1, #st1_intm) = #0");

/*****************************************************************************/
/* INTR_DISABLE – disables all masked interrupts by setting INTM */
/* bit in Status Register 1 */
/*****************************************************************************/
#define INTR_GLOBAL_DISABLE \
asm(" bit(st1, #st1_intm) = #1");

//中断初始化,打开USB和DMA中断
void
interrupt_init()
{
IVPD = ((Uint32)RESET_VEC>>8) & 0xFFFF; // init IVPD reg
IVPH = ((Uint32)RESET_VEC>>8) & 0xFFFF; // init IVPH reg

// enable USB interrupt
IFR0 |= IFR0_USBMSK; // Clear USB intrpt flag
IER0 |= IER0_USBMSK; // Enable USB intrpt mask

// enable DMA0 interrupt
IFR1 |= IFR1_DMA0MSK;
IER1 |= IER1_DMA0MSK;

// enable DMA1 interrupt
IFR0 |= IFR0_DMA1MSK;
IER0 |= IER0_DMA1MSK;

INTR_GLOBAL_ENABLE; // enable global interrupt
}

chunying wu:

vectors.asm如下:

;************************************************************************** ; .C54CM_off; .CPL_off; .ARMS_off .mmregs .ref _c_int00, _USB_ISR, _DMA_0_ISR, _DMA_1_ISR, _McBSP_2_ISR .def _RESET_VEC, no_isr

;**********************************************************************************; predefined stack operation modes ;**********************************************************************************; USE_RETA : 2×16-bit fast return mode (RETA used); NO_RETA : 2×16-bit slow return mode (RETA not used); C54X_STK : 32-bit slow return mode – default if no stack mode specified

; .vli_off

;********************************************************************************** .sect "Rst_Vec" .align 256 ;**********************************************************************************

_RESET_VEC: .ivec _c_int00 ; Reset / Software Interrupt #0 – 32bit slow ret

NMI: .ivec no_isr ; Nonmaskable / Software Interrupt #1

INT0: .ivec no_isr ; Ext. User Interrupt #0 / Software Interrupt #2 INT2: .ivec no_isr ; Ext. User Interrupt #2 / Software Interrupt #3

TINT0: .ivec no_isr ; Timer #0 / Software Interrupt #4

RINT0: .ivec no_isr ; McBSP #0 Rec / Software Interrupt #5

RINT1: .ivec no_isr ; McBSP #1 Rcv / Software Interrupt #6

XINT1: .ivec no_isr ; McBSP #1 Xmit / Software Interrupt #7

USB: .ivec _USB_ISR ; USB / Software Interrupt #8

DMAC1: .ivec _DMA_1_ISR ; DMA Channel #1 / Software Interrupt #9

DSPINT: .ivec no_isr ; Host Interrupt / Software Interrupt #10

INT3: .ivec no_isr ; Ext. User Interrupt #3 / Software Interrupt #11

RINT2: .ivec _McBSP_2_ISR ; McBSP #2 Rcv / Software Interrupt #12

XINT2: .ivec no_isr ; McBSP #2 Xmit / Software Interrupt #13

DMAC4: .ivec no_isr ; DMA Channel #4 / Software Interrupt #14

DMAC5: .ivec no_isr ; DMA Channel #5 / Software Interrupt #15

INT1: .ivec no_isr ; Ext. User Interrupt #1 / Software Interrupt #16

XINT0: .ivec no_isr ; McBSP #0 Xmit / Software Interrupt #17

DMAC0: .ivec _DMA_0_ISR ; DMA Channel #0 / Software Interrupt #18

INT4: .ivec no_isr ; Ext. User Interrupt #4 / Software Interrupt #19

DMAC2: .ivec no_isr ; DMA Channel #2 / Software Interrupt #20

DMAC3: .ivec no_isr ; DMA Channel #3 / Software Interrupt #21

TINT1: .ivec no_isr ; Timer #1 / Software Interrupt #22

I2C: .ivec no_isr ; I2C Interrupt / Software Interrupt #23

BERR: .ivec no_isr ; Bus Error / Software Interrupt #24

DLOG: .ivec no_isr ; Emulation / Software Interrupt #25

RTOS: .ivec no_isr ; Emulation / Software Interrupt #26

SINT27: .ivec no_isr ; Software Interrupt #27

SINT28: .ivec no_isr ; Software Interrupt #28

SINT29: .ivec no_isr ; Software Interrupt #29

SINT30: .ivec no_isr ; Software Interrupt #30

;SINT31: .ivec no_isr ; Software Interrupt #31

; .vli_on

.sect ".text"

********************************************************************************** Name : no_isr **** **** Purpose : Spurious interrupt handler **** **** Author : **** **********************************************************************************no_isr: return_int

Tony Tang:

用或的关系将相应的位置1,而其它位的值不变,有什么不对的吗?

赞(0)
未经允许不得转载:TI中文支持网 » dma中断向量表配置不明白
分享到: 更多 (0)