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

📄 irq_ven.s

📁 AT91所有开发板的资料 AT91所有开发板的资料
💻 S
字号:
; ********************************************************************************
; *
; * ARM Strategic Support Group
; *
; ********************************************************************************

; ********************************************************************************
; *
; * Module      : irq_ven.s                   
; * Description : Angel IRQ veneer code                     
; *    
; *           This code is written to allow chaining of the
; *           example IRQ code with the Angel IRQ handler      
; *           caring for the registers using the stack.   
; *
; * Tool Chain	: ARM Developer Suite v1.0
; * Platform   	: Evaluator7T
; * History    	: 
; *
; *     970326 DBrooke
; *		- created example code
; *
; *     980420 MEchavarria
; * 	- modified for Sharp 790A
; *     - added timer counter interrupt handler
; *
; *     980429 ASloss
; *		- added button interrupt handler
; *
; *		2000-04-04 Andrew N. Sloss
; *		- ported to the Evaluator7T
; *	
; * Notes      :
; *
; *  The AREA must have 
; *  - the attribute READONLY, otherwise the linker will not
; *   place it in ROM.
; *  - the attribute CODE, otherwise the assembler will not
; *   let us put any code in this AREA
; *
; ********************************************************************************

; ********************************************************************************
; * IMPORT/EXPORT
; ********************************************************************************

	IMPORT timer_irq
	IMPORT button_irq
	EXPORT handler_irq
	EXPORT Angel_IRQ_Address
	EXPORT SetupSVC		

	AREA	irq, CODE, READONLY

; ********************************************************************************
; * DATA
; ********************************************************************************


INTPND		DCD		0x03ff4004				;IRQ controller

; *********************************************************************************
; * ROUTINES
; *********************************************************************************

; -- irqHandler -------------------------------------------------------------------
;
; Description	: handles the IRQ interrupt and determines the source and then
;		  		  vectors to the correct interrupt rountine.
;

handler_irq
	STMFD	sp!, {r0 - r3, LR}	;Maintain Stack using APCS standard

	; -- identify source of interrupt .........................

	LDR 	r0, INTPND	 
	LDR 	r0, [r0]		

	; -- check if source is a timer interrupt .................

	TST 	r0, #0x0400
	BNE		handler_event_timer 

	; -- check if source is a button interrupt ................

	TST		r0, #0x0001		
	BNE		handler_event_button	

	LDMFD	sp!, {r0 - r3, lr}		;If not then its an Angel request
	LDR 	pc, Angel_IRQ_Address	;remove the regs from the stack and call 
					;the routine
;
; **********************************************************************************
; EVENT: Timer 
; **********************************************************************************
;

handler_event_timer
	BL	timer_irq				;if this point is reached then the irq is from 
								;the timer
	LDMFD   sp!, {r0 - r3,lr}	;return from the irq_auxtimer routine - 
								;restore the registers 
	subs    pc, lr, #4 			;and return from the interrupt
;
; **********************************************************************************
; EVENT: Button
; **********************************************************************************
;

handler_event_button
	BL	button_irq				;if this point is reached then the irq is from the button
	LDMFD   sp!, {r0 - r3,lr}	;return from the irq_buttonpress routine - restore the registers 
	subs    pc, lr, #4 			;and return from the interrupt
		
SetupSVC
	MOV	pc, lr					; return


	AREA	var, DATA, READWRITE

Angel_IRQ_Address	
	DCD 0x00000000				; Scratch location for Angel IRQ Handler address


	END

; ***********************************************************************************
; * END OF irq_ven.c 
; ***********************************************************************************

⌨️ 快捷键说明

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