source: rtems/c/src/lib/libbsp/i386/force386/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: 1.9 KB
Line 
1/*  Clock_initialize
2 *
3 *  This routine initializes the Motorola MFP 68901 on the
4 *  FORCE CPU386 board.  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 <bsp.h>
22#include <clockdrv.h>
23#include <stdlib.h>
24
25volatile rtems_unsigned32 Clock_driver_ticks;
26rtems_unsigned32 Clock_isrs;              /* ISRs until next tick */
27rtems_isr_entry  Old_ticker;
28
29rtems_device_driver Clock_initialize(
30  rtems_device_major_number major,
31  rtems_device_minor_number minor,
32  void *pargp,
33  rtems_id tid,
34  rtems_unsigned32 *rval
35)
36{
37  Install_clock( Clock_isr );
38}
39
40void ReInstall_clock(
41  rtems_isr_entry clock_isr
42)
43{
44  rtems_unsigned32 isrlevel = 0;
45
46  rtems_interrupt_disable( isrlevel );
47   (void) set_vector( clock_isr, 0x38, 1 );
48  rtems_interrupt_enable( isrlevel );
49}
50
51void Install_clock(
52  rtems_isr_entry clock_isr
53)
54{
55  Clock_driver_ticks = 0;
56  Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
57
58  if ( BSP_Configuration.ticks_per_timeslice ) {
59    Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, 0x38, 1 );
60    outport_byte( TBCR, 0x14 );  /* reset it, delay mode, 50X */
61    outport_byte( TBDR, 0x50 );  /* 1 millisecond */
62    outport_byte( IERA, 0x41 );  /* enable interrupt for B */
63  }
64  atexit( Clock_exit );
65}
66
67void Clock_exit( void )
68{
69  if ( BSP_Configuration.ticks_per_timeslice ) {
70    outport_byte( TBCR, 0x00 );  /* initial value */
71    outport_byte( IERA, 0x40 );  /* disable interrupt */
72    /* ??? Is "do not restore old vector" causing problems? */
73  }
74}
75
Note: See TracBrowser for help on using the repository browser.