forked from Imagelibrary/rtems
2007-11-28 Joel Sherrill <joel.sherrill@OARcorp.com>
* mpc5xx/clock/clock.c, mpc5xx/timer/timer.c, mpc8260/clock/clock.c, mpc8260/cpm/brg.c, mpc8260/timer/timer.c, mpc8xx/clock/clock.c, mpc8xx/console-generic/console-generic.c, mpc8xx/timer/timer.c, new-exceptions/raw_exception.c, old-exceptions/cpu.c, ppc403/clock/clock.c, ppc403/console/console.c, ppc403/console/console.c.polled, ppc403/console/console405.c, ppc403/ictrl/ictrl.c, ppc403/irq/ictrl.c, ppc403/timer/timer.c, ppc403/tty_drv/tty_drv.c: Eliminate PowerPC specific elements from the CPU Table. They have been replaced with variables named bsp_XXX as needed.
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
2007-11-28 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* mpc5xx/clock/clock.c, mpc5xx/timer/timer.c, mpc8260/clock/clock.c,
|
||||
mpc8260/cpm/brg.c, mpc8260/timer/timer.c, mpc8xx/clock/clock.c,
|
||||
mpc8xx/console-generic/console-generic.c, mpc8xx/timer/timer.c,
|
||||
new-exceptions/raw_exception.c, old-exceptions/cpu.c,
|
||||
ppc403/clock/clock.c, ppc403/console/console.c,
|
||||
ppc403/console/console.c.polled, ppc403/console/console405.c,
|
||||
ppc403/ictrl/ictrl.c, ppc403/irq/ictrl.c, ppc403/timer/timer.c,
|
||||
ppc403/tty_drv/tty_drv.c: Eliminate PowerPC specific elements from
|
||||
the CPU Table. They have been replaced with variables named bsp_XXX
|
||||
as needed.
|
||||
|
||||
2007-11-28 Till Straumann <strauman@slac.stanford.edu>
|
||||
|
||||
* shared/src/cache.c: removed redundant mpc8xx versions
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/clock/clock.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -79,10 +79,11 @@ void clockOn(void* unused)
|
||||
{
|
||||
unsigned desiredLevel;
|
||||
uint32_t pit_value;
|
||||
extern uint32_t bsp_clicks_per_usec;
|
||||
|
||||
/* calculate and set modulus */
|
||||
pit_value = (rtems_configuration_get_microseconds_per_tick() *
|
||||
rtems_cpu_configuration_get_clicks_per_usec()) - 1 ;
|
||||
bsp_clicks_per_usec) - 1 ;
|
||||
|
||||
if (pit_value > 0xffff) { /* pit is only 16 bits long */
|
||||
rtems_fatal_error_occurred(-1);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -79,18 +79,12 @@ void Timer_initialize(void)
|
||||
Timer_starting = get_itimer();
|
||||
}
|
||||
|
||||
#ifndef rtems_cpu_configuration_get_timer_least_valid
|
||||
#define rtems_cpu_configuration_get_timer_least_valid() 0
|
||||
#endif
|
||||
|
||||
#ifndef rtems_cpu_configuration_get_timer_average_overhead
|
||||
#define rtems_cpu_configuration_get_timer_average_overhead() 0
|
||||
#endif
|
||||
|
||||
int Read_timer(void)
|
||||
{
|
||||
uint32_t clicks;
|
||||
uint32_t total;
|
||||
extern uint32_t bsp_timer_least_valid;
|
||||
extern uint32_t bsp_timer_average_overhead;
|
||||
|
||||
clicks = get_itimer();
|
||||
|
||||
@@ -100,10 +94,10 @@ int Read_timer(void)
|
||||
return total; /* in XXX microsecond units */
|
||||
|
||||
else {
|
||||
if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
|
||||
if ( total < bsp_timer_least_valid ) {
|
||||
return 0; /* below timer resolution */
|
||||
}
|
||||
return (total - rtems_cpu_configuration_get_timer_average_overhead());
|
||||
return (total - bsp_timer_average_overhead);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/clock/clock.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -90,36 +90,17 @@ rtems_isr Clock_isr(rtems_vector_number vector)
|
||||
|
||||
void clockOn(void* unused)
|
||||
{
|
||||
extern uint32_t bsp_clicks_per_usec;
|
||||
|
||||
decrementer_value = rtems_configuration_get_microseconds_per_tick() *
|
||||
rtems_cpu_configuration_get_clicks_per_usec() - 1;
|
||||
bsp_clicks_per_usec - 1;
|
||||
|
||||
PPC_Set_decrementer( decrementer_value );
|
||||
Clock_driver_ticks = 0;
|
||||
|
||||
ClockInitialised = 1;
|
||||
|
||||
|
||||
#if 0
|
||||
unsigned desiredLevel;
|
||||
uint32_t pit_value;
|
||||
|
||||
pit_value = (rtems_configuration_get_microseconds_per_tick() *
|
||||
rtems_cpu_configuration_get_clicks_per_usec()) - 1 ;
|
||||
|
||||
if (pit_value > 0xffff) { /* pit is only 16 bits long */
|
||||
rtems_fatal_error_occurred(-1);
|
||||
}
|
||||
m8260.sccr &= ~(1<<24);
|
||||
m8260.pitc = pit_value;
|
||||
|
||||
desiredLevel = BSP_get_clock_irq_level();
|
||||
/* set PIT irq level, enable PIT, PIT interrupts */
|
||||
/* and clear int. status */
|
||||
m8260.piscr = /*M8260_PISCR_PIRQ(desiredLevel) |*/
|
||||
M8260_PISCR_PTE | M8260_PISCR_PS | M8260_PISCR_PIE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Called via atexit()
|
||||
* Remove the clock interrupt handler by setting handler to NULL
|
||||
@@ -156,11 +137,12 @@ Clock_exit(void)
|
||||
|
||||
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() *
|
||||
rtems_cpu_configuration_get_clicks_per_usec() - 1;
|
||||
bsp_clicks_per_usec - 1;
|
||||
|
||||
PPC_Set_decrementer( decrementer_value );
|
||||
|
||||
|
||||
@@ -51,9 +51,6 @@ static unsigned int brg_use_count[NUM_BRGS];
|
||||
/* (initialised to zeros) */
|
||||
static unsigned int clk_use_count[NUM_BRGS];
|
||||
|
||||
|
||||
extern rtems_cpu_table Cpu_table;
|
||||
|
||||
/*
|
||||
* Compute baud-rate-generator configuration register value
|
||||
*/
|
||||
@@ -62,8 +59,9 @@ m8xx_get_brg_cd (int baud)
|
||||
{
|
||||
int divisor;
|
||||
int div16 = 0;
|
||||
extern uint32_t bsp_serial_per_sec;
|
||||
|
||||
divisor = ((Cpu_table.serial_per_sec) + (baud / 2)) / baud;
|
||||
divisor = ((bsp_serial_per_sec) + (baud / 2)) / baud;
|
||||
if (divisor > 4096) {
|
||||
div16 = 1;
|
||||
divisor = (divisor + 8) / 16;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -84,6 +84,8 @@ int Read_timer(void)
|
||||
{
|
||||
uint32_t clicks;
|
||||
uint32_t total;
|
||||
extern uint32_t bsp_timer_least_valid;
|
||||
extern uint32_t bsp_timer_average_overhead;
|
||||
|
||||
clicks = get_itimer();
|
||||
|
||||
@@ -93,10 +95,10 @@ int Read_timer(void)
|
||||
return total; /* in XXX microsecond units */
|
||||
|
||||
else {
|
||||
if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
|
||||
if ( total < bsp_timer_least_valid ) {
|
||||
return 0; /* below timer resolution */
|
||||
}
|
||||
return (total - rtems_cpu_configuration_get_timer_average_overhead());
|
||||
return (total - bsp_timer_average_overhead);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/clock/clock.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -73,12 +73,15 @@ void clockOn(void* unused)
|
||||
uint32_t pit_value;
|
||||
uint32_t mf_value;
|
||||
rtems_boolean force_prescaler = FALSE;
|
||||
if (rtems_cpu_configuration_get_clicks_per_usec() == 0) {
|
||||
extern uint32_t bsp_clicks_per_usec;
|
||||
extern uint32_t bsp_clock_speed;
|
||||
|
||||
if (bsp_clicks_per_usec == 0) {
|
||||
/*
|
||||
* oscclk is too low for PIT, compute extclk and derive PIT from there
|
||||
*/
|
||||
mf_value = m8xx.plprcr >> 20;
|
||||
pit_value = (_CPU_Table.clock_speed
|
||||
pit_value = (bsp_clock_speed
|
||||
/ (mf_value+1)
|
||||
/ 1000
|
||||
/ 4
|
||||
@@ -89,7 +92,7 @@ void clockOn(void* unused)
|
||||
}
|
||||
else {
|
||||
pit_value = (rtems_configuration_get_microseconds_per_tick() *
|
||||
rtems_cpu_configuration_get_clicks_per_usec());
|
||||
bsp_clicks_per_usec);
|
||||
|
||||
m8xx.sccr &= ~(1<<23);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
* Saskatoon, Saskatchewan, CANADA
|
||||
* eric@skatter.usask.ca
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* Modifications by Darlene Stewart <Darlene.Stewart@iit.nrc.ca>
|
||||
@@ -57,7 +57,6 @@
|
||||
#include <rtems/bspIo.h> /* for printk */
|
||||
|
||||
int BSP_irq_enabled_at_cpm(const rtems_irq_number irqLine);
|
||||
extern rtems_cpu_table Cpu_table;
|
||||
|
||||
/* BSP supplied routine */
|
||||
extern int mbx8xx_console_get_configuration();
|
||||
@@ -111,8 +110,9 @@ m8xx_get_brg_cd (int baud)
|
||||
{
|
||||
int divisor;
|
||||
int div16 = 0;
|
||||
extern uint32_t bsp_clock_speed;
|
||||
|
||||
divisor = ((Cpu_table.clock_speed / 16) + (baud / 2)) / baud;
|
||||
divisor = ((bsp_clock_speed / 16) + (baud / 2)) / baud;
|
||||
if (divisor > 4096) {
|
||||
div16 = 1;
|
||||
divisor = (divisor + 8) / 16;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1_1/timer/timer.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -69,18 +69,12 @@ void Timer_initialize(void)
|
||||
Timer_starting = get_itimer();
|
||||
}
|
||||
|
||||
#ifndef rtems_cpu_configuration_get_timer_least_valid
|
||||
#define rtems_cpu_configuration_get_timer_least_valid() 0
|
||||
#endif
|
||||
|
||||
#ifndef rtems_cpu_configuration_get_timer_average_overhead
|
||||
#define rtems_cpu_configuration_get_timer_average_overhead() 0
|
||||
#endif
|
||||
|
||||
int Read_timer(void)
|
||||
{
|
||||
uint32_t clicks;
|
||||
uint32_t total;
|
||||
extern uint32_t bsp_timer_least_valid;
|
||||
extern uint32_t bsp_timer_average_overhead;
|
||||
|
||||
clicks = get_itimer();
|
||||
|
||||
@@ -90,10 +84,10 @@ int Read_timer(void)
|
||||
return total; /* in XXX microsecond units */
|
||||
|
||||
else {
|
||||
if ( total < rtems_cpu_configuration_get_timer_least_valid() ) {
|
||||
if ( total < bsp_timer_least_valid ) {
|
||||
return 0; /* below timer resolution */
|
||||
}
|
||||
return (total - rtems_cpu_configuration_get_timer_average_overhead());
|
||||
return (total - bsp_timer_average_overhead);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ void * codemove(void *, const void *, unsigned int, unsigned long);
|
||||
static void* ppc_get_vector_addr(rtems_vector vector)
|
||||
{
|
||||
unsigned vaddr;
|
||||
extern rtems_cpu_table Cpu_table;
|
||||
extern boolean bsp_exceptions_in_RAM;
|
||||
|
||||
switch(vector) {
|
||||
/*
|
||||
@@ -76,7 +76,7 @@ static void* ppc_get_vector_addr(rtems_vector vector)
|
||||
vaddr = ((unsigned)vector) << 8;
|
||||
break;
|
||||
}
|
||||
if ( Cpu_table.exceptions_in_RAM )
|
||||
if ( bsp_exceptions_in_RAM )
|
||||
return ((void*) vaddr);
|
||||
|
||||
return ((void*) (vaddr + 0xfff00000));
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* Derived from c/src/exec/cpu/no_cpu/cpu.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1997.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be found in
|
||||
@@ -111,11 +111,12 @@ void _CPU_Initialize_vectors(void)
|
||||
{
|
||||
int i;
|
||||
proc_ptr handler = (proc_ptr)ppc_spurious;
|
||||
extern void (*bsp_spurious_handler)(uint32_t vector, CPU_Interrupt_frame *);
|
||||
|
||||
_CPU_IRQ_info.Vector_table = _ISR_Vector_table;
|
||||
|
||||
if ( _CPU_Table.spurious_handler )
|
||||
handler = (proc_ptr)_CPU_Table.spurious_handler;
|
||||
if ( bsp_spurious_handler )
|
||||
handler = (proc_ptr)bsp_spurious_handler;
|
||||
|
||||
for (i = 0; i < PPC_INTERRUPT_MAX; i++)
|
||||
_ISR_Vector_table[i] = handler;
|
||||
@@ -305,30 +306,33 @@ void _CPU_ISR_install_vector(
|
||||
proc_ptr *old_handler
|
||||
)
|
||||
{
|
||||
proc_ptr ignored;
|
||||
*old_handler = _ISR_Vector_table[ vector ];
|
||||
proc_ptr ignored;
|
||||
extern void (*bsp_spurious_handler)(uint32_t vector, CPU_Interrupt_frame *);
|
||||
extern boolean bsp_exceptions_in_RAM;
|
||||
|
||||
/*
|
||||
* If the interrupt vector table is a table of pointer to isr entry
|
||||
* points, then we need to install the appropriate RTEMS interrupt
|
||||
* handler for this vector number.
|
||||
*/
|
||||
*old_handler = _ISR_Vector_table[ vector ];
|
||||
|
||||
/*
|
||||
* Install the wrapper so this ISR can be invoked properly.
|
||||
*/
|
||||
if (_CPU_Table.exceptions_in_RAM)
|
||||
_CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
|
||||
/*
|
||||
* If the interrupt vector table is a table of pointer to isr entry
|
||||
* points, then we need to install the appropriate RTEMS interrupt
|
||||
* handler for this vector number.
|
||||
*/
|
||||
|
||||
/*
|
||||
* We put the actual user ISR address in '_ISR_vector_table'. This will
|
||||
* be used by the _ISR_Handler so the user gets control.
|
||||
*/
|
||||
/*
|
||||
* Install the wrapper so this ISR can be invoked properly.
|
||||
*/
|
||||
if (bsp_exceptions_in_RAM)
|
||||
_CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
|
||||
|
||||
_ISR_Vector_table[ vector ] = new_handler ? (ISR_Handler_entry)new_handler :
|
||||
_CPU_Table.spurious_handler ?
|
||||
(ISR_Handler_entry)_CPU_Table.spurious_handler :
|
||||
(ISR_Handler_entry)ppc_spurious;
|
||||
/*
|
||||
* We put the actual user ISR address in '_ISR_vector_table'. This will
|
||||
* be used by the _ISR_Handler so the user gets control.
|
||||
*/
|
||||
|
||||
_ISR_Vector_table[ vector ] = new_handler ? (ISR_Handler_entry)new_handler :
|
||||
bsp_spurious_handler ?
|
||||
(ISR_Handler_entry)bsp_spurious_handler :
|
||||
(ISR_Handler_entry)ppc_spurious;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* for these modifications:
|
||||
* COPYRIGHT (c) 1997 by IMD, Puchheim, Germany.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -188,6 +188,10 @@ void ClockOn(
|
||||
{
|
||||
uint32_t iocr;
|
||||
register uint32_t tcr;
|
||||
extern uint32_t bsp_clicks_per_usec;
|
||||
#ifdef ppc405
|
||||
extern boolean bsp_timer_internal_clock;
|
||||
#endif
|
||||
#ifdef ppc403
|
||||
uint32_t pvr;
|
||||
#endif /* ppc403 */
|
||||
@@ -196,7 +200,7 @@ void ClockOn(
|
||||
|
||||
#ifndef ppc405 /* this is a ppc403 */
|
||||
asm volatile ("mfdcr %0, 0xa0" : "=r" (iocr)); /* IOCR */
|
||||
if (rtems_cpu_configuration_get_timer_internal_clock()) {
|
||||
if (bsp_timer_internal_clock) {
|
||||
iocr &= ~4; /* timer clocked from system clock */
|
||||
}
|
||||
else {
|
||||
@@ -220,7 +224,7 @@ void ClockOn(
|
||||
|
||||
#else /* ppc405 */
|
||||
asm volatile ("mfdcr %0, 0x0b2" : "=r" (iocr)); /*405GP CPC0_CR1 */
|
||||
if (rtems_cpu_configuration_get_timer_internal_clock()) {
|
||||
if (bsp_timer_internal_clock) {
|
||||
iocr &=~0x800000 ;/* timer clocked from system clock CETE*/
|
||||
}
|
||||
else {
|
||||
@@ -236,7 +240,7 @@ void ClockOn(
|
||||
|
||||
#endif /* ppc405 */
|
||||
pit_value = rtems_configuration_get_microseconds_per_tick() *
|
||||
rtems_cpu_configuration_get_clicks_per_usec();
|
||||
bsp_clicks_per_usec;
|
||||
|
||||
/*
|
||||
* Set PIT value
|
||||
|
||||
@@ -209,7 +209,8 @@ void
|
||||
spiBaudSet(uint32_t baudrate)
|
||||
{
|
||||
uint32_t tmp;
|
||||
tmp = rtems_cpu_configuration_get_serial_per_sec() / baudrate;
|
||||
extern uint32_t bsp_serial_per_sec;
|
||||
tmp = bsp_serial_per_sec / baudrate;
|
||||
tmp = ((tmp) >> 4) - 1;
|
||||
port->BRDL = tmp & 0xff;
|
||||
port->BRDH = tmp >> 8;
|
||||
@@ -302,13 +303,14 @@ spiPollWrite(int minor,const char *buf,int len)
|
||||
void
|
||||
spiDeInit(void)
|
||||
{
|
||||
extern uint32_t bsp_serial_rate;
|
||||
/*
|
||||
* disable interrupts for serial port
|
||||
* set it to state to work with polling boot monitor, if any...
|
||||
*/
|
||||
|
||||
/* set up baud rate to original state */
|
||||
spiBaudSet(rtems_cpu_configuration_get_serial_rate());
|
||||
spiBaudSet(bsp_serial_rate);
|
||||
|
||||
/* clear any receive (error) status */
|
||||
port->SPLS = (LSRDataReady | LSRFramingError | LSROverrunError |
|
||||
@@ -338,6 +340,8 @@ spiInitialize(void)
|
||||
{
|
||||
register unsigned tmp;
|
||||
rtems_isr_entry previous_isr; /* this is a dummy */
|
||||
extern boolean bsp_serial_external_clock;
|
||||
extern uint32_t bsp_serial_rate;
|
||||
|
||||
/*
|
||||
* Initialise the serial port
|
||||
@@ -350,7 +354,7 @@ spiInitialize(void)
|
||||
asm volatile ("mfdcr %0, 0xa0" : "=r" (tmp)); /* IOCR */
|
||||
|
||||
tmp &= ~3;
|
||||
tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? 2 : 0) | 1;
|
||||
tmp |= (bsp_serial_external_clock ? 2 : 0) | 1;
|
||||
|
||||
asm volatile ("mtdcr 0xa0, %0" : "=r" (tmp) : "0" (tmp)); /* IOCR */
|
||||
|
||||
@@ -359,7 +363,7 @@ spiInitialize(void)
|
||||
LSRParityError | LSRBreakInterrupt);
|
||||
|
||||
/* set up baud rate */
|
||||
spiBaudSet(rtems_cpu_configuration_get_serial_rate());
|
||||
spiBaudSet(bsp_serial_rate);
|
||||
|
||||
/* set up port control: DTR/RTS active,8 bit,1 stop,no parity */
|
||||
port->SPCTL = (CRNormal |
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* Derived from c/src/lib/libbsp/no_cpu/no_bsp/console/console.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -140,17 +140,20 @@ rtems_device_driver console_initialize(
|
||||
{
|
||||
rtems_status_code status;
|
||||
register unsigned tmp;
|
||||
extern uint32_t bsp_serial_per_sec;
|
||||
extern boolean bsp_serial_external_clock;
|
||||
extern boolean bsp_serial_cts_rts;
|
||||
extern uint32_t bsp_serial_rate;
|
||||
|
||||
/* Initialise the serial port */
|
||||
asm volatile ("mfdcr %0, 0xa0" : "=r" (tmp)); /* IOCR */
|
||||
tmp &= ~3;
|
||||
tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? 2 : 0) |
|
||||
(rtems_cpu_configuration_get_serial_cts_rts() ? 1 : 0);
|
||||
tmp |= (bsp_serial_external_clock ? 2 : 0) |
|
||||
(bsp_serial_cts_rts ? 1 : 0);
|
||||
asm volatile ("mtdcr 0xa0, %0" : "=r" (tmp) : "0" (tmp)); /* IOCR */
|
||||
port->SPLS = (LSRDataReady | LSRFramingError | LSROverrunError |
|
||||
LSRParityError | LSRBreakInterrupt);
|
||||
tmp = rtems_cpu_configuration_get_serial_per_sec() /
|
||||
rtems_cpu_configuration_get_serial_rate();
|
||||
tmp = bsp_serial_per_sec / bsp_get_serial_rate;
|
||||
#if 0 /* replaced by IMD... */
|
||||
tmp = ((tmp + 8) >> 4) - 1;
|
||||
port->BRDL = tmp & 0x255;
|
||||
@@ -262,6 +265,7 @@ void outbyte(
|
||||
)
|
||||
{
|
||||
unsigned char status;
|
||||
extern boolean bsp_serial_xon_xoff;
|
||||
|
||||
while (port->SPHS)
|
||||
port->SPHS = (HSRDsr | HSRCts);
|
||||
@@ -276,7 +280,7 @@ void outbyte(
|
||||
break;
|
||||
}
|
||||
|
||||
if (rtems_cpu_configuration_get_serial_xon_xoff())
|
||||
if (bsp_serial_xon_xoff)
|
||||
while (is_character_ready(&status))
|
||||
{
|
||||
if (status == XOFFchar)
|
||||
|
||||
@@ -194,8 +194,9 @@ void
|
||||
spiBaudSet(uint32_t baudrate)
|
||||
{
|
||||
uint32_t tmp;
|
||||
extern uint32_t bsp_serial_per_sec;
|
||||
|
||||
tmp = spiBaudRound( (double)rtems_cpu_configuration_get_serial_per_sec() / (baudrate * 16) );
|
||||
tmp = spiBaudRound( (double)bsp_serial_per_sec / (baudrate * 16) );
|
||||
|
||||
port->LCR = port->LCR | LCR_DL;
|
||||
|
||||
@@ -331,6 +332,7 @@ static rtems_isr serial_ISR(rtems_vector_number v)
|
||||
void
|
||||
spiDeInit(void)
|
||||
{
|
||||
extern uint32_t bsp_serial_rate;
|
||||
/*
|
||||
* disable interrupts for serial port
|
||||
* set it to state to work with polling boot monitor, if any...
|
||||
@@ -338,7 +340,7 @@ spiDeInit(void)
|
||||
|
||||
|
||||
/* set up baud rate to original state */
|
||||
spiBaudSet(rtems_cpu_configuration_get_serial_rate());
|
||||
spiBaudSet(bsp_serial_rate);
|
||||
|
||||
port->IER = 0;
|
||||
|
||||
@@ -355,6 +357,8 @@ spiInitialize(void)
|
||||
register unsigned tmp;
|
||||
rtems_isr_entry previous_isr; /* this is a dummy */
|
||||
unsigned char _ier;
|
||||
extern boolean bsp_serial_external_clock;
|
||||
extern uint32_t bsp_serial_rate;
|
||||
|
||||
/*
|
||||
* Initialise the serial port
|
||||
@@ -367,9 +371,9 @@ spiInitialize(void)
|
||||
asm volatile ("mfdcr %0, 0x0b1" : "=r" (tmp)); /* CPC_CR0 0x0b1 */
|
||||
|
||||
/* UART0 bit 24 0x80, UART1 bit 25 0x40 */
|
||||
tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? (USE_UART ? 0x40 : 0x80) : 0);
|
||||
tmp |= (bsp_serial_external_clock ? (USE_UART ? 0x40 : 0x80) : 0);
|
||||
|
||||
tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? 0: ((UART_INTERNAL_CLOCK_DIVISOR -1) << 1));
|
||||
tmp |= (bsp_serial_external_clock ? 0: ((UART_INTERNAL_CLOCK_DIVISOR -1) << 1));
|
||||
|
||||
asm volatile ("mtdcr 0x0b1, %0" : "=r" (tmp) : "0" (tmp)); /* CPC_CR0 0x0b1*/
|
||||
|
||||
@@ -381,7 +385,7 @@ spiInitialize(void)
|
||||
port->LCR = LCR_WL8 | LCR_SB1 | LCR_PN;
|
||||
|
||||
/* set up baud rate */
|
||||
spiBaudSet(rtems_cpu_configuration_get_serial_rate());
|
||||
spiBaudSet(bsp_serial_rate);
|
||||
|
||||
if (ppc403_spi_interrupt) {
|
||||
|
||||
|
||||
@@ -161,6 +161,7 @@ ictrl_spurious_handler(uint32_t spurious_mask,
|
||||
CPU_Interrupt_frame *cpu_frame)
|
||||
{
|
||||
int v;
|
||||
extern void (*bsp_spurious_handler)(uint32_t vector, CPU_Interrupt_frame *);
|
||||
|
||||
for (v=0; v < PPC_IRQ_EXT_MAX; v++) {
|
||||
if (VEC_TO_EXMSK(v) & spurious_mask) {
|
||||
@@ -170,8 +171,8 @@ ictrl_spurious_handler(uint32_t spurious_mask,
|
||||
printf("spurious external interrupt: %d at pc 0x%x; disabling\n",
|
||||
vector, cpu_frame->Interrupt.pcoqfront);
|
||||
#endif
|
||||
if (rtems_cpu_configuration_get_spurious_handler()) {
|
||||
rtems_cpu_configuration_get_spurious_handler()(v + PPC_IRQ_EXT_BASE,cpu_frame);
|
||||
if (bsp_spurious_handler) {
|
||||
bsp_spurious_handler(v + PPC_IRQ_EXT_BASE,cpu_frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ ictrl_spurious_handler(uint32_t spurious_mask,
|
||||
CPU_Interrupt_frame *cpu_frame)
|
||||
{
|
||||
int v;
|
||||
extern void (*bsp_spurious_handler)(uint32_t vector, CPU_Interrupt_frame *);
|
||||
|
||||
for (v=0; v < PPC_IRQ_EXT_MAX; v++) {
|
||||
if (VEC_TO_EXMSK(v) & spurious_mask) {
|
||||
@@ -170,8 +171,8 @@ ictrl_spurious_handler(uint32_t spurious_mask,
|
||||
printf("spurious external interrupt: %d at pc 0x%x; disabling\n",
|
||||
vector, cpu_frame->Interrupt.pcoqfront);
|
||||
#endif
|
||||
if (rtems_cpu_configuration_get_spurious_handler()) {
|
||||
rtems_cpu_configuration_get_spurious_handler()(v + PPC_IRQ_EXT_BASE,cpu_frame);
|
||||
if (bsp_spurious_handler()) {
|
||||
bsp_spurious_handler(v + PPC_IRQ_EXT_BASE,cpu_frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
* Derived from c/src/lib/libcpu/hppa1.1/timer/timer.c:
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* COPYRIGHT (c) 1989-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
@@ -86,6 +86,8 @@ int Read_timer()
|
||||
{
|
||||
uint32_t clicks;
|
||||
uint32_t total;
|
||||
extern uint32_t bsp_timer_least_valid;
|
||||
extern uint32_t bsp_timer_average_overhead;
|
||||
|
||||
clicks = get_itimer();
|
||||
|
||||
@@ -95,9 +97,9 @@ int Read_timer()
|
||||
return total; /* in XXX microsecond units */
|
||||
|
||||
else {
|
||||
if ( total < rtems_cpu_configuration_get_timer_least_valid() )
|
||||
if ( total < bsp_timer_least_valid )
|
||||
return 0; /* below timer resolution */
|
||||
return (total - rtems_cpu_configuration_get_timer_average_overhead());
|
||||
return (total - bsp_timer_average_overhead);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
#include "../ictrl/ictrl.h"
|
||||
#include <stdlib.h> /* for atexit() */
|
||||
|
||||
extern uint32_t bsp_serial_per_sec;
|
||||
extern boolean bsp_serial_external_clock;
|
||||
extern boolean bsp_serial_cts_rts;
|
||||
extern boolean bsp_serial_xon_xoff;
|
||||
extern uint32_t bsp_serial_rate;
|
||||
|
||||
struct ttyasync {
|
||||
/*---------------------------------------------------------------------------+
|
||||
@@ -154,7 +159,7 @@ tty0BaudSet(uint32_t baudrate)
|
||||
{
|
||||
uint32_t tmp;
|
||||
|
||||
tmp = tty0_round( (double)rtems_cpu_configuration_get_serial_per_sec() / (baudrate * 16) );
|
||||
tmp = tty0_round( (double)bsp_serial_per_sec / (baudrate * 16) );
|
||||
|
||||
tty0port->LCR = tty0port->LCR | LCR_DL;
|
||||
|
||||
@@ -327,7 +332,7 @@ tty0DeInit(void)
|
||||
*/
|
||||
|
||||
/* set up baud rate to original state */
|
||||
tty0BaudSet(rtems_cpu_configuration_get_serial_rate());
|
||||
tty0BaudSet(bsp_serial_rate);
|
||||
|
||||
tty0port->IER = 0;
|
||||
|
||||
@@ -345,6 +350,8 @@ tty0Initialize(void)
|
||||
rtems_isr_entry previous_isr; /* this is a dummy */
|
||||
unsigned char _ier;
|
||||
unsigned char _tmp;
|
||||
extern uint32_t bsp_serial_rate;
|
||||
extern boolean bsp_serial_external_clock;
|
||||
|
||||
/*
|
||||
* Initialise the serial tty0port
|
||||
@@ -357,9 +364,9 @@ tty0Initialize(void)
|
||||
asm volatile ("mfdcr %0, 0x0b1" : "=r" (tmp)); /* CPC_CR0 0x0b1 */
|
||||
|
||||
/* UART0 bit 24 0x80, UART1 bit 25 0x40 */
|
||||
tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? (TTY0_USE_UART ? 0x40 : 0x80) : 0);
|
||||
tmp |= (bsp_serial_external_clock ? (TTY0_USE_UART ? 0x40 : 0x80) : 0);
|
||||
|
||||
tmp |= (rtems_cpu_configuration_get_serial_external_clock() ? 0: ((TTY0_UART_INTERNAL_CLOCK_DIVISOR -1) << 1));
|
||||
tmp |= (bsp_serial_external_clock ? 0: ((TTY0_UART_INTERNAL_CLOCK_DIVISOR -1) << 1));
|
||||
|
||||
asm volatile ("mtdcr 0x0b1, %0" : "=r" (tmp) : "0" (tmp)); /* CPC_CR0 0x0b1*/
|
||||
|
||||
@@ -371,7 +378,7 @@ tty0Initialize(void)
|
||||
tty0port->LCR = LCR_WL8 | LCR_SB1 | LCR_PN;
|
||||
|
||||
/* set up baud rate */
|
||||
tty0BaudSet(rtems_cpu_configuration_get_serial_rate());
|
||||
tty0BaudSet(bsp_serial_rate);
|
||||
|
||||
|
||||
#ifdef TTY0_USE_INTERRUPT
|
||||
|
||||
Reference in New Issue
Block a user