2017-12-22 08:26:44 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#include "contiki.h"
|
2009-10-30 15:06:26 +00:00
|
|
|
#include "dev/uart1.h"
|
|
|
|
|
2017-12-22 08:26:44 +00:00
|
|
|
#include <string.h>
|
|
|
|
/*---------------------------------------------------------------------------*/
|
|
|
|
#define SLIP_END 0300
|
|
|
|
#undef putchar
|
|
|
|
/*---------------------------------------------------------------------------*/
|
2009-10-30 15:06:26 +00:00
|
|
|
int
|
|
|
|
putchar(int c)
|
|
|
|
{
|
2017-12-22 08:26:44 +00:00
|
|
|
#if SLIP_ARCH_CONF_ENABLED
|
|
|
|
static char debug_frame = 0;
|
|
|
|
|
|
|
|
if(!debug_frame) { /* Start of debug output */
|
|
|
|
uart1_writeb(SLIP_END);
|
|
|
|
uart1_writeb('\r'); /* Type debug line == '\r' */
|
|
|
|
debug_frame = 1;
|
|
|
|
}
|
|
|
|
#endif /* SLIP_ARCH_CONF_ENABLED */
|
|
|
|
|
|
|
|
/* Need to also print '\n' because for example COOJA will not show
|
|
|
|
any output before line end */
|
2009-10-30 15:06:26 +00:00
|
|
|
uart1_writeb((char)c);
|
2017-12-22 08:26:44 +00:00
|
|
|
|
|
|
|
#if SLIP_ARCH_CONF_ENABLED
|
|
|
|
/*
|
|
|
|
* Line buffered output, a newline marks the end of debug output and
|
|
|
|
* implicitly flushes debug output.
|
|
|
|
*/
|
|
|
|
if(c == '\n') {
|
|
|
|
uart1_writeb(SLIP_END);
|
|
|
|
debug_frame = 0;
|
|
|
|
}
|
|
|
|
#endif /* SLIP_ARCH_CONF_ENABLED */
|
2009-10-30 15:06:26 +00:00
|
|
|
return c;
|
|
|
|
}
|
2017-12-22 08:26:44 +00:00
|
|
|
/*---------------------------------------------------------------------------*/
|