2001-11-08 Dennis Ehlin (ECS) <Dennis.Ehlin@ecs.ericsson.se>

This modification is part of the submitted modifications necessary to
	support the IBM PPC405 family.  This submission was reviewed by
	Thomas Doerfler <Thomas.Doerfler@imd-systems.de> who ensured it did
	not negatively impact the ppc403 BSPs.  The submission and tracking
	process was captured as PR50.
	* ppc403/console/console405.c ppc403/tty_drv/.cvsignore,
	ppc403/tty_drv/Makefile.am, ppc403/tty_drv/tty_drv.c,
	ppc403/tty_drv/tty_drv.h: New files.
	* Makefile.am, README, configure.ac, old_exception_processing/cpu.c,
	old_exception_processing/cpu.h, ppc403/Makefile.am,
	ppc403/clock/clock.c, ppc403/console/Makefile.am,
	ppc403/console/console.c, ppc403/ictrl/ictrl.c, ppc403/ictrl/ictrl.h,
	ppc403/timer/timer.c: Modified.
This commit is contained in:
Joel Sherrill
2001-11-09 00:04:57 +00:00
parent de202e7204
commit e9ae97fbc6
21 changed files with 1382 additions and 33 deletions
@@ -366,7 +366,7 @@ static void ppc_spurious(int v, CPU_Interrupt_frame *i)
printf("Spurious interrupt on vector %d from %08.8x\n",
v, i->pc);
#endif
#ifdef ppc403
#if defined(ppc403) || defined(ppc405)
if (v == PPC_IRQ_EXTERNAL)
{
register int r = 0;
@@ -627,7 +627,7 @@ unsigned32 ppc_exception_vector_addr(
Offset = 0x00e00;
break;
#if defined(ppc403)
#if defined(ppc403) || defined(ppc405)
/* PPC_IRQ_CRIT is the same vector as PPC_IRQ_RESET
case PPC_IRQ_CRIT:
@@ -474,7 +474,7 @@ typedef struct {
void (*spurious_handler)(unsigned32 vector, CPU_Interrupt_frame *);
boolean exceptions_in_RAM; /* TRUE if in RAM */
#if (defined(ppc403) || defined(mpc860) || defined(mpc821))
#if (defined(ppc403) || defined(ppc405) || defined(mpc860) || defined(mpc821))
unsigned32 serial_per_sec; /* Serial clocks per second */
boolean serial_external_clock;
boolean serial_xon_xoff;
@@ -508,7 +508,7 @@ typedef struct {
#define rtems_cpu_configuration_get_exceptions_in_ram() \
(_CPU_Table.exceptions_in_RAM)
#if (defined(ppc403) || defined(mpc860) || defined(mpc821))
#if (defined(ppc403) || defined(ppc405) || defined(mpc860) || defined(mpc821))
#define rtems_cpu_configuration_get_serial_per_sec() \
(_CPU_Table.serial_per_sec)
+16
View File
@@ -1,3 +1,19 @@
2001-11-08 Dennis Ehlin (ECS) <Dennis.Ehlin@ecs.ericsson.se>
This modification is part of the submitted modifications necessary to
support the IBM PPC405 family. This submission was reviewed by
Thomas Doerfler <Thomas.Doerfler@imd-systems.de> who ensured it did
not negatively impact the ppc403 BSPs. The submission and tracking
process was captured as PR50.
* ppc403/console/console405.c ppc403/tty_drv/.cvsignore,
ppc403/tty_drv/Makefile.am, ppc403/tty_drv/tty_drv.c,
ppc403/tty_drv/tty_drv.h: New files.
* Makefile.am, README, configure.ac, old_exception_processing/cpu.c,
old_exception_processing/cpu.h, ppc403/Makefile.am,
ppc403/clock/clock.c, ppc403/console/Makefile.am,
ppc403/console/console.c, ppc403/ictrl/ictrl.c, ppc403/ictrl/ictrl.h,
ppc403/timer/timer.c: Modified.
2001-11-07 Joel Sherrill <joel@OARcorp.com>
* configure.ac: Delete the commented out line that said that
+4
View File
@@ -34,6 +34,10 @@ endif
if ppc403
CPU_SUBDIR = ppc403
endif
if ppc405
## 403 and 405 chips use the same CPU sources...
CPU_SUBDIR = ppc403
endif
SUBDIRS = $(SHARED_LIB) $(EXCEPTION_SUBDIR) $(CPU_SUBDIR) wrapup
+12 -4
View File
@@ -9,17 +9,25 @@ available from IBM and Motorola.
Since these routines can differ amongst different members
of the PowerPC family, an entry per CPU type is provided.
Initially, (4/December/1995), only the PPC403 was supported.
At this time, support is included for the following PowerPC
family members:
family members using the new exception processing model:
+ mpc505
+ mpc6xx
+ mpc750
+ mpc821
+ mpc821
+ mpc823 (uses mpc821 directory)
+ mpc850 (uses mpc860 directory)
+ mpc860
+ ppc403
+ mpc8260
The following PowerPC family members are supported but
still use the old exception processing model:
+ ppc403
+ ppc405 (uses ppc403 directory)
+ ppc6xx (no libcpu support)
Note that because of similarities in various family members,
the mpc823 should be able to use the mpc821 code and the
mpc850 should be able to use the mpc850 code.
+3
View File
@@ -50,6 +50,7 @@ test "$RTEMS_CPU_MODEL" = "mpc860" \
## first.
AM_CONDITIONAL(old_exception_processing, \
test "$RTEMS_CPU_MODEL" = "ppc403" || \
test "$RTEMS_CPU_MODEL" = "ppc405" || \
test "$RTEMS_CPU_MODEL" = "mpc505" || \
test "$RTEMS_CPU_MODEL" = "ppc603e" \
)
@@ -64,6 +65,7 @@ AM_CONDITIONAL(mpc8xx, test "$RTEMS_CPU_MODEL" = "mpc8xx" \
|| test "$RTEMS_CPU_MODEL" = "mpc860" )
AM_CONDITIONAL(mpc8260, test "$RTEMS_CPU_MODEL" = "mpc8260")
AM_CONDITIONAL(ppc403, test "$RTEMS_CPU_MODEL" = "ppc403")
AM_CONDITIONAL(ppc405, test "$RTEMS_CPU_MODEL" = "ppc405")
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
@@ -82,6 +84,7 @@ mpc8xx/timer/Makefile
ppc403/Makefile
ppc403/clock/Makefile
ppc403/console/Makefile
ppc403/tty_drv/Makefile
ppc403/ictrl/Makefile
ppc403/timer/Makefile
ppc403/vectors/Makefile
@@ -366,7 +366,7 @@ static void ppc_spurious(int v, CPU_Interrupt_frame *i)
printf("Spurious interrupt on vector %d from %08.8x\n",
v, i->pc);
#endif
#ifdef ppc403
#if defined(ppc403) || defined(ppc405)
if (v == PPC_IRQ_EXTERNAL)
{
register int r = 0;
@@ -627,7 +627,7 @@ unsigned32 ppc_exception_vector_addr(
Offset = 0x00e00;
break;
#if defined(ppc403)
#if defined(ppc403) || defined(ppc405)
/* PPC_IRQ_CRIT is the same vector as PPC_IRQ_RESET
case PPC_IRQ_CRIT:
@@ -366,7 +366,7 @@ static void ppc_spurious(int v, CPU_Interrupt_frame *i)
printf("Spurious interrupt on vector %d from %08.8x\n",
v, i->pc);
#endif
#ifdef ppc403
#if defined(ppc403) || defined(ppc405)
if (v == PPC_IRQ_EXTERNAL)
{
register int r = 0;
@@ -627,7 +627,7 @@ unsigned32 ppc_exception_vector_addr(
Offset = 0x00e00;
break;
#if defined(ppc403)
#if defined(ppc403) || defined(ppc405)
/* PPC_IRQ_CRIT is the same vector as PPC_IRQ_RESET
case PPC_IRQ_CRIT:
@@ -474,7 +474,7 @@ typedef struct {
void (*spurious_handler)(unsigned32 vector, CPU_Interrupt_frame *);
boolean exceptions_in_RAM; /* TRUE if in RAM */
#if (defined(ppc403) || defined(mpc860) || defined(mpc821))
#if (defined(ppc403) || defined(ppc405) || defined(mpc860) || defined(mpc821))
unsigned32 serial_per_sec; /* Serial clocks per second */
boolean serial_external_clock;
boolean serial_xon_xoff;
@@ -508,7 +508,7 @@ typedef struct {
#define rtems_cpu_configuration_get_exceptions_in_ram() \
(_CPU_Table.exceptions_in_RAM)
#if (defined(ppc403) || defined(mpc860) || defined(mpc821))
#if (defined(ppc403) || defined(ppc405) || defined(mpc860) || defined(mpc821))
#define rtems_cpu_configuration_get_serial_per_sec() \
(_CPU_Table.serial_per_sec)
@@ -4,7 +4,12 @@
AUTOMAKE_OPTIONS = foreign 1.4
if ppc403
SUBDIRS = console clock timer vectors ictrl
endif
if ppc405
SUBDIRS = console tty_drv clock timer vectors ictrl
endif
include $(top_srcdir)/../../../../../automake/subdirs.am
include $(top_srcdir)/../../../../../automake/local.am
+42 -15
View File
@@ -25,7 +25,6 @@
* for these modifications:
* COPYRIGHT (c) 1997 by IMD, Puchheim, Germany.
*
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
@@ -33,6 +32,8 @@
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* Modifications for PPC405GP by Dennis Ehlin
*
* $Id$
*/
@@ -59,7 +60,11 @@ static inline rtems_unsigned32 get_itimer(void)
{
register rtems_unsigned32 rc;
#ifndef ppc405 /* this is a ppc403 */
asm volatile ("mfspr %0, 0x3dd" : "=r" ((rc))); /* TBLO */
#else /* ppc405 */
asm volatile ("mfspr %0, 0x10c" : "=r" ((rc))); /* 405GP TBL */
#endif /* ppc405 */
return rc;
}
@@ -71,11 +76,10 @@ static inline rtems_unsigned32 get_itimer(void)
rtems_isr
Clock_isr(rtems_vector_number vector)
{
rtems_unsigned32 clicks_til_next_interrupt;
if (!auto_restart)
{
rtems_unsigned32 clicks_til_next_interrupt;
rtems_unsigned32 itimer_value;
/*
* setup for next interrupt; making sure the new value is reasonably
* in the future.... in case we lost out on an interrupt somehow
@@ -131,24 +135,25 @@ Clock_isr(rtems_vector_number vector)
void Install_clock(rtems_isr_entry clock_isr)
{
rtems_isr_entry previous_isr;
rtems_unsigned32 pvr, iocr;
rtems_unsigned32 iocr;
register rtems_unsigned32 tcr;
#ifdef ppc403
rtems_unsigned32 pvr;
#endif /* ppc403 */
Clock_driver_ticks = 0;
#ifndef ppc405 /* this is a ppc403 */
asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); /* IOCR */
if (rtems_cpu_configuration_get_timer_internal_clock()) {
iocr &= ~4; /* timer clocked from system clock */
}
else {
iocr |= 4; /* select external timer clock */
}
asm volatile ("mtdcr 0xa0, %0" : "=r" (iocr) : "0" (iocr)); /* IOCR */
asm volatile ("mfspr %0, 0x11f" : "=r" ((pvr))); /* PVR */
if (((pvr & 0xffff0000) >> 16) != 0x0020)
return; /* Not a ppc403 */
@@ -162,10 +167,26 @@ void Install_clock(rtems_isr_entry clock_isr)
else if ((pvr & 0xff00) == 0x0100) /* 403GB */
auto_restart = 1;
#else /* ppc405 */
asm volatile ("mfdcr %0, 0x0b2" : "=r" (iocr)); /*405GP CPC0_CR1 */
if (rtems_cpu_configuration_get_timer_internal_clock()) {
iocr &=~0x800000 ;/* timer clocked from system clock CETE*/
}
else {
iocr |= 0x800000; /* select external timer clock CETE*/
}
asm volatile ("mtdcr 0x0b2, %0" : "=r" (iocr) : "0" (iocr)); /* 405GP CPC0_CR1 */
/*
* Enable auto restart
*/
auto_restart=1;
#endif /* ppc405 */
pit_value = rtems_configuration_get_microseconds_per_tick() *
rtems_cpu_configuration_get_clicks_per_usec();
/*
* initialize the interval here
* First tick is set to right amount of time in the future
@@ -176,16 +197,19 @@ void Install_clock(rtems_isr_entry clock_isr)
rtems_interrupt_catch(clock_isr, PPC_IRQ_PIT, &previous_isr);
/*
* Set PIT value
*/
asm volatile ("mtspr 0x3db, %0" : : "r" (pit_value)); /* PIT */
asm volatile ("mfspr %0, 0x3da" : "=r" ((tcr))); /* TCR */
tcr &= ~ 0x04400000;
tcr |= (auto_restart ? 0x04400000 : 0x04000000);
/*
* Set timer to autoreload, bit TCR->ARE = 1 0x0400000
* Enable PIT interrupt, bit TCR->PIE = 1 0x4000000
*/
tick_time = get_itimer() + pit_value;
asm volatile ("mfspr %0, 0x3da" : "=r" ((tcr))); /* TCR */
tcr = (tcr & ~0x04400000) | (auto_restart ? 0x04400000 : 0x04000000);
asm volatile ("mtspr 0x3da, %0" : "=r" ((tcr)) : "0" ((tcr))); /* TCR */
atexit(Clock_exit);
@@ -208,6 +232,9 @@ ReInstall_clock(rtems_isr_entry new_clock_isr)
/*
* Called via atexit()
* Remove the clock interrupt handler by setting handler to NULL
*
* This will not work on the 405GP because
* when bit's are set in TCR they can only be unset by a reset
*/
void
@@ -6,7 +6,12 @@ AUTOMAKE_OPTIONS = foreign 1.4
PGM = $(ARCH)/console.rel
if ppc403
C_FILES = console.c
endif
if ppc405
C_FILES = console405.c
endif
console_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
@@ -25,6 +30,6 @@ all-local: $(ARCH) $(console_rel_OBJECTS) $(PGM)
.PRECIOUS: $(PGM)
EXTRA_DIST = console.c console.c.polled
EXTRA_DIST = console.c console.c.polled console405.c
include $(top_srcdir)/../../../../../automake/local.am
@@ -147,7 +147,7 @@ typedef volatile struct async *pasync;
static const pasync port = (pasync)0x40000000;
static void *spittyp; /* handle for termios */
int ppc403_spi_interrupt = 1; /* do not use interrupts... */
int ppc403_spi_interrupt = 1; /* use interrupts... */
/*
* Rx Interrupt handler
File diff suppressed because it is too large Load Diff
+44 -2
View File
@@ -18,6 +18,8 @@
* IMD makes no representations about the suitability
* of this software for any purpose.
*
* Modifications for PPC405GP by Dennis Ehlin
*
*/
#include "ictrl.h"
@@ -41,6 +43,47 @@ rtems_isr_entry ictrl_vector_table[PPC_IRQ_EXT_MAX];
/*
* clear bits in EXISR that have a bit set in mask
*/
#if defined(ppc405)
RTEMS_INLINE_ROUTINE void
clr_exisr(unsigned32 mask)
{
asm volatile ("mtdcr 0xC0,%0"::"r" (mask));/*EXISR*/
}
/*
* get value of EXISR
*/
RTEMS_INLINE_ROUTINE unsigned32
get_exisr(void)
{
unsigned32 val;
asm volatile ("mfdcr %0,0xC0":"=r" (val));/*EXISR*/
return val;
}
/*
* get value of EXIER
*/
RTEMS_INLINE_ROUTINE unsigned32
get_exier(void)
{
unsigned32 val;
asm volatile ("mfdcr %0,0xC2":"=r" (val));/*EXIER*/
return val;
}
/*
* set value of EXIER
*/
RTEMS_INLINE_ROUTINE void
set_exier(unsigned32 val)
{
asm volatile ("mtdcr 0xC2,%0"::"r" (val));/*EXIER*/
}
#else /* not ppc405 */
RTEMS_INLINE_ROUTINE void
clr_exisr(unsigned32 mask)
{
@@ -78,7 +121,7 @@ set_exier(unsigned32 val)
{
asm volatile ("mtdcr 0x42,%0"::"r" (val));/*EXIER*/
}
#endif /* ppc405 */
/*
* enable an external interrupt, make this interrupt consistent
*/
@@ -191,7 +234,6 @@ ictrl_set_vector(rtems_isr_entry new_handler,
/* check for valid vector range */
if ((vector >= PPC_IRQ_EXT_BASE) &&
(vector < PPC_IRQ_EXT_BASE + PPC_IRQ_EXT_MAX)) {
/* return old handler entry */
*old_handler = ictrl_vector_table[vector - PPC_IRQ_EXT_BASE];
@@ -19,6 +19,8 @@
* IMD makes no representations about the suitability
* of this software for any purpose.
*
* Modifications for PPC405GP by Dennis Ehlin
*
*/
@@ -40,10 +42,19 @@ extern "C" {
/* mask for external interrupt status in EXIER/EXISR register */
/* note: critical interrupt is in these registers aswell */
#ifndef ppc405
#define PPC_EXI_MASK 0x0FFFFFFF
#else /* ppc405 */
#define PPC_EXI_MASK 0xFFFFFFFF
#endif /* ppc405 */
#ifndef ppc405
#define PPC_IRQ_EXT_SPIR (PPC_IRQ_EXT_BASE+4)
#define PPC_IRQ_EXT_SPIT (PPC_IRQ_EXT_BASE+5)
#else /* ppc405 */
#define PPC_IRQ_EXT_UART0 (PPC_IRQ_EXT_BASE+0)
#define PPC_IRQ_EXT_UART1 (PPC_IRQ_EXT_BASE+1)
#endif /* ppc405 */
#define PPC_IRQ_EXT_JTAGR (PPC_IRQ_EXT_BASE+6)
#define PPC_IRQ_EXT_JTAGT (PPC_IRQ_EXT_BASE+7)
#define PPC_IRQ_EXT_DMA0 (PPC_IRQ_EXT_BASE+8)
@@ -30,7 +30,10 @@
* found in the file LICENSE in this distribution or at
* http://www.OARcorp.com/rtems/license.html.
*
* Modifications for PPC405GP by Dennis Ehlin
*
* $Id$
*
*/
#include <rtems.h>
@@ -45,7 +48,13 @@ static inline rtems_unsigned32 get_itimer(void)
{
rtems_unsigned32 ret;
#ifndef ppc405
asm volatile ("mfspr %0, 0x3dd" : "=r" ((ret))); /* TBLO */
#else /* ppc405 */
/* asm volatile ("mfspr %0, 0x3dd" : "=r" ((ret))); TBLO */
asm volatile ("mfspr %0, 0x10c" : "=r" ((ret))); /* 405GP TBL */
#endif /* ppc405 */
return ret;
}
@@ -54,10 +63,21 @@ void Timer_initialize()
{
rtems_unsigned32 iocr;
#ifndef ppc405
asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); /* IOCR */
iocr &= ~4;
iocr |= 4; /* Select external timer clock */
asm volatile ("mtdcr 0xa0, %0" : "=r" (iocr) : "0" (iocr)); /* IOCR */
#else /* ppc405 */
asm volatile ("mfdcr %0, 0x0b2" : "=r" (iocr)); /*405GP CPC0_CR1 */
/* asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); IOCR */
/* iocr |= 0x800000; select external timer clock CETE*/
iocr &= ~0x800000; /* timer clocked from system clock CETE*/
asm volatile ("mtdcr 0x0b2, %0" : "=r" (iocr) : "0" (iocr)); /* 405GP CPC0_CR1 */
/* asm volatile ("mtdcr 0xa0, %0" : "=r" (iocr) : "0" (iocr)); IOCR */
#endif /* ppc405 */
Timer_starting = get_itimer();
}
@@ -0,0 +1,2 @@
Makefile
Makefile.in
@@ -0,0 +1,32 @@
##
## $Id$
##
AUTOMAKE_OPTIONS = foreign 1.4
PGM = $(ARCH)/tty_drv.rel
include_HEADERS = tty_drv.h
C_FILES = tty_drv.c
tty_drv_rel_OBJECTS = $(C_FILES:%.c=$(ARCH)/%.o)
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../automake/compile.am
include $(top_srcdir)/../../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(tty_drv_rel_OBJECTS)
$(make-rel)
all-local: $(ARCH) $(tty_drv_rel_OBJECTS) $(PGM)
.PRECIOUS: $(PGM)
EXTRA_DIST = tty_drv.c tty_drv.h
include $(top_srcdir)/../../../../../automake/local.am
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,63 @@
#ifdef ppc405
#ifndef __tty_drv__
#define __tty_drv__
/* functions */
#ifdef __cplusplus
extern "C" {
#endif
/* ttyS1 entry points */
rtems_device_driver tty0_initialize(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver tty0_open(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver tty0_control(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
/* tty1 & tty2 shared entry points */
rtems_device_driver tty0_close(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver tty0_read(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver tty0_write(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
#define TTY0_DRIVER_TABLE_ENTRY \
{ tty0_initialize, tty0_open, tty0_close, \
tty0_read, tty0_write, tty0_control }
#ifdef __cplusplus
}
#endif
/* end of include file */
#endif /* __tty_drv__ */
#endif /* ppc405 */