📄 lh7a400_int_vec.s
字号:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; $Workfile: LH7A400_int_vec.s $
; $Revision: 1.5 $
; $Author: KovitzP $
; $Date: Jan 03 2002 16:13:58 $
;
; Project: LH7A400
;
; Description: Interrupt handler setup support file
;
; Reference: Internal Documentation
;
; Revision history:
; $Log: P:/PVCS6_6/archives/LH7A400 (Aruba)/Interrupts/LH7A400_int_vec.s-arc $
;
; Rev 1.5 Jan 03 2002 16:13:58 KovitzP
; Integrated with priority_driver.c functions
;
; Rev 1.4 Nov 20 2001 16:33:26 KovitzP
; Fixed a bug in the FIQ dispatcher that was causing a return to
; the wrong address.
;
; Rev 1.3 Nov 20 2001 08:30:40 KovitzP
; Added standard form comments. Removed the while loop
; from the FIQ dispatcher; the FIQ dispatcher processes only
; the highest priority pending FIQ. The FIQ dispatcher is now
; reentrant.
;
; Rev 1.2 Nov 16 2001 18:13:58 KovitzP
; Corrected bugs that were causing FIQ priority_encode and function vectors to be stored in the wrong places
;
; Rev 1.1 Nov 15 2001 17:29:16 KovitzP
; Added FIQ support. Changed default handler operation to properly handle uninstalled interrupts. Added functions to uninstall interrupts. Will not work with cache enabled; install handler routines do not drain D cache or invalidate I-cache.
;
; Rev 1.0 Nov 13 2001 17:43:14 SuryanG
; Initial revision.
;
; Rev 1.0 Nov 12 2001 12:48:50 SuryanG
; Initial revision.
;
;
; COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS INC.
; CAMAS, WA
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
AREA INTVEC, CODE ;name this block of code
IMPORT LH7A400_IRQ_dispatcher ;this is defined in int_driver.c
EXPORT irq_dispatcher_addr
EXPORT irq_vec
EXPORT fiq_priority_encode_0
EXPORT fiq_handlers_0
EXPORT LH7A400_FIQ_dispatcher
EXPORT LH7A400_FIQ_disp_end
EXPORT LH7A400_unhandled_fiq_handler
ARM_FIQ_VEC EQU 0x1C
LH7A400_APB_BASE EQU 0x80000000
LH7A400_INT_STAT EQU 0x500
LH7A400_INT_CLEAR EQU 0x50C
ILLEGAL_PRIORITY EQU 4
;-------------------------------------------------------------------
;
;
; Function: LH7A400_FIQ_dispatcher
;
; Purpose:
; Transfer program control to a previously installed FIQ handler
; function based on the desired priority
;
; Processing:
; Use the lower 4 bits of the interrupt controller status register
; as an index into a priority encoder array. Use the priority read
; from that array as an index into the FIQ handler array. Call the
; handler function read from the array, restore status, and return.
;
; Parameters: None
;
; Outputs: None
;
; Returns: Nothing
;
; Notes:
; This function is designed to be copied into memory such that
; LH7A400_FIQ_dispatcher() begins at address 0x1C (the FIQ
; exception vector). Copy this function and associated
; data from the label LH7A400_FIQ_dispatcher to the label
; LH7A400_FIQ_disp_end.
;
; This function uses only r8-r12. It passes the contents of r8
; and r12 to the function LH7A400_unhandled_fiq_handler, so use
; caution if editing this function.
;
; If the handler function uses any of r0-r7, it must preserve
; those registers on entry and restore them on exit. The handler
; need not preserve r8-r12.
;
; The dispatcher is re-entrant. Handler functions may enable
; FIQs to allow higher priority FIQs to be processed.
;
;---------------------------------------------------------------------
LH7A400_FIQ_dispatcher
SUB r14,r14,#4
STMFD sp!,{r14} ; free the link register
; keep the pointer to the priority encode in r11--this is not relocatable
MOV r11,#(ARM_FIQ_VEC+fiq_priority_encode_0-LH7A400_FIQ_dispatcher)
; keep pointer to the FIQ handlers in r10--this is not relocatable
MOV r10,#(ARM_FIQ_VEC+fiq_handlers_0-LH7A400_FIQ_dispatcher)
; keep pointer to the base of the APB registers in r12
MOV r12,#LH7A400_APB_BASE
LDR r8,[r12,#LH7A400_INT_STAT]
AND r8,r8,#0xf ; isolate the FIQ status bits
LDRSB r9,[r11,r8] ; r9 = fiq_priority_encode[r8]
LDR r11,[r10,r9,LSL #2] ; r11 = fiq_handlers[r8]
MOV lr,pc ; r11()
MOV pc,r11
fiq_disp_exit
LDMFD sp!,{pc}^
;-------------------------------------------------------------------
;
;
; Function: LH7A400_unhandled_fiq_handler
;
; Purpose:
; Clear all pending FIQs at the time when this handler was called.
;
; Processing:
; Write the status bits to the INTC->Clear register
;
; Parameters:
; r14 contains the return address (r14 is the lr)
; r12 contains the base of the AHB peripheral registers
; r8 contains the FIQ bits that caused this function to be envoked
; (i.e., r8 = INTC->Status & _BITMASK(4)
;
; Outputs: None
;
; Returns: Nothing
;
; Notes:
;
;---------------------------------------------------------------------
LH7A400_unhandled_fiq_handler
STR r8,[r12,#LH7A400_INT_CLEAR]
MOV pc,lr ;return
LH7A400_FIQ_disp_end
fiq_handlers_0
DCD 0 ;handler for priority 0
DCD 0 ;handler for priority 1
DCD 0 ;handler for priority 2
DCD 0 ;handler for priority 3
DCD 0 ;handler for unhandled interrupts
fiq_priority_encode_0
DCB ILLEGAL_PRIORITY ; priority for no FIQ sources pending
DCB ILLEGAL_PRIORITY ; priority FIQ sources 0 pending
DCB ILLEGAL_PRIORITY ; priority FIQ sources 1 pending
DCB ILLEGAL_PRIORITY ; priority FIQ sources 1,0 pending
DCB ILLEGAL_PRIORITY ; priority FIQ sources 2 pending
DCB ILLEGAL_PRIORITY ; priority FIQ sources 2,0 pending
DCB ILLEGAL_PRIORITY ; priority FIQ sources 2,1 pending
DCB ILLEGAL_PRIORITY ; priority FIQ sources 2,1,0 pending
DCB ILLEGAL_PRIORITY ; priority FIQ sources 3 pending
DCD ILLEGAL_PRIORITY ; priority FIQ sources 3,0 pending
DCD ILLEGAL_PRIORITY ; priority FIQ sources 3,1 pending
DCD ILLEGAL_PRIORITY ; priority FIQ sources 3,1,0 pending
DCD ILLEGAL_PRIORITY ; priority FIQ sources 3,2 pending
DCD ILLEGAL_PRIORITY ; priority FIQ sources 3,2,0 pending
DCD ILLEGAL_PRIORITY ; priority FIQ sources 3,2,1 pending
DCD ILLEGAL_PRIORITY ; priority FIQ sources 3,2,1,0 pending
irq_dispatcher_addr
DCD LH7A400_IRQ_dispatcher
;-------------------------------------------------------------------
;
;
; Function: irq_vec
;
; Purpose:
; Transfers control to LH7A400_IRQ_dispatcher() after an IRQ
; exception.
;
; Processing:
; Load the address of LH7A400_IRQ_dispatcher() stored at reserved
; address 0x14 into the pc register.
;
; Parameters: None
;
; Outputs: None
;
; Returns: Nothing
;
; Notes:
; See discussion of this function in LH7A400_int_driver.c,
; int_install_irq_dispatcher() function header.
;
;
;---------------------------------------------------------------------
irq_vec
LDR pc,[pc,#-12] ; pc is 0x18 + 8. subtracting 12 yield 0x14.
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -