c6000 中断使用方法

中断的使用包括三个文件的编写

1.vec.asm:中断向量表,将中断 号和对应的中断处理函数相连。

2.interupt_int:中断初始化函数,用于将每个事件和某类型的中断号进行映射

3.interrupt void    c_intxx(void):中断处理函数,由用户自己定义

 

 

具体关系以定时器进行说明:

 

htimer(handle) ---固有---  TimerEvent (事件)  <-----map----->  14  (中断号)---- 固有--- Timer 0 Interrupt(中断性质)

                                                                                                         ----vec.asm----- void c_int14(中断函数)


2.vec.asm


********************************************************************************
*  vecs.asm    V1.00                                                       

*  Copyright 2004 by SEED Electronic Technology LTD.                          
*  All rights reserved. SEED Electronic Technology LTD.                       
*  Restricted rights to use, duplicate or disclose this code are              
*  granted through contract.                                                   
                                            
*    Designed by: Hongshuai.Li
********************************************************************************

*------------------------------------------------------------------------------
* Global symbols defined here and exported out of this file
*------------------------------------------------------------------------------
   .global _vectors
   .global _c_int00
   .global _vector1
   .global _vector2
   .global _vector3
   .global _vector4
   .global _vector5
   .global _vector6
   .global _vector7
   .global _vector8
   .global _vector9     
   .global _vector10
   .global _vector11  
   .global _vector12 
   .global _vector13  
   .global _c_int14  ; Hookup the c_int14 ISR in main()
   .global _vector15

*------------------------------------------------------------------------------
* Global symbols referenced in this file but defined somewhere else.
* Remember that your interrupt service routines need to be referenced here.
*------------------------------------------------------------------------------
   .ref _c_int00

*------------------------------------------------------------------------------
* This is a macro that instantiates one entry in the interrupt service table.
*------------------------------------------------------------------------------
VEC_ENTRY .macro addr
    STW   B0,*--B15
    MVKL  addr,B0
    MVKH  addr,B0
    B     B0
    LDW   *B15++,B0
    NOP   2
    NOP  
    NOP  
   .endm


*------------------------------------------------------------------------------
* This is a dummy interrupt service routine used to initialize the IST.
*------------------------------------------------------------------------------
_vec_dummy:
  B    B3
  NOP  5

*------------------------------------------------------------------------------
* This is the actual interrupt service table (IST). It is properly aligned and
* is located in the subsection .text:vecs. This means if you don't explicitly
* specify this section in your linker command file, it will default and link
* into the .text section. Remember to set the ISTP register to point to this
* table.
*------------------------------------------------------------------------------
 .sect ".text:vecs"
 .align 1024

_vectors:
_vector0:   VEC_ENTRY _c_int00    ;RESET
_vector1:   VEC_ENTRY _vec_dummy  ;NMI
_vector2:   VEC_ENTRY _vec_dummy  ;RSVD
_vector3:   VEC_ENTRY _vec_dummy
_vector4:   VEC_ENTRY _vec_dummy
_vector5:   VEC_ENTRY _vec_dummy
_vector6:   VEC_ENTRY _vec_dummy
_vector7:   VEC_ENTRY _vec_dummy
_vector8:   VEC_ENTRY _vec_dummy
_vector9:   VEC_ENTRY _vec_dummy
_vector10:  VEC_ENTRY _vec_dummy
_vector11:  VEC_ENTRY _vec_dummy
_vector12:  VEC_ENTRY _vec_dummy
_vector13:  VEC_ENTRY _vec_dummy
_vector14:  VEC_ENTRY _c_int14  ; Hookup the c_int14 ISR in main()
_vector15:  VEC_ENTRY _vec_dummy

*------------------------------------------------------------------------------


********************************************************************************
* End of vecs.asm
********************************************************************************

 

 

 

1.void  interupt_int(void)

 

void interupt_int(void)
{
   
           IRQ_setVecs(vectors);//重新设置中断向量,


           IRQ_globalEnable();//全局中断使能
           IRQ_nmiEnable(); 


           IRQ_map(TimerEvent,14);/ /把定时中断重新映射到 14
           IRQ_reset(TimerEvent );


           // IRQ_enable(TimerEvent );此句在主函数中开启中断处使用
    
    
}

 

3.interrupt void c_int14(void)

 

 

 

你可能感兴趣的:(DSP,王者进阶)