source: rtems/c/src/lib/libbsp/powerpc/ss555/clock/p_clock.c @ a800d09c

4.104.114.84.95
Last change on this file since a800d09c was a800d09c, checked in by Joel Sherrill <joel.sherrill@…>, on 04/12/04 at 21:52:13

2004-04-12 David Querbach <querbach@…>

  • .cvsignore, ChangeLog?, Makefile.am, README, bsp_specs, configure.ac, times, clock/p_clock.c, console/console.c, include/.cvsignore, include/bsp.h, include/coverhd.h, irq/irq.h, startup/bspstart.c, startup/iss555.c, startup/linkcmds, startup/start.S, wrapup/.cvsignore, wrapup/Makefile.am: New files.
  • 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.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
26extern void clockOn(void*);
27extern void clockOff (void*);
28extern int clockIsOn(void*);
29extern void Clock_isr();
30
31static 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
39int 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
48int 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}
Note: See TracBrowser for help on using the repository browser.