* \version $Id$
* \author Bernie Innocenti <bernie@codewiz.org>
*
- * $WIZARD_MODULE = {
- * "name" : "crc16",
- * "depends" : [],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "crc16"
*/
#ifndef ALGO_CRC_H
* \version $Id$
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "md2",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_md2.h"
- * }
+ * $WIZ$ module_name = "md2"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_md2.h"
*/
#ifndef ALGO_MD2_H
*
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "pid_control",
- * "depends" : ["timer"],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "pid_control"
+ * $WIZ$ module_depends = "timer"
*/
#ifndef ALGO_PID_CONTROL_H
* \author Giovanni Bajo <rasky@develer.com>
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "ramp",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_ramp.h"
- * }
+ * $WIZ$ module_name = "ramp"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_ramp.h"
*/
#ifndef ALGO_RAMP_H
* \version $Id$
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "randpool",
- * "depends" : ["timer"],
- * "configuration" : "bertos/cfg/cfg_randpool.h"
- * }
+ * $WIZ$ module_name = "randpool"
+ * $WIZ$ module_depends = "timer"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_randpool.h"
*/
#ifndef ALGO_RANDPOOL_H
* \version $Id$
* \author Bernie Innocenti <bernie@codewiz.org>
*
- * $WIZARD_MODULE = {
- * "name" : "rle",
- * "depends" : [],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "rle"
*/
#ifndef RLE_H
#define RLE_H
*
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "rotating_hash",
- * "depends" : [],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "rotating_hash"
*/
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "tea",
- * "depends" : [],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "tea"
*/
#ifndef ALGO_TEA_H
* \version $Id$
*
* \author Daniele Basile <asterix@develer.com>
+ * $WIZ$
*/
#ifndef CFG_TIMER_H
/**
*
- * $WIZARD_LIST = { "timer_select" : ["TIMER_DEFAULT"] }
+ * $WIZ$ timer_select = "TIMER_DEFAULT"
*/
/// Hardware timer selection for drv/timer.c. $WIZARD = { "type" : "enum", "value_list" : "timer_select" }
*
* \version $Id$
* \author Daniele Basile <asterix@develer.com>
- *
+ *
+ * $WIZ$
*/
#ifndef CFG_LOG_H
* The priority level go from error (highest) to info (lowest) (see cfg/debug.h
* for more detail).
*
- * $WIZARD_LIST = {
- * "log_level" : ["LOG_LVL_NONE", "LOG_LVL_ERR", "LOG_LVL_WARN", "LOG_LVL_INFO"]
+ * $WIZ$ log_level = "LOG_LVL_NONE", "LOG_LVL_ERR", "LOG_LVL_WARN", "LOG_LVL_INFO"
* }
*/
#define LOG_LVL_NONE 0
* There are two logging format: terse and verbose. The latter prepends
* function names and line number information to each log entry.
*
- * $WIZARD_LIST = {
- * "log_format" : ["LOG_FMT_VERBOSE", "LOG_FMT_TERSE"]
- * }
+ * $WIZ$ log_format = "LOG_FMT_VERBOSE", "LOG_FMT_TERSE"
*/
#define LOG_FMT_VERBOSE 1
#define LOG_FMT_TERSE 0
* \author Daniele Basile <asterix@develer.com>
*
* \brief Low-level serial module for AVR (interface).
+ *
*/
#ifndef DRV_SER_AVR_H
/**
* SPI clock polarity.
*
- * $WIZARD_LIST = {
- * "ser_spi_pol" : ["SPI_NORMAL_LOW", "SPI_NORMAL_HIGH"]
+ * $WIZ$ ser_spi_pol = "SPI_NORMAL_LOW", "SPI_NORMAL_HIGH"
* }
*/
#define SPI_NORMAL_LOW 0
/**
* SPI clock phase.
*
- * $WIZARD_LIST = {
- * "ser_spi_phase": ["SPI_SAMPLE_ON_FIRST_EDGE", "SPI_SAMPLE_ON_SECOND_EDGE"]
+ * $WIZ$ ser_spi_phase = "SPI_SAMPLE_ON_FIRST_EDGE", "SPI_SAMPLE_ON_SECOND_EDGE"
* }
*/
#define SPI_SAMPLE_ON_FIRST_EDGE 0
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "adc",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_adc.h"
- * }
+ * $WIZ$ module_name = "adc"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_adc.h"
*/
*
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "dataflash",
- * "depends" : ["kfile"],
- * "configuration" : "bertos/cfg/cfg_dataflash.h"
+ * $WIZ$ module_name = "dataflash"
+ * $WIZ$ module_depends = "kfile"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_dataflash.h"
* }
*/
*
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "dc_motor",
- * "depends" : ["pwm", "pid_control", "adc", "timer"],
- * "configuration" : "bertos/cfg/cfg_dc_motor.h"
- * }
+ * $WIZ$ module_name = "dc_motor"
+ * $WIZ$ module_depends = "pwm", "pid_control", "adc", "timer"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_dc_motor.h"
*/
#ifndef DRV_DC_MOTOR_H
* \author Stefano Fedrigo <aleph@develer.com>
* \author Bernie Innocenti <bernie@codewiz.org>
*
- * $WIZARD_MODULE = {
- * "name" : "eeprom",
- * "depends" : ["kfile"],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "eeprom"
+ * $WIZ$ module_depends = "kfile"
*/
#ifndef DRV_EEPROM_H
* \version $Id$
* \author Daniele Basile <asterix@develer.com>
*
- * $wizard_module = {
- * "name" : "flash25",
- * "depends" : ["kfile"],
- * "configuration" : "bertos/cfg/cfg_flash25.h"
- * }
+ * $WIZ$ module_name = "flash25"
+ * $WIZ$ module_depends = "kfile"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_flash25.h"
*/
* this drive. Every time we call flash25_init() function we check
* if memory defined are right (see flash25.c form more detail).
*
- * $WIZARD_LIST = {
- * "flash25_list" : ["FLASH25_AT25F2048"]
- * }
+ * $WIZ$ flash25_list = "FLASH25_AT25F2048"
*/
#define FLASH25_AT25F2048 1
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "ft245rl",
- * "depends" : ["kfile", "timer"],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "ft245rl"
+ * $WIZ$ module_depends = "kfile", "timer"
*/
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "i2c",
- * "depends" : [],
+ * $WIZ$ module_name = "i2c"
* "configuration" : "bertos/cfg/cfg_i2c.h"
- * }
*/
+
#ifndef DRV_I2C_H
#define DRV_I2C_H
* use that.
* With this you can choose, at compile time, which backend to use.
*
- * $WIZARD_LIST = {
- * "i2c_backend" : ["I2C_BACKEND_BUILTIN", "I2C_BACKEND_BITBANG"]
- * }
+ * $WIZ$ i2c_backend = "I2C_BACKEND_BUILTIN", "I2C_BACKEND_BITBANG"
*/
#define I2C_BACKEND_BUILTIN 0 ///< Uses cpu builtin i2c driver
#define I2C_BACKEND_BITBANG 1 ///< Uses emulated bitbang driver
* \author Giovanni Bajo <rasky@develer.com>
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "ntc",
- * "depends" : ["adc"],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "ntc"
+ * $WIZ$ module_depends = "adc"
*/
#ifndef DRV_NTC_H
* \version $Id: ft245rl.c 22301 2008-09-09 16:53:17Z batt $
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "pcf8574",
- * "depends" : ["i2c"],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "pcf8574"
+ * $WIZ$ module_depends = "i2c"
*/
#ifndef DRV_PCF8574_H
* \version $Id$
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "phase",
- * "depends" : ["timer"],
- * "configuration" : "bertos/cfg/cfg_phase.h"
+ * $WIZ$ module_name = "phase"
+ * $WIZ$ module_depends = "timer"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_phase.h"
* }
*/
* \author Francesco Sacchi <batt@develer.com>
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "pwm",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_pwm.h"
- * }
+ * $WIZ$ module_name = "pwm"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_pwm.h"
*/
#ifndef DRV_PWM_H
* \version $Id$
* \author Bernie Innocenti <bernie@codewiz.org>
*
- * $WIZARD_MODULE = {
- * "name" : "ser",
- * "depends" : ["kfile", "timer"],
- * "configuration" : "bertos/cfg/cfg_ser.h"
- * }
+ * $WIZ$ module_name = "ser"
+ * $WIZ$ module_depends = "kfile", "timer"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_ser.h"
*/
#ifndef DRV_SER_H
/**
* \name LSB or MSB first data order for SPI driver.
*
- * $WIZARD_LIST = {
- * "ser_order_bit" : ["SER_MSB_FIRST", "SER_LSB_FIRST"]
- * }
+ * $WIZ$ ser_order_bit = "SER_MSB_FIRST", "SER_LSB_FIRST"
*/
#define SER_MSB_FIRST 0
#define SER_LSB_FIRST 1
* \author Francesco Sacchi <batt@develer.com>
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "spi_bitbang",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_spi_bitbang.h"
- * }
+ * $WIZ$ module_name = "spi_bitbang"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_spi_bitbang.h"
*/
/**
* Define send and receive order bit.
*
- * $WIZARD_LIST = {
- * "ordet_bit_list" : ["SPI_LSB_FIRST", "SPI_MSB_FIRST"]
- * }
+ * $WIZ$ ordet_bit_list = "SPI_LSB_FIRST", "SPI_MSB_FIRST"
*/
#define SPI_LSB_FIRST 1
#define SPI_MSB_FIRST 2
* \author Simone Zinanni <s.zinanni@develer.com>
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "stepper",
- * "depends" : ["timer", "ramp"],
- * "configuration" : "bertos/cfg/cfg_stepper.h"
+ * $WIZ$ module_name = "stepper"
+ * $WIZ$ module_depends = "timer", "ramp"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_stepper.h"
* }
*/
* \author Giovanni Bajo <rasky@develer.com>
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "thermo",
- * "depends" : ["timer", "ntc"],
- * "configuration" : "bertos/cfg/cfg_thermo.h"
+ * $WIZ$ module_name = "thermo"
+ * $WIZ$ module_depends = "timer", "ntc"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_thermo.h"
* }
*/
* \version $Id$
* \author Bernie Innocenti <bernie@codewiz.org>
*
- * $WIZARD_MODULE = {
- * "name" : "timer",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_timer.h"
- * }
+ * $WIZ$ module_name = "timer"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_timer.h"
*/
#ifndef DRV_TIMER_H
*
* \brief Watchdog module, supplies a simple API to manage wdt on supported target.
*
- * $WIZARD_MODULE = {
- * "name" : "wdt",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_wdt.h"
- * }
+ * $WIZ$ module_name = "wdt"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_wdt.h"
*/
#ifndef DRV_WDT_H
* \author Francesco Sacchi <batt@develer.com>
* \author Daniele Basile <asterix@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "kfile",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_kfile.h"
- * }
+ * $WIZ$ module_name = "kfile"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_kfile.h"
*/
#ifndef KERN_KFILE_H
* \version $Id$
* \author Bernie Innocenti <bernie@codewiz.org>
*
- * $WIZARD_MODULE = {
- * "name" : "kernel",
- * "depends" : [],
- * "configuration" : "bertos/cfg/cfg_kern.h"
- * }
+ * $WIZ$ module_name = "kernel"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_kern.h"
*/
#ifndef KERN_PROC_H
*
* \brief Basical functions to use pocketBus protocol.
*
- * $WIZARD_MODULE = {
- * "name" : "pocketbus",
- * "depends" : ["rotating_hash", "kfile"],
- * "configuration" : "bertos/cfg/cfg_pocketbus.h"
- * }
+ * $WIZ$ module_name = "pocketbus"
+ * $WIZ$ module_depends = "rotating_hash", "kfile"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_pocketbus.h"
*/
#ifndef NET_POCKETBUS_H
*
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "pocketcmd",
- * "depends" : ["timer", "pocketbus"],
- * "configuration" : ""
- * }
+ * $WIZ$ module_name = "pocketcmd"
+ * $WIZ$ module_depends = "timer", "pocketbus"
*/
#ifndef NET_POCKETCMD_H
* \author Bernie Innocenti <bernie@codewiz.org>
* \author Francesco Sacchi <batt@develer.com>
*
- * $WIZARD_MODULE = {
- * "name" : "xmodem",
- * "depends" : ["kfile"],
- * "configuration" : "bertos/cfg/cfg_xmodem.h"
- * }
+ * $WIZ$ module_name = "xmodem"
+ * $WIZ$ module_depends = "kfile"
+ * $WIZ$ module_configuration = "bertos/cfg/cfg_xmodem.h"
*/
import const
import DefineException
+# Try to use the new parsing module for the module information and the define lists
+import newParser
+
def isBertosDir(directory):
return os.path.exists(directory + "/VERSION")
return D
def loadModuleData(project):
+ moduleInfoDict = {}
+ listInfoDict = {}
+ configurationInfoDict = {}
+ for filename, path in findDefinitions("*.h", project):
+ commentList = newParser.getCommentList(open(path + "/" + filename, "r").read())
+ if len(commentList) > 0:
+ moduleInfo = {}
+ configurationInfo = {}
+ try:
+ toBeParsed, moduleDict = newParser.loadModuleDefinition(commentList[0])
+ except newParser.ParseError, err:
+ print "error in file %s. line: %d - statement %s" % (path + "/" + filename, err.line_number, err.line)
+ print err.args
+ print err.message
+ raise Exception
+ for module, information in moduleDict.items():
+ if "configuration" in information.keys() and len(information["configuration"]):
+ configuration = moduleDict[module]["configuration"]
+ configurationInfo[configuration] = loadConfigurationInfos(project.info("SOURCES_PATH") + "/" + configuration)
+ moduleInfoDict.update(moduleDict)
+ configurationInfoDict.update(configurationInfo)
+ if toBeParsed:
+ try:
+ listDict = newParser.loadDefineLists(commentList[1:])
+ listInfoDict.update(listDict)
+ except newParser.ParseError, err:
+ print "error in file %s. line: %d - statement %s" % (path + "/" + filename, err.line_number, err.line)
+ print err.args
+ print err.message
+ raise Exception
+ for filename, path in findDefinitions("*_" + project.info("CPU_INFOS")["TOOLCHAIN"] + ".h", project):
+ commentList = newParser.getCommentList(open(path + "/" + filename, "r").read())
+ listInfoDict.update(newParser.loadDefineLists(commentList))
+ project.setInfo("MODULES", moduleInfoDict)
+ project.setInfo("LISTS", listInfoDict)
+ project.setInfo("CONFIGURATIONS", configurationInfoDict)
+
+
+def loadModuleData_old(project):
"""
Loads all the module data, like module definition, list definition, and module configurations
int the given BProject, using the SOURCES_PATH information from this as the base for find the
moduleDict[moduleDefinition["module_name"]]["configuration"] = ""
if "module_description" in moduleDefinition.keys():
moduleDict[moduleDefinition["module_name"]]["description"] = moduleDefinition["module_description"]
+ moduleDict[moduleDefinition["module_name"]]["enabled"] = False
return toBeParsed, moduleDict
-def loadDefineList(commentList):
+def loadDefineLists(commentList):
defineList = {}
for comment in commentList:
for num, line in enumerate(comment):
def main():
try:
+ defineLists = {}
+ modules = {}
commentList = getCommentList(open("test/to_parse.h", "r").read())
- print loadModuleDefinition(commentList[0])
- print loadDefineList(commentList[1:])
+ toBeParsedm, moduleInfo = loadModuleDefinition(commentList[0])
+ modules.update(moduleInfo)
+ if toBeParsed:
+ defineLists.update(loadDefineList(commentList[1:]))
+ print modules
+ print defineLists
except ParseError, err:
print "Error: line %d - %s" % (err.line_number, err.line)