Index: c/src/lib/libbsp/m68k/mcf52235/ChangeLog
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/ChangeLog	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/ChangeLog	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -1,2 +1,15 @@
+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>
 
Index: c/src/lib/libbsp/m68k/mcf52235/README
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/README	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/README	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -4,5 +4,5 @@
 
 Description: Motorola MCF52235EVB
-============
+============================================================================
 CPU: MCF52235, 60MHz
 SRAM: 32K
@@ -12,8 +12,8 @@
 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.
 
@@ -23,15 +23,33 @@
           --disable-tests
 
+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
 
@@ -47,5 +65,5 @@
 |  5  |        |        |        |        |        |        |        |        |
 +-----+--------+--------+--------+--------+--------+--------+--------+--------+
-|  4  | FEC RX | FEC TX |        |        |        |        |        |   PIT  |
+|  4  |        |        |        |        |        |        |        |   PIT  |
 +-----+--------+--------+--------+--------+--------+--------+--------+--------+
 |  3  | UART 0 | UART 1 | UART 2 |        |        |        |        |        |
@@ -55,2 +73,91 @@
 |  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 ***
+
+
Index: c/src/lib/libbsp/m68k/mcf52235/clock/clock.c
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/clock/clock.c	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/clock/clock.c	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -18,13 +18,17 @@
 /*
  * 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;
-    }
-    return (i - s_pcntrAtTick) * s_nanoScale;
+  uint32_t i;
+
+  if (MCF_PIT1_PCSR & MCF_PIT_PCSR_PIF) {
+    i = s_pcntrAtTick + (MCF_PIT1_PMR - MCF_PIT1_PCNTR);
+  }
+  else {
+    i = s_pcntrAtTick - MCF_PIT1_PCNTR;
+  }
+  return i * s_nanoScale;
 }
 
@@ -51,7 +55,7 @@
  * Turn off the clock
  */
-static void Clock_driver_support_shutdown_hardware() 
+static void Clock_driver_support_shutdown_hardware()
 {
-    MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN;
+  MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN;
 }
 
@@ -63,33 +67,31 @@
 static void Clock_driver_support_initialize_hardware()
 {
-    int level;
-    uint32_t pmr;
-    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;
-        preScaleCode++;
-    }
-    s_nanoScale = 1000000000 / (clk >> preScaleCode);
+  int level;
+  uint32_t pmr;
+  uint32_t preScaleCode = 0;
+  uint32_t clk = bsp_get_CPU_clock_speed() >> 1;
+  uint32_t tps = 1000000 / Configuration.microseconds_per_tick;
 
-    MCF_INTC0_ICR56 = MCF_INTC_ICR_IL(PIT3_IRQ_LEVEL) |
-                        MCF_INTC_ICR_IP(PIT3_IRQ_PRIORITY);
-    rtems_interrupt_disable( level );
-    MCF_INTC0_IMRH &= ~MCF_INTC_IMRH_MASK56;
-    MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN;
-    rtems_interrupt_enable( level );
+  while (preScaleCode < 15) {
+    pmr = (clk >> preScaleCode) / tps;
+    if (pmr < (1 << 15))
+      break;
+    preScaleCode++;
+  }
+  s_nanoScale = 1000000000 / (clk >> preScaleCode);
 
-    MCF_PIT1_PCSR = MCF_PIT_PCSR_PRE(preScaleCode) |
-                        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;
-    s_pcntrAtTick = MCF_PIT1_PCNTR;
+  MCF_INTC0_ICR56 = MCF_INTC_ICR_IL(PIT3_IRQ_LEVEL) |
+    MCF_INTC_ICR_IP(PIT3_IRQ_PRIORITY);
+  rtems_interrupt_disable(level);
+  MCF_INTC0_IMRH &= ~MCF_INTC_IMRH_MASK56;
+  MCF_PIT1_PCSR &= ~MCF_PIT_PCSR_EN;
+  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_PIT1_PMR = pmr;
+  MCF_PIT1_PCSR = MCF_PIT_PCSR_PRE(preScaleCode) |
+    MCF_PIT_PCSR_PIE | MCF_PIT_PCSR_RLD | MCF_PIT_PCSR_EN;
+  s_pcntrAtTick = MCF_PIT1_PCNTR;
 }
 
Index: c/src/lib/libbsp/m68k/mcf52235/console/console.c
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/console/console.c	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/console/console.c	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -24,21 +24,21 @@
 
 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 )
-{ 
-	int level;
-
-    if (c == '\n')
-        _BSP_null_char('\r');
-	rtems_interrupt_disable(level);
-    while ( (MCF_UART_USR(CONSOLE_PORT) & MCF_UART_USR_TXRDY) == 0 )
-        continue;
-    MCF_UART_UTB(CONSOLE_PORT) = c;
-    while ( (MCF_UART_USR(CONSOLE_PORT) & MCF_UART_USR_TXRDY) == 0 )
-        continue;
-	rtems_interrupt_enable(level);
-}
+static int IntUartInterruptWrite(int minor, const char *buf, int len);
+
+static void _BSP_null_char(char c)
+{
+  int level;
+
+  if (c == '\n')
+    _BSP_null_char('\r');
+  rtems_interrupt_disable(level);
+  while ((MCF_UART_USR(CONSOLE_PORT) & MCF_UART_USR_TXRDY) == 0)
+    continue;
+  MCF_UART_UTB(CONSOLE_PORT) = c;
+  while ((MCF_UART_USR(CONSOLE_PORT) & MCF_UART_USR_TXRDY) == 0)
+    continue;
+  rtems_interrupt_enable(level);
+}
+
 BSP_output_char_function_type BSP_output_char = _BSP_null_char;
 
