summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-04 22:20:55 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-04 22:20:55 +0000
commit7f3c6cee09ee44b627b11de34248aba485c789b3 (patch)
treec07336cf657989c76a25646872238208bbd4c581 /c/src/lib/libbsp/sparc
parent2007-12-04 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-7f3c6cee09ee44b627b11de34248aba485c789b3.tar.bz2
2007-12-04 Joel Sherrill <joel.sherrill@OARcorp.com>
* amba/amba.c, clock/ckinit.c, console/console.c, include/bsp.h, startup/bspstart.c, timer/timer.c: Move interrupt_stack_size field from CPU Table to Configuration Table. Eliminate CPU Table from all ports. Delete references to CPU Table in all forms.
Diffstat (limited to 'c/src/lib/libbsp/sparc')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/ChangeLog7
-rw-r--r--c/src/lib/libbsp/sparc/leon3/amba/amba.c10
-rw-r--r--c/src/lib/libbsp/sparc/leon3/clock/ckinit.c24
-rw-r--r--c/src/lib/libbsp/sparc/leon3/console/console.c36
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/bsp.h3
-rw-r--r--c/src/lib/libbsp/sparc/leon3/startup/bspstart.c7
-rw-r--r--c/src/lib/libbsp/sparc/leon3/timer/timer.c13
7 files changed, 60 insertions, 40 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/ChangeLog b/c/src/lib/libbsp/sparc/leon3/ChangeLog
index 5a61b6ae24..9f4a4cc917 100644
--- a/c/src/lib/libbsp/sparc/leon3/ChangeLog
+++ b/c/src/lib/libbsp/sparc/leon3/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-04 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * amba/amba.c, clock/ckinit.c, console/console.c, include/bsp.h,
+ startup/bspstart.c, timer/timer.c: Move interrupt_stack_size field
+ from CPU Table to Configuration Table. Eliminate CPU Table from all
+ ports. Delete references to CPU Table in all forms.
+
2007-12-03 Joel Sherrill <joel.sherrill@OARcorp.com>
* amba/amba.c, startup/bspstart.c: Moved most of the remaining CPU
diff --git a/c/src/lib/libbsp/sparc/leon3/amba/amba.c b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
index b95fc542a6..bb4bb31489 100644
--- a/c/src/lib/libbsp/sparc/leon3/amba/amba.c
+++ b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
@@ -58,10 +58,12 @@ void bsp_predriver_hook(void)
if ( i > 0 ){
/* Found APB IRQ_MP Interrupt Controller */
LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) dev.start;
- if (Configuration.User_multiprocessing_table != NULL) {
- tmp = getasr17();
- LEON3_Cpu_Index = (tmp >> 28) & 3;
- }
+ #if defined(RTEMS_MULTIPROCESSING)
+ if (rtems_configuration_get_user_multiprocessing_table() != NULL) {
+ tmp = getasr17();
+ LEON3_Cpu_Index = (tmp >> 28) & 3;
+ }
+ #endif
}
/* find GP Timer */
diff --git a/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c b/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
index d9f2acb6fe..172aec5f09 100644
--- a/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
+++ b/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
@@ -33,8 +33,13 @@
extern rtems_configuration_table Configuration;
-#define LEON3_CLOCK_INDEX \
- (Configuration.User_multiprocessing_table ? LEON3_Cpu_Index : 0)
+#if defined(RTEMS_MULTIPROCESSING)
+ #define LEON3_CLOCK_INDEX \
+ (rtems_configuration_get_user_multiprocessing_table() ? LEON3_Cpu_Index : 0)
+#else
+ #define LEON3_CLOCK_INDEX 0
+#endif
+
volatile LEON3_Timer_Regs_Map *LEON3_Timer_Regs = 0;
static int clkirq;
@@ -43,6 +48,17 @@ static int clkirq;
#define Clock_driver_support_at_tick()
+#if defined(RTEMS_MULTIPROCESSING)
+ #define Adjust_clkirq_for_node() \
+ do { \
+ if (rtems_configuration_get_user_multiprocessing_table() != NULL) { \
+ clkirq += LEON3_Cpu_Index; \
+ } \
+ } while(0)
+#else
+ #define Adjust_clkirq_for_node()
+#endif
+
#define Clock_driver_support_find_timer() \
do { \
int cnt; \
@@ -55,9 +71,7 @@ static int clkirq;
LEON3_Timer_Regs = (volatile LEON3_Timer_Regs_Map *) dev.start; \
clkirq = (LEON3_Timer_Regs->status & 0xfc) >> 3; \
\
- if (Configuration.User_multiprocessing_table != NULL) { \
- clkirq += LEON3_Cpu_Index; \
- } \
+ Adjust_clkirq_for_node(); \
} \
} while (0)
diff --git a/c/src/lib/libbsp/sparc/leon3/console/console.c b/c/src/lib/libbsp/sparc/leon3/console/console.c
index 79c79c27db..705bdeb130 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/console.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/console.c
@@ -90,17 +90,18 @@ int uarts = 0;
static int isinit = 0;
volatile LEON3_UART_Regs_Map *LEON3_Console_Uart[LEON3_APBUARTS];
-int scan_uarts() {
+int scan_uarts() {
int i;
- amba_apb_device apbuarts[LEON3_APBUARTS];
-
+ amba_apb_device apbuarts[LEON3_APBUARTS];
+
if (isinit == 0) {
i = 0; uarts = 0;
- uarts = amba_find_apbslvs(&amba_conf,VENDOR_GAISLER,GAISLER_APBUART,apbuarts,LEON3_APBUARTS);
+ uarts = amba_find_apbslvs(
+ &amba_conf, VENDOR_GAISLER, GAISLER_APBUART, apbuarts, LEON3_APBUARTS);
for(i=0; i<uarts; i++){
- LEON3_Console_Uart[i] = (volatile LEON3_UART_Regs_Map *)apbuarts[i].start;
- }
+ LEON3_Console_Uart[i] = (volatile LEON3_UART_Regs_Map *)apbuarts[i].start;
+ }
isinit = 1;
}
return uarts;
@@ -121,11 +122,13 @@ rtems_device_driver console_initialize(
/* Find UARTs */
scan_uarts();
-
- if (Configuration.User_multiprocessing_table != NULL)
- uart0 = LEON3_Cpu_Index;
- else
- uart0 = 0;
+
+ /* default to zero and override if multiprocessing */
+ uart0 = 0;
+ #if defined(RTEMS_MULTIPROCESSING)
+ if (rtems_configuration_get_user_multiprocessing_table() != NULL)
+ uart0 = LEON3_Cpu_Index;
+ #endif
/* Register Device Names */
@@ -145,14 +148,17 @@ rtems_device_driver console_initialize(
/*
- * Initialize Hardware
+ * Initialize Hardware if ONLY CPU or first CPU in MP system
*/
- if ((Configuration.User_multiprocessing_table == NULL) ||
- ((Configuration.User_multiprocessing_table)->node == 1))
+
+ #if defined(RTEMS_MULTIPROCESSING)
+ if ((rtems_configuration_get_user_multiprocessing_table())->node == 1))
+ #endif
{
for (i = uart0; i < uarts; i++)
{
- LEON3_Console_Uart[i]->ctrl |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
+ LEON3_Console_Uart[i]->ctrl |=
+ LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
LEON3_Console_Uart[i]->status = 0;
}
}
diff --git a/c/src/lib/libbsp/sparc/leon3/include/bsp.h b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
index 045b7c2f5a..e72f5ffcbc 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
@@ -43,7 +43,6 @@ extern "C" {
*/
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2
-#define CONFIGURE_INTERRUPT_STACK_MEMORY (16 * 1024)
/*
* Network driver configuration
@@ -122,8 +121,6 @@ void bsp_spurious_initialize( void );
extern rtems_configuration_table BSP_Configuration; /* owned by BSP */
-extern rtems_cpu_table Cpu_table; /* owned by BSP */
-
#ifdef __cplusplus
}
#endif
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
index 47d17ef89c..a766acf225 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
@@ -34,8 +34,6 @@
extern rtems_configuration_table Configuration;
rtems_configuration_table BSP_Configuration;
-rtems_cpu_table Cpu_table;
-
/*
* Tells us where to put the workspace in case remote debugger is present.
*/
@@ -112,11 +110,6 @@ void bsp_start( void )
{
unsigned char *work_space_start;
- /*
- * This should be enough interrupt stack.
- */
- Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
-
work_space_start =
(unsigned char *)rdb_start - BSP_Configuration.work_space_size;
diff --git a/c/src/lib/libbsp/sparc/leon3/timer/timer.c b/c/src/lib/libbsp/sparc/leon3/timer/timer.c
index 9d6f89a593..2c1127a30a 100644
--- a/c/src/lib/libbsp/sparc/leon3/timer/timer.c
+++ b/c/src/lib/libbsp/sparc/leon3/timer/timer.c
@@ -22,12 +22,13 @@
#include <bsp.h>
-extern rtems_configuration_table Configuration;
-
-#define LEON3_TIMER_INDEX \
- (Configuration.User_multiprocessing_table ? \
- (Configuration.User_multiprocessing_table)->maximum_nodes + \
- (Configuration.User_multiprocessing_table)->node - 1 : 1)
+#if defined(RTEMS_MULTIPROCESSING)
+ #define LEON3_TIMER_INDEX \
+ (rtems_configuration_get_user_multiprocessing_table() ? : \
+ (rtems_configuration_get_user_multiprocessing_table()->node) - 1 : 1)
+#else
+ #define LEON3_TIMER_INDEX 0
+#endif
rtems_boolean Timer_driver_Find_average_overhead;