Changeset 39cafa5 in rtems for c/src/lib/libbsp/i386


Ignore:
Timestamp:
10/15/96 21:39:06 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
6c58b6f
Parents:
27f0d424
Message:

updated to format of 3.6.0 clock drivers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/i386ex/clock/ckinit.c

    r27f0d424 r39cafa5  
    2222
    2323#include <bsp.h>
    24 #include <clockdrv.h>
     24
     25#include <rtems/libio.h>
     26
    2527#include <stdlib.h>
    2628
     29#define CLOCK_VECTOR 0x20
     30
     31rtems_unsigned32 Clock_isrs;              /* ISRs until next tick */
     32
    2733volatile rtems_unsigned32 Clock_driver_ticks;
    28 rtems_unsigned32 Clock_isrs;              /* ISRs until next tick */
     34
    2935rtems_isr_entry  Old_ticker;
    3036
    31 rtems_device_driver Clock_initialize(
    32   rtems_device_major_number major,
    33   rtems_device_minor_number minor,
    34   void *pargp,
    35   rtems_id tid,
    36   rtems_unsigned32 *rval
     37void Clock_exit( void );
     38
     39/*
     40 * These are set by clock driver during its init
     41 */
     42 
     43rtems_device_major_number rtems_clock_major = ~0;
     44rtems_device_major_number rtems_clock_minor = 0;
     45
     46/*
     47 *  This is the ISR handler.
     48 */
     49
     50rtems_isr Clock_isr(
     51  rtems_vector_number vector
    3752)
    3853{
    39   Install_clock( Clock_isr );
    40 }
    41 
    42 void ReInstall_clock(
    43   rtems_isr_entry clock_isr
    44 )
    45 {
    46   rtems_unsigned32 isrlevel = 0;
    47 
    48   rtems_interrupt_disable( isrlevel );
    49    (void) set_vector( clock_isr, 0x20, 1 ); /* was 0x38 */
    50   rtems_interrupt_enable( isrlevel );
     54  /* enable_tracing(); */
     55  Clock_driver_ticks += 1;
     56  if ( Clock_isrs == 1 ) {
     57    rtems_clock_tick();
     58    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
     59  }
     60  else
     61    Clock_isrs -= 1;
    5162}
    5263
     
    5970
    6071  if ( BSP_Configuration.ticks_per_timeslice ) {
    61     Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, 0x20, 1 );
    62                                                      /* was 0x38 */
     72    Old_ticker = ( rtems_isr_entry ) set_vector( clock_isr, CLOCK_VECTOR, 1 );
    6373
    6474/*  The following is already set up in interns.s ->
     
    8696{
    8797  if ( BSP_Configuration.ticks_per_timeslice ) {
    88 /*     outport_byte( TBCR, 0x00 ); */ /* initial value */
    89 /*    outport_byte( IERA, 0x40 ); */ /* disable interrupt */
    90 /* ??? Is "do not restore old vector" causing problems? */
     98     /* should do something here */;
    9199  }
    92100}
    93101
     102
     103rtems_device_driver Clock_initialize(
     104  rtems_device_major_number major,
     105  rtems_device_minor_number minor,
     106  void *pargp
     107)
     108{
     109  Install_clock( Clock_isr );
     110
     111  /*
     112   * make major/minor avail to others such as shared memory driver
     113   */
     114 
     115  rtems_clock_major = major;
     116  rtems_clock_minor = minor;
     117 
     118  return RTEMS_SUCCESSFUL;
     119}
     120
     121rtems_device_driver Clock_control(
     122  rtems_device_major_number major,
     123  rtems_device_minor_number minor,
     124  void *pargp
     125)
     126{
     127    rtems_unsigned32 isrlevel;
     128    rtems_libio_ioctl_args_t *args = pargp;
     129 
     130    if (args == 0)
     131        goto done;
     132 
     133    /*
     134     * This is hokey, but until we get a defined interface
     135     * to do this, it will just be this simple...
     136     */
     137 
     138    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
     139    {
     140        Clock_isr(CLOCK_VECTOR);
     141    }
     142    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
     143    {
     144      rtems_interrupt_disable( isrlevel );
     145       (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
     146      rtems_interrupt_enable( isrlevel );
     147    }
     148 
     149done:
     150    return RTEMS_SUCCESSFUL;
     151}
     152
Note: See TracChangeset for help on using the changeset viewer.