summaryrefslogtreecommitdiffstats
path: root/c/src/lib
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-05 16:44:02 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-05 16:44:02 +0000
commit458bd343e24cda7169c75f079705979891c9abc1 (patch)
treea9e584c28211674b28d1e37aec005e0e3a25afa1 /c/src/lib
parentEliminated references to stack checker related #defines. (diff)
downloadrtems-458bd343e24cda7169c75f079705979891c9abc1.tar.bz2
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@faw.uni-ulm.de>.
Diffstat (limited to 'c/src/lib')
-rw-r--r--c/src/lib/libc/malloc.c3
-rw-r--r--c/src/lib/libcpu/hppa1.1/clock/clock.c4
-rw-r--r--c/src/lib/libcpu/powerpc/mpc821/clock/clock.c4
-rw-r--r--c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c5
-rw-r--r--c/src/lib/libcpu/powerpc/mpc821/timer/timer.c6
-rw-r--r--c/src/lib/libcpu/powerpc/mpc860/clock/clock.c4
-rw-r--r--c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c5
-rw-r--r--c/src/lib/libcpu/powerpc/mpc860/timer/timer.c6
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/clock/clock.c6
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/console/console.c9
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/console/console.c.polled11
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/ictrl/ictrl.c6
-rw-r--r--c/src/lib/libcpu/powerpc/ppc403/timer/timer.c6
-rw-r--r--c/src/lib/libcpu/powerpc/shared/cpu.h2
14 files changed, 29 insertions, 48 deletions
diff --git a/c/src/lib/libc/malloc.c b/c/src/lib/libc/malloc.c
index 30f74c89bb..80708f57c2 100644
--- a/c/src/lib/libc/malloc.c
+++ b/c/src/lib/libc/malloc.c
@@ -32,7 +32,6 @@
rtems_id RTEMS_Malloc_Heap;
size_t RTEMS_Malloc_Sbrk_amount;
-extern rtems_cpu_table Cpu_table;
#ifdef RTEMS_DEBUG
#define MALLOC_STATS
#define MALLOC_DIRTY
@@ -109,7 +108,7 @@ void RTEMS_Malloc_Initialize(
* left over from another process. This would be a security violation.
*/
- if ( Cpu_table.do_zero_of_workspace )
+ if ( rtems_cpu_configuration_get_do_zero_of_workspace() )
memset( starting_address, 0, length );
/*
diff --git a/c/src/lib/libcpu/hppa1.1/clock/clock.c b/c/src/lib/libcpu/hppa1.1/clock/clock.c
index a0588e57fd..99d0a69125 100644
--- a/c/src/lib/libcpu/hppa1.1/clock/clock.c
+++ b/c/src/lib/libcpu/hppa1.1/clock/clock.c
@@ -22,8 +22,6 @@ rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int);
#include <stdlib.h> /* for atexit() */
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
typedef unsigned long long hppa_click_count_t;
/*
@@ -207,7 +205,7 @@ Clock_delay(rtems_unsigned32 microseconds)
(void) Clock_read_itimer();
future_time = Clock_clicks +
((rtems_unsigned64) microseconds) *
- Cpu_table.itimer_clicks_per_microsecond;
+ rtems_cpu_configuration_get_itimer_clicks_per_microsecond();
for (;;)
{
diff --git a/c/src/lib/libcpu/powerpc/mpc821/clock/clock.c b/c/src/lib/libcpu/powerpc/mpc821/clock/clock.c
index ce27c426a9..a41bde3de5 100644
--- a/c/src/lib/libcpu/powerpc/mpc821/clock/clock.c
+++ b/c/src/lib/libcpu/powerpc/mpc821/clock/clock.c
@@ -42,8 +42,6 @@
#include <stdlib.h> /* for atexit() */
#include <mpc821.h>
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
volatile rtems_unsigned32 Clock_driver_ticks;
extern volatile m821_t m821;
@@ -74,7 +72,7 @@ void Install_clock(rtems_isr_entry clock_isr)
Clock_driver_ticks = 0;
pit_value = rtems_configuration_get_microseconds_per_tick() /
- Cpu_table.clicks_per_usec;
+ rtems_cpu_configuration_get_clicks_per_usec();
if (pit_value == 0) {
pit_value = 0xffff;
} else {
diff --git a/c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c b/c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c
index 4b6a3a308b..dbf978bb4d 100644
--- a/c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c
+++ b/c/src/lib/libcpu/powerpc/mpc821/console-generic/console-generic.c
@@ -51,8 +51,6 @@
#define NIFACES 4 /* number of console devices (serial ports) */
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
static Buf_t *rxBufList[NIFACES];
static Buf_t *rxBufListTail[NIFACES];
@@ -87,7 +85,8 @@ m821_get_brg_cd (int baud)
int divisor;
int div16 = 0;
- divisor = ((Cpu_table.clock_speed / 16) + (baud / 2)) / baud;
+ divisor = ((rtems_cpu_configuration_get_clock_speed() / 16) +
+ (baud / 2)) / baud;
if (divisor > 4096) {
div16 = 1;
divisor = (divisor + 8) / 16;
diff --git a/c/src/lib/libcpu/powerpc/mpc821/timer/timer.c b/c/src/lib/libcpu/powerpc/mpc821/timer/timer.c
index d9c42e9565..4ad3b2fb2e 100644
--- a/c/src/lib/libcpu/powerpc/mpc821/timer/timer.c
+++ b/c/src/lib/libcpu/powerpc/mpc821/timer/timer.c
@@ -46,8 +46,6 @@
#include <rtems.h>
#include <mpc821.h>
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
static volatile rtems_unsigned32 Timer_starting;
static rtems_boolean Timer_driver_Find_average_overhead;
@@ -85,10 +83,10 @@ int Read_timer(void)
return total; /* in XXX microsecond units */
else {
- if ( total < Cpu_table.timer_least_valid ) {
+ if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
return 0; /* below timer resolution */
}
- return (total - Cpu_table.timer_average_overhead);
+ return (total - rtems_cpu_configuration_get_timer_average_overhead());
}
}
diff --git a/c/src/lib/libcpu/powerpc/mpc860/clock/clock.c b/c/src/lib/libcpu/powerpc/mpc860/clock/clock.c
index 452b939a6d..2d01d786b2 100644
--- a/c/src/lib/libcpu/powerpc/mpc860/clock/clock.c
+++ b/c/src/lib/libcpu/powerpc/mpc860/clock/clock.c
@@ -43,8 +43,6 @@
#include <stdlib.h> /* for atexit() */
#include <mpc860.h>
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
volatile rtems_unsigned32 Clock_driver_ticks;
extern volatile m860_t m860;
@@ -75,7 +73,7 @@ void Install_clock(rtems_isr_entry clock_isr)
Clock_driver_ticks = 0;
pit_value = rtems_configuration_get_microseconds_per_tick() /
- Cpu_table.clicks_per_usec;
+ rtems_cpu_configuration_get_clicks_per_usec();
if (pit_value == 0) {
pit_value = 0xffff;
} else {
diff --git a/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c b/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c
index 604bb8734a..c713f9ebdc 100644
--- a/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c
+++ b/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c
@@ -54,8 +54,6 @@
#define NIFACES 6 /* number of console devices (serial ports) */
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
static Buf_t *rxBufList[NIFACES];
static Buf_t *rxBufListTail[NIFACES];
@@ -90,7 +88,8 @@ m860_get_brg_cd (int baud)
int divisor;
int div16 = 0;
- divisor = ((Cpu_table.clock_speed / 16) + (baud / 2)) / baud;
+ divisor = ((rtems_cpu_configuration_get_clock_speed() / 16) +
+ (baud / 2)) / baud;
if (divisor > 4096) {
div16 = 1;
divisor = (divisor + 8) / 16;
diff --git a/c/src/lib/libcpu/powerpc/mpc860/timer/timer.c b/c/src/lib/libcpu/powerpc/mpc860/timer/timer.c
index 732ab565a7..6cfb6fdcbf 100644
--- a/c/src/lib/libcpu/powerpc/mpc860/timer/timer.c
+++ b/c/src/lib/libcpu/powerpc/mpc860/timer/timer.c
@@ -46,8 +46,6 @@
#include <rtems.h>
#include <mpc860.h>
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
static volatile rtems_unsigned32 Timer_starting;
static rtems_boolean Timer_driver_Find_average_overhead;
@@ -85,10 +83,10 @@ int Read_timer(void)
return total; /* in XXX microsecond units */
else {
- if ( total < Cpu_table.timer_least_valid ) {
+ if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
return 0; /* below timer resolution */
}
- return (total - Cpu_table.timer_average_overhead);
+ return (total - rtems_cpu_configuration_get_timer_average_overhead());
}
}
diff --git a/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c b/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c
index dfcbea5535..dc019d6b7e 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c
+++ b/c/src/lib/libcpu/powerpc/ppc403/clock/clock.c
@@ -43,8 +43,6 @@
#include <stdlib.h> /* for atexit() */
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
volatile rtems_unsigned32 Clock_driver_ticks;
static rtems_unsigned32 pit_value, tick_time;
static rtems_boolean auto_restart;
@@ -140,7 +138,7 @@ void Install_clock(rtems_isr_entry clock_isr)
asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); /* IOCR */
- if (Cpu_table.timer_internal_clock) {
+ if (rtems_cpu_configuration_get_timer_internal_clock()) {
iocr &= ~4; /* timer clocked from system clock */
}
else {
@@ -165,7 +163,7 @@ void Install_clock(rtems_isr_entry clock_isr)
auto_restart = 1;
pit_value = rtems_configuration_get_microseconds_per_tick() *
- Cpu_table.clicks_per_usec;
+ rtems_cpu_configuration_get_clicks_per_usec();
if ( rtems_configuration_get_ticks_per_timeslice() ) {
register rtems_unsigned32 tcr;
diff --git a/c/src/lib/libcpu/powerpc/ppc403/console/console.c b/c/src/lib/libcpu/powerpc/ppc403/console/console.c
index b1fc7bfe9c..11177c8a42 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/console/console.c
+++ b/c/src/lib/libcpu/powerpc/ppc403/console/console.c
@@ -60,7 +60,6 @@
#include <rtems/libio.h>
#include "../ictrl/ictrl.h"
#include <stdlib.h> /* for atexit() */
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
struct async {
/*---------------------------------------------------------------------------+
@@ -215,7 +214,7 @@ void
spiBaudSet(unsigned32 baudrate)
{
unsigned32 tmp;
- tmp = Cpu_table.serial_per_sec / baudrate;
+ tmp = rtems_cpu_configuration_get_serial_per_sec() / baudrate;
tmp = ((tmp) >> 4) - 1;
port->BRDL = tmp & 0xff;
port->BRDH = tmp >> 8;
@@ -314,7 +313,7 @@ spiDeInit(void)
*/
/* set up baud rate to original state */
- spiBaudSet(Cpu_table.serial_rate);
+ spiBaudSet(rtems_cpu_configuration_get_serial_rate());
/* clear any receive (error) status */
port->SPLS = (LSRDataReady | LSRFramingError | LSROverrunError |
@@ -356,7 +355,7 @@ spiInitialize(void)
asm volatile ("mfdcr %0, 0xa0" : "=r" (tmp)); /* IOCR */
tmp &= ~3;
- tmp |= (Cpu_table.serial_external_clock ? 2 : 0) | 1;
+ tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? 2 : 0) | 1;
asm volatile ("mtdcr 0xa0, %0" : "=r" (tmp) : "0" (tmp)); /* IOCR */
@@ -365,7 +364,7 @@ spiInitialize(void)
LSRParityError | LSRBreakInterrupt);
/* set up baud rate */
- spiBaudSet(Cpu_table.serial_rate);
+ spiBaudSet(rtems_cpu_configuration_get_serial_rate());
/* set up port control: DTR/RTS active,8 bit,1 stop,no parity */
port->SPCTL = (CRNormal |
diff --git a/c/src/lib/libcpu/powerpc/ppc403/console/console.c.polled b/c/src/lib/libcpu/powerpc/ppc403/console/console.c.polled
index e5d3b6fbce..976b5f975c 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/console/console.c.polled
+++ b/c/src/lib/libcpu/powerpc/ppc403/console/console.c.polled
@@ -34,8 +34,6 @@
#include <rtems.h>
#include <rtems/libio.h>
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
struct async {
/*-----------------------------------------------------------------------------+
| Line Status Register.
@@ -147,12 +145,13 @@ rtems_device_driver console_initialize(
/* Initialise the serial port */
asm volatile ("mfdcr %0, 0xa0" : "=r" (tmp)); /* IOCR */
tmp &= ~3;
- tmp |= (Cpu_table.serial_external_clock ? 2 : 0) |
- (Cpu_table.serial_cts_rts ? 1 : 0);
+ tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? 2 : 0) |
+ (rtems_cpu_configuration_get_serial_cts_rts() ? 1 : 0);
asm volatile ("mtdcr 0xa0, %0" : "=r" (tmp) : "0" (tmp)); /* IOCR */
port->SPLS = (LSRDataReady | LSRFramingError | LSROverrunError |
LSRParityError | LSRBreakInterrupt);
- tmp = Cpu_table.serial_per_sec / Cpu_table.serial_rate;
+ tmp = rtems_cpu_configuration_get_serial_per_sec() /
+ rtems_cpu_configuration_get_serial_rate();
#if 0 /* replaced by IMD... */
tmp = ((tmp + 8) >> 4) - 1;
port->BRDL = tmp & 0x255;
@@ -278,7 +277,7 @@ void outbyte(
break;
}
- if (Cpu_table.serial_xon_xoff)
+ if (rtems_cpu_configuration_get_serial_xon_xoff())
while (is_character_ready(&status))
{
if (status == XOFFchar)
diff --git a/c/src/lib/libcpu/powerpc/ppc403/ictrl/ictrl.c b/c/src/lib/libcpu/powerpc/ppc403/ictrl/ictrl.c
index 8f808d432d..6ba3947bc8 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/ictrl/ictrl.c
+++ b/c/src/lib/libcpu/powerpc/ppc403/ictrl/ictrl.c
@@ -108,7 +108,7 @@ disable_ext_irq( unsigned32 mask)
* this function is called, when a external interrupt is present and
* enabled but there is no handler installed. It will clear
* the corresponding enable bits and call the spurious handler
- * present in the _CPU_Table, if any.
+ * present in the CPU Configuration Table, if any.
*
*/
void
@@ -125,8 +125,8 @@ ictrl_spurious_handler(unsigned32 spurious_mask,
printf("spurious external interrupt: %d at pc 0x%x; disabling\n",
vector, cpu_frame->Interrupt.pcoqfront);
#endif
- if (_CPU_Table.spurious_handler) {
- _CPU_Table.spurious_handler(v + PPC_IRQ_EXT_BASE,cpu_frame);
+ if (rtems_cpu_configuration_get_spurious_handler()) {
+ rtems_cpu_configuration_get_spurious_handler()(v + PPC_IRQ_EXT_BASE,cpu_frame);
}
}
}
diff --git a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c b/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
index 0ff48aec90..a45f2b396f 100644
--- a/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
+++ b/c/src/lib/libcpu/powerpc/ppc403/timer/timer.c
@@ -36,8 +36,6 @@
#include <rtems.h>
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
static volatile rtems_unsigned32 Timer_starting;
static rtems_boolean Timer_driver_Find_average_overhead;
@@ -78,9 +76,9 @@ int Read_timer()
return total; /* in XXX microsecond units */
else {
- if ( total < Cpu_table.timer_least_valid )
+ if ( total < rtems_cpu_configuration_get_timer_least_valid() )
return 0; /* below timer resolution */
- return (total - Cpu_table.timer_average_overhead);
+ return (total - rtems_cpu_configuration_get_timer_average_overhead());
}
}
diff --git a/c/src/lib/libcpu/powerpc/shared/cpu.h b/c/src/lib/libcpu/powerpc/shared/cpu.h
index 4cfb9e3ef6..8b886ffc2d 100644
--- a/c/src/lib/libcpu/powerpc/shared/cpu.h
+++ b/c/src/lib/libcpu/powerpc/shared/cpu.h
@@ -247,7 +247,7 @@ n:
do { \
unsigned32 start, ticks, now; \
CPU_Get_timebase_low( start ) ; \
- ticks = (_microseconds) * Cpu_table.clicks_per_usec; \
+ ticks = (_microseconds) * rtems_cpu_configuration_get_clicks_per_usec(); \
do \
CPU_Get_timebase_low( now ) ; \
while (now - start < ticks); \