source: rtems/bsps/powerpc/ss555/clock/p_clock.c @ 511dc4b

5
Last change on this file since 511dc4b was 7632906, checked in by Sebastian Huber <sebastian.huber@…>, on 04/19/18 at 04:35:52

bsps: Move clock drivers to bsps

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.8 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 *  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
20#include <bsp.h>
21#include <bsp/irq.h>
22#include <rtems/bspIo.h>
23#include <mpc5xx.h>
24
25static rtems_irq_connect_data clockIrqData = {
26  CPU_PERIODIC_TIMER,
27  (rtems_irq_hdl)Clock_isr,
28  NULL,
29  (rtems_irq_enable)clockOn,
30  (rtems_irq_disable)clockOff,
31  (rtems_irq_is_enabled)clockIsOn
32};
33
34int BSP_disconnect_clock_handler (void)
35{
36  if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
37     printk("Unable to stop system clock\n");
38    rtems_fatal_error_occurred(1);
39  }
40  return BSP_remove_rtems_irq_handler (&clockIrqData);
41}
42
43int BSP_connect_clock_handler (rtems_irq_hdl hdl)
44{
45  if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
46     printk("Unable to get system clock handler\n");
47    rtems_fatal_error_occurred(1);
48  }
49  if (!BSP_remove_rtems_irq_handler (&clockIrqData)) {
50   printk("Unable to remove current system clock handler\n");
51    rtems_fatal_error_occurred(1);
52  }
53  /*
54   * Reinit structure
55   */
56  clockIrqData.name = CPU_PERIODIC_TIMER;
57  clockIrqData.hdl = (rtems_irq_hdl) hdl;
58  clockIrqData.on = (rtems_irq_enable)clockOn;
59  clockIrqData.off = (rtems_irq_enable)clockOff;
60  clockIrqData.isOn = (rtems_irq_is_enabled)clockIsOn;
61
62  return BSP_install_rtems_irq_handler (&clockIrqData);
63}
Note: See TracBrowser for help on using the repository browser.