diag-trace
5.0.1
µOS++ Tracing Infrastructure
Toggle main menu visibility
Loading...
Searching...
No Matches
c-api-inlines.h
Go to the documentation of this file.
1
/*
2
* This file is part of the µOS++ project (https://micro-os-plus.github.io/).
3
* Copyright (c) 2015-2026 Liviu Ionescu. All rights reserved.
4
*
5
* Permission to use, copy, modify, and/or distribute this software for any
6
* purpose is hereby granted, under the terms of the MIT license.
7
*
8
* If a copy of the license was not distributed with this file, it can be
9
* obtained from https://opensource.org/licenses/mit.
10
*/
11
12
// ----------------------------------------------------------------------------
13
24
25
// ----------------------------------------------------------------------------
26
27
#if !defined(MICRO_OS_PLUS_DIAG_TRACE_H_)
28
#error "Do not include this file directly; use "micro-os-plus/diag/trace.h"."
29
#endif
// MICRO_OS_PLUS_DIAG_TRACE_H_
30
31
// ----------------------------------------------------------------------------
32
33
#ifndef MICRO_OS_PLUS_DIAG_TRACE_INLINES_C_API_INLINES_H_
34
#define MICRO_OS_PLUS_DIAG_TRACE_INLINES_C_API_INLINES_H_
35
36
// ----------------------------------------------------------------------------
37
38
// When TRACE is not enabled, define all as empty.
39
#if !defined(MICRO_OS_PLUS_DIAG_TRACE_ENABLED)
40
41
// ----------------------------------------------------------------------------
42
43
#include <stdarg.h>
44
#include <sys/types.h>
45
46
// ----------------------------------------------------------------------------
47
// Empty definitions.
48
49
#if defined(__GNUC__)
50
#pragma GCC diagnostic push
51
52
#pragma GCC diagnostic ignored "-Wunused-parameter"
53
#endif
// defined(__GNUC__)
54
55
static
inline
__attribute__ ((always_inline))
void
56
micro_os_plus_trace_initialise
(
void
)
57
{
58
}
59
60
#if defined(__GNUC__)
61
#pragma GCC diagnostic push
62
63
#if defined(__cplusplus)
64
#pragma GCC diagnostic ignored "-Wold-style-cast"
65
#endif
// defined(__cplusplus)
66
#endif
// defined(__GNUC__)
67
68
static
inline
__attribute__ ((always_inline)) ssize_t
69
micro_os_plus_trace_write
(
const
void
* buf,
size_t
nbyte)
70
{
71
return
(ssize_t)(nbyte);
72
}
73
74
static
inline
__attribute__ ((always_inline))
void
75
micro_os_plus_trace_flush
(
void
)
76
{
77
}
78
79
#if defined(__GNUC__)
80
#pragma GCC diagnostic pop
81
#endif
// defined(__GNUC__)
82
83
// ----------------------------------------------------------------------------
84
85
static
inline
__attribute__ ((always_inline, format (printf, 1, 2))) int
86
micro_os_plus_trace_printf
(const
char
* format, ...)
87
{
88
return
0;
89
}
90
91
static
inline
__attribute__ ((always_inline, format (printf, 1, 0))) int
92
micro_os_plus_trace_vprintf
(const
char
* format, va_list arguments)
93
{
94
return
0;
95
}
96
97
static
inline
__attribute__ ((always_inline))
int
98
micro_os_plus_trace_puts
(
const
char
* s)
99
{
100
return
0;
101
}
102
103
static
inline
__attribute__ ((always_inline))
int
104
micro_os_plus_trace_putchar
(
int
c)
105
{
106
return
c;
107
}
108
109
static
inline
__attribute__ ((always_inline))
void
110
micro_os_plus_trace_dump_args
(
int
argc,
char
* argv[])
111
{
112
}
113
114
#if defined(__GNUC__)
115
#pragma GCC diagnostic pop
116
#endif
// defined(__GNUC__)
117
118
// ----------------------------------------------------------------------------
119
120
#endif
// !defined(MICRO_OS_PLUS_DIAG_TRACE_ENABLED)
121
122
// ----------------------------------------------------------------------------
123
124
#endif
// MICRO_OS_PLUS_DIAG_TRACE_INLINES_C_API_INLINES_H_
125
126
// ----------------------------------------------------------------------------
micro_os_plus_trace_dump_args
void micro_os_plus_trace_dump_args(int argc, char *argv[])
Write the argv[] array to the trace output channel.
Definition
trace-c-api.cpp:103
micro_os_plus_trace_initialise
void micro_os_plus_trace_initialise(void)
Initialise the trace output channel.
Definition
trace-c-api.cpp:52
micro_os_plus_trace_write
ssize_t micro_os_plus_trace_write(const void *buf, size_t nbyte)
Write the given number of bytes to the trace output channel.
Definition
trace-c-api.cpp:58
micro_os_plus_trace_flush
void micro_os_plus_trace_flush(void)
Flush the trace output channel.
Definition
trace-c-api.cpp:64
micro_os_plus_trace_printf
int micro_os_plus_trace_printf(const char *format,...)
Write a formatted string to the trace output channel.
Definition
trace-c-api.cpp:72
micro_os_plus_trace_puts
int micro_os_plus_trace_puts(const char *s)
Write the string and a line terminator to the trace output channel.
Definition
trace-c-api.cpp:91
micro_os_plus_trace_vprintf
int micro_os_plus_trace_vprintf(const char *format, va_list arguments)
Write a formatted variable arguments list to the trace output channel.
Definition
trace-c-api.cpp:85
micro_os_plus_trace_putchar
int micro_os_plus_trace_putchar(int c)
Write the single character to the trace output channel.
Definition
trace-c-api.cpp:97
include
micro-os-plus
diag
trace
inlines
c-api-inlines.h
Generated by
1.17.0