source: rtems/c/src/lib/libbsp/m68k/mvme162/clock/ckinit.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on May 11, 1995 at 5:39:37 PM

Initial revision

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*  Clock_init()
2 *
3 *  This routine initializes the Tick Timer 2 on the MVME162 board.
4 *  The tick frequency is 1 millisecond.
5 *
6 *  Input parameters:  NONE
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
11 *  On-Line Applications Research Corporation (OAR).
12 *  All rights assigned to U.S. Government, 1994.
13 *
14 *  This material may be reproduced by or for the U.S. Government pursuant
15 *  to the copyright license under the clause at DFARS 252.227-7013.  This
16 *  notice must appear in all copies of this file and its derivatives.
17 *
18 *  Modifications of respective RTEMS file: COPYRIGHT (c) 1994.
19 *  EISCAT Scientific Association. M.Savitski
20 *
21 *  This material is a part of the MVME162 Board Support Package
22 *  for the RTEMS executive. Its licensing policies are those of the
23 *  RTEMS above.
24 *
25 *  $Id$
26 */
27
28#include <stdlib.h>
29
30#include <rtems.h>
31#include <bsp.h>
32#include <clockdrv.h>
33
34#define MS_COUNT          1000            /* T2's countdown constant (1 ms) */
35#define CLOCK_INT_LEVEL   6                         /* T2's interrupt level */
36
37rtems_unsigned32 Clock_isrs;        /* ISRs until next tick */
38volatile rtems_unsigned32 Clock_driver_ticks;
39                                    /* ticks since initialization */
40rtems_isr_entry  Old_ticker;
41
42rtems_device_driver Clock_initialize(
43  rtems_device_major_number major,
44  rtems_device_minor_number minor,
45  void *pargp,
46  rtems_id tid,
47  rtems_unsigned32 *rval
48)
49{
50  Install_clock( Clock_isr );
51}
52
53void ReInstall_clock( clock_isr )
54rtems_isr_entry clock_isr;
55{
56  rtems_unsigned32 isrlevel;
57
58  rtems_interrupt_disable( isrlevel );
59  (void) set_vector( clock_isr, (VECTOR_BASE >> 28) * 0x10 + 0x9, 1 );
60  rtems_interrupt_enable( isrlevel );
61}
62
63void Install_clock( clock_isr )
64rtems_isr_entry clock_isr;
65{
66
67  Clock_driver_ticks = 0;
68  Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
69
70  if ( BSP_Configuration.ticks_per_timeslice ) {
71    Old_ticker = (rtems_isr_entry)
72      set_vector( clock_isr, (VECTOR_BASE >> 28) * 0x10 + 0x9, 1 );
73
74    lcsr->vector_base = 0x67800000;              /* set vb, enable interrupts */
75    lcsr->to_ctl = 0xE7;              /* prescaler to 1 MHz (see Appendix A1) */
76    lcsr->timer_cmp_2 = MS_COUNT;
77    lcsr->timer_cnt_2 = 0;                                   /* clear counter */
78    lcsr->board_ctl |= 0x700;  /* increment, reset-on-compare, clear-ovfl-cnt */
79
80    lcsr->intr_level[0] |= CLOCK_INT_LEVEL * 0x10;           /* set int level */
81    lcsr->intr_ena |= 0x02000000;            /* enable tick timer 2 interrupt */
82
83    atexit( Clock_exit );
84  }
85
86}
87
88void Clock_exit( void )
89{
90/* Dummy for now. See other m68k BSP's for code examples */
91}
Note: See TracBrowser for help on using the repository browser.