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/libcpu/powerpc/ppc403/clock/clock.c

    r5072b07 r3a4ae6c  
    3434#include <bsp.h>
    3535#include <clockdrv.h>
     36#include <rtems/libio.h>
    3637
    3738#include <stdlib.h>                     /* for atexit() */
     
    4344static rtems_boolean auto_restart;
    4445
    45 rtems_device_driver Clock_initialize(
    46   rtems_device_major_number major,
    47   rtems_device_minor_number minor,
    48   void *pargp,
    49   rtems_id tid,
    50   rtems_unsigned32 *rval
    51 )
    52 {
    53     Install_clock(Clock_isr);
    54 }
    55 
    56 
    57 void
    58 ReInstall_clock(rtems_isr_entry new_clock_isr)
    59 {
    60     rtems_isr_entry previous_isr;
    61     rtems_unsigned32 isrlevel = 0;
    62 
    63     rtems_interrupt_disable(isrlevel);
    64    
    65     rtems_interrupt_catch(new_clock_isr, PPC_IRQ_PIT,
    66                           &previous_isr);
    67 
    68     rtems_interrupt_enable(isrlevel);
    69 }
    70 
     46void Clock_exit( void );
     47 
     48/*
     49 * These are set by clock driver during its init
     50 */
     51 
     52rtems_device_major_number rtems_clock_major = ~0;
     53rtems_device_minor_number rtems_clock_minor;
     54 
    7155static INLINE rtems_unsigned32 get_itimer(void)
    7256{
     
    7660
    7761    return rc;
     62}
     63
     64/*
     65 *  ISR Handler
     66 */
     67 
     68rtems_isr
     69Clock_isr(rtems_vector_number vector)
     70{
     71    if (!auto_restart)
     72        {
     73            rtems_unsigned32 clicks_til_next_interrupt;
     74            rtems_unsigned32 itimer_value;
     75
     76            /*
     77             * setup for next interrupt; making sure the new value is reasonably
     78             * in the future.... in case we lost out on an interrupt somehow
     79             */
     80
     81            itimer_value = get_itimer();
     82            tick_time += pit_value;
     83
     84            /*
     85             * how far away is next interrupt *really*
     86             * It may be a long time; this subtraction works even if
     87             * Clock_clicks_interrupt < Clock_clicks_low_order via
     88             * the miracle of unsigned math.
     89             */
     90            clicks_til_next_interrupt = tick_time - itimer_value;
     91
     92            /*
     93             * If it is too soon then bump it up.
     94             * This should only happen if CPU_HPPA_CLICKS_PER_TICK is too small.
     95             * But setting it low is useful for debug, so...
     96             */
     97
     98            if (clicks_til_next_interrupt < 400)
     99                {
     100                    tick_time = itimer_value + 1000;
     101                    clicks_til_next_interrupt = 1000;
     102                    /* XXX: count these! this should be rare */
     103                }
     104
     105            /*
     106             * If it is too late, that means we missed the interrupt somehow.
     107             * Rather than wait 35-50s for a wrap, we just fudge it here.
     108             */
     109           
     110            if (clicks_til_next_interrupt > pit_value)
     111                {
     112                    tick_time = itimer_value + 1000;
     113                    clicks_til_next_interrupt = 1000;
     114                    /* XXX: count these! this should never happen :-) */
     115                }
     116
     117            asm volatile ("mtpit %0" :: "r" (clicks_til_next_interrupt));
     118        }
     119
     120    asm volatile ( "mttsr %0" :: "r" (0x08000000));
     121
     122    Clock_driver_ticks++;
     123
     124    rtems_clock_tick();
    78125}
    79126
     
    132179}
    133180
    134 
    135 rtems_isr
    136 Clock_isr(rtems_vector_number vector)
    137 {
    138     if (!auto_restart)
    139         {
    140             rtems_unsigned32 clicks_til_next_interrupt;
    141             rtems_unsigned32 itimer_value;
    142 
    143             /*
    144              * setup for next interrupt; making sure the new value is reasonably
    145              * in the future.... in case we lost out on an interrupt somehow
    146              */
    147 
    148             itimer_value = get_itimer();
    149             tick_time += pit_value;
    150 
    151             /*
    152              * how far away is next interrupt *really*
    153              * It may be a long time; this subtraction works even if
    154              * Clock_clicks_interrupt < Clock_clicks_low_order via
    155              * the miracle of unsigned math.
    156              */
    157             clicks_til_next_interrupt = tick_time - itimer_value;
    158 
    159             /*
    160              * If it is too soon then bump it up.
    161              * This should only happen if CPU_HPPA_CLICKS_PER_TICK is too small.
    162              * But setting it low is useful for debug, so...
    163              */
    164 
    165             if (clicks_til_next_interrupt < 400)
    166                 {
    167                     tick_time = itimer_value + 1000;
    168                     clicks_til_next_interrupt = 1000;
    169                     /* XXX: count these! this should be rare */
    170                 }
    171 
    172             /*
    173              * If it is too late, that means we missed the interrupt somehow.
    174              * Rather than wait 35-50s for a wrap, we just fudge it here.
    175              */
    176            
    177             if (clicks_til_next_interrupt > pit_value)
    178                 {
    179                     tick_time = itimer_value + 1000;
    180                     clicks_til_next_interrupt = 1000;
    181                     /* XXX: count these! this should never happen :-) */
    182                 }
    183 
    184             asm volatile ("mtpit %0" :: "r" (clicks_til_next_interrupt));
    185         }
    186 
    187     asm volatile ( "mttsr %0" :: "r" (0x08000000));
    188 
    189     Clock_driver_ticks++;
    190 
    191     rtems_clock_tick();
    192 }
     181void
     182ReInstall_clock(rtems_isr_entry new_clock_isr)
     183{
     184    rtems_isr_entry previous_isr;
     185    rtems_unsigned32 isrlevel = 0;
     186
     187    rtems_interrupt_disable(isrlevel);
     188   
     189    rtems_interrupt_catch(new_clock_isr, PPC_IRQ_PIT,
     190                          &previous_isr);
     191
     192    rtems_interrupt_enable(isrlevel);
     193}
     194
    193195
    194196/*
     
    214216}
    215217
     218rtems_device_driver Clock_initialize(
     219  rtems_device_major_number major,
     220  rtems_device_minor_number minor,
     221  void *pargp
     222)
     223{
     224  Install_clock( Clock_isr );
     225 
     226  /*
     227   * make major/minor avail to others such as shared memory driver
     228   */
     229 
     230  rtems_clock_major = major;
     231  rtems_clock_minor = minor;
     232 
     233  return RTEMS_SUCCESSFUL;
     234}
     235 
     236rtems_device_driver Clock_control(
     237  rtems_device_major_number major,
     238  rtems_device_minor_number minor,
     239  void *pargp
     240)
     241{
     242    rtems_libio_ioctl_args_t *args = pargp;
     243 
     244    if (args == 0)
     245        goto done;
     246 
     247    /*
     248     * This is hokey, but until we get a defined interface
     249     * to do this, it will just be this simple...
     250     */
     251 
     252    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
     253    {
     254        Clock_isr(PPC_IRQ_PIT);
     255    }
     256    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
     257    {
     258        ReInstall_clock(args->buffer);
     259    }
     260 
     261done:
     262    return RTEMS_SUCCESSFUL;
     263}
     264
Note: See TracChangeset for help on using the changeset viewer.