source: rtems/c/src/lib/libbsp/m68k/mrm332/clock/ckinit.c @ f68401e

4.115
Last change on this file since f68401e was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*  Clock_init()
2 *
3 *  This routine initailizes the periodic interrupt timer on
4 *  the Motorola 68332.
5 *
6 *  Input parameters:  NONE
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989-1999.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 */
17
18#include <stdlib.h>
19#include <bsp.h>
20#include <mrm332.h>
21
22#define CLOCK_VECTOR   MRM_PIV
23
24uint32_t         Clock_isrs;        /* ISRs until next tick */
25volatile uint32_t         Clock_driver_ticks;
26                                    /* ticks since initialization */
27rtems_isr_entry  Old_ticker;
28
29void Clock_exit( void );
30
31/*
32 * These are set by clock driver during its init
33 */
34
35rtems_device_major_number rtems_clock_major = ~0;
36rtems_device_minor_number rtems_clock_minor;
37
38rtems_isr Clock_isr(rtems_vector_number vector)
39{
40  Clock_driver_ticks += 1;
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
50void Install_clock(
51  rtems_isr_entry clock_isr
52)
53{
54  Clock_driver_ticks = 0;
55  Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000;
56
57  Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
58
59  /* enable 1mS interrupts */
60  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );/* load counter */
61  *PICR = (unsigned short int)                     /* enable interrupt */
62    ( SAM(ISRL_PIT,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
63
64  atexit( Clock_exit );
65}
66
67void Clock_exit( void )
68{
69  /* shutdown the periodic interrupt */
70  *PICR = (unsigned short int)
71    ( SAM(0,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
72  /*     ^^ zero disables interrupt */
73
74  /* do not restore old vector */
75}
76
77rtems_device_driver Clock_initialize(
78  rtems_device_major_number major,
79  rtems_device_minor_number minor,
80  void *pargp
81)
82{
83  Install_clock( Clock_isr );
84
85  /*
86   * make major/minor avail to others such as shared memory driver
87   */
88
89  rtems_clock_major = major;
90  rtems_clock_minor = minor;
91
92  return RTEMS_SUCCESSFUL;
93}
Note: See TracBrowser for help on using the repository browser.