openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
trace.h
Go to the documentation of this file.
1
3#ifndef WOZ_TRACE_H
4#define WOZ_TRACE_H
5
6#include <stddef.h>
7#include <stdint.h>
8
9#if defined(CONFIG_WOZ_E2E_TRACE)
10
11#include "woz_log.h"
12
14#define WOZ_TRACE_HEX8_LEN 17
15
17static inline const char *woz_trace_hex8(char buf[WOZ_TRACE_HEX8_LEN], const uint8_t *bytes,
18 size_t len)
19{
20 static const char nybble[16] = "0123456789abcdef";
21 size_t n = (len < 8) ? len : 8;
22 for (size_t i = 0; i < n; i++) {
23 buf[2 * i] = nybble[(bytes[i] >> 4) & 0x0f];
24 buf[2 * i + 1] = nybble[bytes[i] & 0x0f];
25 }
26 buf[2 * n] = '\0';
27 return buf;
28}
29
31#define WOZ_TRACE(stage, fmt, ...) \
32 LOG_INF("[WOZ_TRACE] src=lock stage=" stage " " fmt, ##__VA_ARGS__)
33
34#else /* !CONFIG_WOZ_E2E_TRACE */
35
36#include "woz_log.h"
37
38#define WOZ_TRACE_HEX8_LEN 17
39
41#define WOZ_TRACE(stage, fmt, ...) \
42 do { \
43 if (0) { \
44 woz_printf("[WOZ_TRACE] src=lock stage=" stage " " fmt, ##__VA_ARGS__); \
45 } \
46 } while (0)
47
49static inline const char *woz_trace_hex8(char buf[WOZ_TRACE_HEX8_LEN], const uint8_t *bytes,
50 size_t len)
51{
52 (void)bytes;
53 (void)len;
54 buf[0] = '\0';
55 return buf;
56}
57
58#endif /* CONFIG_WOZ_E2E_TRACE */
59
60#endif /* WOZ_TRACE_H */
static const char * woz_trace_hex8(char buf[WOZ_TRACE_HEX8_LEN], const uint8_t *bytes, size_t len)
Stub that touches buf and bytes so neither becomes unused.
Definition trace.h:49