Changeset 3a4ae6c in rtems for c/src/lib/libcpu/powerpc


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.

Location:
c/src/lib/libcpu/powerpc/ppc403
Files:
2 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
  • c/src/lib/libcpu/powerpc/ppc403/console/console.c

    r5072b07 r3a4ae6c  
    3232#define NO_BSP_INIT
    3333
    34 #include <rtems.h>
    35 #include "console.h"
    36 #include "bsp.h"
     34#include <bsp.h>
     35#include <rtems/libio.h>
    3736
    3837extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
     
    140139  rtems_device_major_number  major,
    141140  rtems_device_minor_number  minor,
    142   void                      *arg,
    143   rtems_id                   self,
    144   rtems_unsigned32          *status
    145 )
    146 {
     141  void                      *arg
     142)
     143{
     144  rtems_status_code status;
    147145  register unsigned tmp;
    148146
     
    165163  port->SPHS = (HSRDsr | HSRCts);
    166164
    167   *status = RTEMS_SUCCESSFUL;
     165  status = rtems_io_register_name(
     166    "/dev/console",
     167    major,
     168    (rtems_device_minor_number) 0
     169  );
     170 
     171  if (status != RTEMS_SUCCESSFUL)
     172    rtems_fatal_error_occurred(status);
     173 
     174  return RTEMS_SUCCESSFUL;
    168175}
    169176
     
    281288
    282289/*
    283  * __read  -- read bytes from the serial port. Ignore fd, since
    284  *            we only have stdin.
    285  */
    286 
    287 int __read(
    288   int fd,
    289   char *buf,
    290   int nbytes
    291 )
    292 {
    293   int i = 0;
    294 
    295   for (i = 0; i < nbytes; i++) {
    296     *(buf + i) = inbyte();
    297     if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) {
    298       (*(buf + i++)) = '\n';
    299       (*(buf + i)) = 0;
     290 *  Open entry point
     291 */
     292 
     293rtems_device_driver console_open(
     294  rtems_device_major_number major,
     295  rtems_device_minor_number minor,
     296  void                    * arg
     297)
     298{
     299  return RTEMS_SUCCESSFUL;
     300}
     301 
     302/*
     303 *  Close entry point
     304 */
     305 
     306rtems_device_driver console_close(
     307  rtems_device_major_number major,
     308  rtems_device_minor_number minor,
     309  void                    * arg
     310)
     311{
     312  return RTEMS_SUCCESSFUL;
     313}
     314 
     315/*
     316 * read bytes from the serial port. We only have stdin.
     317 */
     318 
     319rtems_device_driver console_read(
     320  rtems_device_major_number major,
     321  rtems_device_minor_number minor,
     322  void                    * arg
     323)
     324{
     325  rtems_libio_rw_args_t *rw_args;
     326  char *buffer;
     327  int maximum;
     328  int count = 0;
     329 
     330  rw_args = (rtems_libio_rw_args_t *) arg;
     331 
     332  buffer = rw_args->buffer;
     333  maximum = rw_args->count;
     334 
     335  for (count = 0; count < maximum; count++) {
     336    buffer[ count ] = inbyte();
     337    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
     338      buffer[ count++ ]  = '\n';
     339      buffer[ count ]  = 0;
    300340      break;
    301341    }
    302342  }
    303   return (i);
    304 }
    305 
    306 /*
    307  * __write -- write bytes to the serial port. Ignore fd, since
    308  *            stdout and stderr are the same. Since we have no filesystem,
    309  *            open will only return an error.
    310  */
    311 
    312 int __write(
    313   int fd,
    314   char *buf,
    315   int nbytes
    316 )
    317 {
    318   int i;
    319 
    320   for (i = 0; i < nbytes; i++) {
    321     if (*(buf + i) == '\n') {
    322       outbyte ('\r');
    323     }
    324     outbyte (*(buf + i));
     343 
     344  rw_args->bytes_moved = count;
     345  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
     346}
     347 
     348/*
     349 * write bytes to the serial port. Stdout and stderr are the same.
     350 */
     351 
     352rtems_device_driver console_write(
     353  rtems_device_major_number major,
     354  rtems_device_minor_number minor,
     355  void                    * arg
     356)
     357{
     358  int count;
     359  int maximum;
     360  rtems_libio_rw_args_t *rw_args;
     361  char *buffer;
     362 
     363  rw_args = (rtems_libio_rw_args_t *) arg;
     364 
     365  buffer = rw_args->buffer;
     366  maximum = rw_args->count;
     367 
     368  for (count = 0; count < maximum; count++) {
     369    if ( buffer[ count ] == '\n') {
     370      outbyte('\r');
     371    }
     372    outbyte( buffer[ count ] );
    325373  }
    326   return (nbytes);
    327 }
     374  return maximum;
     375}
     376 
     377/*
     378 *  IO Control entry point
     379 */
     380 
     381rtems_device_driver console_control(
     382  rtems_device_major_number major,
     383  rtems_device_minor_number minor,
     384  void                    * arg
     385)
     386{
     387  return RTEMS_SUCCESSFUL;
     388}
     389
Note: See TracChangeset for help on using the changeset viewer.