Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
printk.h
Go to the documentation of this file.
1/* printk.h - low-level debug output */
2
3/*
4 * Copyright (c) 2010-2012, 2014 Wind River Systems, Inc.
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8#ifndef ZEPHYR_INCLUDE_SYS_PRINTK_H_
9#define ZEPHYR_INCLUDE_SYS_PRINTK_H_
10
11#include <zephyr/toolchain.h>
12#include <stddef.h>
13#include <stdarg.h>
14#include <inttypes.h>
15
16#ifdef CONFIG_LOG_PRINTK_STATIC
18#endif
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
49#ifdef CONFIG_PRINTK
50
51#ifdef CONFIG_LOG_PRINTK_STATIC
52/* If printk is redirected to the logging use the macro which allow build time
53 * logging message creation which is faster and allows format string stripping in
54 * case of dictionary based logging.
55 */
56#define printk(...) Z_LOG_PRINTK(0, __VA_ARGS__)
57#else
58__printf_like(1, 2) void printk(const char *fmt, ...);
59#endif /* CONFIG_LOG_PRINTK_STATIC */
60
61__printf_like(1, 0) void vprintk(const char *fmt, va_list ap);
62
63#else
64static inline __printf_like(1, 2) void printk(const char *fmt, ...)
65{
66 ARG_UNUSED(fmt);
67}
68
69static inline __printf_like(1, 0) void vprintk(const char *fmt, va_list ap)
70{
71 ARG_UNUSED(fmt);
72 ARG_UNUSED(ap);
73}
74#endif
75
76#ifdef CONFIG_PICOLIBC
77
78#include <stdio.h>
79
80#define snprintk(...) snprintf(__VA_ARGS__)
81#define vsnprintk(str, size, fmt, ap) vsnprintf(str, size, fmt, ap)
82
83#else
84
85__printf_like(3, 4) int snprintk(char *str, size_t size,
86 const char *fmt, ...);
87__printf_like(3, 0) int vsnprintk(char *str, size_t size,
88 const char *fmt, va_list ap);
89
90#endif
91
92#ifdef __cplusplus
93}
94#endif
95
96#endif
int snprintk(char *str, size_t size, const char *fmt,...)
static void vprintk(const char *fmt, va_list ap)
Definition printk.h:69
static void printk(const char *fmt,...)
Print kernel debugging message.
Definition printk.h:64
int vsnprintk(char *str, size_t size, const char *fmt, va_list ap)
Macros to abstract toolchain specific capabilities.