The unified diff between revisions [253c6510..] and [23a3e9a5..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'uart.c'
# # old_revision [253c65100e2208e0b8c93178896f5aab89e4ec0b] # new_revision [23a3e9a50b4034343e3bd217d2c225dcaec064dd] # # patch "uart.c" # from [601012b857324c934c9bc318a55df1029187a16b] # to [37a2e0459886f7f9c4e4a5361e21d50902dbe3f7] # ============================================================ --- uart.c 601012b857324c934c9bc318a55df1029187a16b +++ uart.c 37a2e0459886f7f9c4e4a5361e21d50902dbe3f7 @@ -1,6 +1,7 @@ #include "uart.h" #include "types.h" #include "interrupt.h" +#include "event.h" #define UARTBASE 0xE000C000 @@ -112,6 +113,7 @@ void __attribute__((interrupt("IRQ"))) u } } uart_rxwrite = local_rxwrite; + event_set(EVENT_UART_INPUT); break; case 0x2: /* THRE interrupt */ @@ -153,6 +155,31 @@ void putint(unsigned int n) { putstr(s+i); } +void putint_s(int n) { + char s[12]; + int i; + int neg; + + /* OK, technically, this might not work properly for the most + * negative possible number. Oh well. + */ + neg = (n < 0); + if (neg) + n = -n; + + i = 11; + s[i] = '\0'; + + do { + s[--i] = n % 10 + '0'; + } while ((n /= 10) > 0); + + if (neg) + s[--i] = '-'; + + putstr(s+i); +} + void puthex(unsigned int n) { char s[9]; int i;