📄 irq_tc.s
字号:
/*
------------------------------------------------------------------------------
- ATMEL Microcontroller Software Support - ROUSSET -
------------------------------------------------------------------------------
The software is delivered "AS IS" without warranty or condition of any
kind, either express, implied or statutory. This includes without
limitation any warranty or condition with respect to merchantability or
fitness for any particular purpose, or against the infringements of
intellectual property rights of others.
-----------------------------------------------------------------------------
- File source : irq_tc.s
- Object : Assembler Timer Counter Interrupt Handler.
- Translator : ARM Software Development Toolkit V2.11a
-
- Imported Resources :
- TCHandlerTable, PtTCBBase
- Exported Resources :
- tc0_interrupt_handler, tc1_interrupt_handler, tc2_interrupt_handler
-
- 1.0 JCZ 16/12/97 : Creation
- 1.1 JCZ 24/04/98 : Add END at the end of file
- 1.2 JCZ 15/09/98 : See irq.mac 1.1
- 2.0 JCZ 21/10/98 : Clean up and add interworking capabilities
------------------------------------------------------------------------------
Function :
The handlers for each Timer Counter are stored in the table <TCHandlerTable>.
When an interrupt occurs, the core branchs the channel corresponding
assembler handler which manage the system ( core and AIC ) and branch to
the corresponding C handler. This last can be defined by the C function
<init_timer_irq>.
Note in thumb mode, handler addresses are saved with bit 0 set. Then,
you don't need to set it before execution of bx.
------------------------------------------------------------------------------
*/
/* AREA AT91Lib, CODE, READONLY, INTERWORK
.section code,r
.interwork
*/
/* -------------------------- List of Included Files --------------------------- */
.INCLUDE "../Include/arm.inc"
.INCLUDE "../Include/tc.inc"
.INCLUDE "../Include/aic.inc"
.INCLUDE "../Include/irq.mac"
/* ------------------------- List of constants and types ------------------------ */
/* None */
/* ------------------------- List of Imported resources ------------------------- */
/* Timer Counter Handler Table */
.extern TCHandlerTable
#; ------------------------- List of Internal resources -------------------------
PtTCBBase:
.long TCB_BASE
/*
------------------------------------------------------------------------------
- Function : interrupt_end
- Treatments : End of Timer Counter interrupt.
- Input Parameters : None
- Output Parameters : Come back in the interrupted mode,
- : restore PC and SPSR.
- Registers lost : None
- Called Functions : None
- Called Macros : IRQ_EXIT
------------------------------------------------------------------------------
*/
interrupt_end:
IRQ_EXIT
/*------------------------ List of Exported resources -------------------------*/
/*
------------------------------------------------------------------------------
- Function : tc0_interrupt_handler
- Treatments : Timer Counter Channel 0 Interrupt Handler.
- Input Parameters : LR = the address of the interrupted instruction.
- : SPSR = CPSR before interrupt.
- Output Parameters : None
- Registers lost : None
- Called Functions : The corresponding handler read in the Handler Table.
- : interrupt_end
- Called Macros : IRQ_ENTRY
------------------------------------------------------------------------------
*/
.global tc0_interrupt_handler
tc0_interrupt_handler:
IRQ_ENTRY
/*- Load the Timer Counter 0 Base address */
ldr r0, PtTCBBase
/* add r0, r0, #TC0 */
/*- Load the address of the Timer Counter Handler Table */
ldr r1, =TCHandlerTable
/*- Branch to the TC0 Interrupt Handler with return address on end of interrupt */
ldr r1, [r1]
adr r14, interrupt_end
bx r1
/*
------------------------------------------------------------------------------
- Function : tc1_interrupt_handler
- Treatments : Timer Counter Channel 1 Interrupt Handler.
- Input Parameters : LR = the address of the interrupted instruction.
- : SPSR = CPSR before interrupt.
- Output Parameters : None
- Registers lost : None
- Called Functions : The corresponding handler read in the Handler Table.
- : interrupt_end
- Called Macros : IRQ_ENTRY
------------------------------------------------------------------------------
*/
.global tc1_interrupt_handler
tc1_interrupt_handler:
IRQ_ENTRY
/*- Load the Timer Counter 1 Base address */
ldr r0, PtTCBBase
add r0, r0, #TC1
/*- Load the address of the Timer Counter Handler Table*/
ldr r1, =TCHandlerTable
/*- Branch to the TC0 Interrupt Handler with return address on end of interrupt*/
ldr r1, [r1, #4]
adr r14, interrupt_end
bx r1
/*
------------------------------------------------------------------------------
- Function : tc2_interrupt_handler
- Treatments : Timer Counter Channel 2 Interrupt Handler.
- Input Parameters : LR = the address of the interrupted instruction.
- : SPSR = CPSR before interrupt.
- Output Parameters : None
- Registers lost : None
- Called Functions : The corresponding handler read in the Handler Table.
- : interrupt_end
- Called Macros : IRQ_ENTRY
------------------------------------------------------------------------------
*/
.global tc2_interrupt_handler
tc2_interrupt_handler:
IRQ_ENTRY
/*- Load the Timer Counter 2 Base address*/
ldr r0, PtTCBBase
add r0, r0, #TC2
/*- Load the address of the Timer Counter Handler Table*/
ldr r1, =TCHandlerTable
/*- Branch to the TC0 Interrupt Handler with return address on end of interrupt*/
ldr r1, [r1, #2*4]
adr r14, interrupt_end
bx r1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -