Back to home page

LXR

 
 

    


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

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  *  Modified to support the MPC750.
0012  *  Modifications Copyright (c) 1999 Eric Valette valette@crf.canon.fr
0013  */
0014 
0015 #include <bsp.h>
0016 #include <rtems/bspIo.h>
0017 #include <bsp/irq.h>
0018 
0019 extern void clockOn(void*);
0020 extern void clockOff (void*);
0021 extern int clockIsOn(void*);
0022 extern void Clock_isr(void);
0023 
0024 static rtems_irq_connect_data clockIrqData = {BSP_PERIODIC_TIMER,
0025                           (rtems_irq_hdl)Clock_isr,
0026                           NULL,
0027                           (rtems_irq_enable)clockOn,
0028                           (rtems_irq_disable)clockOff,
0029                           (rtems_irq_is_enabled)clockIsOn};
0030 
0031 int BSP_get_clock_irq_level(void)
0032 {
0033   /*
0034    * Caution : if you change this, you must change the
0035    * definition of BSP_PERIODIC_TIMER accordingly
0036    */
0037   return BSP_PERIODIC_TIMER;
0038 }
0039 
0040 int BSP_disconnect_clock_handler (void)
0041 {
0042   if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
0043      printk("Unable to stop system clock\n");
0044     rtems_fatal_error_occurred(1);
0045   }
0046   return BSP_remove_rtems_irq_handler (&clockIrqData);
0047 }
0048 
0049 int BSP_connect_clock_handler (rtems_irq_hdl hdl)
0050 {
0051   if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
0052      printk("Unable to get system clock handler\n");
0053     rtems_fatal_error_occurred(1);
0054   }
0055   if (!BSP_remove_rtems_irq_handler (&clockIrqData)) {
0056    printk("Unable to remove current system clock handler\n");
0057     rtems_fatal_error_occurred(1);
0058   }
0059   /*
0060    * Reinit structure
0061    */
0062   clockIrqData.name = BSP_PERIODIC_TIMER;
0063   clockIrqData.hdl = (rtems_irq_hdl) hdl;
0064   clockIrqData.on = (rtems_irq_enable)clockOn;
0065   clockIrqData.off = (rtems_irq_enable)clockOff;
0066   clockIrqData.isOn = (rtems_irq_is_enabled)clockIsOn;
0067 
0068   return BSP_install_rtems_irq_handler (&clockIrqData);
0069 }