source: rtems/c/src/lib/libbsp/mips/genmongoosev/clock/clockdrv.c @ 5b301ab

4.104.115
Last change on this file since 5b301ab was 11978407, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/30/08 at 06:49:04

2008-09-30 Ralf Corsépius <ralf.corsepius@…>

  • clock/clockdrv.c: include "../../../shared/clockdrv_shell.h".
  • Makefile.am: Reflect changes above.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  Instantiate the clock driver shell for the Mongoose-V's on-CPU timer.
3 *
4 *  COPYRIGHT (c) 1989-2001.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#include <rtems.h>
15#include <libcpu/mongoose-v.h>
16#include <bsp.h>
17
18#if defined(USE_TIMER2_FOR_CLOCK)
19#define CLOCK_BASE   MONGOOSEV_TIMER2_BASE
20#define CLOCK_VECTOR MONGOOSEV_IRQ_TIMER2
21#else
22#define CLOCK_BASE   MONGOOSEV_TIMER1_BASE
23#define CLOCK_VECTOR MONGOOSEV_IRQ_TIMER1
24#endif
25
26/* reset Timeout (TO) bit */
27
28#define Clock_driver_support_at_tick() \
29  do { \
30    MONGOOSEV_WRITE_REGISTER( CLOCK_BASE, MONGOOSEV_TIMER_CONTROL_REGISTER, \
31         (MONGOOSEV_TIMER_CONTROL_COUNTER_ENABLE | MONGOOSEV_TIMER_CONTROL_INTERRUPT_ENABLE)); \
32  } while(0)
33
34#define Clock_driver_support_install_isr( _new, _old ) \
35  do { \
36    _old = set_vector( _new, CLOCK_VECTOR, 1 ); \
37  } while(0)
38
39#define Clock_driver_support_initialize_hardware() \
40   do { \
41    uint32_t   _clicks = CPU_CLOCK_RATE_MHZ * rtems_configuration_get_microseconds_per_tick(); \
42    MONGOOSEV_WRITE_REGISTER( CLOCK_BASE, MONGOOSEV_TIMER_INITIAL_COUNTER_REGISTER, _clicks ); \
43    Clock_driver_support_at_tick(); \
44   } while(0)
45
46#define Clock_driver_support_shutdown_hardware() \
47  MONGOOSEV_WRITE_REGISTER( CLOCK_BASE, MONGOOSEV_TIMER_CONTROL_REGISTER, 0 )
48
49#include "../../../shared/clockdrv_shell.h"
Note: See TracBrowser for help on using the repository browser.