Files
gps/soc/software/gps_system/header/gps_macros.h
T

59 lines
1.7 KiB
C

#ifndef GPS_MACROS_INCLUDED
#define GPS_MACROS_INCLUDED
#include <stdio.h>
/*
* Verbosity is cumulative:
* 1: navigation result (position and DOP)
* 2: tracked channel/PRN summary
* 3: state transitions, warnings/errors and integrity summary
* 4: performance, NAV satellite and low-level diagnostic detail
*
* The aliases keep call sites descriptive without creating extra verbosity
* levels. GPS_DEBUG_LEVEL should normally be in the range 1..4.
*/
#define DEBUG_STATUS 1
#define DEBUG_CHANNELS 2
#define DEBUG_EVENTS 3
#define DEBUG_TRACE 4
#define DEBUG_ERROR DEBUG_EVENTS
#define DEBUG_WARNING DEBUG_EVENTS
#define DEBUG_INFO DEBUG_EVENTS
#define DEBUG_DEBUG DEBUG_TRACE
#define GPS_LOG_CAT_ACQ "ACQ"
#define GPS_LOG_CAT_TRK "TRK"
#define GPS_LOG_CAT_ISR "ISR"
#define GPS_LOG_CAT_NAV "NAV"
#define GPS_LOG_CAT_SCHED "SCHED"
#define GPS_LOG_CAT_MEM "MEM"
#define GPS_LOG_CAT_HWREG "HWREG"
#define GPS_LOG_CAT_FUSION "FUSION"
// Set the current verbosity level
#ifdef DEBUG
#ifndef GPS_DEBUG_LEVEL
#define GPS_DEBUG_LEVEL DEBUG_DEBUG
#endif
#define DEBUG_LEVEL GPS_DEBUG_LEVEL
#endif
#ifdef DEBUG_LEVEL
#define GPS_DEBUG_ENABLED(level) ((level) <= DEBUG_LEVEL)
#define PRINT_DEBUG(level, ...) \
do { if (GPS_DEBUG_ENABLED(level)) printf(__VA_ARGS__); } while (0)
#define GPS_LOG(level, category, ...) \
do { if (GPS_DEBUG_ENABLED(level)) { printf("[%s] ", (category)); printf(__VA_ARGS__); } } while (0)
#else
#define GPS_DEBUG_ENABLED(level) 0
#define PRINT_DEBUG(level, ...) \
do { } while (0)
#define GPS_LOG(level, category, ...) \
do { } while (0)
// Do nothing
#endif
#endif