1 | /* |
---|
2 | *------------------------------------------------------------------- |
---|
3 | * |
---|
4 | * This file contains the subroutines necessary to initalize |
---|
5 | * and maintain the MAX791 based watchdog timer used on efi68k |
---|
6 | * |
---|
7 | * This file has been created by John S. Gwynne for the efi68k |
---|
8 | * project. |
---|
9 | * |
---|
10 | * Redistribution and use in source and binary forms are permitted |
---|
11 | * provided that the following conditions are met: |
---|
12 | * 1. Redistribution of source code and documentation must retain |
---|
13 | * the above authorship, this list of conditions and the |
---|
14 | * following disclaimer. |
---|
15 | * 2. The name of the author may not be used to endorse or promote |
---|
16 | * products derived from this software without specific prior |
---|
17 | * written permission. |
---|
18 | * |
---|
19 | * This software is provided "AS IS" without warranty of any kind, |
---|
20 | * either expressed or implied, including, but not limited to, the |
---|
21 | * implied warranties of merchantability, title and fitness for a |
---|
22 | * particular purpose. |
---|
23 | * |
---|
24 | *------------------------------------------------------------------ |
---|
25 | * |
---|
26 | * $Id$ |
---|
27 | */ |
---|
28 | #include <bsp.h> |
---|
29 | |
---|
30 | void wd_interrupt(void) { |
---|
31 | /* toggle WDI of the MAX791. A more sophisticated routine |
---|
32 | can be inserted into the exception table after booting. */ |
---|
33 | |
---|
34 | /* 3 changes guaranty a pulse independent of initial state */ |
---|
35 | *MCR |= OUT1; |
---|
36 | *MCR &= ~OUT1; |
---|
37 | *MCR |= OUT1; |
---|
38 | } |
---|
39 | |
---|
40 | /* _catchWDint is the interrupt front-end */ |
---|
41 | extern void _catchWDint(); |
---|
42 | asm(" .text |
---|
43 | .align 2 |
---|
44 | .globl _catchWDint |
---|
45 | _catchWDint: |
---|
46 | lea %sp@(4),%sp /* pop return address */ |
---|
47 | moveml %d0-%d7/%a0-%a6,%sp@- /* save registers */ |
---|
48 | jbsr wd_interrupt |
---|
49 | moveml %sp@+,%d0-%d7/%a0-%a6 |
---|
50 | rte |
---|
51 | "); |
---|
52 | |
---|
53 | void watch_dog_init(void) { |
---|
54 | set_vector(_catchWDint, WD_ISR_LEVEL+24, 0); |
---|
55 | } |
---|