Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:59

0001 /*
0002  *  Clock Tick interrupt conexion code.
0003  *
0004  *  COPYRIGHT (c) 1989-1997.
0005  *  On-Line Applications Research Corporation (OAR).
0006  *
0007  *  The license and distribution terms for this file may in
0008  *  the file LICENSE in this distribution or at
0009  *  http://www.rtems.org/license/LICENSE.
0010  *
0011  *  SS555 port sponsored by Defence Research and Development Canada - Suffield
0012  *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
0013  *
0014  *  Derived from c/src/lib/libbsp/powerpc/mbx8xx/clock/p_clock.c:
0015  *
0016  *  Modified to support the MPC750.
0017  *  Modifications Copyright (c) 1999 Eric Valette valette@crf.canon.fr
0018  */
0019 
0020 #include <bsp.h>
0021 #include <bsp/irq.h>
0022 #include <rtems/bspIo.h>
0023 #include <mpc5xx.h>
0024 
0025 static rtems_irq_connect_data clockIrqData = {
0026   CPU_PERIODIC_TIMER,
0027   (rtems_irq_hdl)Clock_isr,
0028   NULL,
0029   (rtems_irq_enable)clockOn,
0030   (rtems_irq_disable)clockOff,
0031   (rtems_irq_is_enabled)clockIsOn
0032 };
0033 
0034 int BSP_disconnect_clock_handler (void)
0035 {
0036   if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
0037      printk("Unable to stop system clock\n");
0038     rtems_fatal_error_occurred(1);
0039   }
0040   return BSP_remove_rtems_irq_handler (&clockIrqData);
0041 }
0042 
0043 int BSP_connect_clock_handler (rtems_irq_hdl hdl)
0044 {
0045   if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
0046      printk("Unable to get system clock handler\n");
0047     rtems_fatal_error_occurred(1);
0048   }
0049   if (!BSP_remove_rtems_irq_handler (&clockIrqData)) {
0050    printk("Unable to remove current system clock handler\n");
0051     rtems_fatal_error_occurred(1);
0052   }
0053   /*
0054    * Reinit structure
0055    */
0056   clockIrqData.name = CPU_PERIODIC_TIMER;
0057   clockIrqData.hdl = (rtems_irq_hdl) hdl;
0058   clockIrqData.on = (rtems_irq_enable)clockOn;
0059   clockIrqData.off = (rtems_irq_enable)clockOff;
0060   clockIrqData.isOn = (rtems_irq_is_enabled)clockIsOn;
0061 
0062   return BSP_install_rtems_irq_handler (&clockIrqData);
0063 }