1 | /* timer_isr() |
---|
2 | * |
---|
3 | * This ISR is used to bump a count of interval "overflow" interrupts which |
---|
4 | * have occurred since the timer was started. The number of overflows is taken |
---|
5 | * into account in the Read_timer() routine. |
---|
6 | * |
---|
7 | * Input parameters: NONE |
---|
8 | * |
---|
9 | * Output parameters: NONE |
---|
10 | * |
---|
11 | * COPYRIGHT (c) 1989-1999. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.com/license/LICENSE. |
---|
17 | * |
---|
18 | * Modifications of respective RTEMS file: COPYRIGHT (c) 1994. |
---|
19 | * Copyright (c) 1998, National Research Council of Canada |
---|
20 | * |
---|
21 | * $Id$ |
---|
22 | */ |
---|
23 | |
---|
24 | #include <rtems/asm.h> |
---|
25 | |
---|
26 | BEGIN_CODE |
---|
27 | |
---|
28 | .set INTR_CLEAR_REG, 0xfff40074 | interrupt clear register |
---|
29 | .set T1_CNTRL_REG, 0xfff40060 | tick timer 1 control register |
---|
30 | .set CLEAR_INT, 0x01000000 | clear tick 1 interrupt |
---|
31 | .set CLEAR_OVF, 0x00000004 | clear tick 1 overflow counter |
---|
32 | |
---|
33 | PUBLIC (Ttimer_val) |
---|
34 | PUBLIC (timerisr) |
---|
35 | SYM (timerisr): |
---|
36 | move.l a0, -(a7) | save a0 |
---|
37 | move.l d0, -(a7) | save d0 |
---|
38 | move.w sr, -(a7) | save ccr |
---|
39 | movea.l #INTR_CLEAR_REG, a0 | a0 = addr of intr clr reg |
---|
40 | ori.l #CLEAR_INT, (a0) | clear tick timer 1 intr |
---|
41 | movea.l #T1_CNTRL_REG, a0 | a0 = addr of t1 cntrl reg |
---|
42 | move.l (a0), d0 | read overflow counter |
---|
43 | lsr.l #4, d0 | put overflow in low order bits |
---|
44 | andi.l #0xF, d0 | keep only overflow |
---|
45 | add.l d0, SYM (Ttimer_val) | increment timer value |
---|
46 | ori.l #CLEAR_OVF, (a0) | clear overflow counter |
---|
47 | move.w (a7)+, sr | restore ccr |
---|
48 | move.l (a7)+, d0 | restore d0 |
---|
49 | move.l (a7)+, a0 | restore a0 |
---|
50 | rte |
---|
51 | |
---|
52 | END_CODE |
---|
53 | END |
---|