summaryrefslogtreecommitdiff
path: root/ps2_usb/sendchar_usart.c
diff options
context:
space:
mode:
authortmk2011-02-21 15:43:17 +0900
committertmk2011-02-22 03:09:14 +0900
commitfb8d23c60c757d5d9c2270cb0123a53be2049a28 (patch)
tree2f5d695f9d501468dc83f4861e7367cdf905ed3f /ps2_usb/sendchar_usart.c
parent47f5d8b545eec12ca74d8e7048bb5daa290d937e (diff)
integrate V-USB support into ps2_usb
Diffstat (limited to 'ps2_usb/sendchar_usart.c')
-rw-r--r--ps2_usb/sendchar_usart.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/ps2_usb/sendchar_usart.c b/ps2_usb/sendchar_usart.c
new file mode 100644
index 000000000..fe18177a3
--- /dev/null
+++ b/ps2_usb/sendchar_usart.c
@@ -0,0 +1,58 @@
+#include <stdint.h>
+#include "oddebug.h"
+#include "sendchar.h"
+
+
+/* from oddebug.h */
+#if defined UBRR
+# define ODDBG_UBRR UBRR
+#elif defined UBRRL
+# define ODDBG_UBRR UBRRL
+#elif defined UBRR0
+# define ODDBG_UBRR UBRR0
+#elif defined UBRR0L
+# define ODDBG_UBRR UBRR0L
+#endif
+
+#if defined UCR
+# define ODDBG_UCR UCR
+#elif defined UCSRB
+# define ODDBG_UCR UCSRB
+#elif defined UCSR0B
+# define ODDBG_UCR UCSR0B
+#endif
+
+#if defined TXEN
+# define ODDBG_TXEN TXEN
+#else
+# define ODDBG_TXEN TXEN0
+#endif
+
+#if defined USR
+# define ODDBG_USR USR
+#elif defined UCSRA
+# define ODDBG_USR UCSRA
+#elif defined UCSR0A
+# define ODDBG_USR UCSR0A
+#endif
+
+#if defined UDRE
+# define ODDBG_UDRE UDRE
+#else
+# define ODDBG_UDRE UDRE0
+#endif
+
+#if defined UDR
+# define ODDBG_UDR UDR
+#elif defined UDR0
+# define ODDBG_UDR UDR0
+#endif
+
+
+/* from oddebug.c */
+int8_t sendchar(uint8_t c)
+{
+ while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */
+ ODDBG_UDR = c;
+ return 1;
+}