2014-11-30 16:25:41 +01:00
|
|
|
/****************************************************************************
|
2014-11-30 21:06:05 +01:00
|
|
|
* apps/graphics/traveler/include/trv_debug.h
|
2014-11-30 16:25:41 +01:00
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
* used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-11-30 21:06:05 +01:00
|
|
|
#ifndef __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DEBUG_H
|
|
|
|
#define __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DEBUG_H
|
2014-11-30 16:25:41 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "trv_types.h"
|
|
|
|
|
2014-12-14 19:23:19 +01:00
|
|
|
#include <stdio.h>
|
2014-11-30 16:25:41 +01:00
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Feature Selection Switches
|
|
|
|
*
|
2014-11-30 21:06:05 +01:00
|
|
|
* CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 3 turns off sound and video and
|
2014-11-30 16:25:41 +01:00
|
|
|
* enables verbose debug messages on stdout.
|
2014-11-30 21:06:05 +01:00
|
|
|
* CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 2 turns off sound and video and
|
2014-11-30 16:25:41 +01:00
|
|
|
* enables normal debug output
|
2014-11-30 21:06:05 +01:00
|
|
|
* CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 1 turns off sound and enables
|
2014-11-30 16:25:41 +01:00
|
|
|
* normal debug output
|
|
|
|
* OTHERWISE, all debugging features are disabled.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ENABLE_SOUND 1
|
|
|
|
#define ENABLE_VIDEO 1
|
|
|
|
#undef TRV_VERBOSE
|
|
|
|
|
2014-11-30 21:06:05 +01:00
|
|
|
#ifndef CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL
|
|
|
|
# define CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL 0
|
2014-12-14 19:23:19 +01:00
|
|
|
#elif (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 3)
|
2014-11-30 16:25:41 +01:00
|
|
|
# undef ENABLE_SOUND
|
|
|
|
# undef ENABLE_VIDEO
|
|
|
|
# define TRV_VERBOSE 1
|
2014-11-30 21:06:05 +01:00
|
|
|
#elif (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 2)
|
2014-11-30 16:25:41 +01:00
|
|
|
# undef ENABLE_SOUND
|
|
|
|
# undef ENABLE_VIDEO
|
2014-11-30 21:06:05 +01:00
|
|
|
#elif (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL == 1)
|
2014-11-30 16:25:41 +01:00
|
|
|
# undef ENABLE_SOUND
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Sound is not yet supported */
|
|
|
|
|
|
|
|
#undef ENABLE_SOUND
|
|
|
|
|
|
|
|
/* Debug output macros */
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPP_HAVE_VARARGS
|
2014-11-30 21:06:05 +01:00
|
|
|
# if (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL > 0)
|
2014-11-30 16:25:41 +01:00
|
|
|
|
|
|
|
# define trv_debug(format, ...) \
|
2014-12-14 19:23:19 +01:00
|
|
|
printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
2014-11-30 16:25:41 +01:00
|
|
|
|
|
|
|
# ifdef TRV_VERBOSE
|
|
|
|
# define trv_vdebug(format, ...) \
|
|
|
|
printf(EXTRA_FMT format EXTRA_ARG, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
# else
|
2014-12-01 21:04:33 +01:00
|
|
|
# define trv_vdebug(x...)
|
2014-11-30 16:25:41 +01:00
|
|
|
# endif
|
|
|
|
|
|
|
|
# else
|
|
|
|
|
2014-12-01 21:04:33 +01:00
|
|
|
# define trv_debug(x...)
|
|
|
|
# define trv_vdebug(x...)
|
2014-11-30 16:25:41 +01:00
|
|
|
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* Variadic macros NOT supported */
|
|
|
|
|
2014-11-30 21:06:05 +01:00
|
|
|
# if (CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL > 0)
|
2014-11-30 16:25:41 +01:00
|
|
|
# ifdef TRV_VERBOSE
|
|
|
|
# define trv_vdebug trv_debug
|
|
|
|
# else
|
|
|
|
# define trv_vdebug (void)
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# define trv_debug (void)
|
|
|
|
# define trv_vdebug (void)
|
|
|
|
# endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* The debugging interfaces are normally accessed via the macros provided
|
|
|
|
* above. If the cross-compiler's C pre-processor supports a variable
|
|
|
|
* number of macro arguments, then those macros below will map all
|
|
|
|
* debug statements to printf.
|
|
|
|
*
|
|
|
|
* If the cross-compiler's pre-processor does not support variable length
|
|
|
|
* arguments, then this additional interface will be built.
|
|
|
|
*/
|
|
|
|
|
2014-12-01 21:04:33 +01:00
|
|
|
#if !defined(CONFIG_CPP_HAVE_VARARGS) && CONFIG_GRAPHICS_TRAVELER_DEBUG_LEVEL > 0
|
2014-11-30 16:25:41 +01:00
|
|
|
int trv_debug(FAR const char *format, ...);
|
|
|
|
#endif
|
|
|
|
|
2014-11-30 21:06:05 +01:00
|
|
|
#endif /* __APPS_GRAPHICS_TRAVELER_INCLUDE_TRV_DEBUG_H */
|