Changeset 458bd34 in rtems for c/src/lib


Ignore:
Timestamp:
Nov 5, 1999, 4:44:02 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
968f7742
Parents:
707f5c7
Message:

This is another pass at making sure that nothing outside the BSP
unnecessarily uses any variables defined by the BSP. On this
sweep, use of BSP_Configuration and Cpu_table was eliminated.

A significant part of this modification was the addition of
macros to access fields in the RTEMS configuration structures.

This is necessary to strengthen the division between the BSP independent
parts of RTEMS and the BSPs themselves. This started after
comments and analysis by Ralf Corsepius <corsepiu@…>.

Location:
c/src/lib
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libc/malloc.c

    r707f5c7 r458bd34  
    3333size_t RTEMS_Malloc_Sbrk_amount;
    3434
    35 extern rtems_cpu_table   Cpu_table;
    3635#ifdef RTEMS_DEBUG
    3736#define MALLOC_STATS
     
    110109   */
    111110
    112   if ( Cpu_table.do_zero_of_workspace )
     111  if ( rtems_cpu_configuration_get_do_zero_of_workspace() )
    113112     memset( starting_address, 0, length );
    114113
  • c/src/lib/libcpu/hppa1.1/clock/clock.c

    r707f5c7 r458bd34  
    2222
    2323#include <stdlib.h>                     /* for atexit() */
    24 
    25 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    2624
    2725typedef unsigned long long hppa_click_count_t;
     
    208206    future_time = Clock_clicks +
    209207      ((rtems_unsigned64) microseconds) *
    210         Cpu_table.itimer_clicks_per_microsecond;
     208        rtems_cpu_configuration_get_itimer_clicks_per_microsecond();
    211209
    212210    for (;;)
  • c/src/lib/libcpu/powerpc/mpc821/clock/clock.c

    r707f5c7 r458bd34  
    4343#include <mpc821.h>
    4444
    45 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    46 
    4745volatile rtems_unsigned32 Clock_driver_ticks;
    4846extern volatile m821_t m821;
     
    7573 
    7674  pit_value = rtems_configuration_get_microseconds_per_tick() /
    77                Cpu_table.clicks_per_usec;
     75               rtems_cpu_configuration_get_clicks_per_usec();
    7876  if (pit_value == 0) {
    7977    pit_value = 0xffff;
  • c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c

    r707f5c7 r458bd34  
    5252#define NIFACES 4        /* number of console devices (serial ports) */
    5353
    54 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    55 
    5654static Buf_t *rxBufList[NIFACES];
    5755static Buf_t *rxBufListTail[NIFACES];
     
    8886  int div16 = 0;
    8987 
    90   divisor = ((Cpu_table.clock_speed / 16) + (baud / 2)) / baud;
     88  divisor = ((rtems_cpu_configuration_get_clock_speed() / 16) +
     89              (baud / 2)) / baud;
    9190  if (divisor > 4096) {
    9291    div16 = 1;
  • c/src/lib/libcpu/powerpc/mpc821/timer/timer.c

    r707f5c7 r458bd34  
    4747#include <mpc821.h>
    4848
    49 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    50 
    5149static volatile rtems_unsigned32 Timer_starting;
    5250static rtems_boolean Timer_driver_Find_average_overhead;
     
    8684
    8785  else {
    88     if ( total < Cpu_table.timer_least_valid ) {
     86    if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
    8987      return 0;            /* below timer resolution */
    9088    }
    91     return (total - Cpu_table.timer_average_overhead);
     89    return (total - rtems_cpu_configuration_get_timer_average_overhead());
    9290  }
    9391}
  • c/src/lib/libcpu/powerpc/mpc860/clock/clock.c

    r707f5c7 r458bd34  
    4444#include <mpc860.h>
    4545
    46 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    47 
    4846volatile rtems_unsigned32 Clock_driver_ticks;
    4947extern volatile m860_t m860;
     
    7674 
    7775  pit_value = rtems_configuration_get_microseconds_per_tick() /
    78                Cpu_table.clicks_per_usec;
     76               rtems_cpu_configuration_get_clicks_per_usec();
    7977  if (pit_value == 0) {
    8078    pit_value = 0xffff;
  • c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c

    r707f5c7 r458bd34  
    5555#define NIFACES 6        /* number of console devices (serial ports) */
    5656
    57 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    58 
    5957static Buf_t *rxBufList[NIFACES];
    6058static Buf_t *rxBufListTail[NIFACES];
     
    9189  int div16 = 0;
    9290 
    93   divisor = ((Cpu_table.clock_speed / 16) + (baud / 2)) / baud;
     91  divisor = ((rtems_cpu_configuration_get_clock_speed() / 16) +
     92                 (baud / 2)) / baud;
    9493  if (divisor > 4096) {
    9594    div16 = 1;
  • c/src/lib/libcpu/powerpc/mpc860/timer/timer.c

    r707f5c7 r458bd34  
    4747#include <mpc860.h>
    4848
    49 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    50 
    5149static volatile rtems_unsigned32 Timer_starting;
    5250static rtems_boolean Timer_driver_Find_average_overhead;
     
    8684
    8785  else {
    88     if ( total < Cpu_table.timer_least_valid ) {
     86    if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
    8987      return 0;            /* below timer resolution */
    9088    }
    91     return (total - Cpu_table.timer_average_overhead);
     89    return (total - rtems_cpu_configuration_get_timer_average_overhead());
    9290  }
    9391}
  • c/src/lib/libcpu/powerpc/ppc403/clock/clock.c

    r707f5c7 r458bd34  
    4444#include <stdlib.h>                     /* for atexit() */
    4545
    46 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    47 
    4846volatile rtems_unsigned32 Clock_driver_ticks;
    4947static rtems_unsigned32 pit_value, tick_time;
     
    141139    asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); /* IOCR */
    142140
    143     if (Cpu_table.timer_internal_clock) {
     141    if (rtems_cpu_configuration_get_timer_internal_clock()) {
    144142        iocr &= ~4; /* timer clocked from system clock */
    145143    }
     
    166164 
    167165    pit_value = rtems_configuration_get_microseconds_per_tick() *
    168       Cpu_table.clicks_per_usec;
     166      rtems_cpu_configuration_get_clicks_per_usec();
    169167 
    170168    if ( rtems_configuration_get_ticks_per_timeslice() ) {
  • c/src/lib/libcpu/powerpc/ppc403/console/console.c

    r707f5c7 r458bd34  
    6161#include "../ictrl/ictrl.h"
    6262#include <stdlib.h>                                     /* for atexit() */
    63 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    6463
    6564struct async {
     
    216215{
    217216  unsigned32 tmp;
    218   tmp = Cpu_table.serial_per_sec / baudrate;
     217  tmp = rtems_cpu_configuration_get_serial_per_sec() / baudrate;
    219218  tmp = ((tmp) >> 4) - 1;
    220219  port->BRDL = tmp & 0xff;
     
    315314
    316315  /* set up baud rate to original state */
    317   spiBaudSet(Cpu_table.serial_rate);
     316  spiBaudSet(rtems_cpu_configuration_get_serial_rate());
    318317
    319318  /* clear any receive (error) status */
     
    357356
    358357  tmp &= ~3;
    359   tmp |= (Cpu_table.serial_external_clock ? 2 : 0) | 1;
     358  tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? 2 : 0) | 1;
    360359
    361360  asm volatile ("mtdcr 0xa0, %0" : "=r" (tmp) : "0" (tmp)); /* IOCR */
     
    366365
    367366  /* set up baud rate */
    368   spiBaudSet(Cpu_table.serial_rate);
     367  spiBaudSet(rtems_cpu_configuration_get_serial_rate());
    369368
    370369  /* set up port control: DTR/RTS active,8 bit,1 stop,no parity */
  • c/src/lib/libcpu/powerpc/ppc403/console/console.c.polled

    r707f5c7 r458bd34  
    3434#include <rtems.h>
    3535#include <rtems/libio.h>
    36 
    37 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    3836
    3937struct async {
     
    148146  asm volatile ("mfdcr %0, 0xa0" : "=r" (tmp)); /* IOCR */
    149147  tmp &= ~3;
    150   tmp |= (Cpu_table.serial_external_clock ? 2 : 0) |
    151       (Cpu_table.serial_cts_rts ? 1 : 0);
     148  tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? 2 : 0) |
     149      (rtems_cpu_configuration_get_serial_cts_rts() ? 1 : 0);
    152150  asm volatile ("mtdcr 0xa0, %0" : "=r" (tmp) : "0" (tmp)); /* IOCR */
    153151  port->SPLS = (LSRDataReady | LSRFramingError | LSROverrunError |
    154152         LSRParityError | LSRBreakInterrupt);
    155   tmp = Cpu_table.serial_per_sec / Cpu_table.serial_rate;
     153  tmp = rtems_cpu_configuration_get_serial_per_sec() /
     154          rtems_cpu_configuration_get_serial_rate();
    156155#if 0 /* replaced by IMD... */
    157156  tmp = ((tmp + 8) >> 4) - 1;
     
    279278    }
    280279
    281   if (Cpu_table.serial_xon_xoff)
     280  if (rtems_cpu_configuration_get_serial_xon_xoff())
    282281    while (is_character_ready(&status))
    283282    {
  • c/src/lib/libcpu/powerpc/ppc403/ictrl/ictrl.c

    r707f5c7 r458bd34  
    109109 *  enabled but there is no handler installed. It will clear
    110110 *  the corresponding enable bits and call the spurious handler
    111  *  present in the _CPU_Table, if any.
     111 *  present in the CPU Configuration Table, if any.
    112112 *
    113113 */
     
    126126             vector, cpu_frame->Interrupt.pcoqfront);
    127127#endif
    128       if (_CPU_Table.spurious_handler) {
    129         _CPU_Table.spurious_handler(v + PPC_IRQ_EXT_BASE,cpu_frame);
     128      if (rtems_cpu_configuration_get_spurious_handler()) {
     129        rtems_cpu_configuration_get_spurious_handler()(v + PPC_IRQ_EXT_BASE,cpu_frame);
    130130      }
    131131    }
  • c/src/lib/libcpu/powerpc/ppc403/timer/timer.c

    r707f5c7 r458bd34  
    3636
    3737#include <rtems.h>
    38 
    39 extern rtems_cpu_table           Cpu_table;             /* owned by BSP */
    4038
    4139static volatile rtems_unsigned32 Timer_starting;
     
    7977
    8078  else {
    81     if ( total < Cpu_table.timer_least_valid )
     79    if ( total < rtems_cpu_configuration_get_timer_least_valid() )
    8280      return 0;            /* below timer resolution */
    83     return (total - Cpu_table.timer_average_overhead);
     81    return (total - rtems_cpu_configuration_get_timer_average_overhead());
    8482  }
    8583}
  • c/src/lib/libcpu/powerpc/shared/cpu.h

    r707f5c7 r458bd34  
    248248    unsigned32 start, ticks, now; \
    249249    CPU_Get_timebase_low( start ) ; \
    250     ticks = (_microseconds) * Cpu_table.clicks_per_usec; \
     250    ticks = (_microseconds) * rtems_cpu_configuration_get_clicks_per_usec(); \
    251251    do \
    252252      CPU_Get_timebase_low( now ) ; \
Note: See TracChangeset for help on using the changeset viewer.