* mcf52235/README, mcf52235/gdb-init, mcf52235/clock/clock.c,
	mcf52235/console/console.c, mcf52235/include/bsp.h,
	mcf52235/include/coverhd.h, mcf52235/start/start.S,
	mcf52235/startup/bspclean.c, mcf52235/startup/bspstart.c,
	mcf52235/startup/linkcmds, mcf52235/timer/timer.c: Cleaned up
	white space and code formmated to adhere to RTEMS standards. Fixed
	a bug in the nano seconds since last tick support. Fixed a bug
	with the location of the start stack (no longer within
	.bss). Removed double definition of IPSBAR and some type defs
	etc.. Added timing test overhead results.
This commit is contained in:
Chris Johns
2008-06-19 05:46:19 +00:00
parent 8f25cec8bb
commit 9374e9b082
12 changed files with 644 additions and 622 deletions

View File

@@ -1,3 +1,16 @@
2008-06-19 Matthew Riek <matthew.riek@ibiscomputer.com.au>
* mcf52235/README, mcf52235/gdb-init, mcf52235/clock/clock.c,
mcf52235/console/console.c, mcf52235/include/bsp.h,
mcf52235/include/coverhd.h, mcf52235/start/start.S,
mcf52235/startup/bspclean.c, mcf52235/startup/bspstart.c,
mcf52235/startup/linkcmds, mcf52235/timer/timer.c: Cleaned up
white space and code formmated to adhere to RTEMS standards. Fixed
a bug in the nano seconds since last tick support. Fixed a bug
with the location of the start stack (no longer within
.bss). Removed double definition of IPSBAR and some type defs
etc.. Added timing test overhead results.
2008-06-10 Matthew Riek <matthew.riek@ibiscomputer.com.au>
* .cvsignore, ChangeLog, Makefile.am, README, bsp_specs,

View File

@@ -3,7 +3,7 @@
#
Description: Motorola MCF52235EVB
============
============================================================================
CPU: MCF52235, 60MHz
SRAM: 32K
FLASH: 256K
@@ -11,10 +11,10 @@ FLASH: 256K
This is a Motorola evaluation board that uses the MCF52235 Coldfire CPU.
This board is running at 60MHz scaled from a 25MHz oscillator.
============================================================================
NOTES:
======
Currently this BSP must be configured with most (all?) RTEMS features turned
Currently this BSP must be configured with most RTEMS features turned
off as RAM usage is too high.
Configure as follows:
@@ -22,17 +22,35 @@ configure --target=m68k-rtems4.9 --enable-rtemsbsp=mcf52235 \
--disable-networking --disable-posix --disable-itron --disable-cxx \
--disable-tests
TODO:
=====
To get the tests to compile (but not run) change the linkcmds to specify
a larger sram memory region (256K works). This of course will let you
compile all tests, but many or most of them wont run.
See testsuites/samples/minumum for an example of what type of config flags
you need for this BSP!
In you project before you include confdefs.h, define some or all of the
following:
#define CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
#define CONFIGURE_DISABLE_CLASSIC_NOTEPADS
#define CONFIGURE_INIT_TASK_STACK_SIZE x
#define CONFIGURE_MINIMUM_TASK_STACK_SIZE x
#define CONFIGURE_INTERRUPT_STACK_SIZE x
Note that the default stack size is 1K
Note that the default number of priorities is 15
============================================================================
TODO:
*) Work with TINY RTEMS to get the ram usage down.
*) Add drivers for I2C, ADC, FEC
*) Support for LWIP
*) Update the coverhd.h (calling overheads) page 21 of the BSP guide
*) Adjust initial stack so that it's space is not forever unusable after init
*) Fix up constants used by cfinit such as clockspeed, rambase, flashbase etc.
*) Recover the 1K stack space reserved in linkcmds used for board startup.
============================================================================
Interrupt map
+-----+-----------------------------------------------------------------------+
@@ -46,7 +64,7 @@ TODO:
+-----+--------+--------+--------+--------+--------+--------+--------+--------+
| 5 | | | | | | | | |
+-----+--------+--------+--------+--------+--------+--------+--------+--------+
| 4 | FEC RX | FEC TX | | | | | | PIT |
| 4 | | | | | | | | PIT |
+-----+--------+--------+--------+--------+--------+--------+--------+--------+
| 3 | UART 0 | UART 1 | UART 2 | | | | | |
+-----+--------+--------+--------+--------+--------+--------+--------+--------+
@@ -54,3 +72,92 @@ TODO:
+-----+--------+--------+--------+--------+--------+--------+--------+--------+
| 1 | | | | | | | | |
+-----+--------+--------+--------+--------+--------+--------+--------+--------+
============================================================================
*** TIME TEST 1 ***
rtems_semaphore_create 8
rtems_semaphore_delete 10
rtems_semaphore_obtain: available 3
rtems_semaphore_obtain: not available -- NO_WAIT 3
rtems_semaphore_release: no waiting tasks 7
*** END OF TEST 1 ***
*** TIME TEST OVERHEAD ***
rtems_shutdown_executive 0
rtems_task_create 0
rtems_task_ident 0
rtems_task_start 0
rtems_task_restart 0
rtems_task_delete 0
rtems_task_suspend 0
rtems_task_resume 0
rtems_task_set_priority 0
rtems_task_mode 0
rtems_task_get_note 0
rtems_task_set_note 0
rtems_task_wake_when 0
rtems_task_wake_after 0
rtems_interrupt_catch 0
rtems_clock_get 0
rtems_clock_set 0
rtems_clock_tick 0
<pause>
rtems_timer_create 0
rtems_timer_delete 0
rtems_timer_ident 0
rtems_timer_fire_after 0
rtems_timer_fire_when 1
rtems_timer_reset 0
rtems_timer_cancel 0
rtems_semaphore_create 0
rtems_semaphore_delete 0
rtems_semaphore_ident 0
rtems_semaphore_obtain 0
rtems_semaphore_release 0
rtems_message_queue_create 0
rtems_message_queue_ident 0
rtems_message_queue_delete 0
rtems_message_queue_send 0
rtems_message_queue_urgent 0
rtems_message_queue_broadcast 0
rtems_message_queue_receive 0
rtems_message_queue_flush 0
<pause>
rtems_event_send 0
rtems_event_receive 0
rtems_signal_catch 0
rtems_signal_send 0
rtems_partition_create 0
rtems_partition_ident 0
rtems_partition_delete 0
rtems_partition_get_buffer 0
rtems_partition_return_buffer 0
rtems_region_create 0
rtems_region_ident 0
rtems_region_delete 0
rtems_region_get_segment 0
rtems_region_return_segment 0
rtems_port_create 0
rtems_port_ident 0
rtems_port_delete 0
rtems_port_external_to_internal 0
rtems_port_internal_to_external 0
<pause>
rtems_io_initialize 0
rtems_io_open 0
rtems_io_close 0
rtems_io_read 0
rtems_io_write 0
rtems_io_control 0
rtems_fatal_error_occurred 0
rtems_rate_monotonic_create 0
rtems_rate_monotonic_ident 0
rtems_rate_monotonic_delete 0
rtems_rate_monotonic_cancel 0
rtems_rate_monotonic_period 0
rtems_multiprocessing_announce 0
*** END OF TIME OVERHEAD ***