@@ -48,15 +48,15 @@
 struct IntUartInfoStruct
 {
-	int                    iomode;
-	volatile int           uimr;
-	int                    baud;
-	int                    databits;
-	int                    parity;
-	int                    stopbits;
-	int                    hwflow;
-	int                    rx_in;
-	int                    rx_out;
-	char                   rx_buffer[RX_BUFFER_SIZE];
-	void                  *ttyp;
+  int iomode;
+  volatile int uimr;
+  int baud;
+  int databits;
+  int parity;
+  int stopbits;
+  int hwflow;
+  int rx_in;
+  int rx_out;
+  char rx_buffer[RX_BUFFER_SIZE];
+  void *ttyp;
 };
 
@@ -69,86 +69,81 @@
  ***************************************************************************/
 static void
-IntUartSet(int minor, int baud, int databits, int parity, int stopbits, int hwflow)
-{
-	int                         divisor;
-	uint32_t					clock_speed;
-	uint8_t                   umr1 = 0;
-	uint8_t                   umr2 = 0;
-	struct IntUartInfoStruct   *info = &IntUartInfo[minor];
-	int                         level;
-
-	rtems_interrupt_disable(level);
-
-
-	/* disable interrupts, clear RTS line, and disable the UARTS */
-	MCF_UART_UIMR(minor) = 0;
-	MCF_UART_UOP0(minor) = 1;
-	MCF_UART_UCR(minor) = (MCF_UART_UCR_TX_DISABLED | MCF_UART_UCR_RX_DISABLED);
-
-	/* save the current values */
-	info->uimr     = 0;
-	info->baud     = baud;
-	info->databits = databits;
-	info->parity   = parity;
-	info->stopbits = stopbits;
-	info->hwflow   = hwflow;
-
-    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 )
-	{
-		/* set hardware flow options */
-		umr1 |= MCF_UART_UMR_RXRTS;
-		umr2 |= MCF_UART_UMR_TXCTS;
-	}
-
-	/* determine the new umr values */
-	umr1 |= (parity | databits);
-	umr2 |= (stopbits);
-
-	/* reset the uart */
-	MCF_UART_UCR(minor) = MCF_UART_UCR_RESET_ERROR;
-	MCF_UART_UCR(minor) = MCF_UART_UCR_RESET_RX;
-	MCF_UART_UCR(minor) = MCF_UART_UCR_RESET_TX;
-
-	/* reset the uart mode register and update values */
-	MCF_UART_UCR(minor) = MCF_UART_UCR_RESET_MR;
-	MCF_UART_UMR(minor) = umr1;
-	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_UBG1(minor) = (divisor & 0xff00) >> 8;
-	MCF_UART_UBG2(minor) = (divisor & 0x00ff);
-
-	/* enable the uart */
-    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 )
-	{
-		/* 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 )
-	{
-		/* assert the RTS line */
-		MCF_UART_UOP1(minor) = 1;
-	}
-
-	rtems_interrupt_enable(level);
-
-}
-
+IntUartSet(int minor, int baud, int databits, int parity, int stopbits,
+           int hwflow)
+{
+  int divisor;
+  uint32_t clock_speed;
+  uint8_t umr1 = 0;
+  uint8_t umr2 = 0;
+  struct IntUartInfoStruct *info = &IntUartInfo[minor];
+  int level;
+
+  rtems_interrupt_disable(level);
+
+  /* disable interrupts, clear RTS line, and disable the UARTS */
+  MCF_UART_UIMR(minor) = 0;
+  MCF_UART_UOP0(minor) = 1;
+  MCF_UART_UCR(minor) = (MCF_UART_UCR_TX_DISABLED | MCF_UART_UCR_RX_DISABLED);
+
+  /* save the current values */
+  info->uimr = 0;
+  info->baud = baud;
+  info->databits = databits;
+  info->parity = parity;
+  info->stopbits = stopbits;
+  info->hwflow = hwflow;
+
+  clock_speed = bsp_get_CPU_clock_speed();
+  /* determine the baud divisor value */
+  divisor = ((clock_speed) / (32 * baud));
+  if (divisor < 2)
+    divisor = 2;
+
+  /* check to see if doing hardware flow control */
+  if (hwflow) {
+    /* set hardware flow options */
+    umr1 |= MCF_UART_UMR_RXRTS;
+    umr2 |= MCF_UART_UMR_TXCTS;
+  }
+
+  /* determine the new umr values */
+  umr1 |= (parity | databits);
+  umr2 |= (stopbits);
+
+  /* reset the uart */
+  MCF_UART_UCR(minor) = MCF_UART_UCR_RESET_ERROR;
+  MCF_UART_UCR(minor) = MCF_UART_UCR_RESET_RX;
+  MCF_UART_UCR(minor) = MCF_UART_UCR_RESET_TX;
+
+  /* reset the uart mode register and update values */
+  MCF_UART_UCR(minor) = MCF_UART_UCR_RESET_MR;
+  MCF_UART_UMR(minor) = umr1;
+  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_UBG1(minor) = (divisor & 0xff00) >> 8;
+  MCF_UART_UBG2(minor) = (divisor & 0x00ff);
+
+  /* enable the uart */
+  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) {
+    /* 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) {
+    /* assert the RTS line */
+    MCF_UART_UOP1(minor) = 1;
+  }
+
+  rtems_interrupt_enable(level);
+
+}
 
 /***************************************************************************
@@ -161,80 +156,69 @@
    an error of +/- 5% at 25MHz processor clock
  ***************************************************************************/
