summaryrefslogtreecommitdiff
path: root/include/serial.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-05-14 06:56:15 +0000
committerWolfgang Denk <wd@denx.de>2011-07-26 16:39:03 +0200
commit7b826c2f3510eaf185c7b4b0d709b9e766831bd6 (patch)
treec4ce1e32b13bb7fb0095004db23602e8a9b2be85 /include/serial.h
parent1c9a5606d8ff0c664c9e83de38e93d5602312d79 (diff)
serial: implement common uart post test
The current arch/driver specific UART posts basically boil down to setting the UART to loop back mode, then reading and writing data. If we ignore the loop back part, the rest can be built upon the existing common serial API. So let's do just that. First add a call back for serial drivers to implement loop back control. Then write a post test that walks all of the serial drivers, puts them into loop back mode, and verifies that reading/writing at all the diff baud rates is OK. If a serial driver doesn't support loop back mode (either it can't or it hasn't done so yet), then skip it. This should allow for people to easily migrate to the new post test with existing serial drivers. I haven't touched the few already existing uart post tests as I don't the hardware or knowledge of converting them over. So I've marked the new test as weak which will allow the existing tests to override the default until they are converted. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'include/serial.h')
-rw-r--r--include/serial.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/serial.h b/include/serial.h
index e6d3859bd92..08d106a7c05 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -1,6 +1,8 @@
#ifndef __SERIAL_H__
#define __SERIAL_H__
+#include <post.h>
+
#define NAMESIZE 16
struct serial_device {
@@ -13,6 +15,9 @@ struct serial_device {
int (*tstc) (void);
void (*putc) (const char c);
void (*puts) (const char *s);
+#if CONFIG_POST & CONFIG_SYS_POST_UART
+ void (*loop) (int);
+#endif
struct serial_device *next;
};