source: rtems/bsps/m68k/mrm332/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: 1.8 KB
Line 
1/*
2 *  This routine initailizes the periodic interrupt timer on
3 *  the Motorola 68332.
4 */
5
6/*
7 *  COPYRIGHT (c) 1989-2014.
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
15#include <stdlib.h>
16#include <bsp.h>
17#include <mrm332.h>
18#include <rtems/clockdrv.h>
19#include <rtems/m68k/sim.h>
20
21#define CLOCK_VECTOR   MRM_PIV
22
23uint32_t                Clock_isrs;         /* ISRs until next tick */
24volatile uint32_t       Clock_driver_ticks; /* ticks since initialization */
25static rtems_isr_entry  Old_ticker;
26
27static void Clock_exit( void );
28
29static rtems_isr Clock_isr(rtems_vector_number vector)
30{
31  Clock_driver_ticks += 1;
32
33  if ( Clock_isrs == 1 ) {
34    rtems_clock_tick();
35    Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000;
36  }
37  else
38    Clock_isrs -= 1;
39}
40
41static void Install_clock(rtems_isr_entry clock_isr)
42{
43  Clock_driver_ticks = 0;
44  Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000;
45
46  Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
47
48  /* enable 1mS interrupts */
49  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );/* load counter */
50  *PICR = (unsigned short int)                     /* enable interrupt */
51    ( SAM(ISRL_PIT,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
52
53  atexit( Clock_exit );
54}
55
56void Clock_exit( void )
57{
58  /* shutdown the periodic interrupt */
59  *PICR = (unsigned short int)
60    ( SAM(0,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
61  /*     ^^ zero disables interrupt */
62
63  /* do not restore old vector */
64}
65
66rtems_device_driver Clock_initialize(
67  rtems_device_major_number major,
68  rtems_device_minor_number minor,
69  void *pargp
70)
71{
72  Install_clock( Clock_isr );
73
74  return RTEMS_SUCCESSFUL;
75}
Note: See TracBrowser for help on using the repository browser.