View File

@@ -17,15 +17,19 @@ static uint32_t s_nanoScale = 0;
/*
* Provide nanosecond extension
* Interrupts are disabled when this is called
*/
static uint32_t bsp_clock_nanoseconds_since_last_tick(void)
{
uint32_t i = MCF_PIT1_PCNTR;
if(MCF_PIT1_PCSR & MCF_PIT_PCSR_PIF)
{
i = MCF_PIT1_PCNTR + MCF_PIT1_PMR;
uint32_t i;
if (MCF_PIT1_PCSR & MCF_PIT_PCSR_PIF) {
i = s_pcntrAtTick + (MCF_PIT1_PMR - MCF_PIT1_PCNTR);
}
return (i - s_pcntrAtTick) * s_nanoScale;
else {
i = s_pcntrAtTick - MCF_PIT1_PCNTR;
}
return i * s_nanoScale;
}
#define Clock_driver_nanoseconds_since_last_tick bsp_clock_nanoseconds_since_last_tick
@@ -67,9 +71,11 @@ static void Clock_driver_support_initialize_hardware()
uint32_t preScaleCode = 0;
uint32_t clk = bsp_get_CPU_clock_speed() >> 1;
uint32_t tps = 1000000 / Configuration.microseconds_per_tick;
while (preScaleCode < 15) {
pmr = (clk >> preScaleCode) / tps;
if(pmr < (1 << 15)) break;
if (pmr < (1 << 15))
break;
preScaleCode++;
}
s_nanoScale = 1000000000 / (clk >> preScaleCode);
@@ -82,14 +88,10 @@ static void Clock_driver_support_initialize_hardware()
rtems_interrupt_enable(level);
MCF_PIT1_PCSR = MCF_PIT_PCSR_PRE(preScaleCode) |
MCF_PIT_PCSR_OVW |
MCF_PIT_PCSR_PIE |
MCF_PIT_PCSR_RLD;
MCF_PIT_PCSR_OVW | MCF_PIT_PCSR_PIE | MCF_PIT_PCSR_RLD;
MCF_PIT1_PMR = pmr;
MCF_PIT1_PCSR = MCF_PIT_PCSR_PRE(preScaleCode) |
MCF_PIT_PCSR_PIE |
MCF_PIT_PCSR_RLD |
MCF_PIT_PCSR_EN;
MCF_PIT_PCSR_PIE | MCF_PIT_PCSR_RLD | MCF_PIT_PCSR_EN;
s_pcntrAtTick = MCF_PIT1_PCNTR;
}

View File

