2007-09-06 Daniel Hellstrom <daniel@gaisler.com>

* Makefile.am, preinstall.am: New files, split of printk.
	* console/console.c, console/debugputs.c: Split printk support out.
	* include/spacewire.h: Removed.
	* Makefile.am, preinstall.am: Use the following new drivers from
	sparc/shared: PCI, b1553BRM, SpaceWire(GRSPW), CAN (GRCAN), Raw UART.
This commit is contained in:
Joel Sherrill
2007-09-06 13:23:43 +00:00
parent ee8933f26d
commit 344ba65adb
6 changed files with 128 additions and 213 deletions

View File

@@ -1,3 +1,11 @@
2007-09-06 Daniel Hellstrom <daniel@gaisler.com>
* Makefile.am, preinstall.am: New files, split of printk.
* console/console.c, console/debugputs.c: Split printk support out.
* include/spacewire.h: Removed.
* Makefile.am, preinstall.am: Use the following new drivers from
sparc/shared: PCI, b1553BRM, SpaceWire(GRSPW), CAN (GRCAN), Raw UART.
2007-09-06 Daniel Hellstrom <daniel@gaisler.com>
* console/debugputs.c: Now works on multi-CPU systems.

View File

@@ -11,6 +11,7 @@ dist_project_lib_DATA = bsp_specs
include_HEADERS = include/bsp.h
include_HEADERS += include/tm27.h
include_HEADERS += ../../sparc/shared/include/debug_defs.h
nodist_include_HEADERS = include/bspopts.h
DISTCLEANFILES = include/bspopts.h
@@ -23,7 +24,6 @@ SUBDIRS = . tools
include_HEADERS += include/leon.h
include_HEADERS += include/coverhd.h
include_HEADERS += include/spacewire.h
EXTRA_DIST = ../../sparc/shared/start.S
start.$(OBJEXT): ../../sparc/shared/start.S
@@ -55,16 +55,56 @@ amba_rel_CPPFLAGS = $(AM_CPPFLAGS)
amba_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
noinst_PROGRAMS += console.rel
console_rel_SOURCES = console/console.c console/consolereserveresources.c \
console/debugputs.c
console_rel_SOURCES = console/console.c console/consolereserveresources.c
console_rel_CPPFLAGS = $(AM_CPPFLAGS)
console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
noinst_PROGRAMS += debugio.rel
debugio_rel_SOURCES = console/debugputs.c
debugio_rel_CPPFLAGS = $(AM_CPPFLAGS)
debugio_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
noinst_PROGRAMS += clock.rel
clock_rel_SOURCES = clock/ckinit.c
clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
# PCI
include_HEADERS += ../../sparc/shared/include/pci.h
noinst_PROGRAMS += pci.rel
pci_rel_SOURCES = pci/pci.c ../../sparc/shared/pci/pcifinddevice.c
pci_rel_CPPFLAGS = $(AM_CPPFLAGS)
pci_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
# B1553BRM
include_HEADERS += ../../sparc/shared/include/b1553brm.h ../../sparc/shared/include/b1553brm_pci.h
noinst_PROGRAMS += brm.rel
brm_rel_SOURCES = ../../sparc/shared/1553/b1553brm.c ../../sparc/shared/1553/b1553brm_pci.c
brm_rel_CPPFLAGS = $(AM_CPPFLAGS)
brm_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
# CAN
include_HEADERS += ../../sparc/shared/include/occan.h ../../sparc/shared/include/occan_pci.h ../../sparc/shared/include/grcan.h
noinst_PROGRAMS += can.rel
can_rel_SOURCES = ../../sparc/shared/can/occan.c ../../sparc/shared/can/occan_pci.c ../../sparc/shared/can/grcan.c
can_rel_CPPFLAGS = $(AM_CPPFLAGS)
can_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
# SpaceWire
include_HEADERS += ../../sparc/shared/include/grspw.h ../../sparc/shared/include/grspw_pci.h
noinst_PROGRAMS += spw.rel
spw_rel_SOURCES = ../../sparc/shared/spw/grspw.c ../../sparc/shared/spw/grspw_pci.c
spw_rel_CPPFLAGS = $(AM_CPPFLAGS)
spw_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
# UART
include_HEADERS += ../../sparc/shared/include/apbuart.h ../../sparc/shared/include/apbuart_pci.h
noinst_PROGRAMS += uart.rel
uart_rel_SOURCES = ../../sparc/shared/uart/apbuart.c ../../sparc/shared/uart/apbuart_pci.c
uart_rel_CPPFLAGS = $(AM_CPPFLAGS)
uart_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
if HAS_NETWORKING
noinst_PROGRAMS += leon_smc91111.rel
leon_smc91111_rel_SOURCES = leon_smc91111/leon_smc91111.c
@@ -96,8 +136,8 @@ endif
noinst_LIBRARIES = libbsp.a
libbsp_a_SOURCES =
libbsp_a_LIBADD = startup.rel amba.rel console.rel clock.rel timer.rel \
gnatsupp.rel
libbsp_a_LIBADD = startup.rel amba.rel console.rel clock.rel debugio.rel \
timer.rel gnatsupp.rel brm.rel can.rel spw.rel uart.rel pci.rel
if HAS_NETWORKING
libbsp_a_LIBADD += leon_open_eth.rel