-static int
-IntUartSetAttributes(int minor, const struct termios *t)
-{
-	/* set default index values */
-	int                         baud     = (int)19200;
-	int                         databits = (int)MCF_UART_UMR_BC_8;
-	int                         parity   = (int)MCF_UART_UMR_PM_NONE;
-	int                         stopbits = (int)MCF_UART_UMR_SB_STOP_BITS_1;
-	int                         hwflow   = (int)0;
-	struct IntUartInfoStruct   *info     = &IntUartInfo[minor];
-
-	/* check to see if input is valid */
-	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 )
-		{
-			case CS5:
-				databits = (int)MCF_UART_UMR_BC_5;
-				break;
-			case CS6:
-				databits = (int)MCF_UART_UMR_BC_6;
-				break;
-			case CS7:
-				databits = (int)MCF_UART_UMR_BC_7;
-				break;
-			case CS8:
-				databits = (int)MCF_UART_UMR_BC_8;
-				break;
-		}
-
-		/* determine if parity is enabled */
-		if ( t->c_cflag & PARENB )
-		{
-			if ( t->c_cflag & PARODD )
-			{
-				/* odd parity */
-				parity = (int)MCF_UART_UMR_PM_ODD;
-			}
-			else
-			{
-				/* even parity */
-				parity = (int)MCF_UART_UMR_PM_EVEN;
-			}
-		}
-
-		/* determine stop bits */
-		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 )
-		{
-			hwflow = 1;
-		}
-	}
-
-	/* check to see if values have changed */
-	if ( ( baud     != info->baud     ) ||
-		 ( databits != info->databits ) ||
-		 ( parity   != info->parity   ) ||
-		 ( stopbits != info->stopbits ) ||
-		 ( hwflow   != info->hwflow   ) )
-	{
-
-		/* call function to set values */
-		IntUartSet(minor, baud, databits, parity, stopbits, hwflow);
-	}
-
-	return( RTEMS_SUCCESSFUL );
+static int IntUartSetAttributes(int minor, const struct termios *t)
+{
+  /* set default index values */
+  int baud = (int) 19200;
+  int databits = (int) MCF_UART_UMR_BC_8;
+  int parity = (int) MCF_UART_UMR_PM_NONE;
+  int stopbits = (int) MCF_UART_UMR_SB_STOP_BITS_1;
+  int hwflow = (int) 0;
+  struct IntUartInfoStruct *info = &IntUartInfo[minor];
+
+  /* check to see if input is valid */
+  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) {
+      case CS5:
+        databits = (int) MCF_UART_UMR_BC_5;
+        break;
+      case CS6:
+        databits = (int) MCF_UART_UMR_BC_6;
+        break;
+      case CS7:
+        databits = (int) MCF_UART_UMR_BC_7;
+        break;
+      case CS8:
+        databits = (int) MCF_UART_UMR_BC_8;
+        break;
+    }
+
+    /* determine if parity is enabled */
+    if (t->c_cflag & PARENB) {
+      if (t->c_cflag & PARODD) {
+        /* odd parity */
+        parity = (int) MCF_UART_UMR_PM_ODD;
+      } else {
+        /* even parity */
+        parity = (int) MCF_UART_UMR_PM_EVEN;
+      }
+    }
+
+    /* determine stop bits */
+    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) {
+      hwflow = 1;
+    }
+  }
+
+  /* check to see if values have changed */
+  if ((baud != info->baud) ||
+      (databits != info->databits) ||
+      (parity != info->parity) ||
+      (stopbits != info->stopbits) || (hwflow != info->hwflow)) {
+
+    /* call function to set values */
+    IntUartSet(minor, baud, databits, parity, stopbits, hwflow);
+  }
+
+  return (RTEMS_SUCCESSFUL);
 
 }
@@ -247,68 +231,57 @@
    chars and dequeueing chars waiting for transmission.
  ***************************************************************************/
