diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-19 06:35:52 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-20 09:57:01 +0200 |
commit | 7632906fc290b652416ab59eb5fb49356c064ed6 (patch) | |
tree | ac036b1f95637e044e10138ceea8d2b56d80ec97 /bsps/arm/edb7312 | |
parent | bsps: Move bspsmpgetcurrentprocessor.c to bsps (diff) | |
download | rtems-7632906fc290b652416ab59eb5fb49356c064ed6.tar.bz2 |
bsps: Move clock drivers to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'bsps/arm/edb7312')
-rw-r--r-- | bsps/arm/edb7312/clock/clockdrv.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/bsps/arm/edb7312/clock/clockdrv.c b/bsps/arm/edb7312/clock/clockdrv.c new file mode 100644 index 0000000000..26839f35ca --- /dev/null +++ b/bsps/arm/edb7312/clock/clockdrv.c @@ -0,0 +1,72 @@ +/* + * Cirrus EP7312 Clock driver + * + * Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#include <rtems.h> +#include <ep7312.h> +#include <bsp.h> +#include <bsp/irq.h> +#include <assert.h> + +#if ON_SKYEYE==1 + #define CLOCK_DRIVER_USE_FAST_IDLE 1 +#endif + +void Clock_isr(void * arg); + +#define Clock_driver_support_at_tick() \ + do { \ + *EP7312_TC1EOI = 0xffffffff; \ + } while(0) + +#define Clock_driver_support_install_isr( _new ) \ + do { \ + rtems_status_code status = RTEMS_SUCCESSFUL; \ + status = rtems_interrupt_handler_install( \ + BSP_TC1OI, \ + "Clock", \ + RTEMS_INTERRUPT_UNIQUE, \ + Clock_isr, \ + NULL \ + ); \ + assert(status == RTEMS_SUCCESSFUL); \ + } while(0) + +/* + * Set up the clock hardware + */ +#if ON_SKYEYE + #define TCD_VALUE \ + (rtems_configuration_get_microseconds_per_tick() * 2000)/25000 +#else + #define TCD_VALUE \ + (rtems_configuration_get_microseconds_per_tick() * 2000)/1000000 +#endif + +#define Clock_driver_support_initialize_hardware() \ + do { \ + *EP7312_SYSCON1 |= EP7312_SYSCON1_TC1_PRESCALE; \ + *EP7312_TC1D = TCD_VALUE; \ + *EP7312_TC1EOI = 0xFFFFFFFF; \ + } while (0) + +#define Clock_driver_support_shutdown_hardware() \ + do { \ + rtems_status_code status = RTEMS_SUCCESSFUL; \ + status = rtems_interrupt_handler_remove( \ + BSP_TC1OI, \ + Clock_isr, \ + NULL \ + ); \ + assert(status == RTEMS_SUCCESSFUL); \ + } while (0) + +#define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER + +#include "../../../shared/dev/clock/clockimpl.h" |