forked from Imagelibrary/rtems
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -22,22 +22,25 @@
|
||||
#include <stdlib.h>
|
||||
#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 < 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[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;
|
||||
if ((LEON3_Console_Uart[u]->status & LEON_REG_UART_STATUS_DR) == 0)
|
||||
return -1;
|
||||
return (int) LEON3_Console_Uart[u]->data;
|
||||
} else {
|
||||
assert( 0 );
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
31
c/src/lib/libbsp/sparc/leon3/startup/bspidle.S
Normal file
31
c/src/lib/libbsp/sparc/leon3/startup/bspidle.S
Normal 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
|
||||
|
||||
@@ -59,6 +59,3 @@ rtems_isr_entry set_vector( /* returns old vector */
|
||||
|
||||
return previous_isr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user