-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 )
-	{
-		/* read data and put into the receive buffer */
-		while ( MCF_UART_USR(chan) & MCF_UART_USR_RXRDY )
-		{
-
-			if ( MCF_UART_USR(chan) & MCF_UART_USR_ERROR )
-			{
-				/* clear the error */
-				MCF_UART_UCR(chan) = MCF_UART_UCR_RESET_ERROR;
-			}
-			/* put data in rx buffer and check for errors */
-			info->rx_buffer[info->rx_in] = MCF_UART_URB(chan);
-
-			/* update buffer values */
-			info->rx_in++;
-
-			if ( info->rx_in >= RX_BUFFER_SIZE )
-			{
-				info->rx_in = 0;
-			}
-		}
-		/* Make sure the port has been opened */
-		if ( info->ttyp )
-		{
-
-			/* check to see if task driven */
-			if ( info->iomode == TERMIOS_TASK_DRIVEN )
-			{
-				/* notify rx task that rx buffer has data */
-				rtems_termios_rxirq_occured(info->ttyp);
-			}
-			else
-			{
-				/* Push up the received data */
-				rtems_termios_enqueue_raw_characters(info->ttyp, info->rx_buffer, info->rx_in);
-				info->rx_in    = 0;
-			}
-		}
-	}
-
-	/* check to see if data needs to be transmitted */
-	if ( ( info->uimr & MCF_UART_UIMR_TXRDY ) &&
-		 ( MCF_UART_UISR(chan) & MCF_UART_UISR_TXRDY ) )
-	{
-
-		/* disable tx interrupts */
-		info->uimr &= ~MCF_UART_UIMR_TXRDY;
-		MCF_UART_UIMR(chan) = info->uimr;
-
-		/* tell upper level that character has been sent */
-		if ( info->ttyp )
-			rtems_termios_dequeue_characters(info->ttyp, 1);
-	}
-}
-
-
+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) {
+    /* read data and put into the receive buffer */
+    while (MCF_UART_USR(chan) & MCF_UART_USR_RXRDY) {
+
+      if (MCF_UART_USR(chan) & MCF_UART_USR_ERROR) {
+        /* clear the error */
+        MCF_UART_UCR(chan) = MCF_UART_UCR_RESET_ERROR;
+      }
+      /* put data in rx buffer and check for errors */
+      info->rx_buffer[info->rx_in] = MCF_UART_URB(chan);
+
+      /* update buffer values */
+      info->rx_in++;
+
+      if (info->rx_in >= RX_BUFFER_SIZE) {
+        info->rx_in = 0;
+      }
+    }
+    /* Make sure the port has been opened */
+    if (info->ttyp) {
+
+      /* check to see if task driven */
+      if (info->iomode == TERMIOS_TASK_DRIVEN) {
+        /* notify rx task that rx buffer has data */
+        rtems_termios_rxirq_occured(info->ttyp);
+      } else {
+        /* Push up the received data */
+        rtems_termios_enqueue_raw_characters(info->ttyp, info->rx_buffer,
+                                             info->rx_in);
+        info->rx_in = 0;
+      }
+    }
+  }
+
+  /* check to see if data needs to be transmitted */
+  if ((info->uimr & MCF_UART_UIMR_TXRDY) &&
+      (MCF_UART_UISR(chan) & MCF_UART_UISR_TXRDY)) {
+
+    /* disable tx interrupts */
+    info->uimr &= ~MCF_UART_UIMR_TXRDY;
+    MCF_UART_UIMR(chan) = info->uimr;
+
+    /* tell upper level that character has been sent */
+    if (info->ttyp)
+      rtems_termios_dequeue_characters(info->ttyp, 1);
+  }
+}
 
 /***************************************************************************
@@ -319,69 +292,60 @@
    interrupt vectors are hooked.
  ***************************************************************************/
-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++ )
-	{
-		info = &IntUartInfo[chan];
-
-		info->ttyp     = NULL;
-		info->rx_in    = 0;
-		info->rx_out   = 0;
-		info->baud     = -1;
-		info->databits = -1;
-		info->parity   = -1;
-		info->stopbits = -1;
-		info->hwflow   = -1;
-		info->iomode   = TERMIOS_POLLED; /*polled console io */
-
-		MCF_UART_UACR(chan) = 0;
-		MCF_UART_UIMR(chan) = 0;
-		if ( info->iomode != TERMIOS_POLLED )
-		{
-			rtems_interrupt_catch (IntUartInterruptHandler,
-								   UART_INTC0_IRQ_VECTOR(chan),
-								   &old_handler);
-		}
-
-		/* set uart default values */
-		IntUartSetAttributes(chan, NULL);
-
-        /* unmask interrupt */
-		rtems_interrupt_disable(level);
-        switch(chan) {
-        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);
-            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);
-            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);
-            break;
-        }
-		rtems_interrupt_enable(level);
-
-	} /* of chan loop */
-
-
-} /* IntUartInitialise */
-
+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++) {
+    info = &IntUartInfo[chan];
+
+    info->ttyp = NULL;
+    info->rx_in = 0;
+    info->rx_out = 0;
+    info->baud = -1;
+    info->databits = -1;
+    info->parity = -1;
+    info->stopbits = -1;
+    info->hwflow = -1;
+    info->iomode = TERMIOS_POLLED;                /*polled console io */
+
+    MCF_UART_UACR(chan) = 0;
+    MCF_UART_UIMR(chan) = 0;
+    if (info->iomode != TERMIOS_POLLED) {
+      rtems_interrupt_catch(IntUartInterruptHandler,
+                            UART_INTC0_IRQ_VECTOR(chan), &old_handler);
+    }
+
+    /* set uart default values */
+    IntUartSetAttributes(chan, NULL);
+
+    /* unmask interrupt */
+    rtems_interrupt_disable(level);
+    switch (chan) {
+      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);
+        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);
+        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);
+        break;
+    }
+    rtems_interrupt_enable(level);
+
+  }                                               /* of chan loop */
+
+}                                                 /* IntUartInitialise */
 
 /***************************************************************************
@@ -393,20 +357,19 @@
    interrupts.
  ***************************************************************************/
