diff --git a/src/omv/common.h b/src/omv/common.h new file mode 100644 index 000000000..f62d547c1 --- /dev/null +++ b/src/omv/common.h @@ -0,0 +1,26 @@ +/* + * This file is part of the OpenMV project. + * Copyright (c) 2013/2014 Ibrahim Abdelkader + * This work is licensed under the MIT license, see the file LICENSE for details. + * + * Common macros. + * + */ +#ifndef ALWAYS_INLINE +#define ALWAYS_INLINE inline __attribute__((always_inline)) +#endif + +#ifndef BREAK +#define BREAK() __asm__ volatile ("BKPT") +#endif + +#ifndef DISABLE_OPT +#define DISABLE_OPT __attribute__((optimize("O0"))) +#endif + +#ifdef DEBUG_PRINTF +#define debug_printf(fmt, ...) \ + do { printf("%s(): " fmt, __func__, ##__VA_ARGS__);} while (0) +#else +#define debug_printf(...) +#endif diff --git a/src/omv/ff_wrapper.c b/src/omv/ff_wrapper.c index 5eb480f68..67e9007d5 100644 --- a/src/omv/ff_wrapper.c +++ b/src/omv/ff_wrapper.c @@ -7,7 +7,7 @@ * */ #include -#include "mdefs.h" +#include "common.h" #include "fb_alloc.h" #include "ff_wrapper.h" #define FF_MIN(x,y) (((x)<(y))?(x):(y)) diff --git a/src/omv/img/blob.c b/src/omv/img/blob.c index afa583edc..82c9a5324 100644 --- a/src/omv/img/blob.c +++ b/src/omv/img/blob.c @@ -7,10 +7,10 @@ * */ #include -#include "mdefs.h" #include "fb_alloc.h" #include "xalloc.h" #include "imlib.h" +#include "common.h" ALWAYS_INLINE static uint8_t *init_mask(rectangle_t *roi) { diff --git a/src/omv/img/fft.c b/src/omv/img/fft.c index 767bf6a32..eea937f07 100644 --- a/src/omv/img/fft.c +++ b/src/omv/img/fft.c @@ -9,7 +9,7 @@ #include #include "fb_alloc.h" #include "ff_wrapper.h" -#include "mdefs.h" +#include "common.h" #include "fft.h" // http://processors.wiki.ti.com/index.php/Efficient_FFT_Computation_of_Real_Input diff --git a/src/omv/img/fmath.c b/src/omv/img/fmath.c index 7c1eb4e8b..46983b123 100644 --- a/src/omv/img/fmath.c +++ b/src/omv/img/fmath.c @@ -6,8 +6,8 @@ * Fast approximate math functions. * */ -#include "mdefs.h" #include "fmath.h" +#include "common.h" #define M_PI 3.14159265f #define M_PI_2 1.57079632f diff --git a/src/omv/img/fsort.c b/src/omv/img/fsort.c index dec1c23c2..7b5ec8346 100644 --- a/src/omv/img/fsort.c +++ b/src/omv/img/fsort.c @@ -6,8 +6,8 @@ * Fast 9 and 25 bin sort. * */ -#include "mdefs.h" #include "fsort.h" +#include "common.h" // http://pages.ripco.net/~jgamble/nw.html ALWAYS_INLINE static void cmpswp(uint8_t *a, uint8_t *b) diff --git a/src/omv/img/imlib.c b/src/omv/img/imlib.c index 4282832e9..f13d36730 100644 --- a/src/omv/img/imlib.c +++ b/src/omv/img/imlib.c @@ -16,7 +16,7 @@ #include "fb_alloc.h" #include "xalloc.h" #include "imlib.h" -#include "mdefs.h" +#include "common.h" // Gamma uncompress extern const float xyz_table[256]; diff --git a/src/omv/main.c b/src/omv/main.c index a5594d868..19305116f 100644 --- a/src/omv/main.c +++ b/src/omv/main.c @@ -33,7 +33,6 @@ #include "storage.h" #include "sdcard.h" #include "ff.h" -#include "mdefs.h" #include "modnetwork.h" #include "lib/utils/pyexec.h"