Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-os/platform/mbed_debug.h@0:fb8047b156bb, 2020-01-15 (annotated)
- Committer:
- rahul_dahiya
- Date:
- Wed Jan 15 15:57:15 2020 +0530
- Revision:
- 0:fb8047b156bb
STM32F7 LWIP
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rahul_dahiya |
0:fb8047b156bb | 1 | |
rahul_dahiya |
0:fb8047b156bb | 2 | /** \addtogroup platform */ |
rahul_dahiya |
0:fb8047b156bb | 3 | /** @{*/ |
rahul_dahiya |
0:fb8047b156bb | 4 | /** |
rahul_dahiya |
0:fb8047b156bb | 5 | * \defgroup platform_debug Debug functions |
rahul_dahiya |
0:fb8047b156bb | 6 | * @{ |
rahul_dahiya |
0:fb8047b156bb | 7 | */ |
rahul_dahiya |
0:fb8047b156bb | 8 | |
rahul_dahiya |
0:fb8047b156bb | 9 | /* mbed Microcontroller Library |
rahul_dahiya |
0:fb8047b156bb | 10 | * Copyright (c) 2006-2013 ARM Limited |
rahul_dahiya |
0:fb8047b156bb | 11 | * |
rahul_dahiya |
0:fb8047b156bb | 12 | * Licensed under the Apache License, Version 2.0 (the "License"); |
rahul_dahiya |
0:fb8047b156bb | 13 | * you may not use this file except in compliance with the License. |
rahul_dahiya |
0:fb8047b156bb | 14 | * You may obtain a copy of the License at |
rahul_dahiya |
0:fb8047b156bb | 15 | * |
rahul_dahiya |
0:fb8047b156bb | 16 | * http://www.apache.org/licenses/LICENSE-2.0 |
rahul_dahiya |
0:fb8047b156bb | 17 | * |
rahul_dahiya |
0:fb8047b156bb | 18 | * Unless required by applicable law or agreed to in writing, software |
rahul_dahiya |
0:fb8047b156bb | 19 | * distributed under the License is distributed on an "AS IS" BASIS, |
rahul_dahiya |
0:fb8047b156bb | 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
rahul_dahiya |
0:fb8047b156bb | 21 | * See the License for the specific language governing permissions and |
rahul_dahiya |
0:fb8047b156bb | 22 | * limitations under the License. |
rahul_dahiya |
0:fb8047b156bb | 23 | */ |
rahul_dahiya |
0:fb8047b156bb | 24 | #ifndef MBED_DEBUG_H |
rahul_dahiya |
0:fb8047b156bb | 25 | #define MBED_DEBUG_H |
rahul_dahiya |
0:fb8047b156bb | 26 | #if DEVICE_STDIO_MESSAGES |
rahul_dahiya |
0:fb8047b156bb | 27 | #include <stdio.h> |
rahul_dahiya |
0:fb8047b156bb | 28 | #include <stdarg.h> |
rahul_dahiya |
0:fb8047b156bb | 29 | #endif |
rahul_dahiya |
0:fb8047b156bb | 30 | |
rahul_dahiya |
0:fb8047b156bb | 31 | #ifdef __cplusplus |
rahul_dahiya |
0:fb8047b156bb | 32 | extern "C" { |
rahul_dahiya |
0:fb8047b156bb | 33 | #endif |
rahul_dahiya |
0:fb8047b156bb | 34 | |
rahul_dahiya |
0:fb8047b156bb | 35 | |
rahul_dahiya |
0:fb8047b156bb | 36 | /** Output a debug message |
rahul_dahiya |
0:fb8047b156bb | 37 | * |
rahul_dahiya |
0:fb8047b156bb | 38 | * @param format printf-style format string, followed by variables |
rahul_dahiya |
0:fb8047b156bb | 39 | */ |
rahul_dahiya |
0:fb8047b156bb | 40 | static inline void debug(const char *format, ...) { |
rahul_dahiya |
0:fb8047b156bb | 41 | #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) |
rahul_dahiya |
0:fb8047b156bb | 42 | va_list args; |
rahul_dahiya |
0:fb8047b156bb | 43 | va_start(args, format); |
rahul_dahiya |
0:fb8047b156bb | 44 | vfprintf(stderr, format, args); |
rahul_dahiya |
0:fb8047b156bb | 45 | va_end(args); |
rahul_dahiya |
0:fb8047b156bb | 46 | #endif |
rahul_dahiya |
0:fb8047b156bb | 47 | } |
rahul_dahiya |
0:fb8047b156bb | 48 | |
rahul_dahiya |
0:fb8047b156bb | 49 | |
rahul_dahiya |
0:fb8047b156bb | 50 | /** Conditionally output a debug message |
rahul_dahiya |
0:fb8047b156bb | 51 | * |
rahul_dahiya |
0:fb8047b156bb | 52 | * NOTE: If the condition is constant false (== 0) and the compiler optimization |
rahul_dahiya |
0:fb8047b156bb | 53 | * level is greater than 0, then the whole function will be compiled away. |
rahul_dahiya |
0:fb8047b156bb | 54 | * |
rahul_dahiya |
0:fb8047b156bb | 55 | * @param condition output only if condition is true (!= 0) |
rahul_dahiya |
0:fb8047b156bb | 56 | * @param format printf-style format string, followed by variables |
rahul_dahiya |
0:fb8047b156bb | 57 | */ |
rahul_dahiya |
0:fb8047b156bb | 58 | static inline void debug_if(int condition, const char *format, ...) { |
rahul_dahiya |
0:fb8047b156bb | 59 | #if DEVICE_STDIO_MESSAGES && !defined(NDEBUG) |
rahul_dahiya |
0:fb8047b156bb | 60 | if (condition) { |
rahul_dahiya |
0:fb8047b156bb | 61 | va_list args; |
rahul_dahiya |
0:fb8047b156bb | 62 | va_start(args, format); |
rahul_dahiya |
0:fb8047b156bb | 63 | vfprintf(stderr, format, args); |
rahul_dahiya |
0:fb8047b156bb | 64 | va_end(args); |
rahul_dahiya |
0:fb8047b156bb | 65 | } |
rahul_dahiya |
0:fb8047b156bb | 66 | #endif |
rahul_dahiya |
0:fb8047b156bb | 67 | } |
rahul_dahiya |
0:fb8047b156bb | 68 | |
rahul_dahiya |
0:fb8047b156bb | 69 | |
rahul_dahiya |
0:fb8047b156bb | 70 | #ifdef __cplusplus |
rahul_dahiya |
0:fb8047b156bb | 71 | } |
rahul_dahiya |
0:fb8047b156bb | 72 | #endif |
rahul_dahiya |
0:fb8047b156bb | 73 | |
rahul_dahiya |
0:fb8047b156bb | 74 | #endif |
rahul_dahiya |
0:fb8047b156bb | 75 | |
rahul_dahiya |
0:fb8047b156bb | 76 | /**@}*/ |
rahul_dahiya |
0:fb8047b156bb | 77 | |
rahul_dahiya |
0:fb8047b156bb | 78 | /**@}*/ |
rahul_dahiya |
0:fb8047b156bb | 79 |