-static int
-IntUartInterruptWrite (int minor, const char *buf, int len)
-{
-	int level;
-
-	rtems_interrupt_disable(level);
-
-	/* write out character */
-	MCF_UART_UTB(minor) = *buf;
-
-	/* enable tx interrupt */
-	IntUartInfo[minor].uimr |= MCF_UART_UIMR_TXRDY;
-	MCF_UART_UIMR(minor) = IntUartInfo[minor].uimr;
-
-	rtems_interrupt_enable(level);
-	return( 0 );
+static int IntUartInterruptWrite(int minor, const char *buf, int len)
+{
+  int level;
+
+  rtems_interrupt_disable(level);
+
+  /* write out character */
+  MCF_UART_UTB(minor) = *buf;
+
+  /* enable tx interrupt */
+  IntUartInfo[minor].uimr |= MCF_UART_UIMR_TXRDY;
+  MCF_UART_UIMR(minor) = IntUartInfo[minor].uimr;
+
+  rtems_interrupt_enable(level);
+  return (0);
 }
 
@@ -416,31 +379,26 @@
    Description : This enables interrupts when the tty is opened.
  ***************************************************************************/
-static int
-IntUartInterruptOpen(int major, int minor, void *arg)
-{
-	struct IntUartInfoStruct   *info = &IntUartInfo[minor];
-
-	/* enable the uart */
-	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 )
-	{
-		/* 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 )
-	{
-		/* assert the RTS line */
-		MCF_UART_UOP1(minor) = 1;
-	}
-
-	return( 0 );
-}
-
-
+static int IntUartInterruptOpen(int major, int minor, void *arg)
+{
+  struct IntUartInfoStruct *info = &IntUartInfo[minor];
+
+  /* enable the uart */
+  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) {
+    /* 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) {
+    /* assert the RTS line */
+    MCF_UART_UOP1(minor) = 1;
+  }
+
+  return (0);
+}
 
 /***************************************************************************
@@ -449,20 +407,19 @@
    Description : This disables interrupts when the tty is closed.
  ***************************************************************************/
-static int
-IntUartInterruptClose(int major, int minor, void *arg)
-{
-	struct IntUartInfoStruct   *info = &IntUartInfo[minor];
-
-	/* disable the interrupts and the uart */
-	MCF_UART_UIMR(minor) = 0;
-	MCF_UART_UCR(minor) = (MCF_UART_UCR_TX_DISABLED | MCF_UART_UCR_RX_DISABLED);
-
-	/* reset values */
-	info->ttyp     = NULL;
-	info->uimr       = 0;
-	info->rx_in    = 0;
-	info->rx_out   = 0;
-
-	return( 0 );
+static int IntUartInterruptClose(int major, int minor, void *arg)
+{
+  struct IntUartInfoStruct *info = &IntUartInfo[minor];
+
+  /* disable the interrupts and the uart */
+  MCF_UART_UIMR(minor) = 0;
+  MCF_UART_UCR(minor) = (MCF_UART_UCR_TX_DISABLED | MCF_UART_UCR_RX_DISABLED);
+
+  /* reset values */
+  info->ttyp = NULL;
+  info->uimr = 0;
+  info->rx_in = 0;
+  info->rx_out = 0;
+
+  return (0);
 }
 
@@ -474,50 +431,41 @@
    re-enabled after all data has been read.
  ***************************************************************************/
-static int
-IntUartTaskRead(int minor)
-{
-	char                        buffer[RX_BUFFER_SIZE];
-	int                         count;
-	int                         rx_in;
-	int                         index = 0;
-	struct IntUartInfoStruct   *info  = &IntUartInfo[minor];
-
-	/* determine number of values to copy out */
-	rx_in = info->rx_in;
-	if ( info->rx_out <= rx_in )
-	{
-		count = rx_in - info->rx_out;
-	}
-	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 ) )
-	{
-		/* 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 )
-		{
-			info->rx_out = 0;
-		}
-	}
-
-	/* check to see if buffer is not empty */
-	if ( count > 0 )
-	{
-		/* set characters into termios buffer  */
-		rtems_termios_enqueue_raw_characters(info->ttyp, buffer, count);
-	}
-
-	return( EOF );
-}
-
-
+static int IntUartTaskRead(int minor)
+{
+  char buffer[RX_BUFFER_SIZE];
+  int count;
+  int rx_in;
+  int index = 0;
+  struct IntUartInfoStruct *info = &IntUartInfo[minor];
+
+  /* determine number of values to copy out */
+  rx_in = info->rx_in;
+  if (info->rx_out <= rx_in) {
+    count = rx_in - info->rx_out;
+  } 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)) {
+    /* 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) {
+      info->rx_out = 0;
+    }
+  }
+
+  /* check to see if buffer is not empty */
+  if (count > 0) {
+    /* set characters into termios buffer  */
+    rtems_termios_enqueue_raw_characters(info->ttyp, buffer, count);
+  }
+
+  return (EOF);
+}
 
 /***************************************************************************
@@ -527,13 +475,11 @@
    to the caller without blocking if not character is waiting.
  ***************************************************************************/
-static int
-IntUartPollRead (int minor)
-{
-	if ( (MCF_UART_USR(minor) & MCF_UART_USR_RXRDY) == 0 )
-		return(-1);
-
-	return(MCF_UART_URB(minor));
-}
-
+static int IntUartPollRead(int minor)
+{
+  if ((MCF_UART_USR(minor) & MCF_UART_USR_RXRDY) == 0)
+    return (-1);
+
+  return (MCF_UART_URB(minor));
+}
 
 /***************************************************************************
@@ -544,19 +490,16 @@
    transmitted.
  ***************************************************************************/
-static int
-IntUartPollWrite (int minor, const char *buf, int len)
-{
-	/* loop over buffer */
-	while ( len-- )
-	{
-		/* block until we can transmit */
-		while ( (MCF_UART_USR(minor) & MCF_UART_USR_TXRDY) == 0 )
-			continue;
-		/* transmit data byte */
-		MCF_UART_UTB(minor) = *buf++;
-	}
-	return(0);
-}
-
+static int IntUartPollWrite(int minor, const char *buf, int len)
+{
+  /* loop over buffer */
+  while (len--) {
+    /* block until we can transmit */
+    while ((MCF_UART_USR(minor) & MCF_UART_USR_TXRDY) == 0)
+      continue;
+    /* transmit data byte */
+    MCF_UART_UTB(minor) = *buf++;
+  }
+  return (0);
+}
 
 /***************************************************************************
@@ -566,45 +509,38 @@
    registering /dev/tty devices for each channel and the system /dev/console.
  ***************************************************************************/