View File

@@ -227,21 +227,3 @@ rtems_device_driver console_control(
return rtems_termios_ioctl (arg);
}
/* putchar/getchar for printk */
static void bsp_out_char(char c)
{
console_outbyte_polled(0, c);
}
BSP_output_char_function_type BSP_output_char = bsp_out_char;
static char bsp_in_char(void)
{
int tmp;
while ((tmp = console_inbyte_nonblocking(0)) < 0);
return (char) tmp;
}
BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char;

View File

@@ -69,3 +69,22 @@ int console_inbyte_nonblocking( int port )
return -1;
}
/* putchar/getchar for printk */
static void bsp_out_char(char c)
{
console_outbyte_polled(0, c);
}
BSP_output_char_function_type BSP_output_char = bsp_out_char;
static char bsp_in_char(void)
{
int tmp;
while ((tmp = console_inbyte_nonblocking(0)) < 0);
return (char) tmp;
}
BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char;

View File

@@ -1,186 +0,0 @@
/*
* Macros used for Spacewire bus
*
* 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$
*/
#ifndef __SPACEWIRE_h
#define __SPACEWIRE_h
typedef struct {
volatile unsigned int ctrl;
volatile unsigned int status;
volatile unsigned int nodeaddr;
volatile unsigned int clockdiv;
volatile unsigned int destkey;
volatile unsigned int pad1,pad2,pad3;
volatile unsigned int dma0ctrl; /* 0x20 */
volatile unsigned int dma0rxmax;
volatile unsigned int dma0txdesc;
volatile unsigned int dma0rxdesc;
} LEON3_SPACEWIRE_Regs_Map;
typedef struct {
volatile unsigned int ctrl;
volatile unsigned int addr;
} SPACEWIRE_RXBD;
typedef struct {
volatile unsigned int ctrl;
volatile unsigned int addr_header;
volatile unsigned int len;
volatile unsigned int addr_data;
} SPACEWIRE_TXBD;
#define SPACEWIRE_BDTABLE_SIZE 0x400
#define SPACEWIRE_TXPCK_SIZE 1024
#define SPACEWIRE_RXPCK_SIZE 1024
#define SPACEWIRE_TXBUFS_NR 1
#define SPACEWIRE_RXBUFS_NR 2
#define SPW_BUFMALLOC 1
#define SPW_ALIGN(p,c) ((((unsigned int)(p))+((c)-1))&~((c)-1))
int spacewire_setattibutes(int minor, int nodeaddr, int proto, int dest);
typedef struct {
unsigned int nodeaddr;
unsigned int destnodeaddr;
unsigned int proto;
unsigned int destkey;
unsigned int maxfreq;
unsigned int clkdiv;
unsigned int rxmaxlen;
unsigned int is_rmap,is_rxunaligned,is_rmapcrc;
unsigned int txcur,rxcur,rxbufcur;
unsigned int txbufsize,rxbufsize;
unsigned int txbufcnt,rxbufcnt;
char *ptr_rxbuf0,*ptr_txbuf0;
unsigned int irq;
SPACEWIRE_RXBD *rx;
SPACEWIRE_TXBD *tx;
char _rxtable[SPACEWIRE_BDTABLE_SIZE*2];
char _txtable[SPACEWIRE_BDTABLE_SIZE*2];
#ifndef SPW_BUFMALLOC
char _rxbuf0[SPACEWIRE_RXPCK_SIZE*SPACEWIRE_RXBUFS_NR];
char _txbuf0[SPACEWIRE_TXPCK_SIZE*SPACEWIRE_TXBUFS_NR];
#endif
volatile LEON3_SPACEWIRE_Regs_Map *regs;
} SPACEWIRE_PARAM;
int _SPW_READ(void *addr);
#define SPW_READ(addr) _SPW_READ((void *)(addr))
#define SPW_WRITE(addr,v) *addr=v
#define SPACEWIRE_MAX_CORENR 2
extern SPACEWIRE_PARAM LEON3_Spacewire[SPACEWIRE_MAX_CORENR];
#define SPW_PARAM(c) (LEON3_Spacewire[c])
#define SPW_REG(c,r) (SPW_PARAM(c).regs->r)
#define SPW_REG_CTRL(c) SPW_REG(c,ctrl)
#define SPW_REG_STATUS(c) SPW_REG(c,status)
#define SPW_REG_NODEADDR(c) SPW_REG(c,nodeaddr)
#define SPW_CTRL_READ(c) SPW_READ(&SPW_REG_CTRL(c))
#define SPW_CTRL_WRITE(c,v) SPW_WRITE(&SPW_REG_CTRL(c),v)
#define SPW_STATUS_READ(c) SPW_READ(&SPW_REG_STATUS(c))
#define SPW_STATUS_WRITE(c,v) SPW_WRITE(&SPW_REG_STATUS(c),v)
#define SPW_LINKSTATE(c) (((c) >> 21) & 0x7)
#define SPW_NODEADDR_READ(c) SPW_BYPASSCACHE(&SPW_NODEADDR(c))
#define SPW_NODEADDR_WRITE(c,v) SPW_NODEADDR(c) = v
#define SPACEWIRE_RXNR(c) ((c&~(SPACEWIRE_BDTABLE_SIZE-1))>>3)
#define SPACEWIRE_TXNR(c) ((c&~(SPACEWIRE_BDTABLE_SIZE-1))>>4)
#define SPACEWIRE_RXBD_LENGTH 0x1ffffff
#define SPACEWIRE_RXBD_EN (1<<25)
#define SPACEWIRE_RXBD_WR (1<<26)
#define SPACEWIRE_RXBD_IE (1<<27)
#define SPACEWIRE_RXBD_EEP (1<<28)
#define SPACEWIRE_RXBD_EHC (1<<29)
#define SPACEWIRE_RXBD_EDC (1<<30)
#define SPACEWIRE_RXBD_ETR (1<<31)
#define SPACEWIRE_RXBD_ERROR (SPACEWIRE_RXBD_EEP | \
SPACEWIRE_RXBD_EHC | \
SPACEWIRE_RXBD_EDC | \
SPACEWIRE_RXBD_ETR)
#define SPACEWIRE_RXBD_RMAPERROR (SPACEWIRE_RXBD_EHC | SPACEWIRE_RXBD_EDC)
#define SPACEWIRE_RXBD_LENGTH(c) ((c)&0xffffff)
#define SPACEWIRE_PCKHEAD 2
#define SPACEWIRE_TXBD_LENGTH 0xffffff
#define SPACEWIRE_TXBD_EN (1<<12)
#define SPACEWIRE_TXBD_WR (1<<13)
#define SPACEWIRE_TXBD_IE (1<<14)
#define SPACEWIRE_TXBD_LE (1<<15)
#define SPACEWIRE_TXBD_ERROR (SPACEWIRE_TXBD_LE)
#define SPACEWIRE_CTRL_RA (1<<31)
#define SPACEWIRE_CTRL_RX (1<<30)
#define SPACEWIRE_CTRL_RC (1<<29)
#define SPACEWIRE_CTRL_RESET (1<<6)
#define SPACEWIRE_CTRL_LINKSTART (1<<1)
#define SPACEWIRE_CTRL_LINKDISABLE (1<<0)
#define SPACEWIRE_DMACTRL_TXEN (1<<0)
#define SPACEWIRE_DMACTRL_RXEN (1<<1)
#define SPACEWIRE_DMACTRL_TXIE (1<<2)
#define SPACEWIRE_DMACTRL_RXIE (1<<3)
#define SPACEWIRE_DMACTRL_AI (1<<4)
#define SPACEWIRE_DMACTRL_PS (1<<5)
#define SPACEWIRE_DMACTRL_PR (1<<6)
#define SPACEWIRE_DMACTRL_TA (1<<7)
#define SPACEWIRE_DMACTRL_RA (1<<8)
#define SPACEWIRE_DMACTRL_RD (1<<11)
#define SPACEWIRE_DMACTRL_NS (1<<12)
#define SPACEWIRE_PREPAREMASK_TX (SPACEWIRE_DMACTRL_RXEN | SPACEWIRE_DMACTRL_RXIE | SPACEWIRE_DMACTRL_PS | SPACEWIRE_DMACTRL_TA | SPACEWIRE_DMACTRL_RD)
#define SPACEWIRE_PREPAREMASK_RX (SPACEWIRE_DMACTRL_TXEN | SPACEWIRE_DMACTRL_TXIE | SPACEWIRE_DMACTRL_AI | SPACEWIRE_DMACTRL_PR | SPACEWIRE_DMACTRL_RA)
#define SPACEWIRE_IOCTRL_SET_NODEADDR 1
#define SPACEWIRE_IOCTRL_SET_PROTOCOL 2
#define SPACEWIRE_IOCTRL_SET_DESTNODEADDR 3
#define SPACEWIRE_IOCTRL_GET_COREBASEADDR 4
#define SPACEWIRE_IOCTRL_GET_COREIRQ 5
#define SPACEWIRE_IOCTRL_SET_PACKETSIZE 6
#define SPACEWIRE_IOCTRL_GETPACKET 7
#define SPACEWIRE_IOCTRL_PUTPACKET 8
typedef struct {
unsigned int txsize, rxsize;
} spw_ioctl_packetsize;
typedef struct {
char *buf;
int buf_size;
int ret_size;
} spw_ioctl_packet;
#endif

