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.
This commit is contained in:
Joel Sherrill
2009-08-19 16:28:55 +00:00
parent b181c30607
commit 56035ca340
7 changed files with 67 additions and 42 deletions

View File

@@ -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> 2009-07-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* configure.ac: Rename BSP_BOOTCARD_OPTIONS to * configure.ac: Rename BSP_BOOTCARD_OPTIONS to

View File

@@ -40,11 +40,9 @@ libbsp_a_SOURCES =
libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \ libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
../../shared/bsppost.c ../../shared/bootcard.c startup/bspstart.c \ ../../shared/bsppost.c ../../shared/bootcard.c startup/bspstart.c \
../../sparc/shared/bspgetworkarea.c ../../shared/sbrk.c startup/setvec.c \ ../../sparc/shared/bspgetworkarea.c ../../shared/sbrk.c startup/setvec.c \
startup/spurious.c startup/ithread.S startup/spurious.c startup/bspidle.S
# gnatsupp # gnatsupp
libbsp_a_SOURCES += gnatsupp/gnatsupp.c ../../sparc/shared/gnatcommon.c libbsp_a_SOURCES += gnatsupp/gnatsupp.c ../../sparc/shared/gnatcommon.c
# amba # amba
include_HEADERS += include/amba.h include_HEADERS += include/amba.h
include_HEADERS += ../../sparc/shared/include/ambapp.h include_HEADERS += ../../sparc/shared/include/ambapp.h
@@ -55,7 +53,6 @@ libbsp_a_SOURCES += console/console.c
libbsp_a_SOURCES += console/debugputs.c libbsp_a_SOURCES += console/debugputs.c
# clock # clock
libbsp_a_SOURCES += clock/ckinit.c ../../../shared/clockdrv_shell.h libbsp_a_SOURCES += clock/ckinit.c ../../../shared/clockdrv_shell.h
# PCI # PCI
include_HEADERS += ../../sparc/shared/include/pci.h include_HEADERS += ../../sparc/shared/include/pci.h
libbsp_a_SOURCES += pci/pci.c ../../sparc/shared/pci/pcifinddevice.c libbsp_a_SOURCES += pci/pci.c ../../sparc/shared/pci/pcifinddevice.c

View File

@@ -95,11 +95,12 @@ int scan_uarts(void) {
amba_apb_device apbuarts[LEON3_APBUARTS]; amba_apb_device apbuarts[LEON3_APBUARTS];
if (isinit == 0) { if (isinit == 0) {
i = 0; uarts = 0; i = 0;
uarts = 0;
uarts = amba_find_apbslvs( uarts = amba_find_apbslvs(
&amba_conf, VENDOR_GAISLER, GAISLER_APBUART, apbuarts, LEON3_APBUARTS); &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; LEON3_Console_Uart[i] = (volatile LEON3_UART_Regs_Map *)apbuarts[i].start;
} }
isinit = 1; isinit = 1;

View File

@@ -22,22 +22,25 @@
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
/*
* Number of uarts on AMBA bus
*/
extern int uarts;
/* /*
* console_outbyte_polled * console_outbyte_polled
* *
* This routine transmits a character using polling. * This routine transmits a character using polling.
*/ */
void console_outbyte_polled( void console_outbyte_polled(
int port, int port,
unsigned char ch unsigned char ch
) )
{ {
if ((port >= 0) && (port <= CONFIGURE_NUMBER_OF_TERMIOS_PORTS)) if ((port >= 0) && (port < uarts)) {
{ int u = LEON3_Cpu_Index+port;
while ( (LEON3_Console_Uart[LEON3_Cpu_Index+port]->status & while ( (LEON3_Console_Uart[u]->status & LEON_REG_UART_STATUS_THE) == 0 );
LEON_REG_UART_STATUS_THE) == 0 ); LEON3_Console_Uart[u]->data = (unsigned int) ch;
LEON3_Console_Uart[LEON3_Cpu_Index+port]->data = (unsigned int) ch;
} }
} }
@@ -46,32 +49,23 @@ void console_outbyte_polled(
* *
* This routine polls for a character. * This routine polls for a character.
*/ */
int console_inbyte_nonblocking( int port ) int console_inbyte_nonblocking( int port )
{ {
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 ((port >=0) && (port < CONFIGURE_NUMBER_OF_TERMIOS_PORTS)) if ((LEON3_Console_Uart[u]->status & LEON_REG_UART_STATUS_DR) == 0)
{
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 -1;
return (int) LEON3_Console_Uart[LEON3_Cpu_Index+port]->data; return (int) LEON3_Console_Uart[u]->data;
} } else {
else
{
assert( 0 ); assert( 0 );
} }
return -1; return -1;
} }
/* putchar/getchar for printk */ /* putchar/getchar for printk */
static void bsp_out_char(char c) static void bsp_out_char(char c)
{ {
console_outbyte_polled(0, 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; 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; int tmp;
while ((tmp = console_inbyte_nonblocking(0)) < 0); while ((tmp = console_inbyte_nonblocking(0)) < 0);
return (char) tmp; return tmp;
} }
BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char; BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char;

View File

@@ -37,17 +37,14 @@ extern "C" {
#define LEON3 1 #define LEON3 1
/* /*
* confdefs.h overrides for this BSP: * BSP provides its own Idle thread body
* - two termios serial ports
* - Interrupt stack space is not minimum if defined.
*/ */
void *bsp_idle_thread( uintptr_t ignored );
#define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 #define BSP_IDLE_TASK_BODY bsp_idle_thread
/* /*
* Network driver configuration * Network driver configuration
*/ */
struct rtems_bsdnet_ifconfig; struct rtems_bsdnet_ifconfig;
extern int rtems_leon_open_eth_driver_attach( extern int rtems_leon_open_eth_driver_attach(
struct rtems_bsdnet_ifconfig *config, struct rtems_bsdnet_ifconfig *config,

View File

@@ -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

View File

@@ -59,6 +59,3 @@ rtems_isr_entry set_vector( /* returns old vector */
return previous_isr; return previous_isr;
} }