nrf5x: add blocking retarget impl

This commit is contained in:
Matthias Ringwald 2016-03-19 22:19:21 +01:00
parent 0283db5655
commit 1f450fe42c
2 changed files with 18 additions and 4 deletions

View File

@ -71,7 +71,7 @@ INC_PATHS += -I$(abspath ../../../../../components/toolchain/gcc)
# BTstack territory
BTSTACK_ROOT = ../../../../../components/btstack
C_SOURCE_FILES += $(abspath $(BTSTACK_ROOT)/port/nrf5x/main.c)
C_SOURCE_FILES += $(abspath $(BTSTACK_ROOT)/port/retarget.c)
C_SOURCE_FILES += $(abspath $(BTSTACK_ROOT)/port/retarget_blocking.c)
C_SOURCE_FILES += $(abspath $(BTSTACK_ROOT)/platform/embedded/btstack_run_loop_embedded.c)
C_SOURCE_FILES += $(abspath $(BTSTACK_ROOT)/src/ble/ad_parser.c)
C_SOURCE_FILES += $(abspath $(BTSTACK_ROOT)/src/btstack_linked_list.c)

View File

@ -10,6 +10,8 @@
*
*/
// BTstack patch: block on full outgoing buffer
#if !defined(NRF_LOG_USES_RTT) || NRF_LOG_USES_RTT != 1
#include <stdio.h>
@ -45,7 +47,11 @@ int fputc(int ch, FILE * p_file)
{
UNUSED_PARAMETER(p_file);
UNUSED_VARIABLE(app_uart_put((uint8_t)ch));
int res;
do {
res = app_uart_put((uint8_t)ch);
} while (res);
return ch;
}
@ -60,7 +66,11 @@ int _write(int file, const char * p_char, int len)
for (i = 0; i < len; i++)
{
UNUSED_VARIABLE(app_uart_put(*p_char++));
int res;
do {
res = app_uart_put((uint8_t)*p_char);
} while (res);
p_char++;
}
return len;
@ -89,7 +99,11 @@ __ATTRIBUTES size_t __write(int file, const unsigned char * p_char, size_t len)
for (i = 0; i < len; i++)
{
UNUSED_VARIABLE(app_uart_put(*p_char++));
int res;
do {
res = app_uart_put((uint8_t)*p_char);
} while (res);
p_char++;
}
return len;