-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 ();
-
-	/* set io modes for the different channels and initialize device */
-    IntUartInfo[minor].iomode = TERMIOS_IRQ_DRIVEN;
-	IntUartInitialize(); 
-
-	/* Register the console port */
-	status = rtems_io_register_name ("/dev/console", major, CONSOLE_PORT);
-	if ( status != RTEMS_SUCCESSFUL )
-	{
-		rtems_fatal_error_occurred (status);
-	}
-
-	/* Register the other port */
-	if ( CONSOLE_PORT != 0 )
-	{
-		status = rtems_io_register_name ("/dev/tty00", major, 0);
-		if ( status != RTEMS_SUCCESSFUL )
-		{
-			rtems_fatal_error_occurred (status);
-		}
-	}
-	if ( CONSOLE_PORT != 1 )
-	{
-		status = rtems_io_register_name ("/dev/tty01", major, 1);
-		if ( status != RTEMS_SUCCESSFUL )
-		{
-			rtems_fatal_error_occurred (status);
-		}
-	}
-
-	return(RTEMS_SUCCESSFUL);
+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();
+
+  /* set io modes for the different channels and initialize device */
+  IntUartInfo[minor].iomode = TERMIOS_IRQ_DRIVEN;
+  IntUartInitialize();
+
+  /* Register the console port */
+  status = rtems_io_register_name("/dev/console", major, CONSOLE_PORT);
+  if (status != RTEMS_SUCCESSFUL) {
+    rtems_fatal_error_occurred(status);
+  }
+
+  /* Register the other port */
+  if (CONSOLE_PORT != 0) {
+    status = rtems_io_register_name("/dev/tty00", major, 0);
+    if (status != RTEMS_SUCCESSFUL) {
+      rtems_fatal_error_occurred(status);
+    }
+  }
+  if (CONSOLE_PORT != 1) {
+    status = rtems_io_register_name("/dev/tty01", major, 1);
+    if (status != RTEMS_SUCCESSFUL) {
+      rtems_fatal_error_occurred(status);
+    }
+  }
+
+  return (RTEMS_SUCCESSFUL);
 }
 
@@ -617,80 +553,75 @@
    polled or not.
  ***************************************************************************/
-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;
-	struct IntUartInfoStruct        *info;
-
-	static const rtems_termios_callbacks IntUartPollCallbacks = {
-		NULL,				  /* firstOpen */
-		NULL,				  /* lastClose */
-		IntUartPollRead,	  /* pollRead */
-		IntUartPollWrite,	  /* write */
-		IntUartSetAttributes, /* setAttributes */
-		NULL,				  /* stopRemoteTx */
-		NULL,				  /* startRemoteTx */
-		TERMIOS_POLLED		  /* mode */
-	};
-	static const rtems_termios_callbacks IntUartIntrCallbacks = {
-		IntUartInterruptOpen,  /* firstOpen */
-		IntUartInterruptClose, /* lastClose */
-		NULL,				   /* pollRead */
-		IntUartInterruptWrite, /* write */
-		IntUartSetAttributes,  /* setAttributes */
-		NULL,				   /* stopRemoteTx */
-		NULL,				   /* startRemoteTx */
-		TERMIOS_IRQ_DRIVEN	   /* mode */
-	};
-
-	static const rtems_termios_callbacks IntUartTaskCallbacks = {
-		IntUartInterruptOpen,  /* firstOpen */
-		IntUartInterruptClose, /* lastClose */
-		IntUartTaskRead,	   /* pollRead */
-		IntUartInterruptWrite, /* write */
-		IntUartSetAttributes,  /* setAttributes */
-		NULL,				   /* stopRemoteTx */
-		NULL,				   /* startRemoteTx */
-		TERMIOS_TASK_DRIVEN	   /* mode */
-	};
-
-	/* open the port depending on the minor device number */
-	if ( ( minor >= 0 ) && ( minor < MAX_UART_INFO ) )
-	{
-		info = &IntUartInfo[minor];
-		switch ( info->iomode )
-		{
-			case TERMIOS_POLLED:
-				status = rtems_termios_open(major, minor, arg, &IntUartPollCallbacks);
-				break;
-			case TERMIOS_IRQ_DRIVEN:
-				status = rtems_termios_open(major, minor, arg, &IntUartIntrCallbacks);
-				info->ttyp = args->iop->data1;
-				break;
-			case TERMIOS_TASK_DRIVEN:
-				status = rtems_termios_open(major, minor, arg, &IntUartTaskCallbacks);
-				info->ttyp = args->iop->data1;
-				break;
-		}
-	}
-
-	if (status == RTEMS_SUCCESSFUL)
-	{
-		/*
-	 	* Reset the default baudrate.
-		*/
-		struct termios term;
-		if (tcgetattr (STDIN_FILENO, &term) >= 0)
-		{
-			term.c_cflag &= ~(CBAUD | CSIZE);
-			term.c_cflag |= CS8 | B19200;
-			tcsetattr (STDIN_FILENO, TCSANOW, &term);
-		}
-	}
-
-	return( status );
+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;
+  struct IntUartInfoStruct *info;
+
+  static const rtems_termios_callbacks IntUartPollCallbacks = {
+    NULL,                                         /* firstOpen */
+    NULL,                                         /* lastClose */
+    IntUartPollRead,                              /* pollRead */
+    IntUartPollWrite,                             /* write */
+    IntUartSetAttributes,                         /* setAttributes */
+    NULL,                                         /* stopRemoteTx */
+    NULL,                                         /* startRemoteTx */
+    TERMIOS_POLLED                                /* mode */
+  };
+  static const rtems_termios_callbacks IntUartIntrCallbacks = {
+    IntUartInterruptOpen,                         /* firstOpen */
+    IntUartInterruptClose,                        /* lastClose */
+    NULL,                                         /* pollRead */
+    IntUartInterruptWrite,                        /* write */
+    IntUartSetAttributes,                         /* setAttributes */
+    NULL,                                         /* stopRemoteTx */
+    NULL,                                         /* startRemoteTx */
+    TERMIOS_IRQ_DRIVEN                            /* mode */
+  };
+
+  static const rtems_termios_callbacks IntUartTaskCallbacks = {
+    IntUartInterruptOpen,                         /* firstOpen */
+    IntUartInterruptClose,                        /* lastClose */
+    IntUartTaskRead,                              /* pollRead */
+    IntUartInterruptWrite,                        /* write */
+    IntUartSetAttributes,                         /* setAttributes */
+    NULL,                                         /* stopRemoteTx */
+    NULL,                                         /* startRemoteTx */
+    TERMIOS_TASK_DRIVEN                           /* mode */
+  };
+
+  /* open the port depending on the minor device number */
+  if ((minor >= 0) && (minor < MAX_UART_INFO)) {
+    info = &IntUartInfo[minor];
+    switch (info->iomode) {
+      case TERMIOS_POLLED:
+        status = rtems_termios_open(major, minor, arg, &IntUartPollCallbacks);
+        break;
+      case TERMIOS_IRQ_DRIVEN:
+        status = rtems_termios_open(major, minor, arg, &IntUartIntrCallbacks);
+        info->ttyp = args->iop->data1;
+        break;
+      case TERMIOS_TASK_DRIVEN:
+        status = rtems_termios_open(major, minor, arg, &IntUartTaskCallbacks);
+        info->ttyp = args->iop->data1;
+        break;
+    }
+  }
+
+  if (status == RTEMS_SUCCESSFUL) {
+    /*
+     * Reset the default baudrate.
+     */
+    struct termios term;
+
+    if (tcgetattr(STDIN_FILENO, &term) >= 0) {
+      term.c_cflag &= ~(CBAUD | CSIZE);
+      term.c_cflag |= CS8 | B19200;
+      tcsetattr(STDIN_FILENO, TCSANOW, &term);
+    }
+  }
+
+  return (status);
 }
 
