source: rtems/c/src/lib/libbsp/i960/cvme961/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 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*  Clock_init()
2 *
3 *  This routine initializes the timer on the VIC chip on the CVME961.
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 *  $Id$
19 */
20
21#include <stdlib.h>
22
23#include <rtems.h>
24#include <bsp.h>
25#include <clockdrv.h>
26
27rtems_unsigned32 Clock_isrs;              /* ISRs until next tick */
28i960_isr         Old_ticker;
29volatile rtems_unsigned32 Clock_driver_ticks;
30                                          /* ticks since initialization */
31
32rtems_device_driver Clock_initialize(
33  rtems_device_major_number major,
34  rtems_device_minor_number minor,
35  void *pargp,
36  rtems_id id,
37  rtems_unsigned32 *rval )
38{
39  Install_clock( Clock_isr );
40  atexit( Clock_exit );
41}
42
43void ReInstall_clock(
44  rtems_isr_entry clock_isr
45)
46{
47   (void) set_vector( clock_isr, 5, 1 );
48}
49
50void Install_clock(
51  rtems_isr_entry clock_isr
52)
53{
54  volatile unsigned char *victimer;
55
56  Clock_driver_ticks = 0;
57  Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
58
59  if ( BSP_Configuration.ticks_per_timeslice ) {
60    Old_ticker = set_vector( clock_isr, 5, 1 );
61    victimer = (volatile unsigned char *) 0xa00000c3;
62    *victimer = 0x12;
63    *victimer = 0x92;      /* 1000 HZ */
64  }
65}
66
67void Clock_exit()
68{
69  unsigned char *victimer;
70
71  if ( BSP_Configuration.ticks_per_timeslice ) {
72    victimer = (unsigned char *) 0xa00000c3;
73    *victimer = 0x12;
74    i960_mask_intr( 5 );
75    /* do not restore old vector */
76  }
77}
Note: See TracBrowser for help on using the repository browser.