From 1885f8ba84a23ad83bf8aaa2a725f39c20e1966c Mon Sep 17 00:00:00 2001 From: Hannes Weisbach Date: Thu, 2 May 2013 11:07:37 +0000 Subject: [PATCH] avrftdi: move logging defines to avrftdi_private.h git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@1156 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 2 ++ avrdude/avrftdi.c | 15 +-------------- avrdude/avrftdi_private.h | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index 710287e3..75f69b6a 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -3,6 +3,8 @@ * avrftdi_private.h: Add libusb-1.0 include to fix include order in windows. * NEWS: Add notice avrftdi supporting TPI * avr.c: Fix avr_tpi_poll_nvmbsy() - poll read data instead of return code + * avrftdi_private.h, avrftdi.c: move logging #defines to from avrftdi.c to + avrftdi_private.h, so that they are available for avrftdi_tpi, too. 2013-04-30 Hannes Weisbach diff --git a/avrdude/avrftdi.c b/avrdude/avrftdi.c index ff42f6a4..c931b3df 100644 --- a/avrdude/avrftdi.c +++ b/avrdude/avrftdi.c @@ -48,19 +48,6 @@ #include enum { FTDI_SCK = 1, FTDI_MOSI, FTDI_MISO, FTDI_RESET }; -enum { ERR, WARN, INFO, DEBUG, TRACE }; - -#define __log(lvl, fmt, ...) \ - do { \ - avrftdi_log(lvl, __func__, __LINE__, fmt, ##__VA_ARGS__); \ - } while(0) - - -#define log_err(fmt, ...) __log(ERR, fmt, ##__VA_ARGS__) -#define log_warn(fmt, ...) __log(WARN, fmt, ##__VA_ARGS__) -#define log_info(fmt, ...) __log(INFO, fmt, ##__VA_ARGS__) -#define log_debug(fmt, ...) __log(DEBUG, fmt, ##__VA_ARGS__) -#define log_trace(fmt, ...) __log(TRACE, fmt, ##__VA_ARGS__) #define FTDI_DEFAULT_MASK ( (1 << (FTDI_SCK - 1)) | (1 << (FTDI_MOSI - 1)) ) @@ -114,7 +101,7 @@ ftdi_pin_name(avrftdi_t* pdata, int pin) * This function is the backend of the log_*-macros, but it can be used * directly. */ -static void avrftdi_log(int level, const char * func, int line, +void avrftdi_log(int level, const char * func, int line, const char * fmt, ...) { static int skip_prefix = 0; const char *p = fmt; diff --git a/avrdude/avrftdi_private.h b/avrdude/avrftdi_private.h index 7ba39280..90c9f45b 100644 --- a/avrdude/avrftdi_private.h +++ b/avrdude/avrftdi_private.h @@ -11,6 +11,20 @@ #include "pgm.h" +enum { ERR, WARN, INFO, DEBUG, TRACE }; + +#define __log(lvl, fmt, ...) \ + do { \ + avrftdi_log(lvl, __func__, __LINE__, fmt, ##__VA_ARGS__); \ + } while(0) + + +#define log_err(fmt, ...) __log(ERR, fmt, ##__VA_ARGS__) +#define log_warn(fmt, ...) __log(WARN, fmt, ##__VA_ARGS__) +#define log_info(fmt, ...) __log(INFO, fmt, ##__VA_ARGS__) +#define log_debug(fmt, ...) __log(DEBUG, fmt, ##__VA_ARGS__) +#define log_trace(fmt, ...) __log(TRACE, fmt, ##__VA_ARGS__) + #define E(x, ftdi) \ do { \ if ((x)) \