Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:22:49

0001 /*
0002  * Cirrus EP7312 Clock driver
0003  *
0004  * Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
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 
0011 #include <rtems.h>
0012 #include <ep7312.h>
0013 #include <bsp.h>
0014 #include <bsp/irq.h>
0015 #include <assert.h>
0016 
0017 #if ON_SKYEYE==1
0018   #define CLOCK_DRIVER_USE_FAST_IDLE 1
0019 #endif
0020 
0021 #define Clock_driver_support_at_tick(arg)             \
0022   do {                                                \
0023     *EP7312_TC1EOI = 0xffffffff;                      \
0024   } while(0)
0025 
0026 #define Clock_driver_support_install_isr( _new )       \
0027   do {                                                 \
0028     rtems_status_code status = RTEMS_SUCCESSFUL;       \
0029     status = rtems_interrupt_handler_install(          \
0030         BSP_TC1OI,                                     \
0031         "Clock",                                       \
0032         RTEMS_INTERRUPT_UNIQUE,                        \
0033         _new,                                          \
0034         NULL                                           \
0035     );                                                 \
0036     assert(status == RTEMS_SUCCESSFUL);                \
0037   } while(0)
0038 
0039 /*
0040  * Set up the clock hardware
0041  */
0042 #if ON_SKYEYE
0043   #define TCD_VALUE \
0044     (rtems_configuration_get_microseconds_per_tick() * 2000)/25000
0045 #else
0046   #define TCD_VALUE \
0047     (rtems_configuration_get_microseconds_per_tick() * 2000)/1000000
0048 #endif
0049 
0050 #define Clock_driver_support_initialize_hardware()  \
0051   do {                                              \
0052     *EP7312_SYSCON1 |= EP7312_SYSCON1_TC1_PRESCALE; \
0053     *EP7312_TC1D = TCD_VALUE;                       \
0054     *EP7312_TC1EOI = 0xFFFFFFFF;                    \
0055   } while (0)
0056 
0057 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
0058 
0059 #include "../../../shared/dev/clock/clockimpl.h"