source: rtems/bsps/m68k/mvme147/clock/ckinit.c @ a6b2080

5
Last change on this file since a6b2080 was a6b2080, checked in by Sebastian Huber <sebastian.huber@…>, on 12/05/19 at 14:51:17

clock: Remove Clock_exit() from API

This function is no longer supported by the standard clock driver
implementation (clockimpl.h).

Update #3436.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  This routine initializes the Tick Timer 2 on the MVME147 board.
3 *  The tick frequency is 1 millisecond.
4 */
5
6/*
7 *  COPYRIGHT (c) 1989-1999.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.org/license/LICENSE.
13 *
14 *  MVME147 port for TNI - Telecom Bretagne
15 *  by Dominique LE CAMPION (Dominique.LECAMPION@enst-bretagne.fr)
16 *  May 1996
17 */
18
19#include <stdlib.h>
20
21#include <bsp.h>
22#include <rtems/clockdrv.h>
23
24#define MS_COUNT          65376    /* 1ms */
25/* MS_COUNT = 0x10000 - 1e-3/6.25e-6 */
26#define CLOCK_INT_LEVEL   6               /* T2's interrupt level */
27
28uint32_t         Clock_isrs;                  /* ISRs until next tick */
29volatile uint32_t         Clock_driver_ticks; /* ticks since initialization */
30rtems_isr_entry  Old_ticker;
31
32static void Clock_exit( void );
33
34/*
35 *  ISR Handler
36 */
37static rtems_isr Clock_isr(rtems_vector_number vector)
38{
39  Clock_driver_ticks += 1;
40  pcc->timer2_int_control |= 0x80; /* Acknowledge interr. */
41
42  if (Clock_isrs == 1) {
43    rtems_clock_tick();
44    Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000;
45  }
46  else
47    Clock_isrs -= 1;
48}
49
50static void Install_clock(rtems_isr_entry clock_isr )
51{
52
53  Clock_driver_ticks = 0;
54  Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000;
55
56  Old_ticker = (rtems_isr_entry) set_vector( clock_isr, TIMER_2_VECTOR, 1 );
57
58  pcc->timer2_int_control = 0x00; /* Disable T2 Interr. */
59  pcc->timer2_preload = MS_COUNT;
60  /* write preload value */
61  pcc->timer2_control = 0x07; /* clear T2 overflow counter, enable counter */
62  pcc->timer2_int_control = CLOCK_INT_LEVEL|0x08;
63  /* Enable Timer 2 and set its int. level */
64
65  atexit( Clock_exit );
66}
67
68void Clock_exit( void )
69{
70  pcc->timer2_int_control = 0x00; /* Disable T2 Interr. */
71}
72
73rtems_device_driver Clock_initialize(
74  rtems_device_major_number major,
75  rtems_device_minor_number minor,
76  void *pargp
77)
78{
79  Install_clock( Clock_isr );
80
81  return RTEMS_SUCCESSFUL;
82}
Note: See TracBrowser for help on using the repository browser.