-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdebug.h
More file actions
31 lines (22 loc) · 747 Bytes
/
debug.h
File metadata and controls
31 lines (22 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* SPDX-License-Identifier: MIT
* Copyright (C) 2021-2022 Sergey Bolshakov <beefdeadbeef@gmail.com>
*/
#ifdef DEBUG
#include <inttypes.h>
#include <stdio.h>
#include "trace.h"
extern volatile uint32_t systicks;
#define trace(port, val) \
do { \
trace_send_blocking32(port, systicks); \
trace_send_blocking32(port, val); \
} while(0)
#define debugf(fmt, args...) \
do { \
printf("[%08lx] %s(): " fmt, systicks, __func__, ##args); \
} while (0)
#else
#define trace(port, val)
#define debugf(fmt, args...)
#endif