Changeset 3a4ae6c in rtems for c/src/lib/libbsp/m68k/idp/clock


Ignore:
Timestamp:
Sep 11, 1995, 7:35:39 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
ced11f99
Parents:
5072b07
Message:

The word "RTEMS" almost completely removed from the core.

Configuration Table Template file added and all tests
modified to use this. All gvar.h and conftbl.h files
removed from test directories.

Configuration parameter maximum_devices added.

Core semaphore and mutex handlers added and RTEMS API Semaphore
Manager updated to reflect this.

Initialization sequence changed to invoke API specific initialization
routines. Initialization tasks table now owned by RTEMS Tasks Manager.

Added user extension for post-switch.

Utilized user extensions to implement API specific functionality
like signal dispatching.

Added extensions to the System Initialization Thread so that an
API can register a function to be invoked while the system
is being initialized. These are largely equivalent to the
pre-driver and post-driver hooks.

Added the Modules file oar-go32_p5, modified oar-go32, and modified
the file make/custom/go32.cfg to look at an environment varable which
determines what CPU model is being used.

All BSPs updated to reflect named devices and clock driver's IOCTL
used by the Shared Memory Driver. Also merged clock isr into
main file and removed ckisr.c where possible.

Updated spsize to reflect new and moved variables.

Makefiles for the executive source and include files updated to show
break down of files into Core, RTEMS API, and Neither.

Header and inline files installed into subdirectory based on whether
logically in the Core or a part of the RTEMS API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/idp/clock/ckinit.c

    r5072b07 r3a4ae6c  
    2727#include <stdlib.h>
    2828
    29 #include <rtems.h>
    30 #include <clockdrv.h>
    3129#include <bsp.h>
     30#include <rtems/libio.h>
    3231
    3332rtems_unsigned32 Clock_isrs;        /* ISRs until next tick */
     
    4039void Disable_clock();
    4140
    42 #define TIMER_VECTOR 0x4D
    43 
    44 rtems_device_driver Clock_initialize(
    45   rtems_device_major_number major,
    46   rtems_device_minor_number minor,
    47   void *pargp,
    48   rtems_id tid,
    49   rtems_unsigned32 *rval
     41#define CLOCK_VECTOR 0x4D
     42
     43void Clock_exit( void );
     44 
     45/*
     46 * These are set by clock driver during its init
     47 */
     48 
     49rtems_device_major_number rtems_clock_major = ~0;
     50rtems_device_minor_number rtems_clock_minor;
     51 
     52
     53/*
     54 *  ISR Handler
     55 *
     56 *
     57 * ((1ms * 6.5 MHz) / 2^5) = 203.125) where 6.5 MHz is the clock rate of the
     58 * MC68230, 2^5 is the prescaler factor, and 1ms is the common interrupt
     59 * interval for the Clock_isr routine.
     60 * Therefore, 203 (decimal) is the number to program into the CPRH-L registers
     61 * of the MC68230 for countdown.  However, I have found that 193 instead of
     62 * 203 provides greater accuracy -- why?  The crystal should be more accurate
     63 * than that
     64 */
     65
     66rtems_isr Clock_isr(
     67  rtems_vector_number vector
    5068)
    5169{
    52   Install_clock( Clock_isr );
    53 }
    54 
    55 void ReInstall_clock( clock_isr )
    56 rtems_isr_entry clock_isr;
    57 {
    58   rtems_unsigned32 isrlevel = 0 ;
    59 
    60   rtems_interrupt_disable( isrlevel );
    61    (void) set_vector( clock_isr, TIMER_VECTOR, 1 );
    62   rtems_interrupt_enable( isrlevel );
    63 }
    64 
    65 /* The following was added for debugging purposes */
     70  Clock_driver_ticks += 1;
     71  /* acknowledge interrupt
     72        TSR = 1; */
     73  MC68230_WRITE (TSR, 1);
     74
     75  if ( Clock_isrs == 1 ) {
     76    rtems_clock_tick();
     77        /* Cast to an integer so that 68EC040 IDP which doesn't have an FPU doesn't
     78           have a heart attack -- if you use newlib1.6 or greater and get
     79           libgcc.a for gcc with software floating point support, this is not
     80           a problem */
     81    Clock_isrs =
     82      (int)(BSP_Configuration.microseconds_per_tick / 1000);
     83  }
     84  else
     85    Clock_isrs -= 1;
     86}
     87
    6688void Disable_clock()
    6789{
     
    78100  if ( Configuration.ticks_per_timeslice ) {
    79101/*    led_putnum('c'); * for debugging purposes */
    80     Old_ticker = (rtems_isr_entry) set_vector( clock_isr, TIMER_VECTOR, 1 );
     102    Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
    81103
    82104        /* Disable timer for initialization */
     
    86108           file in this directory to understand why I use the values that I do */
    87109        /* Set up the interrupt vector on the MC68230 chip:
    88                 TIVR = TIMER_VECTOR; */
    89         MC68230_WRITE (TIVR, TIMER_VECTOR);
     110                TIVR = CLOCK_VECTOR; */
     111        MC68230_WRITE (TIVR, CLOCK_VECTOR);
    90112
    91113        /* Set CPRH through CPRL to 193 (not 203) decimal for countdown--see ckisr.c
     
    109131}
    110132
     133void ReInstall_clock( clock_isr )
     134rtems_isr_entry clock_isr;
     135{
     136  rtems_unsigned32 isrlevel = 0 ;
     137
     138  rtems_interrupt_disable( isrlevel );
     139   (void) set_vector( clock_isr, CLOCK_VECTOR, 1 );
     140  rtems_interrupt_enable( isrlevel );
     141}
     142
     143/* The following was added for debugging purposes */
    111144void Clock_exit( void )
    112145{
     
    124157  }
    125158}
     159
     160rtems_device_driver Clock_initialize(
     161  rtems_device_major_number major,
     162  rtems_device_minor_number minor,
     163  void *pargp
     164)
     165{
     166  Install_clock( Clock_isr );
     167 
     168  /*
     169   * make major/minor avail to others such as shared memory driver
     170   */
     171 
     172  rtems_clock_major = major;
     173  rtems_clock_minor = minor;
     174 
     175  return RTEMS_SUCCESSFUL;
     176}
     177 
     178rtems_device_driver Clock_control(
     179  rtems_device_major_number major,
     180  rtems_device_minor_number minor,
     181  void *pargp
     182)
     183{
     184    rtems_libio_ioctl_args_t *args = pargp;
     185 
     186    if (args == 0)
     187        goto done;
     188 
     189    /*
     190     * This is hokey, but until we get a defined interface
     191     * to do this, it will just be this simple...
     192     */
     193 
     194    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
     195    {
     196        Clock_isr(CLOCK_VECTOR);
     197    }
     198    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
     199    {
     200        ReInstall_clock(args->buffer);
     201    }
     202 
     203done:
     204    return RTEMS_SUCCESSFUL;
     205}
     206
Note: See TracChangeset for help on using the changeset viewer.