[U-Boot] [PATCH 06/44] sandbox: Add string and 16-bit I/O functions

Simon Glass
2016-04-10T02:44:58Z

Add outsw() and insw() functions for sandbox, as these are needed by the IDE
code. The functions will not do anything useful if called, but allow the
code to be compiled.

Also add out16() and in16(), required by systemace.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

arch/sandbox/include/asm/io.h | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 5b87fde..cdbb6ba 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -56,6 +56,28 @@ void outl(unsigned int value, unsigned int addr);
void outw(unsigned int value, unsigned int addr);
void outb(unsigned int value, unsigned int addr);

+static inline void _insw(volatile u16 *port, void *buf, int ns)
+{
+ u16 *data = (u16 *) buf;
+ while (ns--)
+ *data++ = *port;
+}
+
+static inline void _outsw(volatile u16 *port, const void *buf, int ns)
+{
+ u16 *data = (u16 *) buf;
+ while (ns--) {
+ *port = *data++;
+ }
+}
+
+#define insw(port, buf, ns) _insw((u16 *)port, buf, ns)
+#define outsw(port, buf, ns) _outsw((u16 *)port, buf, ns)
+
+/* For systemace.c */
+#define out16(addr, val)
+#define in16(addr) 0
+
#include <iotrace.h>

#endif
--
2.8.0.rc3.226.g39d4020