1 | /* |
---|
2 | * Clock Tick interrupt conexion code. |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1997. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may in |
---|
8 | * the file LICENSE in this distribution or at |
---|
9 | * http://www.OARcorp.com/rtems/license.html. |
---|
10 | * |
---|
11 | * Modified to support the MPC750. |
---|
12 | * Modifications Copyright (c) 1999 Eric Valette valette@crf.canon.fr |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #include <bsp.h> |
---|
18 | #include <rtems/bspIo.h> |
---|
19 | #include <bsp/irq.h> |
---|
20 | |
---|
21 | extern void clockOn(void*); |
---|
22 | extern void clockOff (void*); |
---|
23 | extern int clockIsOn(void*); |
---|
24 | extern void Clock_isr(); |
---|
25 | |
---|
26 | static rtems_irq_connect_data clockIrqData = {BSP_PERIODIC_TIMER, |
---|
27 | (rtems_irq_hdl)Clock_isr, |
---|
28 | (rtems_irq_enable)clockOn, |
---|
29 | (rtems_irq_disable)clockOff, |
---|
30 | (rtems_irq_is_enabled)clockIsOn}; |
---|
31 | |
---|
32 | int BSP_get_clock_irq_level() |
---|
33 | { |
---|
34 | /* |
---|
35 | * Caution : if you change this, you must change the |
---|
36 | * definition of BSP_PERIODIC_TIMER accordingly |
---|
37 | */ |
---|
38 | return BSP_PERIODIC_TIMER; |
---|
39 | } |
---|
40 | |
---|
41 | int BSP_disconnect_clock_handler (void) |
---|
42 | { |
---|
43 | if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) { |
---|
44 | printk("Unable to stop system clock\n"); |
---|
45 | rtems_fatal_error_occurred(1); |
---|
46 | } |
---|
47 | return BSP_remove_rtems_irq_handler (&clockIrqData); |
---|
48 | } |
---|
49 | |
---|
50 | int BSP_connect_clock_handler (rtems_irq_hdl hdl) |
---|
51 | { |
---|
52 | if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) { |
---|
53 | printk("Unable to get system clock handler\n"); |
---|
54 | rtems_fatal_error_occurred(1); |
---|
55 | } |
---|
56 | if (!BSP_remove_rtems_irq_handler (&clockIrqData)) { |
---|
57 | printk("Unable to remove current system clock handler\n"); |
---|
58 | rtems_fatal_error_occurred(1); |
---|
59 | } |
---|
60 | /* |
---|
61 | * Reinit structure |
---|
62 | */ |
---|
63 | clockIrqData.name = BSP_PERIODIC_TIMER; |
---|
64 | clockIrqData.hdl = (rtems_irq_hdl) hdl; |
---|
65 | clockIrqData.on = (rtems_irq_enable)clockOn; |
---|
66 | clockIrqData.off = (rtems_irq_enable)clockOff; |
---|
67 | clockIrqData.isOn = (rtems_irq_is_enabled)clockIsOn; |
---|
68 | |
---|
69 | return BSP_install_rtems_irq_handler (&clockIrqData); |
---|
70 | } |
---|