embox

Форк
0
46 строк · 952.0 Байт
1
/**
2
 * @file
3
 * @brief SEGGER RTT
4
 *
5
 * @author  Alexander Kalmuk
6
 * @date    06.05.2020
7
 */
8

9
#include <drivers/diag.h>
10
#include "SEGGER_RTT.h"
11

12
static int rtt_diag_init(const struct diag *diag) {
13
	SEGGER_RTT_Init();
14
	return 0;
15
}
16

17
static void rtt_diag_putc(const struct diag *diag, char ch) {
18
	/* RTT lost charachters, so we should check whether there is a room
19
	 * for a char, but on the other hand, we can block forever here if
20
	 * we are running without JLINK attached (nobody reads buffer and overflow occurs).
21
	 * So just put char without checking for possible overflows. */
22
#if 0
23
	int ret;
24

25
	do {
26
		ret = SEGGER_RTT_PutChar(0, ch);
27
	} while (!ret);
28
#else
29
	SEGGER_RTT_PutChar(0, ch);
30
#endif
31
}
32

33
static char rtt_diag_getc(const struct diag *diag) {
34
	return 0;
35
}
36

37
static int rtt_diag_kbhit(const struct diag *diag) {
38
	return 0;
39
}
40

41
DIAG_OPS_DEF(
42
		.init = rtt_diag_init,
43
		.putc = rtt_diag_putc,
44
		.getc = rtt_diag_getc,
45
		.kbhit = rtt_diag_kbhit,
46
);
47

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.