李現(xiàn)路:在DSP6000中怎樣編寫您的第一個(gè)程序(二) Post By:2009-11-23 23:46:16
三、完整的中斷向量表程序如下:
.global _vectors ;定義一個(gè)能被外部(C語(yǔ)言程序)引用的變量
.global _c_int00
.global _vector1
.global _vector2
.global _vector3
.global _vector1
.global _vector5
.global _vector6
.global _vector7
.global _vector8
.global _vector9
.global _vector10
.global _vector11 ; Hookup the c_int08 ISR(連接這個(gè)中斷設(shè)置寄存器) in main()
.global _vector12 ; Hookup the c_int08 ISR in main()
.global _vector13
.global _vector14
.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 ;reset ISR(復(fù)位中斷設(shè)置寄存), .ref表明一個(gè)或多個(gè)在另一個(gè)模塊中定義而在前模塊中要用到的符號(hào)
*------------------------------------------------------------------------------
* This is a macro that instantiates one entry in the interrupt service table.
*------------------------------------------------------------------------------
VEC_ENTRY .macro addr ;中斷返回函數(shù)
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: ;初始化IST寄存器(中斷向量表起始地址寄存器,用于設(shè)置中斷服務(wù)程序存放的地址)
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 ".vecs" ;定義初始化帶名稱的段
.align 1024 ;分配程序頁(yè)
_vectors:
_vector0: VEC_ENTRY _c_int00 ;RESET(應(yīng)用程序的入口)
_vector1: VEC_ENTRY _vec_dummy ;NMI(非屏蔽中斷,用于處理極為關(guān)鍵的任務(wù))
_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 ; Hookup the c_int08 ISR in main()
_vector12: VEC_ENTRY _vec_dummy ; Hookup the c_int08 ISR in main()
_vector13: VEC_ENTRY _vec_dummy
_vector14: VEC_ENTRY _vec_dummy
_vector15: VEC_ENTRY _vec_dummy