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

4.104.114.84.95
Last change on this file since e00bf285 was e00bf285, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:52:11

2003-09-04 Joel Sherrill <joel@…>

  • clock/clockdrv.c, console/conscfg.c, include/bsp.h, startup/bspstart.c, startup/gdb-support.c, timer/timer.c: URL for license changed.
  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[f849f3e]1/*
[ef380d3f]2 *  Instantiate the clock driver shell for the Mongoose-V's on-CPU timer.
[f849f3e]3 *
[ef380d3f]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
[e00bf285]9 *  http://www.rtems.com/license/LICENSE.
[f849f3e]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
[a355e3ea]26
27
[f849f3e]28/* reset Timeout (TO) bit */
[a355e3ea]29
[f849f3e]30#define Clock_driver_support_at_tick() \
[a355e3ea]31  do { \
32    MONGOOSEV_WRITE_REGISTER( CLOCK_BASE, MONGOOSEV_TIMER_CONTROL_REGISTER, \
33         (MONGOOSEV_TIMER_CONTROL_COUNTER_ENABLE | MONGOOSEV_TIMER_CONTROL_INTERRUPT_ENABLE)); \
34  } while(0)
35
[f849f3e]36
37#define Clock_driver_support_install_isr( _new, _old ) \
38  do { \
39    _old = set_vector( _new, CLOCK_VECTOR, 1 ); \
40  } while(0)
41
42
43#define Clock_driver_support_initialize_hardware() \
[a355e3ea]44   do { \
45    unsigned32 _clicks = CPU_CLOCK_RATE_MHZ * rtems_configuration_get_microseconds_per_tick(); \
46    MONGOOSEV_WRITE_REGISTER( CLOCK_BASE, MONGOOSEV_TIMER_INITIAL_COUNTER_REGISTER, _clicks ); \
[f849f3e]47    Clock_driver_support_at_tick(); \
[a355e3ea]48   } while(0)
[f849f3e]49
50#define Clock_driver_support_shutdown_hardware() \
51  MONGOOSEV_WRITE_REGISTER( CLOCK_BASE, MONGOOSEV_TIMER_CONTROL_REGISTER, 0 )
52
53#include <clockdrv_shell.c>
Note: See TracBrowser for help on using the repository browser.