aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-07-10 20:08:46 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2012-07-10 20:08:46 +0000
commitdbfb5a1f70e69a3f412f2a69f528bf398633c10f (patch)
tree9df9a4e2de93b28fbc22956e6c902cd079cb1f47 /tools
parentf9f6c4db2df5174acdbd79959ff6ea3e07fd0de6 (diff)
downloadChibiOS-dbfb5a1f70e69a3f412f2a69f528bf398633c10f.tar.gz
ChibiOS-dbfb5a1f70e69a3f412f2a69f528bf398633c10f.tar.bz2
ChibiOS-dbfb5a1f70e69a3f412f2a69f528bf398633c10f.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4457 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'tools')
-rw-r--r--tools/gencfg/lib/libstm32f4xx.ftl55
-rw-r--r--tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl2
-rw-r--r--tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl9
3 files changed, 61 insertions, 5 deletions
diff --git a/tools/gencfg/lib/libstm32f4xx.ftl b/tools/gencfg/lib/libstm32f4xx.ftl
index 47b0659e3..9ede34c2c 100644
--- a/tools/gencfg/lib/libstm32f4xx.ftl
+++ b/tools/gencfg/lib/libstm32f4xx.ftl
@@ -20,14 +20,61 @@
--]
[#--
- -- Emits the ChibiOS/RT standard license exception text.
- -- The license exception text is indented by 4 spaces.
+ -- Emits the STM32F4xx ADC driver constant configuration structures.
--]
[#macro EmitADCConfig config]
[#local cfg_name = config.@name[0]?string /]
/**
-[@code.EmitDoxygenBrief config.@brief /]
-[@code.EmitDoxygenDetails config.details /]
+ [@code.EmitDoxygenBrief config.@brief /]
+ [@code.EmitDoxygenDetails config.details /]
*/
const ADCConfig ${cfg_name} = {0};
+
+ [#list config.groups.group as group]
+ [#local grpcfg_name = group.@name[0]?string /]
+/**
+ [@code.EmitDoxygenBrief group.@brief /]
+ [@code.EmitDoxygenDetails group.details /]
+ */
+const ADCGroupConfig ${grpcfg_name} = {
+ /* Circular conversion flag.*/
+ ${group.@circular[0]?string?upper_case},
+ /* Number of channels sampled in the conversion group.*/
+ ${group.channels_sequence.channel?size},
+ /* End of conversion callback or NULL.*/
+ [#if group.@conversion_callback[0]?string?trim == ""]
+ NULL,
+ [#else]
+ ${group.@conversion_callback[0]?string?trim},
+ [/#if]
+ /* Error callback or NULL.*/
+ [#if group.@error_callback[0]?string?trim == ""]
+ NULL,
+ [#else]
+ ${group.@error_callback[0]?string?trim},
+ [/#if]
+};
+ [/#list]
+[/#macro]
+
+[#--
+ -- Emits the STM32F4xx ADC driver configuration external declarations.
+ --]
+[#macro EmitADCConfigExtern config]
+ [#local cfg_name = config.@name[0]?string /]
+ [#list config.groups.group as group]
+ [#local grpcfg_name = group.@name[0]?string /]
+ [#-- Only emits the comment if there is at least a callback defined.--]
+ /* ADC configuration "${cfg_name}".*/
+ extern const ADCConfig ${cfg_name};
+ /* ADC conversion group "${grpcfg_name}".*/
+ extern const ADCGroupConfig ${grpcfg_name};
+ [#if group.@conversion_callback[0]?string?trim != ""]
+ void ${group.@conversion_callback[0]?string?trim}(ADCDriver *, adcsample_t *, size_t);
+ [/#if]
+ [#if group.@error_callback[0]?string?trim != ""]
+ void ${group.@error_callback[0]?string?trim}(ADCDriver *, adcerror_t);
+ [/#if]
+
+ [/#list]
[/#macro]
diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl
index e97f20c82..cd8b17a01 100644
--- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl
+++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.c.ftl
@@ -32,6 +32,8 @@
#include "ch.h"
#include "hal.h"
+#include "${fname + ".h"}"
+
/*===========================================================================*/
/* Module local definitions. */
/*===========================================================================*/
diff --git a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl
index b8f350ff9..050b2f84d 100644
--- a/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl
+++ b/tools/gencfg/processors/hal/stm32f4xx/templates/hal_cfg.h.ftl
@@ -21,6 +21,8 @@
[@pp.dropOutputFile /]
[#import "/@lib/libutils.ftl" as utils /]
[#import "/@lib/liblicense.ftl" as license /]
+[#import "/@lib/libcode.ftl" as code /]
+[#import "/@lib/libstm32f4xx.ftl" as stm32f4xx /]
[#assign fname = doc1.configuration.@name[0] /]
[@pp.changeOutputFile name = fname + ".h" /]
/*
@@ -57,7 +59,12 @@
#ifdef __cplusplus
extern "C" {
#endif
-
+[#list doc1.configuration.configs.* as config]
+ [#assign config_type = config?node_name /]
+ [#if config_type == "adc_config"]
+ [@stm32f4xx.EmitADCConfigExtern config /]
+ [/#if]
+[/#list]
#ifdef __cplusplus
}
#endif