forked from Imagelibrary/rtems
various PowerPC code maintenance
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2009-11-03 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||||
|
|
||||||
|
* shared/clock/clock.c: Remove classic decrementer handler
|
||||||
|
* shared/vme/vme_universe.c: removed non-prototype warnings
|
||||||
|
|
||||||
2009-11-03 Ralf Corsépius <ralf.corsepius@rtems.org>
|
2009-11-03 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* shared/startup/probeMemEnd.c: Add missing prototypes.
|
* shared/startup/probeMemEnd.c: Add missing prototypes.
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
2009-11-02 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||||
|
|
||||||
|
* start/start.S: call to boot_card checked, removed warning
|
||||||
|
|
||||||
2009-10-22 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
2009-10-22 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
* Makefile.am, preinstall.am: Update for exception support changes.
|
* Makefile.am, preinstall.am: Update for exception support changes.
|
||||||
|
|||||||
@@ -90,11 +90,6 @@
|
|||||||
/* */
|
/* */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
#warning Call to boot_card has changed and needs checking.
|
|
||||||
#warning The call is "void boot_card(const char* cmdline);"
|
|
||||||
#warning You need to pass a NULL.
|
|
||||||
#warning Please check and remove these warnings.
|
|
||||||
|
|
||||||
#include <rtems/powerpc/cache.h>
|
#include <rtems/powerpc/cache.h>
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
2009-11-02 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||||
|
|
||||||
|
* start/start.S: call to boot_card checked, removed warning
|
||||||
|
|
||||||
2009-10-22 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
2009-10-22 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
* Makefile.am, preinstall.am: Update for exception support changes.
|
* Makefile.am, preinstall.am: Update for exception support changes.
|
||||||
|
|||||||
@@ -19,11 +19,6 @@
|
|||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
|
||||||
#warning Call to boot_card has changed and needs checking.
|
|
||||||
#warning The call is "void boot_card(const char* cmdline);"
|
|
||||||
#warning You need to pass a NULL.
|
|
||||||
#warning Please check and remove these warnings.
|
|
||||||
|
|
||||||
#include <libcpu/powerpc-utility.h>
|
#include <libcpu/powerpc-utility.h>
|
||||||
#include <rtems/powerpc/cache.h>
|
#include <rtems/powerpc/cache.h>
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
2009-11-03 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||||
|
|
||||||
|
* start/start.S: checked and removed boot_card warning
|
||||||
|
* irq/irq.c: adapted exception handler parameters
|
||||||
|
* startup/bspstart.c: removed non-prototype warnings
|
||||||
|
|
||||||
2009-10-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
2009-10-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||||
|
|
||||||
* vectors/vectors.h, vectors/vectors_init.c, vectors/vectors.S,
|
* vectors/vectors.h, vectors/vectors_init.c, vectors/vectors.S,
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ dist_project_lib_DATA += startup/linkcmds
|
|||||||
noinst_LIBRARIES += libbsp.a
|
noinst_LIBRARIES += libbsp.a
|
||||||
libbsp_a_SOURCES =
|
libbsp_a_SOURCES =
|
||||||
|
|
||||||
# pclock
|
# clock
|
||||||
libbsp_a_SOURCES += clock/p_clock.c
|
libbsp_a_SOURCES += ../shared/clock/clock.c
|
||||||
|
|
||||||
# console
|
# console
|
||||||
libbsp_a_SOURCES += console/console.c
|
libbsp_a_SOURCES += console/console.c
|
||||||
|
|
||||||
@@ -68,7 +69,6 @@ libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/shared/cpuIdent.rel \
|
|||||||
../../../libcpu/@RTEMS_CPU@/shared/cache.rel \
|
../../../libcpu/@RTEMS_CPU@/shared/cache.rel \
|
||||||
../../../libcpu/@RTEMS_CPU@/@exceptions@/rtems-cpu.rel \
|
../../../libcpu/@RTEMS_CPU@/@exceptions@/rtems-cpu.rel \
|
||||||
../../../libcpu/@RTEMS_CPU@/@exceptions@/exc_bspsupport.rel \
|
../../../libcpu/@RTEMS_CPU@/@exceptions@/exc_bspsupport.rel \
|
||||||
../../../libcpu/@RTEMS_CPU@/mpc8260/clock.rel \
|
|
||||||
../../../libcpu/@RTEMS_CPU@/mpc8260/console-generic.rel \
|
../../../libcpu/@RTEMS_CPU@/mpc8260/console-generic.rel \
|
||||||
../../../libcpu/@RTEMS_CPU@/mpc8260/cpm.rel \
|
../../../libcpu/@RTEMS_CPU@/mpc8260/cpm.rel \
|
||||||
../../../libcpu/@RTEMS_CPU@/mpc8260/mmu.rel \
|
../../../libcpu/@RTEMS_CPU@/mpc8260/mmu.rel \
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ volatile unsigned int maxLoop = 0;
|
|||||||
/*
|
/*
|
||||||
* High level IRQ handler called from shared_raw_irq_code_entry
|
* High level IRQ handler called from shared_raw_irq_code_entry
|
||||||
*/
|
*/
|
||||||
int C_dispatch_irq_handler (CPU_Interrupt_frame *frame, unsigned int excNum)
|
int C_dispatch_irq_handler (BSP_Exception_frame *frame, unsigned excNum)
|
||||||
{
|
{
|
||||||
register unsigned int irq;
|
register unsigned int irq;
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -33,11 +33,6 @@
|
|||||||
|
|
||||||
#include <rtems/asm.h>
|
#include <rtems/asm.h>
|
||||||
|
|
||||||
#warning Call to boot_card has changed and needs checking.
|
|
||||||
#warning The call is "void boot_card(const char* cmdline);"
|
|
||||||
#warning You need to pass a NULL.
|
|
||||||
#warning Please check and remove these warnings.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The initial stack is set to run BELOW the code base address.
|
* The initial stack is set to run BELOW the code base address.
|
||||||
* (between the vectors and text sections)
|
* (between the vectors and text sections)
|
||||||
|
|||||||
@@ -89,56 +89,56 @@ void _BSP_Fatal_error(unsigned int v)
|
|||||||
__asm__ __volatile ("sc");
|
__asm__ __volatile ("sc");
|
||||||
}
|
}
|
||||||
|
|
||||||
void _BSP_GPLED0_on()
|
void _BSP_GPLED0_on(void)
|
||||||
{
|
{
|
||||||
BCSR *csr;
|
BCSR *csr;
|
||||||
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
||||||
csr->bcsr0 &= ~GP0_LED; /* Turn on GP0 LED */
|
csr->bcsr0 &= ~GP0_LED; /* Turn on GP0 LED */
|
||||||
}
|
}
|
||||||
|
|
||||||
void _BSP_GPLED0_off()
|
void _BSP_GPLED0_off(void)
|
||||||
{
|
{
|
||||||
BCSR *csr;
|
BCSR *csr;
|
||||||
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
||||||
csr->bcsr0 |= GP0_LED; /* Turn off GP0 LED */
|
csr->bcsr0 |= GP0_LED; /* Turn off GP0 LED */
|
||||||
}
|
}
|
||||||
|
|
||||||
void _BSP_GPLED1_on()
|
void _BSP_GPLED1_on(void)
|
||||||
{
|
{
|
||||||
BCSR *csr;
|
BCSR *csr;
|
||||||
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
||||||
csr->bcsr0 &= ~GP1_LED; /* Turn on GP1 LED */
|
csr->bcsr0 &= ~GP1_LED; /* Turn on GP1 LED */
|
||||||
}
|
}
|
||||||
|
|
||||||
void _BSP_GPLED1_off()
|
void _BSP_GPLED1_off(void)
|
||||||
{
|
{
|
||||||
BCSR *csr;
|
BCSR *csr;
|
||||||
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
||||||
csr->bcsr0 |= GP1_LED; /* Turn off GP1 LED */
|
csr->bcsr0 |= GP1_LED; /* Turn off GP1 LED */
|
||||||
}
|
}
|
||||||
|
|
||||||
void _BSP_Uart1_enable()
|
void _BSP_Uart1_enable(void)
|
||||||
{
|
{
|
||||||
BCSR *csr;
|
BCSR *csr;
|
||||||
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
||||||
csr->bcsr1 &= ~UART1_E; /* Enable Uart1 */
|
csr->bcsr1 &= ~UART1_E; /* Enable Uart1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void _BSP_Uart1_disable()
|
void _BSP_Uart1_disable(void)
|
||||||
{
|
{
|
||||||
BCSR *csr;
|
BCSR *csr;
|
||||||
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
||||||
csr->bcsr1 |= UART1_E; /* Disable Uart1 */
|
csr->bcsr1 |= UART1_E; /* Disable Uart1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void _BSP_Uart2_enable()
|
void _BSP_Uart2_enable(void)
|
||||||
{
|
{
|
||||||
BCSR *csr;
|
BCSR *csr;
|
||||||
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
||||||
csr->bcsr1 &= ~UART2_E; /* Enable Uart2 */
|
csr->bcsr1 &= ~UART2_E; /* Enable Uart2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void _BSP_Uart2_disable()
|
void _BSP_Uart2_disable(void)
|
||||||
{
|
{
|
||||||
BCSR *csr;
|
BCSR *csr;
|
||||||
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
csr = (BCSR *)(m8260.memc[1].br & 0xFFFF8000);
|
||||||
@@ -149,7 +149,6 @@ void _BSP_Uart2_disable()
|
|||||||
void bsp_start(void)
|
void bsp_start(void)
|
||||||
{
|
{
|
||||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||||
extern void *_WorkspaceBase;
|
|
||||||
ppc_cpu_id_t myCpu;
|
ppc_cpu_id_t myCpu;
|
||||||
ppc_cpu_revision_t myCpuRevision;
|
ppc_cpu_revision_t myCpuRevision;
|
||||||
|
|
||||||
|
|||||||
@@ -94,35 +94,6 @@ static int ppc_clock_exception_handler( BSP_Exception_frame *frame, unsigned num
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ppc_clock_exception_handler_classic( BSP_Exception_frame *frame, unsigned number)
|
|
||||||
{
|
|
||||||
uint32_t reg1;
|
|
||||||
uint32_t reg2;
|
|
||||||
uint32_t msr;
|
|
||||||
|
|
||||||
/* Set new decrementer value */
|
|
||||||
asm volatile(
|
|
||||||
"lwz %1, ppc_clock_decrementer_value@sdarel(13);"
|
|
||||||
"mfdec %0;"
|
|
||||||
"add %0, %0, %1;"
|
|
||||||
"mtdec %0"
|
|
||||||
: "=r" (reg1), "=r" (reg2)
|
|
||||||
);
|
|
||||||
|
|
||||||
/* Increment clock ticks */
|
|
||||||
Clock_driver_ticks += 1;
|
|
||||||
|
|
||||||
/* Enable external exceptions */
|
|
||||||
msr = ppc_external_exceptions_enable();
|
|
||||||
|
|
||||||
/* Call clock ticker */
|
|
||||||
ppc_clock_tick();
|
|
||||||
|
|
||||||
/* Restore machine state */
|
|
||||||
ppc_external_exceptions_disable( msr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ppc_clock_exception_handler_booke( BSP_Exception_frame *frame, unsigned number)
|
static int ppc_clock_exception_handler_booke( BSP_Exception_frame *frame, unsigned number)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ int BSP_VMEInit(void)
|
|||||||
vmeTsi148Reset();
|
vmeTsi148Reset();
|
||||||
#ifdef VME_CLEAR_BRIDGE_ERRORS
|
#ifdef VME_CLEAR_BRIDGE_ERRORS
|
||||||
{
|
{
|
||||||
extern unsigned short (*_BSP_clear_vmebridge_errors)();
|
extern unsigned short (*_BSP_clear_vmebridge_errors)(void);
|
||||||
|
|
||||||
_BSP_clear_vmebridge_errors = VME_CLEAR_BRIDGE_ERRORS;
|
_BSP_clear_vmebridge_errors = VME_CLEAR_BRIDGE_ERRORS;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
2009-11-03 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||||
|
|
||||||
|
* startup/bspstart.s, console/console.c: various fixes
|
||||||
|
|
||||||
2009-10-28 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
2009-10-28 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||||
|
|
||||||
* startup/bspstart.s: correct clock tick init
|
* startup/bspstart.s: correct clock tick init
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
/*
|
/*
|
||||||
* Interrupt-driven input buffer
|
* Interrupt-driven input buffer
|
||||||
*/
|
*/
|
||||||
#define RXBUFSIZE 256
|
#define RXBUFSIZE 16
|
||||||
|
|
||||||
#define M8xx_SICR_BRG1 (0)
|
#define M8xx_SICR_BRG1 (0)
|
||||||
#define M8xx_SICR_BRG2 (1)
|
#define M8xx_SICR_BRG2 (1)
|
||||||
@@ -662,7 +662,7 @@ sccInitialize (int chan)
|
|||||||
sccFrstRxBd[chan][i].status |= M8xx_BD_WRAP;
|
sccFrstRxBd[chan][i].status |= M8xx_BD_WRAP;
|
||||||
}
|
}
|
||||||
sccFrstRxBd[chan][i].length = 0;
|
sccFrstRxBd[chan][i].length = 0;
|
||||||
sccFrstRxBd[chan][i].buffer = rxBuf[chan][i];
|
sccFrstRxBd[chan][i].buffer = (*rxBuf[chan])[i];
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Setup the Transmit Buffer Descriptor
|
* Setup the Transmit Buffer Descriptor
|
||||||
@@ -728,32 +728,44 @@ sccInitialize (int chan)
|
|||||||
static int
|
static int
|
||||||
sccPollRead (int minor)
|
sccPollRead (int minor)
|
||||||
{
|
{
|
||||||
unsigned char c;
|
int c = -1;
|
||||||
int chan = minor;
|
int chan = minor;
|
||||||
|
|
||||||
if ((sccCurrRxBd[chan]->status & M8xx_BD_EMPTY) != 0) {
|
while(1) {
|
||||||
return -1;
|
if ((sccCurrRxBd[chan]->status & M8xx_BD_EMPTY) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 == (sccCurrRxBd[chan]->status & (M8xx_BD_OVERRUN
|
||||||
|
| M8xx_BD_PARITY_ERROR
|
||||||
|
| M8xx_BD_FRAMING_ERROR
|
||||||
|
| M8xx_BD_BREAK
|
||||||
|
| M8xx_BD_IDLE))) {
|
||||||
|
/* character received and no error detected */
|
||||||
|
rtems_cache_invalidate_multiple_data_lines((void *)sccCurrRxBd[chan]->buffer,
|
||||||
|
sccCurrRxBd[chan]->length);
|
||||||
|
c = (unsigned)*((char *)sccCurrRxBd[chan]->buffer);
|
||||||
|
/*
|
||||||
|
* clear status
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
sccCurrRxBd[chan]->status =
|
||||||
|
(sccCurrRxBd[chan]->status
|
||||||
|
& (M8xx_BD_WRAP | M8xx_BD_INTERRUPT))
|
||||||
|
| M8xx_BD_EMPTY;
|
||||||
|
/*
|
||||||
|
* advance to next BD
|
||||||
|
*/
|
||||||
|
if ((sccCurrRxBd[chan]->status & M8xx_BD_WRAP) != 0) {
|
||||||
|
sccCurrRxBd[chan] = sccFrstRxBd[chan];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sccCurrRxBd[chan]++;
|
||||||
|
}
|
||||||
|
if (c >= 0) {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rtems_cache_invalidate_multiple_data_lines((void *)sccCurrRxBd[chan]->buffer,
|
|
||||||
sccCurrRxBd[chan]->length);
|
|
||||||
c = *((char *)sccCurrRxBd[chan]->buffer);
|
|
||||||
/*
|
|
||||||
* clear status
|
|
||||||
*/
|
|
||||||
sccCurrRxBd[chan]->status =
|
|
||||||
(sccCurrRxBd[chan]->status
|
|
||||||
& (M8xx_BD_WRAP | M8xx_BD_INTERRUPT))
|
|
||||||
| M8xx_BD_EMPTY;
|
|
||||||
/*
|
|
||||||
* advance to next BD
|
|
||||||
*/
|
|
||||||
if ((sccCurrRxBd[chan]->status & M8xx_BD_WRAP) != 0) {
|
|
||||||
sccCurrRxBd[chan] = sccFrstRxBd[chan];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
sccCurrRxBd[chan]++;
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -173,9 +173,7 @@ void bsp_start( void)
|
|||||||
BSP_panic("Cannot determine BUS frequency\n");
|
BSP_panic("Cannot determine BUS frequency\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bsp_clicks_per_usec = BSP_bus_frequency/16; /* force to zero to control
|
bsp_clicks_per_usec = BSP_bus_frequency/1000000/16;
|
||||||
* PIT clock driver from EXTCLK
|
|
||||||
*/
|
|
||||||
bsp_timer_least_valid = 3;
|
bsp_timer_least_valid = 3;
|
||||||
bsp_timer_average_overhead = 3;
|
bsp_timer_average_overhead = 3;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,28 @@
|
|||||||
2009-10-23 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
|
2009-11-03 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
|
||||||
|
|
||||||
|
* shared/include/powerpc-utility.h, shared/include/byteorder.h,
|
||||||
|
shared/include/cpuIdent.h:
|
||||||
|
add c++ declaration brackets
|
||||||
|
* Makefile.am, mpc8260/clock: removed mpc8260 specific clock
|
||||||
|
driver
|
||||||
|
* e500/mmu/e500_mmu.h, e500/mmu/mmu.c,: removed "non-prototype"
|
||||||
|
warning
|
||||||
|
* mpc8260/timer/timer.c: moved extern declarations outside
|
||||||
|
function body
|
||||||
|
* mpc8xx/mmu/mmu.c: enable data cache when MMU is off to avoid
|
||||||
|
cache confusion during exception entry
|
||||||
|
|
||||||
|
2009-11-02 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
|
||||||
|
|
||||||
|
* mpc8xx/mmu/mmu.c:
|
||||||
|
enable data chache, when MMU is disabled
|
||||||
|
|
||||||
|
2009-10-30 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
|
||||||
|
|
||||||
|
* mpc6xx/clock/c_clock.c:
|
||||||
|
moved timebase/decrementer access from cpukit to libcpu
|
||||||
|
|
||||||
|
2009-10-29 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
|
||||||
|
|
||||||
* shared/include/powerpc-utility.h, mpc6xx/timer/timer.c:
|
* shared/include/powerpc-utility.h, mpc6xx/timer/timer.c:
|
||||||
moved timebase/decrementer access from cpukit to libcpu
|
moved timebase/decrementer access from cpukit to libcpu
|
||||||
|
|||||||
@@ -324,12 +324,6 @@ mpc8260_console_generic_rel_SOURCES = mpc8260/console-generic/console-generic.c
|
|||||||
mpc8260_console_generic_rel_CPPFLAGS = $(AM_CPPFLAGS)
|
mpc8260_console_generic_rel_CPPFLAGS = $(AM_CPPFLAGS)
|
||||||
mpc8260_console_generic_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
mpc8260_console_generic_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||||
|
|
||||||
# mpc8260/clock
|
|
||||||
noinst_PROGRAMS += mpc8260/clock.rel
|
|
||||||
mpc8260_clock_rel_SOURCES = mpc8260/clock/clock.c
|
|
||||||
mpc8260_clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
|
|
||||||
mpc8260_clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
|
||||||
|
|
||||||
# mpc8260/cpm
|
# mpc8260/cpm
|
||||||
include_mpc8260_HEADERS += mpc8260/include/cpm.h
|
include_mpc8260_HEADERS += mpc8260/include/cpm.h
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ rtems_e500_prtlb(rtems_e500_tlb_idx key, int quiet, FILE *f);
|
|||||||
* (other than disabling them).
|
* (other than disabling them).
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
rtems_e500_initlb();
|
rtems_e500_initlb(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write TLB1 entry (can also be used to disable an entry).
|
* Write TLB1 entry (can also be used to disable an entry).
|
||||||
|
|||||||
@@ -180,7 +180,7 @@
|
|||||||
|
|
||||||
/* Factory to generate inline macros for accessing the MAS registers */
|
/* Factory to generate inline macros for accessing the MAS registers */
|
||||||
#define __RDWRMAS(mas,rmas) \
|
#define __RDWRMAS(mas,rmas) \
|
||||||
static inline uint32_t _read_MAS##mas() \
|
static inline uint32_t _read_MAS##mas(void) \
|
||||||
{ uint32_t x; asm volatile("mfspr %0, %1": "=r"(x):"i"(rmas)); return x; } \
|
{ uint32_t x; asm volatile("mfspr %0, %1": "=r"(x):"i"(rmas)); return x; } \
|
||||||
static inline void _write_MAS##mas(uint32_t x) \
|
static inline void _write_MAS##mas(uint32_t x) \
|
||||||
{ asm volatile("mtspr %1, %0":: "r"(x),"i"(rmas)); }
|
{ asm volatile("mtspr %1, %0":: "r"(x),"i"(rmas)); }
|
||||||
|
|||||||
@@ -1,181 +0,0 @@
|
|||||||
/* clock.c
|
|
||||||
*
|
|
||||||
* This routine initializes the PIT on the MPC8xx.
|
|
||||||
* The tick frequency is specified by the bsp.
|
|
||||||
*
|
|
||||||
* Author: Jay Monkman (jmonkman@frasca.com)
|
|
||||||
* Copyright (C) 1998 by Frasca International, Inc.
|
|
||||||
*
|
|
||||||
* Derived from c/src/lib/libcpu/ppc/ppc403/clock/clock.c:
|
|
||||||
*
|
|
||||||
* Author: Andrew Bray <andy@i-cubed.co.uk>
|
|
||||||
*
|
|
||||||
* COPYRIGHT (c) 1995 by i-cubed ltd.
|
|
||||||
*
|
|
||||||
* To anyone who acknowledges that this file is provided "AS IS"
|
|
||||||
* without any express or implied warranty:
|
|
||||||
* permission to use, copy, modify, and distribute this file
|
|
||||||
* for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice and this notice appears in all
|
|
||||||
* copies, and that the name of i-cubed limited not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the
|
|
||||||
* software without specific, written prior permission.
|
|
||||||
* i-cubed limited makes no representations about the suitability
|
|
||||||
* of this software for any purpose.
|
|
||||||
*
|
|
||||||
* Derived from c/src/lib/libcpu/hppa1_1/clock/clock.c:
|
|
||||||
*
|
|
||||||
* COPYRIGHT (c) 1989-2007.
|
|
||||||
* On-Line Applications Research Corporation (OAR).
|
|
||||||
*
|
|
||||||
* 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.h>
|
|
||||||
#include <rtems/clockdrv.h>
|
|
||||||
#include <rtems/libio.h>
|
|
||||||
|
|
||||||
#include <stdlib.h> /* for atexit() */
|
|
||||||
#include <mpc8260.h>
|
|
||||||
#include <bsp/irq.h>
|
|
||||||
|
|
||||||
volatile uint32_t Clock_driver_ticks;
|
|
||||||
extern int BSP_get_clock_irq_level(void);
|
|
||||||
extern int BSP_connect_clock_handler(rtems_isr_entry);
|
|
||||||
extern int BSP_disconnect_clock_handler(void);
|
|
||||||
|
|
||||||
void Clock_exit( void );
|
|
||||||
|
|
||||||
uint32_t decrementer_value;
|
|
||||||
|
|
||||||
volatile int ClockInitialised = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These are set by clock driver during its init
|
|
||||||
*/
|
|
||||||
|
|
||||||
rtems_device_major_number rtems_clock_major = ~0;
|
|
||||||
rtems_device_minor_number rtems_clock_minor;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ISR Handler
|
|
||||||
*/
|
|
||||||
rtems_isr Clock_isr(rtems_vector_number vector)
|
|
||||||
{
|
|
||||||
int clicks;
|
|
||||||
|
|
||||||
if( ClockInitialised ) {
|
|
||||||
PPC_Get_decrementer( clicks );
|
|
||||||
do {
|
|
||||||
clicks += decrementer_value;
|
|
||||||
PPC_Set_decrementer( clicks );
|
|
||||||
|
|
||||||
Clock_driver_ticks++;
|
|
||||||
rtems_clock_tick();
|
|
||||||
} while( clicks < 100 );
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
m8260.piscr |= M8260_PISCR_PS;
|
|
||||||
Clock_driver_ticks++;
|
|
||||||
rtems_clock_tick();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void clockOn(void* unused)
|
|
||||||
{
|
|
||||||
extern uint32_t bsp_clicks_per_usec;
|
|
||||||
|
|
||||||
decrementer_value = rtems_configuration_get_microseconds_per_tick() *
|
|
||||||
bsp_clicks_per_usec - 1;
|
|
||||||
|
|
||||||
PPC_Set_decrementer( decrementer_value );
|
|
||||||
Clock_driver_ticks = 0;
|
|
||||||
|
|
||||||
ClockInitialised = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Called via atexit()
|
|
||||||
* Remove the clock interrupt handler by setting handler to NULL
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clockOff(void* unused)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
/* disable PIT and PIT interrupts */
|
|
||||||
m8260.piscr &= ~(M8260_PISCR_PTE | M8260_PISCR_PIE);
|
|
||||||
#endif
|
|
||||||
ClockInitialised = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int clockIsOn(void* unused)
|
|
||||||
{
|
|
||||||
return ClockInitialised;
|
|
||||||
#if 0
|
|
||||||
if (m8260.piscr & M8260_PISCR_PIE) return 1;
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Called via atexit()
|
|
||||||
* Remove the clock interrupt handler by setting handler to NULL
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
Clock_exit(void)
|
|
||||||
{
|
|
||||||
(void) BSP_disconnect_clock_handler ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Install_clock(rtems_isr_entry clock_isr)
|
|
||||||
{
|
|
||||||
extern uint32_t bsp_clicks_per_usec;
|
|
||||||
|
|
||||||
Clock_driver_ticks = 0;
|
|
||||||
|
|
||||||
decrementer_value = rtems_configuration_get_microseconds_per_tick() *
|
|
||||||
bsp_clicks_per_usec - 1;
|
|
||||||
|
|
||||||
PPC_Set_decrementer( decrementer_value );
|
|
||||||
|
|
||||||
BSP_connect_clock_handler (clock_isr);
|
|
||||||
|
|
||||||
|
|
||||||
ClockInitialised = 1;
|
|
||||||
|
|
||||||
atexit(Clock_exit);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ReInstall_clock(rtems_isr_entry new_clock_isr)
|
|
||||||
{
|
|
||||||
BSP_connect_clock_handler (new_clock_isr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
rtems_device_driver Clock_initialize(
|
|
||||||
rtems_device_major_number major,
|
|
||||||
rtems_device_minor_number minor,
|
|
||||||
void *pargp
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Install_clock( Clock_isr );
|
|
||||||
|
|
||||||
/*
|
|
||||||
* make major/minor avail to others such as shared memory driver
|
|
||||||
*/
|
|
||||||
|
|
||||||
rtems_clock_major = major;
|
|
||||||
rtems_clock_minor = minor;
|
|
||||||
|
|
||||||
return RTEMS_SUCCESSFUL;
|
|
||||||
}
|
|
||||||
@@ -78,12 +78,12 @@ void benchmark_timer_initialize(void)
|
|||||||
Timer_starting = get_itimer();
|
Timer_starting = get_itimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern uint32_t bsp_timer_least_valid;
|
||||||
|
extern uint32_t bsp_timer_average_overhead;
|
||||||
int benchmark_timer_read(void)
|
int benchmark_timer_read(void)
|
||||||
{
|
{
|
||||||
uint32_t clicks;
|
uint32_t clicks;
|
||||||
uint32_t total;
|
uint32_t total;
|
||||||
extern uint32_t bsp_timer_least_valid;
|
|
||||||
extern uint32_t bsp_timer_average_overhead;
|
|
||||||
|
|
||||||
clicks = get_itimer();
|
clicks = get_itimer();
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,11 @@ void mmu_init( void )
|
|||||||
* Initialize IMMU & DMMU Control Registers (MI_CTR & MD_CTR)
|
* Initialize IMMU & DMMU Control Registers (MI_CTR & MD_CTR)
|
||||||
* GPM [0] 0b0 = PowerPC mode
|
* GPM [0] 0b0 = PowerPC mode
|
||||||
* PPM [1] 0b0 = Page resolution of protection
|
* PPM [1] 0b0 = Page resolution of protection
|
||||||
* CIDEF [2] 0b0/0b1 = Default cache-inhibit attribute =
|
* CIDEF [2] 0b0/0b0 = Default cache-inhibit attribute =
|
||||||
* NO for IMMU, YES for DMMU!
|
* NO for IMMU, NO for DMMU
|
||||||
|
* NOTE: it is vital that data caching is ON, when
|
||||||
|
* DMMU is off, otherwise valid/dirty values in
|
||||||
|
* cache would be ignored during exception entry
|
||||||
* reserved/WTDEF [3] 0b0 = Default write-through attribute = not
|
* reserved/WTDEF [3] 0b0 = Default write-through attribute = not
|
||||||
* RSV4x [4] 0b0 = 4 entries not reserved
|
* RSV4x [4] 0b0 = 4 entries not reserved
|
||||||
* reserved/TWAM [5] 0b0/0b1 = 4-Kbyte page hardware assist
|
* reserved/TWAM [5] 0b0/0b1 = 4-Kbyte page hardware assist
|
||||||
@@ -67,7 +70,7 @@ void mmu_init( void )
|
|||||||
*/
|
*/
|
||||||
reg1 = M8xx_MI_CTR_ITLB_INDX(31);
|
reg1 = M8xx_MI_CTR_ITLB_INDX(31);
|
||||||
_mtspr( M8xx_MI_CTR, reg1 );
|
_mtspr( M8xx_MI_CTR, reg1 );
|
||||||
reg1 = M8xx_MD_CTR_CIDEF | M8xx_MD_CTR_TWAM | M8xx_MD_CTR_DTLB_INDX(31);
|
reg1 = M8xx_MD_CTR_TWAM | M8xx_MD_CTR_DTLB_INDX(31);
|
||||||
_mtspr( M8xx_MD_CTR, reg1 );
|
_mtspr( M8xx_MD_CTR, reg1 );
|
||||||
_isync;
|
_isync;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
#ifndef _LIBCPU_BYTEORDER_H
|
#ifndef _LIBCPU_BYTEORDER_H
|
||||||
#define _LIBCPU_BYTEORDER_H
|
#define _LIBCPU_BYTEORDER_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
||||||
extern __inline__ unsigned ld_le16(volatile uint16_t *addr)
|
extern __inline__ unsigned ld_le16(volatile uint16_t *addr)
|
||||||
@@ -49,4 +53,8 @@ extern __inline__ void st_le32(volatile uint32_t *addr, unsigned val)
|
|||||||
|
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _LIBCPU_BYTEORDER_H */
|
#endif /* _LIBCPU_BYTEORDER_H */
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ASM
|
#ifndef ASM
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -130,4 +134,8 @@ static inline bool ppc_cpu_is(ppc_cpu_id_t cpu)
|
|||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,10 +26,10 @@
|
|||||||
* @defgroup powerpc_shared Shared PowerPC Code
|
* @defgroup powerpc_shared Shared PowerPC Code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBCPU_POWERPC_UTILITY_H
|
#ifndef __LIBCPU_POWERPC_UTILITY_H
|
||||||
#define LIBCPU_POWERPC_UTILITY_H
|
#define __LIBCPU_POWERPC_UTILITY_H
|
||||||
|
|
||||||
#ifndef ASM
|
#if !defined(ASM)
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -37,7 +37,11 @@
|
|||||||
#include <rtems/powerpc/registers.h>
|
#include <rtems/powerpc/registers.h>
|
||||||
#include <rtems/powerpc/powerpc.h>
|
#include <rtems/powerpc/powerpc.h>
|
||||||
|
|
||||||
#ifndef ASM
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(ASM)
|
||||||
|
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
#include <rtems/system.h>
|
#include <rtems/system.h>
|
||||||
@@ -242,7 +246,6 @@ static inline void ppc_external_exceptions_disable(uint32_t msr)
|
|||||||
RTEMS_COMPILER_MEMORY_BARRIER();
|
RTEMS_COMPILER_MEMORY_BARRIER();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ASM
|
|
||||||
/*
|
/*
|
||||||
* Simple spin delay in microsecond units for device drivers.
|
* Simple spin delay in microsecond units for device drivers.
|
||||||
* This is very dependent on the clock speed of the target.
|
* This is very dependent on the clock speed of the target.
|
||||||
@@ -291,9 +294,6 @@ extern uint32_t bsp_clicks_per_usec;
|
|||||||
while (now - start < (_cycles)); \
|
while (now - start < (_cycles)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif /* ASM */
|
|
||||||
|
|
||||||
#ifndef ASM
|
|
||||||
/*
|
/*
|
||||||
* Routines to access the decrementer register
|
* Routines to access the decrementer register
|
||||||
*/
|
*/
|
||||||
@@ -306,9 +306,6 @@ extern uint32_t bsp_clicks_per_usec;
|
|||||||
#define PPC_Get_decrementer( _clicks ) \
|
#define PPC_Get_decrementer( _clicks ) \
|
||||||
asm volatile( "mfdec %0" : "=r" (_clicks) )
|
asm volatile( "mfdec %0" : "=r" (_clicks) )
|
||||||
|
|
||||||
#endif /* ASM */
|
|
||||||
|
|
||||||
#ifndef ASM
|
|
||||||
/*
|
/*
|
||||||
* Routines to access the time base register
|
* Routines to access the time base register
|
||||||
*/
|
*/
|
||||||
@@ -350,7 +347,6 @@ static inline void PPC_Set_timebase_register (uint64_t tbr)
|
|||||||
asm volatile( "mtspr 285, %0" : : "r" (tbr_high));
|
asm volatile( "mtspr 285, %0" : : "r" (tbr_high));
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* ASM */
|
|
||||||
|
|
||||||
static inline uint32_t ppc_decrementer_register(void)
|
static inline uint32_t ppc_decrementer_register(void)
|
||||||
{
|
{
|
||||||
@@ -581,8 +577,9 @@ static inline void ppc_set_time_base_64(uint64_t val)
|
|||||||
|
|
||||||
void ppc_code_copy(void *dest, const void *src, size_t n);
|
void ppc_code_copy(void *dest, const void *src, size_t n);
|
||||||
|
|
||||||
#else /* ASM */
|
#endif /* ifndef ASM */
|
||||||
|
|
||||||
|
#if defined(ASM)
|
||||||
#include <rtems/asm.h>
|
#include <rtems/asm.h>
|
||||||
|
|
||||||
.macro LA reg, addr
|
.macro LA reg, addr
|
||||||
@@ -656,4 +653,8 @@ void ppc_code_copy(void *dest, const void *src, size_t n);
|
|||||||
|
|
||||||
#endif /* ASM */
|
#endif /* ASM */
|
||||||
|
|
||||||
#endif /* LIBCPU_POWERPC_UTILITY_H */
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __LIBCPU_POWERPC_UTILITY_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user