Back to home page

LXR

 
 

    


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

0001 /*
0002  *  Clock device driver for Lattice Mico32 (lm32).
0003  */
0004 
0005 /*
0006  *  The license and distribution terms for this file may be
0007  *  found in the file LICENSE in this distribution or at
0008  *  http://www.rtems.org/license/LICENSE.
0009  *
0010  *  COPYRIGHT (c) Yann Sionneau <yann.sionneau@telecom-sudparis.eu> (GSoC 2010)
0011  *  Telecom SudParis
0012  */
0013 
0014 #include <bsp.h>
0015 #include <bsp/irq-generic.h>
0016 #include "../include/system_conf.h"
0017 #include "clock.h"
0018 #include "bspopts.h"
0019 
0020 #if ON_SIMULATOR
0021 #define CLOCK_DRIVER_USE_FAST_IDLE 1
0022 #endif
0023 
0024 #define Clock_driver_support_at_tick(arg) \
0025   do { \
0026     lm32_interrupt_ack(1 << MM_IRQ_TIMER0); \
0027   } while (0)
0028 
0029 #define Clock_driver_support_install_isr(_new ) \
0030   do { \
0031     rtems_isr_entry _old; \
0032     rtems_interrupt_catch(_new, MM_IRQ_TIMER0, &_old); \
0033   } while (0)
0034 
0035 static void Clock_driver_support_initialize_hardware(void)
0036 {
0037   MM_WRITE(MM_TIMER0_COMPARE, 
0038    (MM_READ(MM_FREQUENCY)/(1000000/rtems_configuration_get_microseconds_per_tick())));
0039   MM_WRITE(MM_TIMER0_COUNTER, 0);
0040   MM_WRITE(MM_TIMER0_CONTROL, TIMER_ENABLE | TIMER_AUTORESTART);
0041   bsp_interrupt_vector_enable(MM_IRQ_TIMER0);
0042 }
0043 
0044 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
0045 
0046 #include "../../../shared/dev/clock/clockimpl.h"