summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-19 16:28:55 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-19 16:28:55 +0000
commit56035ca340276e0b4e12af667a112403da066b55 (patch)
tree1887320682a3966ef782e363a719936ca73a632b /c
parent2009-08-19 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-56035ca340276e0b4e12af667a112403da066b55.tar.bz2
2009-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, console/console.c, console/debugputs.c, include/bsp.h, startup/setvec.c: Split idle method into its own file. Properly note to confdefs.h that this BSP has its own idle thread. Also address use of maximum termios constant in debug IO. * startup/bspidle.S: New file.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/ChangeLog8
-rw-r--r--c/src/lib/libbsp/sparc/leon3/Makefile.am5
-rw-r--r--c/src/lib/libbsp/sparc/leon3/console/console.c5
-rw-r--r--c/src/lib/libbsp/sparc/leon3/console/debugputs.c50
-rw-r--r--c/src/lib/libbsp/sparc/leon3/include/bsp.h9
-rw-r--r--c/src/lib/libbsp/sparc/leon3/startup/bspidle.S31
-rw-r--r--c/src/lib/libbsp/sparc/leon3/startup/setvec.c3
7 files changed, 68 insertions, 43 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/ChangeLog b/c/src/lib/libbsp/sparc/leon3/ChangeLog
index 6e747ec1b1..73b0d080ff 100644
--- a/c/src/lib/libbsp/sparc/leon3/ChangeLog
+++ b/c/src/lib/libbsp/sparc/leon3/ChangeLog
@@ -1,3 +1,11 @@
+2009-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * Makefile.am, console/console.c, console/debugputs.c, include/bsp.h,
+ startup/setvec.c: Split idle method into its own file. Properly note
+ to confdefs.h that this BSP has its own idle thread. Also address use
+ of maximum termios constant in debug IO.
+ * startup/bspidle.S: New file.
+
2009-07-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* configure.ac: Rename BSP_BOOTCARD_OPTIONS to
diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am
index 6ead121281..29418b1ade 100644
--- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
@@ -40,11 +40,9 @@ libbsp_a_SOURCES =
libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
../../shared/bsppost.c ../../shared/bootcard.c startup/bspstart.c \
../../sparc/shared/bspgetworkarea.c ../../shared/sbrk.c startup/setvec.c \
- startup/spurious.c startup/ithread.S
-
+ startup/spurious.c startup/bspidle.S
# gnatsupp
libbsp_a_SOURCES += gnatsupp/gnatsupp.c ../../sparc/shared/gnatcommon.c
-
# amba
include_HEADERS += include/amba.h
include_HEADERS += ../../sparc/shared/include/ambapp.h
@@ -55,7 +53,6 @@ libbsp_a_SOURCES += console/console.c
libbsp_a_SOURCES += console/debugputs.c
# clock
libbsp_a_SOURCES += clock/ckinit.c ../../../shared/clockdrv_shell.h
-
# PCI
include_HEADERS += ../../sparc/shared/include/pci.h
libbsp_a_SOURCES += pci/pci.c ../../sparc/shared/pci/pcifinddevice.c
diff --git a/c/src/lib/libbsp/sparc/leon3/console/console.c b/c/src/lib/libbsp/sparc/leon3/console/console.c
index e1c07a9457..24009f52f1 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/console.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/console.c
@@ -95,11 +95,12 @@ int scan_uarts(void) {
amba_apb_device apbuarts[LEON3_APBUARTS];
if (isinit == 0) {
- i = 0; uarts = 0;
+ i = 0;
+ uarts = 0;
uarts = amba_find_apbslvs(
&amba_conf, VENDOR_GAISLER, GAISLER_APBUART, apbuarts, LEON3_APBUARTS);
- for(i=0; i<uarts; i++){
+ for(i=0; i<uarts; i++) {
LEON3_Console_Uart[i] = (volatile LEON3_UART_Regs_Map *)apbuarts[i].start;
}
isinit = 1;
diff --git a/c/src/lib/libbsp/sparc/leon3/console/debugputs.c b/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
index ef51f3b214..10862b8ce5 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
@@ -23,21 +23,24 @@
#include <assert.h>
/*
+ * Number of uarts on AMBA bus
+ */
+extern int uarts;
+
+/*
* console_outbyte_polled
*
* This routine transmits a character using polling.
*/
-
void console_outbyte_polled(
- int port,
+ int port,
unsigned char ch
)
{
- if ((port >= 0) && (port <= CONFIGURE_NUMBER_OF_TERMIOS_PORTS))
- {
- while ( (LEON3_Console_Uart[LEON3_Cpu_Index+port]->status &
- LEON_REG_UART_STATUS_THE) == 0 );
- LEON3_Console_Uart[LEON3_Cpu_Index+port]->data = (unsigned int) ch;
+ if ((port >= 0) && (port < uarts)) {
+ int u = LEON3_Cpu_Index+port;
+ while ( (LEON3_Console_Uart[u]->status & LEON_REG_UART_STATUS_THE) == 0 );
+ LEON3_Console_Uart[u]->data = (unsigned int) ch;
}
}
@@ -46,32 +49,23 @@ void console_outbyte_polled(
*
* This routine polls for a character.
*/
-
int console_inbyte_nonblocking( int port )
{
-
- if ((port >=0) && (port < CONFIGURE_NUMBER_OF_TERMIOS_PORTS))
- {
-
- if (LEON3_Console_Uart[LEON3_Cpu_Index+port]->status & LEON_REG_UART_STATUS_ERR) {
- LEON3_Console_Uart[LEON3_Cpu_Index+port]->status = ~LEON_REG_UART_STATUS_ERR;
- }
-
- if ((LEON3_Console_Uart[LEON3_Cpu_Index+port]->status & LEON_REG_UART_STATUS_DR) == 0)
- return -1;
- return (int) LEON3_Console_Uart[LEON3_Cpu_Index+port]->data;
- }
-
- else
- {
- assert( 0 );
+ if ((port >= 0) && (port < uarts)) {
+ int u = LEON3_Cpu_Index+port;
+ if (LEON3_Console_Uart[u]->status & LEON_REG_UART_STATUS_ERR)
+ LEON3_Console_Uart[u]->status = ~LEON_REG_UART_STATUS_ERR;
+
+ if ((LEON3_Console_Uart[u]->status & LEON_REG_UART_STATUS_DR) == 0)
+ return -1;
+ return (int) LEON3_Console_Uart[u]->data;
+ } else {
+ assert( 0 );
}
-
return -1;
}
/* putchar/getchar for printk */
-
static void bsp_out_char(char c)
{
console_outbyte_polled(0, c);
@@ -85,12 +79,12 @@ static void bsp_out_char(char c)
BSP_output_char_function_type BSP_output_char = bsp_out_char;
-static char bsp_in_char(void)
+static int bsp_in_char(void)
{
int tmp;
while ((tmp = console_inbyte_nonblocking(0)) < 0);
- return (char) tmp;
+ return tmp;
}
BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char;
diff --git a/c/src/lib/libbsp/sparc/leon3/include/bsp.h b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
index d74a21efaf..c62cc0887b 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
@@ -37,17 +37,14 @@ extern "C" {
#define LEON3 1
/*
- * confdefs.h overrides for this BSP:
- * - two termios serial ports
- * - Interrupt stack space is not minimum if defined.
+ * BSP provides its own Idle thread body
*/
-
-#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2
+void *bsp_idle_thread( uintptr_t ignored );
+#define BSP_IDLE_TASK_BODY bsp_idle_thread
/*
* Network driver configuration
*/
-
struct rtems_bsdnet_ifconfig;
extern int rtems_leon_open_eth_driver_attach(
struct rtems_bsdnet_ifconfig *config,
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspidle.S b/c/src/lib/libbsp/sparc/leon3/startup/bspidle.S
new file mode 100644
index 0000000000..e25128c0f6
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspidle.S
@@ -0,0 +1,31 @@
+/*
+ * Idle Thread Body
+ *
+ * This routine puts LEON3 in power-down mode.
+ *
+ * COPYRIGHT (c) 2004.
+ * Gaisler Research.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ *
+ * $Id$
+ */
+
+
+
+#include <rtems/asm.h>
+
+/* LEON specific power-down function */
+
+ .align 4
+ PUBLIC(bsp_idle_thread)
+SYM(bsp_idle_thread):
+pwdloop: mov %g0, %asr19
+ ba pwdloop
+ nop
+ retl
+ nop
+
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/setvec.c b/c/src/lib/libbsp/sparc/leon3/startup/setvec.c
index 123306c5db..b48b3e050d 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/setvec.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/setvec.c
@@ -59,6 +59,3 @@ rtems_isr_entry set_vector( /* returns old vector */
return previous_isr;
}
-
-
-