source: rtems/c/src/lib/libbsp/powerpc/mbx8xx/clock/p_clock.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.9 KB
Line 
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.org/license/LICENSE.
10 *
11 *  Modified to support the MPC750.
12 *  Modifications Copyright (c) 1999 Eric Valette valette@crf.canon.fr
13 */
14
15#include <bsp.h>
16#include <bsp/irq.h>
17#include <rtems/bspIo.h>
18
19extern void clockOn(void*);
20extern void clockOff (void*);
21extern int clockIsOn(void*);
22extern void Clock_isr(void*);
23
24static rtems_irq_connect_data clockIrqData = {BSP_PERIODIC_TIMER,
25                                              (rtems_irq_hdl)Clock_isr,
26                                              0,
27                                              (rtems_irq_enable)clockOn,
28                                              (rtems_irq_disable)clockOff,
29                                              (rtems_irq_is_enabled)clockIsOn};
30
31int BSP_get_clock_irq_level(void)
32{
33  /*
34   * Caution : if you change this, you must change the
35   * definition of BSP_PERIODIC_TIMER accordingly
36   */
37  return 6;
38}
39
40int BSP_disconnect_clock_handler (void)
41{
42  if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
43     printk("Unable to stop system clock\n");
44    rtems_fatal_error_occurred(1);
45  }
46  return BSP_remove_rtems_irq_handler (&clockIrqData);
47}
48
49int BSP_connect_clock_handler (rtems_irq_hdl hdl)
50{
51  if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
52     printk("Unable to get system clock handler\n");
53    rtems_fatal_error_occurred(1);
54  }
55  if (!BSP_remove_rtems_irq_handler (&clockIrqData)) {
56   printk("Unable to remove current system clock handler\n");
57    rtems_fatal_error_occurred(1);
58  }
59  /*
60   * Reinit structure
61   */
62  clockIrqData.name = BSP_PERIODIC_TIMER;
63  clockIrqData.hdl = (rtems_irq_hdl) hdl;
64  clockIrqData.on = (rtems_irq_enable)clockOn;
65  clockIrqData.off = (rtems_irq_enable)clockOff;
66  clockIrqData.isOn = (rtems_irq_is_enabled)clockIsOn;
67
68  return BSP_install_rtems_irq_handler (&clockIrqData);
69}
Note: See TracBrowser for help on using the repository browser.