* \brief Configuration file for KFile interface module.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
#ifndef CFG_KFILE_H
#define CFG_KFILE_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 KFILE_LOG_LEVEL 2
+/// Module logging level definition.
+#define KFILE_LOG_LEVEL LOG_LVL_INFO
-/**
- * Set logging verbosity.
- *
- * If verbosity is zero print short log messages.
- */
-#define KFILE_LOG_VERBOSITY 0
+/// Module logging verbosity.
+#define KFILE_LOG_FORMAT LOG_FMT_TERSE
/// Enable the gets function with echo.
#define CONFIG_KFILE_GETS 1
#endif /* CFG_KFILE_H */
-
-
* the GNU General Public License.
*
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
- * All Rights Reserved.
+ *
* -->
*
* \brief Configuration file for KFile interface module.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
#ifndef CFG_KFILE_H
#define CFG_KFILE_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 KFILE_LOG_LEVEL 2
+/// Module logging level definition.
+#define KFILE_LOG_LEVEL LOG_LVL_INFO
-/**
- * Set logging verbosity.
- *
- * If verbosity is zero print short log messages.
- */
-#define KFILE_LOG_VERBOSITY 0
+/// Module logging format.
+#define KFILE_LOG_FORMAT LOG_FMT_TERSE
/// Enable the gets function with echo.
#define CONFIG_KFILE_GETS 1
#endif /* CFG_KFILE_H */
-
-
* the GNU General Public License.
*
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
- * All Rights Reserved.
+ *
* -->
*
* \brief Configuration file for ADC module.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
#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
+/// Module logging level.
+#define ADC_LOG_LEVEL LOG_LVL_INFO
+/// Module logging format.
+#define ADC_LOG_FORMAT LOG_FMT_VERBOSE
/**
* ADC timing setting parameter
#define CONFIG_ADC_STROBE 0
#endif /* CFG_ADC_H */
-
* \brief Configuration file for data flash memory module.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
#ifndef CFG_DATAFLASH_H
#define CFG_DATAFLASH_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 DATAFLASH_LOG_LEVEL 2
-
-/**
- * Set logging verbosity.
- *
- * If verbosity is zero print short log messages.
- */
-#define DATAFLASH_LOG_VERBOSITY 0
+/// Module logging level definition.
+#define DATAFLASH_LOG_LEVEL LOG_LVL_INFO
+/// Module logging format.
+#define DATAFLASH_LOG_FORMAT LOG_FMT_TERSE
#endif /* CFG_DATAFLASH_H */
-
-
* the GNU General Public License.
*
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
- * All Rights Reserved.
* -->
*
- * \brief Configuration file for flash_avr module.
- *
* \version $Id$
- *
* \author Manuele Fanelli <qwert@develer.com>
+ *
+ * \brief Configuration file for flash_avr module.
*/
#ifndef CFG_FLASH_AVR_H
*/
#define CONFIG_FLASH_AVR_BOOTSIZE 8192
#define CONFIG_FLASH_AVR_LOG_LEVEL LOG_LVL_ERR
-#define CONFIG_FLASH_AVR_LOG_VERBOSITY LOG_SILENT
+#define CONFIG_FLASH_AVR_LOG_FORMAT LOG_FMT_SILENT
#endif /* CFG_BOOT_H */
#define CONFIG_KERN_QUANTUM 50 /**< Time sharing quantum in timer ticks. */
+#define CONFIG_KERN_LOGLEVEL LOG_LVL_ERR
#endif /* CFG_KERN_H */
* the GNU General Public License.
*
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
- * All Rights Reserved.
+ *
* -->
*
* \brief Configuration file for KFile interface module.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
#ifndef CFG_KFILE_H
#define CFG_KFILE_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 KFILE_LOG_LEVEL 2
+/// Module logging level.
+#define KFILE_LOG_LEVEL LOG_LVL_INFO
-/**
- * Set logging verbosity.
- *
- * If verbosity is zero print short log messages.
- */
-#define KFILE_LOG_VERBOSITY 0
+/// Module logging format.
+#define KFILE_LOG_FORMAT LOG_FMT_TERSE
/// Enable the gets function with echo.
#define CONFIG_KFILE_GETS 0
#endif /* CFG_KFILE_H */
-
-
* the GNU General Public License.
*
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
- * All Rights Reserved.
* -->
*
* \brief Configuration file for PWM module.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
#ifndef CFG_PWM_H
#define CFG_PWM_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 PWM_LOG_LEVEL 2
-
-/**
- * Set logging verbosity.
- *
- * If verbosity is zero print short log messages.
- */
-#define PWM_LOG_VERBOSITY 1
+/// Module logging level.
+#define PWM_LOG_LEVEL LOG_LVL_INFO
+/// Module logging format.
+#define PWM_LOG_FORMAT LOG_FMT_VERBOSE
#endif /* CFG_PWM_H */
-
-
* the GNU General Public License.
*
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
- * All Rights Reserved.
+ *
* -->
*
* \brief Configuration file for stepper motor module.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
#ifndef CFG_STEPPER_H
#define CFG_STEPPER_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 STEPPER_LOG_LEVEL 2
-
-/**
- * Set logging verbosity.
- *
- * If verbosity is zero print short log messages.
- */
-#define STEPPER_LOG_VERBOSITY 0
+/// Module logging level.
+#define STEPPER_LOG_LEVEL LOG_LVL_INFO
+/// Module logging format.
+#define STEPPER_LOG_FORMAT LOG_FMT_TERSE
/// Max number of the stepper motor.
#define CONFIG_NUM_STEPPER_MOTORS 6
#define CONFIG_TC_STEPPER_MAX_NUM 6
#endif /* CFG_STEPPER_H */
-
* the GNU General Public License.
*
* Copyright 2008 Develer S.r.l. (http://www.develer.com/)
- * All Rights Reserved.
+ *
* -->
*
* \brief Logging system module.
* This module implement a simple interface to use the multi level logging system.
* The log message have the priority order, like this:
*
- * - error message (most hight)
+ * - error message (highest)
* - warning message
- * - info message (most low)
+ * - info message (lowest)
*
* With this priority system we can log only the message that have egual or major
* priority than log level that you has been configurate. Further you can have a
* level and verbosity mode for your specific module:
*
* \code
+ * /// Module logging level.
+ * #define <cfg_module_name>_LOG_LEVEL LOG_LVL_INFO
*
- * **
- * * 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 <cfg_module_name>_LOG_LEVEL 2
- *
- * **
- * * Set logging verbosity.
- * *
- * * If verbose is zero print short log messages.
- * *
- * #define <cfg_module_name>_LOG_VERBOSE 1
- *
+ * /// Module logging format.
+ * #define <cfg_module_name>_LOG_FORMAT LOG_FMT_VERBOSE
* \endcode
*
* - then, in the module that you use a logging macros you should define
- * a LOG_LEVEL and LOG_VERBOSE using the previous value that you have define
+ * a LOG_LEVEL and LOG_FORMAT using the previous value that you have define
* in cfg_<cfg_module_name>.h header. After this you should include the cfg/log.h
* module:
*
* \code
- *
- * // Define logging setting (for cfg/log.h module).
- * #define LOG_LEVEL <cfg_module_name>_LOG_LEVEL
- * #define LOG_VERBOSE <cfg_module_name>_LOG_VERBOSE
+ * // Define log settings for cfg/log.h.
+ * #define LOG_LEVEL <cfg_module_name>_LOG_LEVEL
+ * #define LOG_FORMAT <cfg_module_name>_LOG_FORMAT
* #include <cfg/log.h>
- *
* \endcode
*
* if you include a log.h module without define the LOG_LEVEL and LOG_VERBOSE
* otherwise the log module use a default settings.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
+ *
*/
#ifndef CFG_LOG_H
#include <cfg/debug.h>
-// Use a default setting if nobody have define a log level
+// Use a default setting if nobody defined a log level
#ifndef LOG_LEVEL
#define LOG_LEVEL LOG_LVL_ERR
#endif
-// Use a default setting if nobody have define a log verbosity
-#ifndef LOG_VERBOSITY
-#define LOG_VERBOSITY LOG_SILENT
+// Use a default setting if nobody defined a log format
+#ifndef LOG_FORMAT
+#define LOG_FORMAT LOG_FMT_TERSE
#endif
/**
-* Multi level logging system.
-*
-* You can use these macro directy or using the cfg/log.h module
-* that provide a simple interface for using the logging multilevel system.
-* The priority level is order form error messages (hight priority) to info messages
-* (low priority), so if you choose a low level log message you can see also all message
-* that have a hight priority.
-*
-* \{
-*/
-/// Logging level definition
-#define LOG_LVL_ERR 0
-#define LOG_LVL_WARN 1
-#define LOG_LVL_INFO 2
-
-/// Logging verbose mode
-#define LOG_VERBOSE 1
-#define LOG_SILENT 0
-
-
-#if LOG_VERBOSITY == LOG_VERBOSE
- #define LOG_PRINT(str_level, str,...) kprintf("%s(%s():%d): "str, str_level, __func__, __LINE__, ## __VA_ARGS__)
-
-#elif LOG_VERBOSITY == LOG_SILENT
- #define LOG_PRINT(str_level, str,...) kprintf("%s: "str, str_level, ## __VA_ARGS__)
-
-#else
- #error No log verbosity defined
-
-#endif
-
-/**
- * Log message level select.
+ * \name Logging level definition
+ *
* When you choose a log level messages you choose
* also which print function are linked.
* If you choose a low level of log you link all log function (error, warning and info),
* but if choose a hight level you link only that have the priority egual or hight.
* The priority level go from error (most hight) to info (most low) (see cfg/debug.h
* for more detail).
+ * \{
+ */
+#define LOG_LVL_NONE 0
+#define LOG_LVL_ERR 1
+#define LOG_LVL_WARN 2
+#define LOG_LVL_INFO 3
+/* \} */
+
+/**
+ * \name Logging format
*
+ * There are two logging format: terse and verbose. The latter prepends
+ * function names and line number information to each log entry.
+ * \{
*/
-#define LOG_ERR(str,...) LOG_PRINT("ERR", str, ## __VA_ARGS__)
+#define LOG_FMT_VERBOSE 1
+#define LOG_FMT_TERSE 0
+/* \} */
-#if (LOG_LEVEL == LOG_LVL_INFO)
- #define LOG_WARN(str,...) LOG_PRINT("WARN", str, ## __VA_ARGS__)
- #define LOG_INFO(str,...) LOG_PRINT("INFO", str, ## __VA_ARGS__)
+#define LOG_SILENT LOG_FMT_TERSE /* OBSOLETE */
+#define LOG_VERBOSE LOG_FMT_VERBOSE /* OBSOLETE */
-#elif (LOG_LEVEL == LOG_LVL_WARN)
- #define LOG_WARN(str,...) LOG_PRINT("WARN", str, ## __VA_ARGS__)
- #define LOG_INFO(str,...) /* Nothing */
+#if LOG_FORMAT == LOG_FMT_VERBOSE
+ #define LOG_PRINT(str_level, str,...) kprintf("%s():%d:%s: " str, str_level, __func__, __LINE__, ## __VA_ARGS__)
+#elif LOG_FORMAT == LOG_FMT_TERSE
+ #define LOG_PRINT(str_level, str,...) kprintf("%s: " str, str_level, ## __VA_ARGS__)
+#else
+ #error No LOG_FORMAT defined
+#endif
+
+#if LOG_LEVEL >= LOG_LVL_ERR
+ #define LOG_ERR(str,...) LOG_PRINT("ERR", str, ## __VA_ARGS__)
+#else
+ #define LOG_ERR(str,...) /* Nothing */
+#endif
-#else /* LOG_LEVEL == LOG_LVL_ERR */
+#if LOG_LEVEL >= LOG_LVL_WARN
+ #define LOG_WARN(str,...) LOG_PRINT("WARN", str, ## __VA_ARGS__)
+#else
#define LOG_WARN(str,...) /* Nothing */
- #define LOG_INFO(str,...) /* Nothing */
+#endif
+#if LOG_LEVEL >= LOG_LVL_INFO
+ #define LOG_INFO(str,...) LOG_PRINT("INFO", str, ## __VA_ARGS__)
+#else
+ #define LOG_INFO(str,...) /* Nothing */
#endif
#endif /* CFG_LOG_H */
-
* \brief PWM hardware-specific implementation
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
// Define logging setting (for cfg/log.h module).
#define LOG_LEVEL PWM_LOG_LEVEL
-#define LOG_VERBOSITY PWM_LOG_VERBOSITY
+#define LOG_FORMAT PWM_LOG_FORMAT
#include <cfg/log.h>
#include <cfg/macros.h>
#include <cfg/debug.h>
#include <cpu/irq.h>
- // Define logging setting (for cfg/log.h module).
-#define LOG_LEVEL CONFIG_FLASH_AVR_LOG_LEVEL
-#define LOG_VERBOSITY CONFIG_FLASH_AVR_LOG_VERBOSITY
+// Define log settings for cfg/log.h
+#define LOG_LEVEL CONFIG_FLASH_AVR_LOG_LEVEL
+#define LOG_FORMAT CONFIG_FLASH_AVR_LOG_FORMAT
#include <cfg/log.h>
#include <drv/wdt.h>
#include <string.h>
-
/**
* Definition of type for avr flash module.
*/
*
* -->
*
- * \brief Function library for dataflash AT45DB family (implementation).
+ * \brief Function library for dataflash AT45DB family (implementation).
*
*
* \version $Id: dataflash.c 21658 2008-06-05 16:42:54Z asterix $
#include <cfg/module.h>
// Define logging setting (for cfg/log.h module).
-#define LOG_LEVEL DATAFLASH_LOG_LEVEL
-#define LOG_VERBOSITY DATAFLASH_LOG_VERBOSITY
+#define LOG_LEVEL DATAFLASH_LOG_LEVEL
+#define LOG_FORMAT DATAFLASH_LOG_FORMAT
#include <cfg/log.h>
#include <drv/timer.h>
*
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
#include <cfg/module.h>
// Define logging setting (for cfg/log.h module).
-#define LOG_LEVEL DATAFLASH_LOG_LEVEL
-#define LOG_VERBOSITY DATAFLASH_LOG_VERBOSITY
+#define LOG_LEVEL DATAFLASH_LOG_LEVEL
+#define LOG_FORMAT DATAFLASH_LOG_FORMAT
#include <cfg/log.h> // for logging system
#include <drv/timer.h>
* and so the delay is do with a for cycle.
*
* \version $Id$
- *
* \author Daniele Basile <asterix@develer.com>
*/
// Define logging setting (for cfg/log.h module).
#define LOG_LEVEL PWM_LOG_LEVEL
-#define LOG_VERBOSITY PWM_LOG_VERBOSITY
+#define LOG_FORMAT PWM_LOG_FORMAT
#include <cfg/log.h> // for logging system
#include <cpu/types.h>
/**
* \file
* <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License. This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
* Copyright 2004, 2008 Develer S.r.l. (http://www.develer.com/)
- * All Rights Reserved.
* -->
*
* \brief Driver to control stepper motor
*
* \version $Id$
- *
* \author Francesco Michelini <francesco.michelini@seacfi.com>
* \author Giovanni Bajo <rasky@develer.com>
* \author Bernie Innocenti <bernie@codewiz.org>
#include <cfg/debug.h>
// Define logging setting (for cfg/log.h module).
-#define LOG_LEVEL STEPPER_LOG_LEVEL
-#define LOG_VERBOSITY STEPPER_LOG_VERBOSITY
+#define LOG_LEVEL STEPPER_LOG_LEVEL
+#define LOG_FORMAT STEPPER_LOG_FORMAT
#include <cfg/log.h>
#include <kern/proc.h>
MOD_INIT(timer);
}
+
+
+#if (ARCH & ARCH_EMUL)
+/**
+ * Stop timer (only used by emulator)
+ */
+void timer_cleanup(void)
+{
+ MOD_CLEANUP(timer);
+
+ timer_hw_cleanup();
+
+ // Hmmm... apparently, the demo app does not cleanup properly
+ //ASSERT(LIST_EMPTY(&timers_queue));
+}
+#endif /* ARCH_EMUL */