Index: emcore/trunk/console.c |
— | — | @@ -25,6 +25,7 @@ |
26 | 26 | #include "console.h"
|
27 | 27 | #include "lcdconsole.h"
|
28 | 28 | #include "usb/dbgconsole.h"
|
| 29 | +#include "uart.h"
|
29 | 30 | #include "format.h"
|
30 | 31 | #include "thread.h"
|
31 | 32 | #include <stdarg.h>
|
— | — | @@ -46,6 +47,9 @@ |
47 | 48 | {
|
48 | 49 | mutex_init(&console_mutex);
|
49 | 50 | mutex_init(&console_readmutex);
|
| 51 | +#ifdef HAVE_UART
|
| 52 | + uart_init();
|
| 53 | +#endif
|
50 | 54 | }
|
51 | 55 |
|
52 | 56 | void cputc_internal(unsigned int consoles, char string) ICODE_ATTR;
|
— | — | @@ -57,6 +61,9 @@ |
58 | 62 | #ifdef HAVE_USB
|
59 | 63 | if (consoles & 2) dbgconsole_putc(string);
|
60 | 64 | #endif
|
| 65 | +#ifdef HAVE_UART
|
| 66 | + if (consoles & 4) uart_putc(string);
|
| 67 | +#endif
|
61 | 68 | }
|
62 | 69 |
|
63 | 70 | static int cprfunc(void* ptr, unsigned char letter)
|
— | — | @@ -114,6 +121,9 @@ |
115 | 122 | #ifdef HAVE_USB
|
116 | 123 | if (consoles & 2) dbgconsole_puts(string);
|
117 | 124 | #endif
|
| 125 | +#ifdef HAVE_UART
|
| 126 | + if (consoles & 4) uart_puts(string);
|
| 127 | +#endif
|
118 | 128 | mutex_unlock(&console_mutex);
|
119 | 129 | }
|
120 | 130 |
|
— | — | @@ -126,6 +136,9 @@ |
127 | 137 | #ifdef HAVE_USB
|
128 | 138 | if (consoles & 2) dbgconsole_write(string, length);
|
129 | 139 | #endif
|
| 140 | +#ifdef HAVE_UART
|
| 141 | + if (consoles & 4) uart_write(string, length);
|
| 142 | +#endif
|
130 | 143 | mutex_unlock(&console_mutex);
|
131 | 144 | }
|
132 | 145 |
|
— | — | @@ -145,6 +158,9 @@ |
146 | 159 | #ifdef HAVE_USB
|
147 | 160 | if ((consoles & 2) && (result = dbgconsole_getc(timeout)) != -1) return result;
|
148 | 161 | #endif
|
| 162 | +#ifdef HAVE_UART
|
| 163 | + if ((consoles & 4) && (result = uart_getc(timeout)) != -1) return result;
|
| 164 | +#endif
|
149 | 165 | mutex_unlock(&console_readmutex);
|
150 | 166 | }
|
151 | 167 |
|
— | — | @@ -155,6 +171,9 @@ |
156 | 172 | #ifdef HAVE_USB
|
157 | 173 | if ((consoles & 2) && (result = dbgconsole_read(buffer, length, timeout))) return result;
|
158 | 174 | #endif
|
| 175 | +#ifdef HAVE_UART
|
| 176 | + if ((consoles & 2) && (result = uart_read(buffer, length, timeout))) return result;
|
| 177 | +#endif
|
159 | 178 | mutex_unlock(&console_readmutex);
|
160 | 179 | }
|
161 | 180 |
|
— | — | @@ -164,13 +183,23 @@ |
165 | 184 | mutex_lock(&console_readmutex, TIMEOUT_BLOCK);
|
166 | 185 | while (length)
|
167 | 186 | {
|
| 187 | + if (
|
168 | 188 | #ifdef HAVE_USB
|
169 | | - if (length && (consoles & 2) && (result = dbgconsole_read(buffer, length, timeout)))
|
| 189 | + ((consoles & 2) && (result = dbgconsole_read(buffer, length, timeout)))
|
| 190 | +#else
|
| 191 | + false
|
| 192 | +#endif
|
| 193 | + ||
|
| 194 | +#ifdef HAVE_UART
|
| 195 | + ((consoles & 4) && (result = uart_read(buffer, length, timeout)))
|
| 196 | +#else
|
| 197 | + false
|
| 198 | +#endif
|
| 199 | + )
|
170 | 200 | {
|
171 | 201 | buffer = &buffer[result];
|
172 | 202 | length -= result;
|
173 | 203 | }
|
174 | | -#endif
|
175 | 204 | }
|
176 | 205 | mutex_unlock(&console_readmutex);
|
177 | 206 | }
|
Index: emcore/trunk/target/ipodnano3g/s5l8702.h |
— | — | @@ -767,6 +767,17 @@ |
768 | 768 | #define WHEELTX (*((uint32_t volatile*)(0x3C20001C))) |
769 | 769 | |
770 | 770 | |
| 771 | +/////UART///// |
| 772 | +#define ULCON (*((uint32_t volatile*)0x3cc00000))
|
| 773 | +#define UCON (*((uint32_t volatile*)0x3cc00004))
|
| 774 | +#define UFCON (*((uint32_t volatile*)0x3cc00008))
|
| 775 | +#define UMCON (*((uint32_t volatile*)0x3cc0000c))
|
| 776 | +#define UFSTAT (*((uint32_t volatile*)0x3cc00018))
|
| 777 | +#define UTXH (*((uint8_t volatile*)0x3cc00020))
|
| 778 | +#define URXH (*((uint8_t volatile*)0x3cc00024))
|
| 779 | +#define UBRDIV (*((uint32_t volatile*)0x3cc00028))
|
| 780 | + |
| 781 | + |
771 | 782 | /////CLOCK GATES///// |
772 | 783 | #define CLOCKGATE_LCD 1 |
773 | 784 | #define CLOCKGATE_USB_1 2 |
Index: emcore/trunk/target/ipodnano3g/target.h |
— | — | @@ -60,6 +60,8 @@ |
61 | 61 |
|
62 | 62 | #define HAVE_BOOTFLASH
|
63 | 63 |
|
| 64 | +#define HAVE_UART
|
| 65 | +
|
64 | 66 | //#define HAVE_STORAGE
|
65 | 67 | //#define HAVE_FLASH_STORAGE
|
66 | 68 | //#define HAVE_STORAGE_FLUSH
|
Index: emcore/trunk/target/ipodclassic/target.h |
— | — | @@ -61,6 +61,8 @@ |
62 | 62 |
|
63 | 63 | #define HAVE_BOOTFLASH
|
64 | 64 |
|
| 65 | +#define HAVE_UART
|
| 66 | +
|
65 | 67 | #define HAVE_STORAGE
|
66 | 68 | #define HAVE_HDD_STORAGE
|
67 | 69 | #define HAVE_STORAGE_FLUSH
|
Index: emcore/trunk/SOURCES |
— | — | @@ -50,6 +50,7 @@ |
51 | 51 | target/ipodnano3g/clickwheel.c
|
52 | 52 | target/ipodnano3g/spi.c
|
53 | 53 | target/ipodnano3g/targetinit.c
|
| 54 | +target/ipodnano3g/uart.c
|
54 | 55 | usb/synopsysotg.c
|
55 | 56 | #endif
|
56 | 57 |
|