From 50caa7b182f66f0810859ef29acfc33e7720a86b Mon Sep 17 00:00:00 2001 From: joan Date: Sun, 4 Feb 2018 09:47:41 +0000 Subject: [PATCH] maintain backward compatibility with EMBEDDED_IN_VM --- pigpio.c | 24 ++++++++++++++++++------ pigpio.h | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pigpio.c b/pigpio.c index 854586b..fcfb758 100644 --- a/pigpio.c +++ b/pigpio.c @@ -195,11 +195,18 @@ bit 0 READ_LAST_NOT_SET_ERROR #define BIT (1<<(gpio&0x1F)) -#define DBG(level, format, arg...) \ - { \ - if (gpioCfg.dbgLevel >= level && (gpioCfg.internals & PI_CFG_SIGHANDLER)) \ - fprintf(stderr, "%s %s: " format "\n" , \ - myTimeStamp(), __FUNCTION__ , ## arg); \ +#ifndef EMBEDDED_IN_VM +#define DBG(level, format, arg...) DO_DBG(level, format, ## arg) +#else +#define DBG(level, format, arg...) +#endif + +#define DO_DBG(level, format, arg...) \ + { \ + if (gpioCfg.dbgLevel >= level && \ + (gpioCfg.internals & PI_CFG_SIGHANDLER)) \ + fprintf(stderr, "%s %s: " format "\n" , \ + myTimeStamp(), __FUNCTION__ , ## arg); \ } #ifndef DISABLE_SER_CHECK_INITED @@ -8106,8 +8113,10 @@ int initInitialise(void) gpioMaskSet = 1; } +#ifndef EMBEDDED_IN_VM if(gpioCfg.internals & PI_CFG_SIGHANDLER) sigSetHandler(); +#endif if (initPeripherals() < 0) return PI_INIT_FAILED; @@ -8502,7 +8511,9 @@ void gpioTerminate(void) if (dmaReg != MAP_FAILED) dmaIn[DMA_CS] = DMA_CHANNEL_RESET; if (dmaReg != MAP_FAILED) dmaOut[DMA_CS] = DMA_CHANNEL_RESET; - if ((gpioCfg.internals & PI_CFG_STATS) && (gpioCfg.internals & PI_CFG_SIGHANDLER)) +#ifndef EMBEDDED_IN_VM + if ((gpioCfg.internals & PI_CFG_STATS) && + (gpioCfg.internals & PI_CFG_SIGHANDLER)) { fprintf(stderr, "\n#####################################################\n"); @@ -8536,6 +8547,7 @@ void gpioTerminate(void) "\n#####################################################\n\n\n"); } +#endif initReleaseResources(); fflush(NULL); diff --git a/pigpio.h b/pigpio.h index 77f4d43..3ae2a09 100644 --- a/pigpio.h +++ b/pigpio.h @@ -31,7 +31,7 @@ For more information, please refer to #include #include -#define PIGPIO_VERSION 65 +#define PIGPIO_VERSION 64 /*TEXT -- 2.30.2