View File

@@ -52,10 +52,6 @@ $(PROJECT_INCLUDE)/coverhd.h: include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
$(PROJECT_INCLUDE)/spacewire.h: include/spacewire.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/spacewire.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/spacewire.h
$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
@@ -72,3 +68,59 @@ PREINSTALL_FILES += $(PROJECT_INCLUDE)/amba.h
$(PROJECT_INCLUDE)/ambapp.h: ../../sparc/shared/include/ambapp.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/ambapp.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/ambapp.h
# PCI
$(PROJECT_INCLUDE)/pci.h: ../../sparc/shared/include/pci.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/pci.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/pci.h
# DEBUG
$(PROJECT_INCLUDE)/debug_defs.h: ../../sparc/shared/include/debug_defs.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/debug_defs.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/debug_defs.h
# SpaceWire
$(PROJECT_INCLUDE)/grspw.h: ../../sparc/shared/include/grspw.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grspw.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/grspw.h
$(PROJECT_INCLUDE)/grspw_pci.h: ../../sparc/shared/include/grspw_pci.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grspw_pci.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/grspw_pci.h
# B1553BRM
$(PROJECT_INCLUDE)/b1553brm_pci.h: ../../sparc/shared/include/b1553brm_pci.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/b1553brm_pci.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/b1553brm_pci.h
$(PROJECT_INCLUDE)/b1553brm.h: ../../sparc/shared/include/b1553brm.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/b1553brm.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/b1553brm.h
# CAN
$(PROJECT_INCLUDE)/occan.h: ../../sparc/shared/include/occan.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/occan.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/occan.h
$(PROJECT_INCLUDE)/occan_pci.h: ../../sparc/shared/include/occan_pci.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/occan_pci.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/occan_pci.h
$(PROJECT_INCLUDE)/grcan.h: ../../sparc/shared/include/grcan.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/grcan.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/grcan.h
# UART
$(PROJECT_INCLUDE)/apbuart.h: ../../sparc/shared/include/apbuart.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/apbuart.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/apbuart.h
$(PROJECT_INCLUDE)/apbuart_pci.h: ../../sparc/shared/include/apbuart_pci.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/apbuart_pci.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/apbuart_pci.h