@@ -700,10 +631,8 @@
    Description : This closes the device via termios
  ***************************************************************************/
-rtems_device_driver console_close(
-	rtems_device_major_number major,
-	rtems_device_minor_number minor,
-	void   * arg)
-{
-    return(rtems_termios_close (arg));
+rtems_device_driver console_close(rtems_device_major_number major,
+                                  rtems_device_minor_number minor, void *arg)
+{
+  return (rtems_termios_close(arg));
 }
 
@@ -714,10 +643,8 @@
    Description : Read from the device via termios
  ***************************************************************************/
-rtems_device_driver console_read(
-	rtems_device_major_number major,
-	rtems_device_minor_number minor,
-	void  * arg)
-{
-    return(rtems_termios_read (arg));
+rtems_device_driver console_read(rtems_device_major_number major,
+                                 rtems_device_minor_number minor, void *arg)
+{
+  return (rtems_termios_read(arg));
 }
 
@@ -727,10 +654,8 @@
    Description : Write to the device via termios
  ***************************************************************************/
-rtems_device_driver console_write(
-	rtems_device_major_number major,
-	rtems_device_minor_number minor,
-	void  * arg)
-{
-    return(rtems_termios_write (arg));
+rtems_device_driver console_write(rtems_device_major_number major,
+                                  rtems_device_minor_number minor, void *arg)
+{
+  return (rtems_termios_write(arg));
 }
 
@@ -740,29 +665,29 @@
    Description : Pass the IOCtl call to termios
  ***************************************************************************/
-rtems_device_driver console_control(
-	rtems_device_major_number major,
-	rtems_device_minor_number minor,
-	void  * arg)
-{
-    return( rtems_termios_ioctl (arg) );
+rtems_device_driver console_control(rtems_device_major_number major,
+                                    rtems_device_minor_number minor,
+                                    void *arg)
+{
+  return (rtems_termios_ioctl(arg));
 }
 int DEBUG_OUTCHAR(int c)
 {
-    if(c == '\n')
-        DEBUG_OUTCHAR('\r');
-    _BSP_null_char(c);
-    return c;
+  if (c == '\n')
+    DEBUG_OUTCHAR('\r');
+  _BSP_null_char(c);
+  return c;
 }
 void DEBUG_OUTSTR(const char *msg)
 {
-    while (*msg)
-        DEBUG_OUTCHAR(*msg++);
+  while (*msg)
+    DEBUG_OUTCHAR(*msg++);
 }
 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]);
-}
+  int n;
+  static const char map[] = "0123456789ABCDEF";
+
+  DEBUG_OUTCHAR(' ');
+  for (n = 28; n >= 0; n -= 4)
+    DEBUG_OUTCHAR(map[(i >> n) & 0xF]);
+}
Index: c/src/lib/libbsp/m68k/mcf52235/gdb-init
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/gdb-init	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/gdb-init	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -25,8 +25,10 @@
 
 # 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 set remote-debug 1
 monitor bdm-reset
 
