From bdcc52e5f18159cadc413c53dd14ef468a6de376 Mon Sep 17 00:00:00 2001 From: asterix Date: Thu, 5 Jun 2008 17:34:27 +0000 Subject: [PATCH] Use log macros instead trace. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@1419 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cfg/cfg_adc.h | 19 +++++++++++++++++-- bertos/cpu/arm/drv/adc_at91.c | 20 +++++++++++++------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/bertos/cfg/cfg_adc.h b/bertos/cfg/cfg_adc.h index 201616e7..26254a41 100644 --- a/bertos/cfg/cfg_adc.h +++ b/bertos/cfg/cfg_adc.h @@ -40,6 +40,23 @@ #ifndef CFG_ADC_H #define CFG_ADC_H +/** + * Logging level definition. + * + * Use 0 to log only the error messages + * Use 1 to log the error and warning messages + * Use 2 to log all messages + */ +#define ADC_LOG_LEVEL 2 + +/** + * Set logging verbosity. + * + * If verbosity is zero print short log messages. + */ +#define ADC_LOG_VERBOSITY 1 + + /** * ADC timing setting parameter * @@ -57,8 +74,6 @@ #define CONFIG_ADC_AVR_REF 1 #define CONFIG_ADC_AVR_DIVISOR 2 - - /// Enable ADS strobe. #define CONFIG_ADC_STROBE 0 diff --git a/bertos/cpu/arm/drv/adc_at91.c b/bertos/cpu/arm/drv/adc_at91.c index d8cea88a..3ebbfa75 100644 --- a/bertos/cpu/arm/drv/adc_at91.c +++ b/bertos/cpu/arm/drv/adc_at91.c @@ -35,17 +35,18 @@ * * This ADC module should be use both whit kernel or none. * If you are using a kernel, the adc drive does not wait the finish of - * conversion but use a singal every time a required conversion are - * ended. This signal wake up a process that return a result of + * conversion but use a singal every time a required conversion are + * ended. This signal wake up a process that return a result of * conversion. Otherwise, if you not use a kernl, this module wait * whit a loop the finishing of conversion. * * * \version $Id$ - * + * * \author Daniele Basile */ + #include "adc_at91.h" #include "cfg/cfg_adc.h" @@ -53,6 +54,11 @@ #include #include +// Define logging setting (for cfg/log.h module). +#define LOG_LEVEL ADC_LOG_LEVEL +#define LOG_VERBOSITY ADC_LOG_VERBOSITY +#include + #include #include @@ -171,23 +177,23 @@ INLINE void adc_hw_init(void) #endif /* \} */ - TRACEMSG("prescaler[%ld], stup[%ld], shtim[%ld]\n",ADC_COMPUTED_PRESCALER,ADC_COMPUTED_STARTUPTIME,ADC_COMPUTED_SHTIME); + LOG_INFO("prescaler[%ld], stup[%ld], shtim[%ld]\n",ADC_COMPUTED_PRESCALER, ADC_COMPUTED_STARTUPTIME, ADC_COMPUTED_SHTIME); //Apply computed prescaler value ADC_MR &= ~ADC_PRESCALER_MASK; ADC_MR |= ((ADC_COMPUTED_PRESCALER << ADC_PRESCALER_SHIFT) & ADC_PRESCALER_MASK); - TRACEMSG("prescaler[%ld]\n", (ADC_COMPUTED_PRESCALER << ADC_PRESCALER_SHIFT) & ADC_PRESCALER_MASK); + LOG_INFO("prescaler[%ld]\n", (ADC_COMPUTED_PRESCALER << ADC_PRESCALER_SHIFT) & ADC_PRESCALER_MASK); //Apply computed start up time ADC_MR &= ~ADC_STARTUP_MASK; ADC_MR |= ((ADC_COMPUTED_STARTUPTIME << ADC_STARTUP_SHIFT) & ADC_STARTUP_MASK); - TRACEMSG("sttime[%ld]\n", (ADC_COMPUTED_STARTUPTIME << ADC_STARTUP_SHIFT) & ADC_STARTUP_MASK); + LOG_INFO("sttime[%ld]\n", (ADC_COMPUTED_STARTUPTIME << ADC_STARTUP_SHIFT) & ADC_STARTUP_MASK); //Apply computed sample and hold time ADC_MR &= ~ADC_SHTIME_MASK; ADC_MR |= ((ADC_COMPUTED_SHTIME << ADC_SHTIME_SHIFT) & ADC_SHTIME_MASK); - TRACEMSG("shtime[%ld]\n", (ADC_COMPUTED_SHTIME << ADC_SHTIME_SHIFT) & ADC_SHTIME_MASK); + LOG_INFO("shtime[%ld]\n", (ADC_COMPUTED_SHTIME << ADC_SHTIME_SHIFT) & ADC_SHTIME_MASK); #if CONFIG_KERNEL //Register and enable irq for adc. -- 2.25.1