From 61e12a3157ea6860f23bf8e29372aa70aeb02be0 Mon Sep 17 00:00:00 2001 From: tmk Date: Sat, 7 May 2011 00:04:18 +0900 Subject: [PATCH] move files: main_vusb.c ps2_usart.c sendchar_usart.c from ps2_usb to common dir --- Makefile.vusb | 3 +- ps2_usb/main_vusb.c => main_vusb.c | 0 ps2_usb/ps2_usart.c => ps2_usart.c | 0 ps2_usb/Makefile | 2 +- ps2_usb/Makefile.vusb | 6 ++-- ps2_usb/sendchar_dummy.c | 8 ----- ps2_usb/sendchar_usart.c | 58 ------------------------------ vusb/sendchar_usart.c | 19 ++++++++++ 8 files changed, 25 insertions(+), 71 deletions(-) rename ps2_usb/main_vusb.c => main_vusb.c (100%) rename ps2_usb/ps2_usart.c => ps2_usart.c (100%) delete mode 100644 ps2_usb/sendchar_dummy.c delete mode 100644 ps2_usb/sendchar_usart.c create mode 100644 vusb/sendchar_usart.c diff --git a/Makefile.vusb b/Makefile.vusb index 0ef1b115505c1e8b4e58dda6edb46b3396a0eede..b8e71a8e36eb834966e460b26cc3c7dfc28b86fd 100644 --- a/Makefile.vusb +++ b/Makefile.vusb @@ -2,7 +2,8 @@ OPT_DEFS += -DHOST_VUSB SRC = usbdrv.c \ usbdrvasm.S \ - oddebug.c + oddebug.c \ + sendchar_usart.c SRC += $(TARGET_SRC) diff --git a/ps2_usb/main_vusb.c b/main_vusb.c similarity index 100% rename from ps2_usb/main_vusb.c rename to main_vusb.c diff --git a/ps2_usb/ps2_usart.c b/ps2_usart.c similarity index 100% rename from ps2_usb/ps2_usart.c rename to ps2_usart.c diff --git a/ps2_usb/Makefile b/ps2_usb/Makefile index 7b55e020199db98843479528958e1666855c9525..605962915f82dc1e4d5f26b447e991cc56725444 100755 --- a/ps2_usb/Makefile +++ b/ps2_usb/Makefile @@ -10,7 +10,7 @@ TARGET_DIR = . # keyboard dependent files TARGET_SRC = main_pjrc.c \ keymap.c \ - matrix.c \ + matrix.c \ led.c \ ps2.c diff --git a/ps2_usb/Makefile.vusb b/ps2_usb/Makefile.vusb index 7b69dc27b505b1af0fb6418e30c78760ad381869..6e49fc44ddd4248716b988a6407666984a9208c9 100644 --- a/ps2_usb/Makefile.vusb +++ b/ps2_usb/Makefile.vusb @@ -12,13 +12,13 @@ TARGET_SRC = main_vusb.c \ keymap.c \ matrix.c \ led.c \ - ps2_usart.c \ - sendchar_dummy.c -# sendchar_usart.c + ps2_usart.c CONFIG_H = config_vusb.h +# V-USB debug level: To use ps2_usart.c level must be 0 +# ps2_usart.c requires USART to receive PS/2 signal. OPT_DEFS = -DDEBUG_LEVEL=0 diff --git a/ps2_usb/sendchar_dummy.c b/ps2_usb/sendchar_dummy.c deleted file mode 100644 index 8c9e583f12ca28ef9873addae0ff41ec5d4e19cd..0000000000000000000000000000000000000000 --- a/ps2_usb/sendchar_dummy.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include "sendchar.h" - - -int8_t sendchar(uint8_t c) -{ - return 1; -} diff --git a/ps2_usb/sendchar_usart.c b/ps2_usb/sendchar_usart.c deleted file mode 100644 index fe18177a3c17b0edc8713e3c3bfdede7c0a6305d..0000000000000000000000000000000000000000 --- a/ps2_usb/sendchar_usart.c +++ /dev/null @@ -1,58 +0,0 @@ -#include -#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; -} diff --git a/vusb/sendchar_usart.c b/vusb/sendchar_usart.c new file mode 100644 index 0000000000000000000000000000000000000000..d6f3c894c4adb5cb519bc50f3595b4ed33b1b29e --- /dev/null +++ b/vusb/sendchar_usart.c @@ -0,0 +1,19 @@ +#include +#include "oddebug.h" +#include "sendchar.h" + + +#if DEBUG_LEVEL > 0 +/* 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; +} +#else +int8_t sendchar(uint8_t c) +{ + return 1; +} +#endif