@@ -43,4 +45,4 @@
 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
Index: c/src/lib/libbsp/m68k/mcf52235/include/bsp.h
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/include/bsp.h	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/include/bsp.h	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -20,14 +20,11 @@
 /***************************************************************************/
 /**  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
 
 /***************************************************************************/
@@ -59,5 +56,7 @@
 
 uint32_t bsp_get_CPU_clock_speed(void);
+
 void bsp_cleanup(void);
+
 m68k_isr_entry set_vector(
   rtems_isr_entry     handler,
@@ -70,7 +69,4 @@
  *  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
Index: c/src/lib/libbsp/m68k/mcf52235/include/coverhd.h
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/include/coverhd.h	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/include/coverhd.h	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -41,9 +41,9 @@
 #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
 
@@ -51,5 +51,5 @@
 #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
Index: c/src/lib/libbsp/m68k/mcf52235/start/start.S
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/start/start.S	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/start/start.S	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -32,5 +32,5 @@
     .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 */
@@ -42,5 +42,5 @@
     .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 */
@@ -52,11 +52,11 @@
     .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 */
@@ -315,15 +315,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 
Index: c/src/lib/libbsp/m68k/mcf52235/startup/bspclean.c
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/startup/bspclean.c	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/startup/bspclean.c	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -23,12 +23,10 @@
 #include <rtems/bspIo.h>
 
-void bsp_cleanup( void )
+void bsp_cleanup(void)
 {
-	printk("\nRTEMS exited!\n");
-	for ( ;; )
-	{
-		asm volatile ( " nop " );
-		asm volatile ( " nop " );
-	}
-
+  printk("\nRTEMS exited!\n");
+  for (;;) {
+    asm volatile (" nop ");
+    asm volatile (" nop ");
+  }
 }
Index: c/src/lib/libbsp/m68k/mcf52235/startup/bspstart.c
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/startup/bspstart.c	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/startup/bspstart.c	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -55,5 +55,5 @@
  *  This routine does the bulk of the system initialisation.
  */
-void bsp_start( void )
+void bsp_start(void)
 {
 }
@@ -61,4 +61,4 @@
 uint32_t bsp_get_CPU_clock_speed(void)
 {
-    return 60000000;
+  return 60000000;
 }
Index: c/src/lib/libbsp/m68k/mcf52235/startup/linkcmds
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/startup/linkcmds	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/startup/linkcmds	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -22,5 +22,4 @@
 _FlashBase = DEFINED(_FlashBase) ? _FlashBase : 0x00000000;
 
-__IPSBAR = DEFINED(__IPSBAR) ? __IPSBAR : 0x40000000;
 _VBR = 0x20000000;
 
@@ -144,10 +143,14 @@
     .bss : 
     {
-        _clear_start = .;
+        PROVIDE (_clear_start = .);
         *(.bss*)
         *(COMMON)
         . = ALIGN (16);
         PROVIDE (_end = .);
+        PROVIDE (_clear_end = .);
+    } >sram
 
+    .stack : 
+    {
         /*
          * Starting Stack
@@ -156,7 +159,5 @@
         . = ALIGN (16);
         PROVIDE(_StackInit = .);
-
-        _clear_end = .;
-        _WorkspaceBase = .;
+        PROVIDE(_WorkspaceBase = .);
     } >sram
 
Index: c/src/lib/libbsp/m68k/mcf52235/timer/timer.c
===================================================================
--- c/src/lib/libbsp/m68k/mcf52235/timer/timer.c	(revision 8f25cec8bb688d4b1ecf364e81fde494f9513f12)
+++ c/src/lib/libbsp/m68k/mcf52235/timer/timer.c	(revision 9374e9b082bf80e68aaa747dd26a5a3b01bc6626)
@@ -17,19 +17,11 @@
 #include <bsp.h>
 
-typedef volatile unsigned char vuint8;
-typedef volatile unsigned short vuint16;
-typedef volatile unsigned long vuint32;
+void Timer_initialize(void)
+{
+  uint32_t preScaleDivisor = bsp_get_CPU_clock_speed() / 1000000;
 
-/* Declare base address of peripherals area */
-#define __IPSBAR ((vuint8 *) 0x40000000)
-
-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_DTIM3_DTMR = 0;
+  MCF_DTIM3_DTMR = MCF_DTIM_DTMR_PS(preScaleDivisor - 1) |
+    MCF_DTIM_DTMR_CLK_DIV1 | MCF_DTIM_DTMR_RST;
 }
 
@@ -37,8 +29,7 @@
  * Return timer value in microsecond units
  */
-int
-Read_timer(void)
+int Read_timer(void)
 {
-    return MCF_DTIM3_DTCN;
+  return MCF_DTIM3_DTCN;
 }
 
@@ -47,12 +38,10 @@
  *  in Timing Test Suite.
  */
-rtems_status_code
-Empty_function(void)
+rtems_status_code Empty_function(void)
 {
-    return RTEMS_SUCCESSFUL;
+  return RTEMS_SUCCESSFUL;
 }
 
-void
-Set_find_average_overhead(rtems_boolean find_flag)
+void Set_find_average_overhead(rtems_boolean find_flag)
 {
 }
