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

Last change on this file since 63defa58 was 63defa58, checked in by Jennifer Averett <jennifer.averett@…>, on 04/04/12 at 13:39:46

PR 1993 - Convert MIPS to PIC IRQ model

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