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

4.104.114.84.95
Last change on this file since c6fb8e90 was c6fb8e90, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 1, 1995 at 3:33:39 PM

updated mvme162 code from Misha (mms@…)

  • 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; /* ticks since initialization */
39rtems_isr_entry  Old_ticker;
40
41rtems_device_driver Clock_initialize( 
42  rtems_device_major_number major,
43  rtems_device_minor_number minor,
44  void *pargp,
45  rtems_id tid,
46  rtems_unsigned32 *rval
47)
48{
49  Install_clock( Clock_isr );
50}
51
52void ReInstall_clock(rtems_isr_entry clock_isr)
53{
54  rtems_unsigned32 isrlevel;
55
56  rtems_interrupt_disable( isrlevel );
57  (void) set_vector( clock_isr, VBR0 * 0x10 + 0x9, 1 );
58  rtems_interrupt_enable( isrlevel );
59}
60
61void Install_clock(rtems_isr_entry clock_isr )
62{
63
64  Clock_driver_ticks = 0;
65  Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
66
67  if ( BSP_Configuration.ticks_per_timeslice ) {
68    Old_ticker = 
69      (rtems_isr_entry) set_vector( clock_isr, VBR0 * 0x10 + 0x9, 1 );
70    lcsr->vector_base |= MASK_INT;   /* unmask VMEchip2 interrupts */
71    lcsr->to_ctl = 0xE7;             /* prescaler to 1 MHz (see Appendix A1) */
72    lcsr->timer_cmp_2 = MS_COUNT;
73    lcsr->timer_cnt_2 = 0;           /* clear counter */
74    lcsr->board_ctl |= 0x700;        /* increment, reset-on-compare, and */
75                                     /*   clear-overflow-cnt */
76
77    lcsr->intr_level[0] |= CLOCK_INT_LEVEL * 0x10;      /* set int level */
78    lcsr->intr_ena |= 0x02000000;       /* enable tick timer 2 interrupt */
79
80    atexit( Clock_exit );
81  } 
82
83}
84
85void Clock_exit( void )
86{
87/* Dummy for now. See other m68k BSP's for code examples */
88}
Note: See TracBrowser for help on using the repository browser.