Wolfgang Denk | 72a087e | 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 | */ |
| 45 | mov r8, lo(timer_overflow) |
| 46 | orh r8, hi(timer_overflow) |
| 47 | ld.w r9, r8[0] |
| 48 | mov r10, -1 |
| 49 | mtsr SYSREG_COMPARE, r10 |
| 50 | sub r9, -1 |
| 51 | st.w r8[0], r9 |
| 52 | rete |
| 53 | |
| 54 | .type unknown_exception, @function |
| 55 | unknown_exception: |
| 56 | pushm r0-r12 |
| 57 | sub r8, sp, REG_R12 - REG_R0 - 4 |
| 58 | mov r9, lr |
| 59 | mfsr r10, SYSREG_RAR_EX |
| 60 | mfsr r11, SYSREG_RSR_EX |
| 61 | pushm r8-r11 |
| 62 | mfsr r12, SYSREG_ECR |
| 63 | mov r11, sp |
| 64 | rcall do_unknown_exception |
| 65 | 1: rjmp 1b |