Files
lk/platform/cc13xx/debug.c
Travis Geiselbrecht cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00

35 lines
699 B
C

/*
* Copyright (c) 2016 Brian Swetland
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#include <kernel/thread.h>
#include <platform/debug.h>
#include <driverlib/uart.h>
#define UART0_BASE 0x40001000
void platform_dputc(char c) {
UARTCharPut(UART0_BASE, c);
}
int platform_dgetc(char *c, bool wait) {
int n;
for (;;) {
if ((n = UARTCharGetNonBlocking(UART0_BASE)) < 0) {
if (wait) {
thread_yield();
} else {
return -1;
}
} else {
*c = n;
return 0;
}
}
}