8920d146ecfb39a8f37afa02994b9bd5cceba894
[bertos.git] / bertos / cfg / cfg_ramp.h
1  /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
30  *
31  * -->
32  *
33  * \brief Configuration file Ramp algorithm module.
34  *
35  * \version $Id$
36  * \author Daniele Basile <asterix@develer.com>
37  */
38
39 #ifndef CFG_RAMP_H
40 #define CFG_RAMP_H
41
42 /**
43  * Define whether the ramp will use floating point calculation within ramp_evaluate().
44  * Otherwise, a less precise fixed point version will be used, which is faster on
45  * platforms which do no support floating point operations.
46  *
47  * \note Floating point operations will be always done within ramp_compute() to
48  * precalculate values, so there has to be at least a floating point emulation support.
49  *
50  * $WIZ$ type = "boolean"
51  */
52 #define RAMP_USE_FLOATING_POINT   0
53
54
55 #if !RAMP_USE_FLOATING_POINT
56
57         /**
58          * Number of least-significant bits which are stripped away during ramp evaluation.
59          * This setting allows to specify larger ramps at the price of less precision.
60          *
61          * The maximum ramp size allowed is 2^(24 + RAMP_CLOCK_SHIFT_PRECISION), in clocks.
62          * For instance, using RAMP_CLOCK_SHIFT_PRECISION 1, and a 8x prescaler, the maximum
63          * length of a ramp is about 6.7 secs. Raising RAMP_CLOCK_SHIFT_PRECISION to 2
64          * brings the maximum length to 13.4 secs, at the price of less precision.
65          *
66          * ramp_compute() will check that the length is below the maximum allowed through
67          * a runtime assertion.
68          *
69          * \note This macro is used only for the fixed-point version of the ramp.
70          * $WIZ$ type = "int"
71          * $WIZ$ min = "0"
72          * $WIZ$ max = "32"
73          */
74         #define RAMP_CLOCK_SHIFT_PRECISION 2
75 #endif
76
77
78 /**
79 * Negative pulse width for ramp.
80 * $WIZ$ type = "int"
81 * $WIZ$ min = "0"
82 */
83 #define RAMP_PULSE_WIDTH    50
84
85 /**
86  * Default ramp time (microsecs).
87  * $WIZ$ type = "int"
88  */
89 #define RAMP_DEF_TIME     6000000UL
90 /**
91  * Default ramp maxfreq (Hz).
92  * $WIZ$ type = "int"
93  * $WIZ$ min = "0"
94  */
95 #define RAMP_DEF_MAXFREQ       5000
96 /**
97  * Default ramp minfreq (Hz).
98  * $WIZ$ type = "int"
99  * $WIZ$ min = "0"
100  */
101 #define RAMP_DEF_MINFREQ        200
102 /**
103  * Default ramp powerrun (deciampere).
104  * $WIZ$ type = "int"
105  * $WIZ$ min = "0"
106  */
107 #define RAMP_DEF_POWERRUN        10
108 /**
109  * Default ramp poweridle (Hz).
110  * $WIZ$ type = "int"
111  * $WIZ$ min = "0"
112  */
113 #define RAMP_DEF_POWERIDLE        1
114
115 #endif /* CFG_RAMP_H */