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.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * SS555 port sponsored by Defence Research and Development Canada - Suffield |
---|
12 | * Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca) |
---|
13 | * |
---|
14 | * Derived from c/src/lib/libbsp/powerpc/mbx8xx/clock/p_clock.c: |
---|
15 | * |
---|
16 | * Modified to support the MPC750. |
---|
17 | * Modifications Copyright (c) 1999 Eric Valette valette@crf.canon.fr |
---|
18 | * |
---|
19 | * $Id$ |
---|
20 | */ |
---|
21 | |
---|
22 | #include <bsp.h> |
---|
23 | #include <bsp/irq.h> |
---|
24 | #include <rtems/bspIo.h> |
---|
25 | |
---|
26 | extern void clockOn(void*); |
---|
27 | extern void clockOff (void*); |
---|
28 | extern int clockIsOn(void*); |
---|
29 | extern void Clock_isr(); |
---|
30 | |
---|
31 | static rtems_irq_connect_data clockIrqData = { |
---|
32 | CPU_PERIODIC_TIMER, |
---|
33 | (rtems_irq_hdl)Clock_isr, |
---|
34 | (rtems_irq_enable)clockOn, |
---|
35 | (rtems_irq_disable)clockOff, |
---|
36 | (rtems_irq_is_enabled)clockIsOn |
---|
37 | }; |
---|
38 | |
---|
39 | int BSP_disconnect_clock_handler (void) |
---|
40 | { |
---|
41 | if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) { |
---|
42 | printk("Unable to stop system clock\n"); |
---|
43 | rtems_fatal_error_occurred(1); |
---|
44 | } |
---|
45 | return BSP_remove_rtems_irq_handler (&clockIrqData); |
---|
46 | } |
---|
47 | |
---|
48 | int BSP_connect_clock_handler (rtems_irq_hdl hdl) |
---|
49 | { |
---|
50 | if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) { |
---|
51 | printk("Unable to get system clock handler\n"); |
---|
52 | rtems_fatal_error_occurred(1); |
---|
53 | } |
---|
54 | if (!BSP_remove_rtems_irq_handler (&clockIrqData)) { |
---|
55 | printk("Unable to remove current system clock handler\n"); |
---|
56 | rtems_fatal_error_occurred(1); |
---|
57 | } |
---|
58 | /* |
---|
59 | * Reinit structure |
---|
60 | */ |
---|
61 | clockIrqData.name = CPU_PERIODIC_TIMER; |
---|
62 | clockIrqData.hdl = (rtems_irq_hdl) hdl; |
---|
63 | clockIrqData.on = (rtems_irq_enable)clockOn; |
---|
64 | clockIrqData.off = (rtems_irq_enable)clockOff; |
---|
65 | clockIrqData.isOn = (rtems_irq_is_enabled)clockIsOn; |
---|
66 | |
---|
67 | return BSP_install_rtems_irq_handler (&clockIrqData); |
---|
68 | } |
---|