summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/shared/console/console.inl
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-05-14 17:28:05 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-05-14 17:28:05 +0000
commit99662046021dbc91ef652d3177c7bc299ac60df6 (patch)
treea4ebaf988766ca8a09b612377a5b20fab8a2ee2a /c/src/lib/libbsp/powerpc/shared/console/console.inl
parent2001-05-14 Till Straumann <strauman@slac.stanford.edu> (diff)
downloadrtems-99662046021dbc91ef652d3177c7bc299ac60df6.tar.bz2
2001-05-14 Till Straumann <strauman@slac.stanford.edu>
Per PR216, "libbsp/powerpc/shared" BSP has been modified considerably with the goal to make it more flexible and reusable by other BSPs. The main strategies were: - eliminate hardcoded base addresses; devices use offsets and a BSP defined base address. - separate functionality into different files (e.g. reboot from inch.c to reboot.c) which can be overridden by a 'derived' BSP. - separate initialization code into separate files (e.g. PCI bridge detection/initialization was separated from the more generic PCI access routines), also to make it easier for 'derived' BSPs to substitute their own initialization code. There are also a couple of enhancements and fixes: - IRQ handling code now has a hook for attaching a VME bridge. - OpenPIC is now explicitely initialized (polarities, senses). Eliminated the implicit assumption on the presence of an ISA PIC. - UART and console driver now supports more than 1 port. The current maximum of 2 can easily be extended by enlarging a table (it would even be easier if the ISR API was not broken by design). - fixed polled_io.c so it correctly supports console on COM2 - fixed TLB invalidation code (start.S). - exception handler prints a stack backtrace. - added BSP_pciFindDevice() to scan the pci bus for a particular vendor/device/instance.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/shared/console/console.inl')
-rw-r--r--c/src/lib/libbsp/powerpc/shared/console/console.inl51
1 files changed, 51 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/powerpc/shared/console/console.inl b/c/src/lib/libbsp/powerpc/shared/console/console.inl
new file mode 100644
index 0000000000..142bdd18ce
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/shared/console/console.inl
@@ -0,0 +1,51 @@
+
+/* inline routines for console i/o
+ *
+ * The purpose of this file is to provide generic inline functions,
+ * i.e. not using hardcoded base addresses. These are provided by
+ * the BSP header.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+
+#define INL_IN_DECL(name,base) \
+static inline unsigned char name(int off) \
+{ \
+ return in_8((unsigned char*)(((unsigned long)base) + off)); \
+}
+
+#define INL_OUT_DECL(name,base) \
+static inline void name(int off, unsigned int val) \
+{ \
+ out_8((unsigned char*)(((unsigned long)base) + off), val); \
+}
+
+#ifdef BSP_UART_IOBASE_COM1
+INL_IN_DECL(com1_inb, BSP_UART_IOBASE_COM1)
+INL_OUT_DECL(com1_outb, BSP_UART_IOBASE_COM1)
+#endif
+#ifdef BSP_UART_IOBASE_COM2
+INL_IN_DECL(com2_inb, BSP_UART_IOBASE_COM2)
+INL_OUT_DECL(com2_outb, BSP_UART_IOBASE_COM2)
+#endif
+
+#if defined(BSP_CONSOLE_PORT)
+#if (BSP_CONSOLE_PORT == BSP_UART_COM1) && defined(BSP_UART_IOBASE_COM1)
+#define INL_CONSOLE_INB com1_inb
+#define INL_CONSOLE_OUTB com1_outb
+#elif (BSP_CONSOLE_PORT == BSP_UART_COM2) && defined(BSP_UART_IOBASE_COM2)
+#define INL_CONSOLE_INB com2_inb
+#define INL_CONSOLE_OUTB com2_outb
+#endif
+#endif
+
+#ifdef BSP_KBD_IOBASE
+INL_IN_DECL(kbd_inb, BSP_KBD_IOBASE)
+INL_OUT_DECL(kbd_outb, BSP_KBD_IOBASE)
+#endif
+
+#ifdef BSP_VGA_IOBASE
+INL_OUT_DECL(vga_outb, BSP_VGA_IOBASE)
+#endif