summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2010-11-12 14:16:57 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2010-11-12 14:16:57 +0000
commit8a54204379574c12af94a9491a91cf59a5857e22 (patch)
tree8000c0ad4c8734fc33326e0d37abd5c12f10d80f /c
parent2010-11-12 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-8a54204379574c12af94a9491a91cf59a5857e22.tar.bz2
2010-11-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
* console/console.h, console/console.c, console/config.c, console/ns16550cfg.c: Removed files. * console/console-config.c: New file. * Makefile.am: Reflect changes above. * configure.ac: New BSP options. * include/bsp.h: Use new BSP options. * network/network.c: Avoid memory leak. * startup/bspstart.c: Initialize console port table. * spi/spi_init.c: Update for SD card API changes.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/ChangeLog12
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/Makefile.am3
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/configure.ac18
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/console/config.c149
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c118
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/console/console.c281
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/console/console.h38
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/console/ns16550cfg.c67
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/include/bsp.h67
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/network/network.c3
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/spi/spi_init.c57
-rw-r--r--c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c13
12 files changed, 207 insertions, 619 deletions
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog b/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog
index ba9c578748..c987ec10c6 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/gen83xx/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * console/console.h, console/console.c, console/config.c,
+ console/ns16550cfg.c: Removed files.
+ * console/console-config.c: New file.
+ * Makefile.am: Reflect changes above.
+ * configure.ac: New BSP options.
+ * include/bsp.h: Use new BSP options.
+ * network/network.c: Avoid memory leak.
+ * startup/bspstart.c: Initialize console port table.
+ * spi/spi_init.c: Update for SD card API changes.
+
2010-06-29 Joel Sherrill <joel.sherrill@oarcorp.com>
* configure.ac: Remove AC_CHECK_SIZEOF([void *]).
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/Makefile.am b/c/src/lib/libbsp/powerpc/gen83xx/Makefile.am
index 104d3ad3e8..cbb6e265bf 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/Makefile.am
+++ b/c/src/lib/libbsp/powerpc/gen83xx/Makefile.am
@@ -79,7 +79,8 @@ libbsp_a_SOURCES += irq/irq.c \
../../shared/src/irq-server.c
# console
-libbsp_a_SOURCES += console/console.c console/ns16550cfg.c
+libbsp_a_SOURCES += ../../shared/console.c \
+ console/console-config.c
# bsp_i2c
libbsp_a_SOURCES += i2c/i2c_init.c
# bsp_spi
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/configure.ac b/c/src/lib/libbsp/powerpc/gen83xx/configure.ac
index 1671c45fe8..2552ec03cf 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/configure.ac
+++ b/c/src/lib/libbsp/powerpc/gen83xx/configure.ac
@@ -43,6 +43,24 @@ RTEMS_BSPOPTS_SET([MPC8349],[hsc_cm01],[1])
RTEMS_BSPOPTS_HELP([MPC8349],
[If defined, use custom settings for the MPC8349 libcpu family.])
+RTEMS_BSPOPTS_SET([BSP_CONSOLE_BAUD],[mpc8313erdb],[115200])
+RTEMS_BSPOPTS_SET([BSP_CONSOLE_BAUD],[*],[9600])
+RTEMS_BSPOPTS_HELP([BSP_CONSOLE_BAUD],[Default baud for console and other serial devices.])
+
+RTEMS_BSPOPTS_SET([BSP_USE_UART_INTERRUPTS],[mpc8313erdb],[1])
+RTEMS_BSPOPTS_HELP([BSP_USE_UART_INTERRUPTS],[enable usage of interrupts for the UART modules])
+
+RTEMS_BSPOPTS_SET([BSP_USE_UART2],[mpc8313erdb],[1])
+RTEMS_BSPOPTS_SET([BSP_USE_UART2],[mpc8349eamds],[1])
+RTEMS_BSPOPTS_SET([BSP_USE_UART2],[hsc_cm01],[1])
+RTEMS_BSPOPTS_HELP([BSP_USE_UART2],[If defined, enables UART2.])
+
+RTEMS_BSPOPTS_SET([HAS_UBOOT],[mpc8313erdb],[1])
+RTEMS_BSPOPTS_HELP([HAS_UBOOT],[If defined, enables U-Boot support.])
+
+RTEMS_BSPOPTS_SET([PPC_USE_DATA_CACHE],[*],[1])
+RTEMS_BSPOPTS_HELP([PPC_USE_DATA_CACHE], [If defined, then the PowerPC specific
+ code in RTEMS will use data cache instructions to optimize the context switch code.])
RTEMS_CHECK_NETWORKING
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/console/config.c b/c/src/lib/libbsp/powerpc/gen83xx/console/config.c
deleted file mode 100644
index ad36676fa3..0000000000
--- a/c/src/lib/libbsp/powerpc/gen83xx/console/config.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*===============================================================*\
-| Project: RTEMS generic MPC83xx BSP |
-+-----------------------------------------------------------------+
-| This file has been adapted from the ep1a BSP to MPC83xx by |
-| Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> |
-| Copyright (c) 2007 |
-| Embedded Brains GmbH |
-| Obere Lagerstr. 30 |
-| D-82178 Puchheim |
-| Germany |
-| rtems@embedded-brains.de |
-| |
-| See the other copyright notice below for the original parts. |
-+-----------------------------------------------------------------+
-| The license and distribution terms for this file may be |
-| found in the file LICENSE in this distribution or at |
-| |
-| http://www.rtems.com/license/LICENSE. |
-| |
-+-----------------------------------------------------------------+
-| this file contains the console driver configuration tables |
-\*===============================================================*/
-/* derived from: */
-/*
- * This file contains the TTY driver table for the EP1A
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#include <libchip/serial.h>
-#include "ns16550cfg.h"
-#include <bsp.h>
-#include <libcpu/io.h>
-#include <mpc83xx/mpc83xx.h>
-
-/*
- * Based on BSP configuration information decide whether to do polling IO
- * or interrupt driven IO.
- */
-
-#define NS16550_FUNCTIONS &ns16550_fns_polled
-
-/*
- * The following table configures the console drivers used in this BSP.
- *
- * The first entry which, when probed, is available, will be named /dev/console,
- * all others being given the name indicated.
- *
- * Each field is interpreted thus:
- *
- * sDeviceName This is the name of the device.
- * pDeviceFns This is a pointer to the set of driver routines to use.
- * pDeviceFlow This is a pointer to the set of flow control routines to
- * use. Serial device drivers will typically supply RTSCTS
- * and DTRCTS handshake routines for DCE to DCE communication,
- * however for DCE to DTE communication, no such routines
- * should be necessary as RTS will be driven automatically
- * when the transmitter is active.
- * ulMargin The high water mark in the input buffer is set to the buffer
- * size less ulMargin. Once this level is reached, the driver's
- * flow control routine used to stop the remote transmitter will
- * be called. This figure should be greater than or equal to
- * the number of stages of FIFO between the transmitter and
- * receiver.
- * ulHysteresis After the high water mark specified by ulMargin has been
- * reached, the driver's routine to re-start the remote
- * transmitter will be called once the level in the input
- * buffer has fallen by ulHysteresis bytes.
- * pDeviceParams This contains either device specific data or a pointer to a
- * device specific structure containing additional information
- * not provided in this table.
- * ulCtrlPort1 This is the primary control port number for the device. This
- * may be used to specify different instances of the same device
- * type.
- * ulCtrlPort2 This is the secondary control port number, of use when a given
- * device has more than one available channel.
- * ulDataPort This is the port number for the data port of the device
- * ulIntVector This encodes the interrupt vector of the device.
- *
- */
-console_tbl Console_Port_Tbl[] = {
- /*
- * NS16550 Chips provide first ttyS0/1 Ports.
- */
- {
- "/dev/ttyS0", /* sDeviceName */
- SERIAL_NS16550, /* deviceType */
- NS16550_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe */
- &ns16550_flow_RTSCTS, /* pDeviceFlow */
- 16, /* ulMargin */
- 8, /* ulHysteresis */
-
- /* pDeviceParams */
- /* baud rate */
-#ifdef MPC8313ERDB
- (void *)115200,
-#else /* MPC8313ERDB */
- (void *)9600,
-#endif /* MPC8313ERDB */
-
- (uint32_t)&(mpc83xx.duart[0]), /* ulCtrlPort1e */
- 0, /* ulCtrlPort2 */
- (uint32_t)&(mpc83xx.duart[0]), /* ulDataPort */
- Read_ns16550_register, /* getRegister */
- Write_ns16550_register, /* setRegister */
- NULL, /* getData */
- NULL, /* setData */
- 0, /* ulClock (filled in init) */
- 0 /* ulIntVector */
- }
-#if BSP_USE_UART2
- ,{
- "/dev/ttyS1", /* sDeviceName */
- SERIAL_NS16550, /* deviceType */
- NS16550_FUNCTIONS, /* pDeviceFns */
- NULL, /* deviceProbe */
- &ns16550_flow_RTSCTS, /* pDeviceFlow */
- 16, /* ulMargin */
- 8, /* ulHysteresis */
-
- /* pDeviceParams */
- /* baud rate */
-#ifdef MPC8313ERDB
- (void *)115200,
-#else /* MPC8313ERDB */
- (void *)9600,
-#endif /* MPC8313ERDB */
-
- (uint32_t)&(mpc83xx.duart[1]), /* ulCtrlPort1-Filled in at runtime */
- 0, /* ulCtrlPort2 */
- (uint32_t)&(mpc83xx.duart[1]), /* ulDataPort-Filled in at runtime*/
- Read_ns16550_register, /* getRegister */
- Write_ns16550_register, /* setRegister */
- NULL, /* getData */
- NULL, /* setData */
- 0, /* ulClock (filled in init) */
- 0 /* ulIntVector */
- }
-#endif
-};
-
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c b/c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c
new file mode 100644
index 0000000000..99317e5a45
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/gen83xx/console/console-config.c
@@ -0,0 +1,118 @@
+/**
+ * @file
+ *
+ * @brief Console configuration.
+ */
+
+/*
+ * Copyright (c) 2008, 2010 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#include <rtems/bspIo.h>
+
+#include <libchip/serial.h>
+#include <libchip/ns16550.h>
+
+#include <mpc83xx/mpc83xx.h>
+
+#include <bspopts.h>
+#include <bsp/irq.h>
+
+#ifdef BSP_USE_UART2
+ #define PORT_COUNT 2
+#else
+ #define PORT_COUNT 1
+#endif
+
+#ifdef BSP_USE_UART_INTERRUPTS
+ #define DEVICE_FNS &ns16550_fns
+#else
+ #define DEVICE_FNS &ns16550_fns_polled
+#endif
+
+static uint8_t gen83xx_console_get_register(uint32_t addr, uint8_t i)
+{
+ volatile uint8_t *reg = (volatile uint8_t *) addr;
+
+ return reg [i];
+}
+
+static void gen83xx_console_set_register(uint32_t addr, uint8_t i, uint8_t val)
+{
+ volatile uint8_t *reg = (volatile uint8_t *) addr;
+
+ reg [i] = val;
+}
+
+unsigned long Console_Port_Count = PORT_COUNT;
+
+rtems_device_minor_number Console_Port_Minor = 0;
+
+console_data Console_Port_Data [PORT_COUNT];
+
+console_tbl Console_Port_Tbl [PORT_COUNT] = {
+ {
+ .sDeviceName = "/dev/ttyS0",
+ .deviceType = SERIAL_NS16550,
+ .pDeviceFns = DEVICE_FNS,
+ .deviceProbe = NULL,
+ .pDeviceFlow = NULL,
+ .ulMargin = 16,
+ .ulHysteresis = 8,
+ .pDeviceParams = (void *) BSP_CONSOLE_BAUD,
+ .ulCtrlPort1 = (uint32_t) &mpc83xx.duart [0],
+ .ulCtrlPort2 = 0,
+ .ulDataPort = (uint32_t) &mpc83xx.duart [0],
+ .getRegister = gen83xx_console_get_register,
+ .setRegister = gen83xx_console_set_register,
+ .getData = NULL,
+ .setData = NULL,
+ .ulClock = 0,
+ .ulIntVector = BSP_IPIC_IRQ_UART1
+ }
+#ifdef BSP_USE_UART2
+ , {
+ .sDeviceName = "/dev/ttyS1",
+ .deviceType = SERIAL_NS16550,
+ .pDeviceFns = DEVICE_FNS,
+ .deviceProbe = NULL,
+ .pDeviceFlow = NULL,
+ .ulMargin = 16,
+ .ulHysteresis = 8,
+ .pDeviceParams = (void *) BSP_CONSOLE_BAUD,
+ .ulCtrlPort1 = (uint32_t) &mpc83xx.duart [1],
+ .ulCtrlPort2 = 0,
+ .ulDataPort = (uint32_t) &mpc83xx.duart [1],
+ .getRegister = gen83xx_console_get_register,
+ .setRegister = gen83xx_console_set_register,
+ .getData = NULL,
+ .setData = NULL,
+ .ulClock = 0,
+ .ulIntVector = BSP_IPIC_IRQ_UART2
+ }
+#endif
+};
+
+static void gen83xx_output_char(char c)
+{
+ const console_fns *console = Console_Port_Tbl [Console_Port_Minor].pDeviceFns;
+
+ if (c == '\n') {
+ console->deviceWritePolled((int) Console_Port_Minor, '\r');
+ }
+ console->deviceWritePolled((int) Console_Port_Minor, c);
+}
+
+BSP_output_char_function_type BSP_output_char = gen83xx_output_char;
+
+BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/console/console.c b/c/src/lib/libbsp/powerpc/gen83xx/console/console.c
deleted file mode 100644
index 52ee30ec09..0000000000
--- a/c/src/lib/libbsp/powerpc/gen83xx/console/console.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*===============================================================*\
-| Project: RTEMS generic MPC83xx BSP |
-+-----------------------------------------------------------------+
-| This file has been adapted from the ep1a BSP to MPC83xx by |
-| Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> |
-| Copyright (c) 2007 |
-| Embedded Brains GmbH |
-| Obere Lagerstr. 30 |
-| D-82178 Puchheim |
-| Germany |
-| rtems@embedded-brains.de |
-| |
-| See the other copyright notice below for the original parts. |
-+-----------------------------------------------------------------+
-| The license and distribution terms for this file may be |
-| found in the file LICENSE in this distribution or at |
-| |
-| http://www.rtems.com/license/LICENSE. |
-| |
-+-----------------------------------------------------------------+
-| this file contains the console driver |
-\*===============================================================*/
-/* derived from: */
-/*
- * This file contains the TTY driver for the ep1a
- *
- * This driver uses the termios pseudo driver.
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#include <bsp.h>
-#include <rtems/libio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <termios.h>
-
-#include "console.h"
-#include <rtems/bspIo.h>
-#include <rtems/termiostypes.h>
-
-/*
- * Load configuration table
- */
-#include "config.c"
-
-#define NUM_CONSOLE_PORTS (sizeof(Console_Port_Tbl)/sizeof(console_tbl))
-
-console_data Console_Port_Data[NUM_CONSOLE_PORTS];
-unsigned long Console_Port_Count;
-rtems_device_minor_number Console_Port_Minor;
-bool Console_Is_Initialized = false;
-/* PAGE
- *
- * console_open
- *
- * open a port as a termios console.
- *
- */
-rtems_device_driver console_open(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- rtems_status_code status;
- rtems_libio_open_close_args_t *args = arg;
- rtems_termios_callbacks Callbacks;
- console_fns *c;
-
- /*
- * Verify the port number is valid.
- */
- if(minor>Console_Port_Count)
- {
- return RTEMS_INVALID_NUMBER;
- }
-
- /*
- * open the port as a termios console driver.
- */
- c = Console_Port_Tbl[minor].pDeviceFns;
- Callbacks.firstOpen = c->deviceFirstOpen;
- Callbacks.lastClose = c->deviceLastClose;
- Callbacks.pollRead = c->deviceRead;
- Callbacks.write = c->deviceWrite;
- Callbacks.setAttributes = c->deviceSetAttributes;
- Callbacks.stopRemoteTx =
- Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx;
- Callbacks.startRemoteTx =
- Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx;
- Callbacks.outputUsesInterrupts = c->deviceOutputUsesInterrupts;
- status = rtems_termios_open ( major, minor, arg, &Callbacks);
- Console_Port_Data[minor].termios_data = args->iop->data1;
- if (status == 0) {
- rtems_termios_set_initial_baud( Console_Port_Data [minor].termios_data, (int) Console_Port_Tbl [minor].pDeviceParams);
- }
-
- return status;
-}
-
-rtems_device_driver console_close(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- rtems_libio_open_close_args_t *args = arg;
-
- if((args->iop->flags&LIBIO_FLAGS_READ) &&
- Console_Port_Tbl[minor].pDeviceFlow &&
- Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx)
- {
- Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor);
- }
-
- return rtems_termios_close (arg);
-}
-
-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_write(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return rtems_termios_write (arg);
-}
-
-rtems_device_driver console_control(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void * arg
-)
-{
- return rtems_termios_ioctl (arg);
-}
-
-/* PAGE
- *
- * console_initialize
- *
- * Routine called to initialize the console device driver.
- */
-rtems_device_driver console_initialize(
- rtems_device_major_number major,
- rtems_device_minor_number minor,
- void *arg
-)
-{
- rtems_status_code status;
-
- /*
- * initialize the termio interface.
- */
- rtems_termios_initialize();
-
- Console_Port_Count=NUM_CONSOLE_PORTS;
-
- for(minor=0;
- minor<Console_Port_Count;
- minor++)
- {
- /*
- * transfer the real internal bus frequency into the
- * console port table
- */
- Console_Port_Tbl[minor].ulClock = BSP_bus_frequency;
- /*
- * First perform the configuration dependant probe, then the
- * device dependant probe
- */
- if((!Console_Port_Tbl[minor].deviceProbe ||
- Console_Port_Tbl[minor].deviceProbe(minor)) &&
- Console_Port_Tbl[minor].pDeviceFns->deviceProbe(minor))
- {
- /*
- * Use this device for the console
- */
- break;
- }
- }
- if(minor==Console_Port_Count)
- {
- /*
- * Failed to find a working device
- */
- rtems_fatal_error_occurred(RTEMS_IO_ERROR);
- }
-
- Console_Port_Minor=minor;
-
- /*
- * Register Device Names
- */
-
- status = rtems_io_register_name("/dev/console",
- major,
- Console_Port_Minor );
- if (status != RTEMS_SUCCESSFUL)
- {
- rtems_fatal_error_occurred(status);
- }
- if ( Console_Port_Tbl[Console_Port_Minor].pDeviceFns->deviceInitialize ) {
- Console_Port_Tbl[Console_Port_Minor]
- .pDeviceFns->deviceInitialize(Console_Port_Minor);
- Console_Is_Initialized = true;
- }
-
- for(minor++;minor<Console_Port_Count;minor++)
- {
- /*
- * First perform the configuration dependant probe, then the
- * device dependant probe
- */
- if((!Console_Port_Tbl[minor].deviceProbe ||
- Console_Port_Tbl[minor].deviceProbe(minor)) &&
- Console_Port_Tbl[minor].pDeviceFns->deviceProbe(minor))
- {
- status = rtems_io_register_name(
- Console_Port_Tbl[minor].sDeviceName,
- major,
- minor );
- if (status != RTEMS_SUCCESSFUL)
- {
- rtems_fatal_error_occurred(status);
- }
-
- /*
- * Initialize the hardware device.
- */
- if ( Console_Port_Tbl[minor].pDeviceFns->deviceInitialize )
- Console_Port_Tbl[minor].pDeviceFns->deviceInitialize( minor);
- }
- }
-
- return RTEMS_SUCCESSFUL;
-}
-
-void debug_putc_onlcr(const char c)
-{
- if (Console_Is_Initialized) {
- Console_Port_Tbl[Console_Port_Minor].pDeviceFns->
- deviceWritePolled(Console_Port_Minor,c);
-
- if (c == '\n') {
- Console_Port_Tbl[Console_Port_Minor].pDeviceFns->
- deviceWritePolled(Console_Port_Minor,'\r');
- }
- }
-}
-
-BSP_output_char_function_type BSP_output_char = debug_putc_onlcr;
-/* const char arg to be compatible with BSP_output_char decl. */
-
-int bsp_uart_pollRead(int minor)
-{
- return Console_Port_Tbl [0].pDeviceFns->deviceRead(0);
-}
-
-int bsp_get_char(void)
-{
- return bsp_uart_pollRead(0);
-}
-
-BSP_polling_getchar_function_type BSP_poll_char = bsp_get_char;
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/console/console.h b/c/src/lib/libbsp/powerpc/gen83xx/console/console.h
deleted file mode 100644
index 1f1d14499d..0000000000
--- a/c/src/lib/libbsp/powerpc/gen83xx/console/console.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * This file contains the TTY driver table definition for the PPCn_60x
- *
- * This driver uses the termios pseudo driver.
- *
- * COPYRIGHT (c) 1998 by Radstone Technology
- *
- *
- * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY
- * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
- * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU.
- *
- * You are hereby granted permission to use, copy, modify, and distribute
- * this file, provided that this notice, plus the above copyright notice
- * and disclaimer, appears in all copies. Radstone Technology will provide
- * no support for this code.
- *
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
-*/
-
-#include <rtems/ringbuf.h>
-#include <libchip/serial.h>
-#include <libchip/ns16550.h>
-
-extern console_tbl Console_Port_Tbl[];
-extern console_data Console_Port_Data[];
-extern unsigned long Console_Port_Count;
-
-bool Console_Port_Tbl_Init_ppc8245(int minor);
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/console/ns16550cfg.c b/c/src/lib/libbsp/powerpc/gen83xx/console/ns16550cfg.c
deleted file mode 100644
index 3275835c86..0000000000
--- a/c/src/lib/libbsp/powerpc/gen83xx/console/ns16550cfg.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*===============================================================*\
-| Project: RTEMS generic MPC83xx BSP |
-+-----------------------------------------------------------------+
-| This file has been adapted from the ep1a BSP to MPC83xx by |
-| Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> |
-| Copyright (c) 2007 |
-| Embedded Brains GmbH |
-| Obere Lagerstr. 30 |
-| D-82178 Puchheim |
-| Germany |
-| rtems@embedded-brains.de |
-| |
-| See the other copyright notice below for the original parts. |
-+-----------------------------------------------------------------+
-| The license and distribution terms for this file may be |
-| found in the file LICENSE in this distribution or at |
-| |
-| http://www.rtems.com/license/LICENSE. |
-| |
-+-----------------------------------------------------------------+
-| this file contains the DUART access routines |
-\*===============================================================*/
-/* derived from: */
-/*
- * This include file contains all console driver definations for the nc16550
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- *
- * $Id$
- */
-
-#include <rtems.h>
-#include <bsp.h>
-#include "console.h"
-
-typedef struct uart_reg
-{
- volatile unsigned char reg;
-} uartReg;
-
-uint8_t Read_ns16550_register(
- uint32_t ulCtrlPort,
- uint8_t ucRegNum
-)
-{
- struct uart_reg *p = (struct uart_reg *)ulCtrlPort;
- uint8_t ucData;
- ucData = p[ucRegNum].reg;
- asm volatile("sync");
- return ucData;
-}
-
-void Write_ns16550_register(
- uint32_t ulCtrlPort,
- uint8_t ucRegNum,
- uint8_t ucData
-)
-{
- struct uart_reg *p = (struct uart_reg *)ulCtrlPort;
- p[ucRegNum].reg = ucData;
- asm volatile("sync");
-}
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/include/bsp.h b/c/src/lib/libbsp/powerpc/gen83xx/include/bsp.h
index bb6dc4c7f3..971d7c71b6 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/gen83xx/include/bsp.h
@@ -20,21 +20,9 @@
#ifndef __GEN83xx_BSP_h
#define __GEN83xx_BSP_h
-#include <bspopts.h>
-
-/*
- * MPC8313E Reference Design Board
- */
-
-#ifdef MPC8313ERDB
-
-#define HAS_UBOOT
+#define BSP_FEATURE_IRQ_EXTENSION
-/* For U-Boot */
-#define CONFIG_MPC83XX
-#define CONFIG_HAS_ETH1
-
-#endif /* MPC8313ERDB */
+#include <bspopts.h>
#include <libcpu/powerpc-utility.h>
@@ -78,25 +66,23 @@ LINKER_SYMBOL(IMMRBAR);
extern "C" {
#endif
-
#include <rtems.h>
#include <rtems/console.h>
#include <rtems/clockdrv.h>
-#include <bsp/irq.h>
#include <bsp/vectors.h>
-#include <bsp/tictac.h>
+#include <bsp/irq.h>
#ifdef HAS_UBOOT
+ #ifdef MPC8313ERDB
+ #define CONFIG_MPC83XX
+ #define CONFIG_HAS_ETH1
+ #endif
-#include <bsp/u-boot.h>
-
-extern bd_t bsp_uboot_board_info;
-extern const size_t bsp_uboot_board_info_size;
-
-#endif /* HAS_UBOOT */
+ #include <bsp/u-boot.h>
-#define BSP_UART1_MINOR 0
-#define BSP_UART2_MINOR 1
+ extern bd_t bsp_uboot_board_info;
+ extern const size_t bsp_uboot_board_info_size;
+#endif
/*
* indicate, that BSP has no IDE driver
@@ -111,21 +97,6 @@ extern const size_t bsp_uboot_board_info_size;
rtems_status_code bsp_register_i2c(void);
rtems_status_code bsp_register_spi(void);
-/* console modes (only termios) */
-#ifdef PRINTK_MINOR
-#undef PRINTK_MINOR
-#endif
-#define PRINTK_MINOR BSP_UART1_MINOR
-
-#if defined(MPC8249EAMDS) || defined(HSC_CM01)
-#define BSP_USE_UART2 TRUE
-#else
-#define BSP_USE_UART2 FALSE
-#endif
-
-#define SINGLE_CHAR_MODE
-#define UARTS_USE_TERMIOS_INT 1
-
/*
* Network driver configuration
*/
@@ -134,16 +105,12 @@ extern int BSP_tsec_attach(struct rtems_bsdnet_ifconfig *config,int attaching);
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_tsec_attach
#ifdef MPC8313ERDB
-
-#define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec2"
-#define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec1"
-
-#else /* MPC8313ERDB */
-
-#define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec1"
-#define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec2"
-
-#endif /* MPC8313ERDB */
+ #define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec2"
+ #define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec1"
+#else
+ #define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec1"
+ #define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec2"
+#endif
#if defined(MPC8349EAMDS)
/*
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/network/network.c b/c/src/lib/libbsp/powerpc/gen83xx/network/network.c
index 66c1199389..272bfad587 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/network/network.c
+++ b/c/src/lib/libbsp/powerpc/gen83xx/network/network.c
@@ -67,12 +67,11 @@ int BSP_tsec_attach
\*=========================================================================*/
{
int unitNumber;
- char *unitName;
/*
* Parse driver name
*/
- if((unitNumber = rtems_bsdnet_parse_driver_name(config, &unitName)) < 0) {
+ if((unitNumber = rtems_bsdnet_parse_driver_name(config, NULL)) < 0) {
return 0;
}
if (attaching) {
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/spi/spi_init.c b/c/src/lib/libbsp/powerpc/gen83xx/spi/spi_init.c
index 3778f7c413..ef36472ab7 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/spi/spi_init.c
+++ b/c/src/lib/libbsp/powerpc/gen83xx/spi/spi_init.c
@@ -247,31 +247,26 @@ static mpc83xx_spi_desc_t bsp_spi_bus_desc = {
#include <libchip/spi-sd-card.h>
-sd_card_driver_entry sd_card_driver_table [1] = { {
-#if 0
- .driver = {
- .ops = &sd_card_driver_ops,
- .size = sizeof( sd_card_driver_entry)
- },
- .table_index = 0,
- .minor = 0,
-#endif
- .device_name = "sd-card-a",
-#if 0
- .disk_device_name = "/dev/sd-card-a",
-#endif
- .transfer_mode = SD_CARD_TRANSFER_MODE_DEFAULT,
- .command = SD_CARD_COMMAND_DEFAULT,
- /* .response = whatever, */
- .response_index = SD_CARD_COMMAND_SIZE,
- .n_ac_max = SD_CARD_N_AC_MAX_DEFAULT,
- .block_number = 0,
- .block_size = 0,
- .block_size_shift = 0,
- .busy = 1,
- .verbose = 1,
- .schedule_if_busy = 0
- }
+#define SD_CARD_NUMBER 1
+
+size_t sd_card_driver_table_size = SD_CARD_NUMBER;
+
+sd_card_driver_entry sd_card_driver_table [SD_CARD_NUMBER] = {
+ {
+ .device_name = "/dev/sd-card-a",
+ .bus = 0,
+ .transfer_mode = SD_CARD_TRANSFER_MODE_DEFAULT,
+ .command = SD_CARD_COMMAND_DEFAULT,
+ /* .response = whatever, */
+ .response_index = SD_CARD_COMMAND_SIZE,
+ .n_ac_max = SD_CARD_N_AC_MAX_DEFAULT,
+ .block_number = 0,
+ .block_size = 0,
+ .block_size_shift = 0,
+ .busy = true,
+ .verbose = true,
+ .schedule_if_busy = false
+ }
};
#endif /* MPC8313ERDB */
@@ -299,6 +294,7 @@ rtems_status_code bsp_register_spi
| 0 or error code |
\*=========================================================================*/
{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
int ret_code;
unsigned spi_busno;
@@ -378,12 +374,11 @@ rtems_status_code bsp_register_spi
#if defined( MPC8313ERDB)
/* Register SD Card driver */
- ret_code = rtems_libi2c_register_drv(
- sd_card_driver_table [0].device_name,
- (rtems_libi2c_drv_t *) &sd_card_driver_table [0],
- spi_busno,
- 0
- );
+ sd_card_driver_table [0].bus = spi_busno;
+ sc = sd_card_register();
+ if (sc != RTEMS_SUCCESSFUL) {
+ return sc;
+ }
#elif defined( MPC8349EAMDS)
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c b/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
index 9e691e5b82..3e88cf2ee6 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/gen83xx/startup/bspstart.c
@@ -20,6 +20,8 @@
* $Id$
*/
+#include <libchip/serial.h>
+
#include <libcpu/powerpc-utility.h>
#include <bsp.h>
@@ -83,6 +85,7 @@ void _BSP_Fatal_error(unsigned n)
void bsp_start( void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
+ unsigned long i = 0;
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
@@ -127,6 +130,16 @@ void bsp_start( void)
bsp_clicks_per_usec = BSP_bus_frequency / 4000000;
#endif /* HAS_UBOOT */
+ /* Initialize some console parameters */
+ for (i = 0; i < Console_Port_Count; ++i) {
+ Console_Port_Tbl [i].ulClock = BSP_bus_frequency;
+
+ #ifdef HAS_UBOOT
+ Console_Port_Tbl [i].pDeviceParams =
+ (void *) bsp_uboot_board_info.bi_baudrate;
+ #endif
+ }
+
/* Initialize exception handler */
sc = ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,