Wolfgang Denk | 6470255 | 2006-10-24 14:27:35 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004-2006 Atmel Corporation |
| 3 | * |
| 4 | * See file CREDITS for list of people who contributed to this |
| 5 | * project. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; either version 2 of |
| 10 | * the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 20 | * MA 02111-1307 USA |
| 21 | */ |
| 22 | #include <asm/sysreg.h> |
| 23 | #include <asm/ptrace.h> |
| 24 | |
| 25 | .section .text.exception,"ax" |
| 26 | .global _evba |
| 27 | .type _evba,@function |
| 28 | .align 10 |
| 29 | _evba: |
| 30 | .irp x,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 |
| 31 | .align 2 |
| 32 | rjmp unknown_exception |
| 33 | .endr |
| 34 | |
| 35 | .global timer_interrupt_handler |
| 36 | .type timer_interrupt_handler,@function |
| 37 | .align 2 |
| 38 | timer_interrupt_handler: |
| 39 | /* |
| 40 | * Increment timer_overflow and re-write COMPARE with 0xffffffff. |
| 41 | * |
| 42 | * We're running at interrupt level 3, so we don't need to save |
| 43 | * r8-r12 or lr to the stack. |
| 44 | */ |
Haavard Skinnemoen | abf19bf | 2006-11-20 15:53:10 +0100 | [diff] [blame] | 45 | lda.w r8, timer_overflow |
Wolfgang Denk | 6470255 | 2006-10-24 14:27:35 +0200 | [diff] [blame] | 46 | ld.w r9, r8[0] |
| 47 | mov r10, -1 |
| 48 | mtsr SYSREG_COMPARE, r10 |
| 49 | sub r9, -1 |
| 50 | st.w r8[0], r9 |
| 51 | rete |
| 52 | |
| 53 | .type unknown_exception, @function |
| 54 | unknown_exception: |
| 55 | pushm r0-r12 |
| 56 | sub r8, sp, REG_R12 - REG_R0 - 4 |
| 57 | mov r9, lr |
| 58 | mfsr r10, SYSREG_RAR_EX |
| 59 | mfsr r11, SYSREG_RSR_EX |
| 60 | pushm r8-r11 |
| 61 | mfsr r12, SYSREG_ECR |
| 62 | mov r11, sp |
| 63 | rcall do_unknown_exception |
| 64 | 1: rjmp 1b |