@@ -25,8 +25,7 @@
static int IntUartPollWrite(int minor, const char *buf, int len);
static int IntUartInterruptWrite(int minor, const char *buf, int len);
static void
_BSP_null_char( char c )
static void _BSP_null_char(char c)
{
int level;
@@ -40,6 +39,7 @@ _BSP_null_char( char c )
continue;
rtems_interrupt_enable(level);
}
BSP_output_char_function_type BSP_output_char = _BSP_null_char;
#define MAX_UART_INFO 3
@@ -68,7 +68,8 @@ struct IntUartInfoStruct IntUartInfo[MAX_UART_INFO];
Description : This updates the hardware UART settings.
***************************************************************************/
static void
IntUartSet(int minor, int baud, int databits, int parity, int stopbits, int hwflow)
IntUartSet(int minor, int baud, int databits, int parity, int stopbits,
int hwflow)
{
int divisor;
uint32_t clock_speed;
@@ -79,7 +80,6 @@ IntUartSet(int minor, int baud, int databits, int parity, int stopbits, int hwfl
rtems_interrupt_disable(level);
/* disable interrupts, clear RTS line, and disable the UARTS */
MCF_UART_UIMR(minor) = 0;
MCF_UART_UOP0(minor) = 1;
@@ -95,15 +95,12 @@ IntUartSet(int minor, int baud, int databits, int parity, int stopbits, int hwfl
clock_speed = bsp_get_CPU_clock_speed();
/* determine the baud divisor value */
// MRTODO
//divisor = ((clock_speed/2) / ( 32 * baud ));
divisor = ((clock_speed) / (32 * baud));
if (divisor < 2)
divisor = 2;
/* check to see if doing hardware flow control */
if ( hwflow )
{
if (hwflow) {
/* set hardware flow options */
umr1 |= MCF_UART_UMR_RXRTS;
umr2 |= MCF_UART_UMR_TXCTS;
@@ -124,7 +121,8 @@ IntUartSet(int minor, int baud, int databits, int parity, int stopbits, int hwfl
MCF_UART_UMR(minor) = umr2;
/* set the baud rate values */
MCF_UART_UCSR(minor) = (MCF_UART_UCSR_RCS_SYS_CLK | MCF_UART_UCSR_TCS_SYS_CLK);
MCF_UART_UCSR(minor) =
(MCF_UART_UCSR_RCS_SYS_CLK | MCF_UART_UCSR_TCS_SYS_CLK);
MCF_UART_UBG1(minor) = (divisor & 0xff00) >> 8;
MCF_UART_UBG2(minor) = (divisor & 0x00ff);
@@ -132,16 +130,14 @@ IntUartSet(int minor, int baud, int databits, int parity, int stopbits, int hwfl
MCF_UART_UCR(minor) = (MCF_UART_UCR_TX_ENABLED | MCF_UART_UCR_RX_ENABLED);
/* check to see if interrupts need to be enabled */
if ( info->iomode != TERMIOS_POLLED )
{
if (info->iomode != TERMIOS_POLLED) {
/* enable rx interrupts */
info->uimr |= MCF_UART_UIMR_RXRDY_FU;
MCF_UART_UIMR(minor) = info->uimr;
}
/* check to see if doing hardware flow control */
if ( hwflow )
{
if (hwflow) {
/* assert the RTS line */
MCF_UART_UOP1(minor) = 1;
}
@@ -150,7 +146,6 @@ IntUartSet(int minor, int baud, int databits, int parity, int stopbits, int hwfl
}
/***************************************************************************
Function : IntUartSetAttributes
@@ -160,8 +155,7 @@ IntUartSet(int minor, int baud, int databits, int parity, int stopbits, int hwfl
Note: The highest baudrate is 115200 as this stays within
an error of +/- 5% at 25MHz processor clock
***************************************************************************/
static int
IntUartSetAttributes(int minor, const struct termios *t)
static int IntUartSetAttributes(int minor, const struct termios *t)
{
/* set default index values */
int baud = (int) 19200;
@@ -172,14 +166,12 @@ IntUartSetAttributes(int minor, const struct termios *t)
struct IntUartInfoStruct *info = &IntUartInfo[minor];
/* check to see if input is valid */
if ( t != (const struct termios *)0 )
{
if (t != (const struct termios *) 0) {
/* determine baud rate index */
baud = termios_baud_to_number(t->c_cflag & CBAUD);
/* determine data bits */
switch ( t->c_cflag & CSIZE )
{
switch (t->c_cflag & CSIZE) {
case CS5:
databits = (int) MCF_UART_UMR_BC_5;
break;
@@ -195,30 +187,24 @@ IntUartSetAttributes(int minor, const struct termios *t)
}
/* determine if parity is enabled */
if ( t->c_cflag & PARENB )
{
if ( t->c_cflag & PARODD )
{
if (t->c_cflag & PARENB) {
if (t->c_cflag & PARODD) {
/* odd parity */
parity = (int) MCF_UART_UMR_PM_ODD;
}
else
{
} else {
/* even parity */
parity = (int) MCF_UART_UMR_PM_EVEN;
}
}
/* determine stop bits */
if ( t->c_cflag & CSTOPB )
{
if (t->c_cflag & CSTOPB) {
/* two stop bits */
stopbits = (int) MCF_UART_UMR_SB_STOP_BITS_2;
}
/* check to see if hardware flow control */
if ( t->c_cflag & CRTSCTS )
{
if (t->c_cflag & CRTSCTS) {
hwflow = 1;
}
}
@@ -227,9 +213,7 @@ IntUartSetAttributes(int minor, const struct termios *t)
if ((baud != info->baud) ||
(databits != info->databits) ||
(parity != info->parity) ||
( stopbits != info->stopbits ) ||
( hwflow != info->hwflow ) )
{
(stopbits != info->stopbits) || (hwflow != info->hwflow)) {
/* call function to set values */
IntUartSet(minor, baud, databits, parity, stopbits, hwflow);
@@ -246,21 +230,17 @@ IntUartSetAttributes(int minor, const struct termios *t)
determines which channel caused the interrupt before queueing any received
chars and dequeueing chars waiting for transmission.
***************************************************************************/
static rtems_isr
IntUartInterruptHandler(rtems_vector_number v)
static rtems_isr IntUartInterruptHandler(rtems_vector_number v)
{
unsigned int chan = v - UART_INTC0_IRQ_VECTOR(0);
struct IntUartInfoStruct *info = &IntUartInfo[chan];
/* check to see if received data */
if ( MCF_UART_UISR(chan) & MCF_UART_UISR_RXRDY_FU )
{
if (MCF_UART_UISR(chan) & MCF_UART_UISR_RXRDY_FU) {
/* read data and put into the receive buffer */
while ( MCF_UART_USR(chan) & MCF_UART_USR_RXRDY )
{
while (MCF_UART_USR(chan) & MCF_UART_USR_RXRDY) {
if ( MCF_UART_USR(chan) & MCF_UART_USR_ERROR )
{
if (MCF_UART_USR(chan) & MCF_UART_USR_ERROR) {
/* clear the error */
MCF_UART_UCR(chan) = MCF_UART_UCR_RESET_ERROR;
}
@@ -270,25 +250,21 @@ IntUartInterruptHandler(rtems_vector_number v)
/* update buffer values */
info->rx_in++;
if ( info->rx_in >= RX_BUFFER_SIZE )
{
if (info->rx_in >= RX_BUFFER_SIZE) {
info->rx_in = 0;
}
}
/* Make sure the port has been opened */
if ( info->ttyp )
{
if (info->ttyp) {
/* check to see if task driven */
if ( info->iomode == TERMIOS_TASK_DRIVEN )
{
if (info->iomode == TERMIOS_TASK_DRIVEN) {
/* notify rx task that rx buffer has data */
rtems_termios_rxirq_occured(info->ttyp);
}
else
{
} else {
/* Push up the received data */
rtems_termios_enqueue_raw_characters(info->ttyp, info->rx_buffer, info->rx_in);
rtems_termios_enqueue_raw_characters(info->ttyp, info->rx_buffer,
info->rx_in);
info->rx_in = 0;
}
}
@@ -296,8 +272,7 @@ IntUartInterruptHandler(rtems_vector_number v)
/* check to see if data needs to be transmitted */
if ((info->uimr & MCF_UART_UIMR_TXRDY) &&
( MCF_UART_UISR(chan) & MCF_UART_UISR_TXRDY ) )
{
(MCF_UART_UISR(chan) & MCF_UART_UISR_TXRDY)) {
/* disable tx interrupts */
info->uimr &= ~MCF_UART_UIMR_TXRDY;
@@ -309,8 +284,6 @@ IntUartInterruptHandler(rtems_vector_number v)
}
}
/***************************************************************************
Function : IntUartInitialize
@@ -318,16 +291,14 @@ IntUartInterruptHandler(rtems_vector_number v)
internal uarts. If the internal uart is to be interrupt driven then the
interrupt vectors are hooked.
***************************************************************************/
static void
IntUartInitialize(void)
static void IntUartInitialize(void)
{
unsigned int chan;
struct IntUartInfoStruct *info;
rtems_isr_entry old_handler;
int level;
for ( chan = 0; chan < MAX_UART_INFO; chan++ )
{
for (chan = 0; chan < MAX_UART_INFO; chan++) {
info = &IntUartInfo[chan];
info->ttyp = NULL;
@@ -342,11 +313,9 @@ IntUartInitialize(void)
MCF_UART_UACR(chan) = 0;
MCF_UART_UIMR(chan) = 0;
if ( info->iomode != TERMIOS_POLLED )
{
if (info->iomode != TERMIOS_POLLED) {
rtems_interrupt_catch(IntUartInterruptHandler,
UART_INTC0_IRQ_VECTOR(chan),
&old_handler);
UART_INTC0_IRQ_VECTOR(chan), &old_handler);
}
/* set uart default values */
@@ -358,32 +327,27 @@ IntUartInitialize(void)
case 0:
MCF_INTC0_ICR13 = MCF_INTC_ICR_IL(UART0_IRQ_LEVEL) |
MCF_INTC_ICR_IP(UART0_IRQ_PRIORITY);
MCF_INTC0_IMRL &= ~(MCF_INTC_IMRL_MASK13 |
MCF_INTC_IMRL_MASKALL);
MCF_INTC0_IMRL &= ~(MCF_INTC_IMRL_MASK13 | MCF_INTC_IMRL_MASKALL);
break;
case 1:
MCF_INTC0_ICR14 = MCF_INTC_ICR_IL(UART1_IRQ_LEVEL) |
MCF_INTC_ICR_IP(UART1_IRQ_PRIORITY);
MCF_INTC0_IMRL &= ~(MCF_INTC_IMRL_MASK14 |
MCF_INTC_IMRL_MASKALL);
MCF_INTC0_IMRL &= ~(MCF_INTC_IMRL_MASK14 | MCF_INTC_IMRL_MASKALL);
break;
case 2:
MCF_INTC0_ICR15 = MCF_INTC_ICR_IL(UART2_IRQ_LEVEL) |
MCF_INTC_ICR_IP(UART2_IRQ_PRIORITY);
MCF_INTC0_IMRL &= ~(MCF_INTC_IMRL_MASK15 |
MCF_INTC_IMRL_MASKALL);
MCF_INTC0_IMRL &= ~(MCF_INTC_IMRL_MASK15 | MCF_INTC_IMRL_MASKALL);
break;
}
rtems_interrupt_enable(level);
} /* of chan loop */
} /* IntUartInitialise */
/***************************************************************************
Function : IntUartInterruptWrite
@@ -392,8 +356,7 @@ IntUartInitialize(void)
to initiate a transmit sequence. Calling this routine enables Tx
interrupts.
***************************************************************************/
static int
IntUartInterruptWrite (int minor, const char *buf, int len)
static int IntUartInterruptWrite(int minor, const char *buf, int len)
{
int level;
@@ -415,8 +378,7 @@ IntUartInterruptWrite (int minor, const char *buf, int len)
Description : This enables interrupts when the tty is opened.
***************************************************************************/
static int
IntUartInterruptOpen(int major, int minor, void *arg)
static int IntUartInterruptOpen(int major, int minor, void *arg)
{
struct IntUartInfoStruct *info = &IntUartInfo[minor];
@@ -424,16 +386,14 @@ IntUartInterruptOpen(int major, int minor, void *arg)
MCF_UART_UCR(minor) = (MCF_UART_UCR_TX_ENABLED | MCF_UART_UCR_RX_ENABLED);
/* check to see if interrupts need to be enabled */
if ( info->iomode != TERMIOS_POLLED )
{
if (info->iomode != TERMIOS_POLLED) {
/* enable rx interrupts */
info->uimr |= MCF_UART_UIMR_RXRDY_FU;
MCF_UART_UIMR(minor) = info->uimr;
}
/* check to see if doing hardware flow control */
if ( info->hwflow )
{
if (info->hwflow) {
/* assert the RTS line */
MCF_UART_UOP1(minor) = 1;
}
@@ -441,15 +401,12 @@ IntUartInterruptOpen(int major, int minor, void *arg)
return (0);
}
/***************************************************************************
Function : IntUartInterruptClose
Description : This disables interrupts when the tty is closed.
***************************************************************************/
static int
IntUartInterruptClose(int major, int minor, void *arg)
static int IntUartInterruptClose(int major, int minor, void *arg)
{
struct IntUartInfoStruct *info = &IntUartInfo[minor];
@@ -473,8 +430,7 @@ IntUartInterruptClose(int major, int minor, void *arg)
and places them into the termios buffer. The rx interrupts will be
re-enabled after all data has been read.
***************************************************************************/
static int
IntUartTaskRead(int minor)
static int IntUartTaskRead(int minor)
{
char buffer[RX_BUFFER_SIZE];
int count;
@@ -484,33 +440,27 @@ IntUartTaskRead(int minor)
/* determine number of values to copy out */
rx_in = info->rx_in;
if ( info->rx_out <= rx_in )
{
if (info->rx_out <= rx_in) {
count = rx_in - info->rx_out;
}
else
{
} else {
count = (RX_BUFFER_SIZE - info->rx_out) + rx_in;
}
/* copy data into local buffer from rx buffer */
while ( ( index < count ) && ( index < RX_BUFFER_SIZE ) )
{
while ((index < count) && (index < RX_BUFFER_SIZE)) {
/* copy data byte */
buffer[index] = info->rx_buffer[info->rx_out];
index++;
/* increment rx buffer values */
info->rx_out++;
if ( info->rx_out >= RX_BUFFER_SIZE )
{
if (info->rx_out >= RX_BUFFER_SIZE) {
info->rx_out = 0;
}
}
/* check to see if buffer is not empty */
if ( count > 0 )
{
if (count > 0) {
/* set characters into termios buffer */
rtems_termios_enqueue_raw_characters(info->ttyp, buffer, count);
}
@@ -518,16 +468,13 @@ IntUartTaskRead(int minor)
return (EOF);
}
/***************************************************************************
Function : IntUartPollRead
Description : This reads a character from the internal uart. It returns
to the caller without blocking if not character is waiting.
***************************************************************************/
static int
IntUartPollRead (int minor)
static int IntUartPollRead(int minor)
{
if ((MCF_UART_USR(minor) & MCF_UART_USR_RXRDY) == 0)
return (-1);
@@ -535,7 +482,6 @@ IntUartPollRead (int minor)
return (MCF_UART_URB(minor));
}
/***************************************************************************
Function : IntUartPollWrite
@@ -543,12 +489,10 @@ IntUartPollRead (int minor)
appropriate internal uart channel waiting till each one is sucessfully
transmitted.
***************************************************************************/
static int
IntUartPollWrite (int minor, const char *buf, int len)
static int IntUartPollWrite(int minor, const char *buf, int len)
{
/* loop over buffer */
while ( len-- )
{
while (len--) {
/* block until we can transmit */
while ((MCF_UART_USR(minor) & MCF_UART_USR_TXRDY) == 0)
continue;
@@ -558,21 +502,18 @@ IntUartPollWrite (int minor, const char *buf, int len)
return (0);
}
/***************************************************************************
Function : console_initialize
Description : This initialises termios, both sets of uart hardware before
registering /dev/tty devices for each channel and the system /dev/console.
***************************************************************************/
rtems_device_driver console_initialize(
rtems_device_major_number major,
rtems_device_driver console_initialize(rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg)
{
rtems_status_code status;
/* Set up TERMIOS */
rtems_termios_initialize();
@@ -582,25 +523,20 @@ rtems_device_driver console_initialize(
/* Register the console port */
status = rtems_io_register_name("/dev/console", major, CONSOLE_PORT);
if ( status != RTEMS_SUCCESSFUL )
{
if (status != RTEMS_SUCCESSFUL) {
rtems_fatal_error_occurred(status);
}
/* Register the other port */
if ( CONSOLE_PORT != 0 )
{
if (CONSOLE_PORT != 0) {
status = rtems_io_register_name("/dev/tty00", major, 0);
if ( status != RTEMS_SUCCESSFUL )
{
if (status != RTEMS_SUCCESSFUL) {
rtems_fatal_error_occurred(status);
}
}
if ( CONSOLE_PORT != 1 )
{
if (CONSOLE_PORT != 1) {
status = rtems_io_register_name("/dev/tty01", major, 1);
if ( status != RTEMS_SUCCESSFUL )
{
if (status != RTEMS_SUCCESSFUL) {
rtems_fatal_error_occurred(status);
}
}
@@ -616,10 +552,8 @@ rtems_device_driver console_initialize(
passed to termios when the devices is opened depending on whether it is
polled or not.
***************************************************************************/
rtems_device_driver console_open(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg)
rtems_device_driver console_open(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg)
{
rtems_status_code status = RTEMS_INVALID_NUMBER;
rtems_libio_open_close_args_t *args = (rtems_libio_open_close_args_t *) arg;
@@ -658,11 +592,9 @@ rtems_device_driver console_open(
};
/* open the port depending on the minor device number */
if ( ( minor >= 0 ) && ( minor < MAX_UART_INFO ) )
{
if ((minor >= 0) && (minor < MAX_UART_INFO)) {
info = &IntUartInfo[minor];
switch ( info->iomode )
{
switch (info->iomode) {
case TERMIOS_POLLED:
status = rtems_termios_open(major, minor, arg, &IntUartPollCallbacks);
break;
@@ -677,14 +609,13 @@ rtems_device_driver console_open(
}
}
if (status == RTEMS_SUCCESSFUL)
{
if (status == RTEMS_SUCCESSFUL) {
/*
* Reset the default baudrate.
*/
struct termios term;
if (tcgetattr (STDIN_FILENO, &term) >= 0)
{
if (tcgetattr(STDIN_FILENO, &term) >= 0) {
term.c_cflag &= ~(CBAUD | CSIZE);
term.c_cflag |= CS8 | B19200;
tcsetattr(STDIN_FILENO, TCSANOW, &term);
@@ -699,10 +630,8 @@ rtems_device_driver console_open(
Description : This closes the device via termios
***************************************************************************/
rtems_device_driver console_close(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg)
rtems_device_driver console_close(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg)
{
return (rtems_termios_close(arg));
}
@@ -713,10 +642,8 @@ rtems_device_driver console_close(
Description : Read from the device via termios
***************************************************************************/
rtems_device_driver console_read(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg)
rtems_device_driver console_read(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg)
{
return (rtems_termios_read(arg));
}
@@ -726,10 +653,8 @@ rtems_device_driver console_read(
Description : Write to the device via termios
***************************************************************************/
rtems_device_driver console_write(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg)
rtems_device_driver console_write(rtems_device_major_number major,
rtems_device_minor_number minor, void *arg)
{
return (rtems_termios_write(arg));
}
@@ -739,8 +664,7 @@ rtems_device_driver console_write(
Description : Pass the IOCtl call to termios
***************************************************************************/
rtems_device_driver console_control(
rtems_device_major_number major,
rtems_device_driver console_control(rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg)
{
@@ -762,6 +686,7 @@ void DEBUG_OUTNUM(int i)
{
int n;
static const char map[] = "0123456789ABCDEF";
DEBUG_OUTCHAR(' ');
for (n = 28; n >= 0; n -= 4)
DEBUG_OUTCHAR(map[(i >> n) & 0xF]);

View File

@@ -24,10 +24,12 @@ define show-exception-sframe
end
# Add -v and -d flags for bdm info
# Add -B flags to utilize hardware breakpoints when they are availiable
#target remote | m68k-bdm-gdbserver pipe /dev/bdmcf0
target remote | m68k-bdm-gdbserver pipe /dev/tblcf2 -B
#monitor set remote-debug 1
monitor bdm-reset
# Set VBR to the beginning of what will be SRAM
@@ -42,5 +44,5 @@ monitor bdm-ctl-set 0x0C04 0x00000061
# Enable PST[3:0] signals
set *((char*) 0x40100074) = 0x0F
# Add the load when debugging from ram, should never happen with rtems
# Add the load when debugging from ram which won't happen with rtems!
#load

View File

@@ -19,16 +19,13 @@ extern "C" {
/***************************************************************************/
/** Hardware data structure headers **/
#include <mcf52235/mcf52235.h> /* internal MCF52235 modules */
#include <mcf5223x/mcf5223x.h>
/* Declare base address of peripherals area */
#define __IPSBAR ((vuint8 *) 0x40000000)
/***************************************************************************/
/** Network driver configuration **/
#if 0
struct rtems_bsdnet_ifconfig;
extern int rtems_fec_driver_attach (struct rtems_bsdnet_ifconfig *config, int attaching );
#define RTEMS_BSP_NETWORK_DRIVER_NAME "fs1"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_fec_driver_attach
#endif
/***************************************************************************/
/** User Definable configuration **/
@@ -58,7 +55,9 @@ extern int rtems_fec_driver_attach (struct rtems_bsdnet_ifconfig *config, int at
/* functions */
uint32_t bsp_get_CPU_clock_speed(void);
void bsp_cleanup(void);
m68k_isr_entry set_vector(
rtems_isr_entry handler,
rtems_vector_number vector,
@@ -69,9 +68,6 @@ m68k_isr_entry set_vector(
* Interrupt assignments
* Highest-priority listed first
*/
#define FEC_IRQ_LEVEL 4
#define FEC_IRQ_RX_PRIORITY 7
#define FEC_IRQ_TX_PRIORITY 6
#define PIT3_IRQ_LEVEL 4
#define PIT3_IRQ_PRIORITY 0

View File

@@ -40,17 +40,17 @@
#define CALLING_OVERHEAD_TASK_MODE 0
#define CALLING_OVERHEAD_TASK_GET_NOTE 0
#define CALLING_OVERHEAD_TASK_SET_NOTE 0
#define CALLING_OVERHEAD_TASK_WAKE_WHEN 1
#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0
#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0
#define CALLING_OVERHEAD_INTERRUPT_CATCH 0
#define CALLING_OVERHEAD_CLOCK_GET 1
#define CALLING_OVERHEAD_CLOCK_SET 1
#define CALLING_OVERHEAD_CLOCK_GET 0
#define CALLING_OVERHEAD_CLOCK_SET 0
#define CALLING_OVERHEAD_CLOCK_TICK 0
#define CALLING_OVERHEAD_TIMER_CREATE 0
#define CALLING_OVERHEAD_TIMER_IDENT 0
#define CALLING_OVERHEAD_TIMER_DELETE 0
#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 1
#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0
#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 1
#define CALLING_OVERHEAD_TIMER_RESET 0
#define CALLING_OVERHEAD_TIMER_CANCEL 0

View File

@@ -31,7 +31,7 @@ SYM(_INTERRUPT_VECTOR):
.long SYM(_uhoh) /* 02 Access Error */
.long SYM(_uhoh) /* 03 Address Error */
.long SYM(_uhoh) /* 04 Illegal Instruction */
.long SYM(_uhoh) /* 05 Reserved */
.long SYM(_uhoh) /* 05 Divide by Zero */
.long SYM(_uhoh) /* 06 Reserved */
.long SYM(_uhoh) /* 07 Reserved */
.long SYM(_uhoh) /* 08 Privilege Violation */
@@ -41,7 +41,7 @@ SYM(_INTERRUPT_VECTOR):
.long SYM(_uhoh) /* 12 Debug Interrupt */
.long SYM(_uhoh) /* 13 Reserved */
.long SYM(_uhoh) /* 14 Format Error */
.long SYM(_uhoh) /* 15 Unitialized Int. */
.long SYM(_uhoh) /* 15 Reserved */
.long SYM(_uhoh) /* 16 Reserved */
.long SYM(_uhoh) /* 17 Reserved */
.long SYM(_uhoh) /* 18 Reserved */
@@ -51,13 +51,13 @@ SYM(_INTERRUPT_VECTOR):
.long SYM(_uhoh) /* 22 Reserved */
.long SYM(_uhoh) /* 23 Reserved */
.long SYM(_spuriousInterrupt) /* 24 Spurious Interrupt */
.long SYM(_uhoh) /* 25 Autovector Level 1 */
.long SYM(_uhoh) /* 26 Autovector Level 2 */
.long SYM(_uhoh) /* 27 Autovector Level 3 */
.long SYM(_uhoh) /* 28 Autovector Level 4 */
.long SYM(_uhoh) /* 29 Autovector Level 5 */
.long SYM(_uhoh) /* 30 Autovector Level 6 */
.long SYM(_uhoh) /* 31 Autovector Level 7 */
.long SYM(_uhoh) /* 25 Reserved */
.long SYM(_uhoh) /* 26 Reserved */
.long SYM(_uhoh) /* 27 Reserved */
.long SYM(_uhoh) /* 28 Reserved */
.long SYM(_uhoh) /* 29 Reserved */
.long SYM(_uhoh) /* 30 Reserved */
.long SYM(_uhoh) /* 31 Reserved */
.long SYM(_uhoh) /* 32 TRAP #0 */
.long SYM(_uhoh) /* 33 TRAP #1 */
.long SYM(_uhoh) /* 34 TRAP #2 */
@@ -314,17 +314,6 @@ _cfm_msec: .long 0x00000000
.align 4
PUBLIC (_uhoh)
SYM(_uhoh):
/*
link a6,#0
lea -20(sp), sp
movem.l d0-d2/a0-a1, (sp)
pea.l 20(sp) | push exception frame address
jsr mcf5xxx_exception_handler
movem.l 4(sp), d0-d2/a0-a1
lea 24(sp), sp
unlk a6
rte
*/
nop | Leave spot for breakpoint
stop #0x2700 | Stop with interrupts disabled
bra.w SYM(_uhoh) | Stuck forever

View File

@@ -25,10 +25,8 @@
void bsp_cleanup(void)
{
printk("\nRTEMS exited!\n");
for ( ;; )
{
for (;;) {
asm volatile (" nop ");
asm volatile (" nop ");
}
}

View File

@@ -21,7 +21,6 @@ _HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x0;
_StackSize = DEFINED(_StackSize) ? _StackSize : 0x400;
_FlashBase = DEFINED(_FlashBase) ? _FlashBase : 0x00000000;
__IPSBAR = DEFINED(__IPSBAR) ? __IPSBAR : 0x40000000;
_VBR = 0x20000000;
ENTRY(start)
@@ -143,21 +142,23 @@ SECTIONS
.bss :
{
_clear_start = .;
PROVIDE (_clear_start = .);
*(.bss*)
*(COMMON)
. = ALIGN (16);
PROVIDE (_end = .);
PROVIDE (_clear_end = .);
} >sram
.stack :
{
/*
* Starting Stack
*/
. += _StackSize;
. = ALIGN (16);
PROVIDE(_StackInit = .);
_clear_end = .;
_WorkspaceBase = .;
PROVIDE(_WorkspaceBase = .);
} >sram
/* Stabs debugging sections. */

View File

@@ -16,28 +16,19 @@
#include <rtems.h>
#include <bsp.h>
typedef volatile unsigned char vuint8;
typedef volatile unsigned short vuint16;
typedef volatile unsigned long vuint32;
/* Declare base address of peripherals area */
#define __IPSBAR ((vuint8 *) 0x40000000)
void
Timer_initialize(void)
void Timer_initialize(void)
{
uint32_t preScaleDivisor = bsp_get_CPU_clock_speed() / 1000000;
MCF_DTIM3_DTMR = 0;
MCF_DTIM3_DTMR = MCF_DTIM_DTMR_PS(preScaleDivisor - 1) |
MCF_DTIM_DTMR_CLK_DIV1 |
MCF_DTIM_DTMR_RST;
MCF_DTIM_DTMR_CLK_DIV1 | MCF_DTIM_DTMR_RST;
}
/*
* Return timer value in microsecond units
*/
int
Read_timer(void)
int Read_timer(void)
{
return MCF_DTIM3_DTCN;
}
@@ -46,13 +37,11 @@ Read_timer(void)
* Empty function call used in loops to measure basic cost of looping
* in Timing Test Suite.
*/
rtems_status_code
Empty_function(void)
rtems_status_code Empty_function(void)
{
return RTEMS_SUCCESSFUL;
}
void
Set_find_average_overhead(rtems_boolean find_flag)
void Set_find_average_overhead(rtems_boolean find_flag)
{
}