1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32 33 34 35 36
37
38 package ti.sysbios.family.msp430;
39
40 /*!
41 * ======== ClockFreqs ========
42 * ClockFreqs Module.
43 *
44 * This module is used to define the ACLK and SMCLK frequencies in effect when
45 * BIOS_start() is called at the end of main(). It also provides a function
46 * that can be called by the application at runtime to query individual
47 * clock frequencies.
48 *
49 * If the application configuration defines values for these two clocks, it
50 * (the application) is responsible for setting up the clocks to the
51 * corresponding frequencies. This module will simply hold the values
52 * specified, for reference by other SYS/BIOS modules, or for query by the
53 * application.
54 *
55 * If the application configuration specifies a value for one of these
56 * two clock frequencies, it must specify values for both clock frequencies;
57 * if it does not, a build error will be thrown.
58 *
59 * If the application does not define values for one of these clocks, the
60 * values will default either to the device reset values, or the boost values
61 * setup by the Boot module (ti.catalog.msp430.init.Boot). For example, if
62 * the application does not configure values for ClockFreq, and does not turn
63 * off the Boot module's default frequency boost, then the Boot module boost
64 * frequencies are used.
65 *
66 * If the application does not configure values for ClockFreq, and *does* turn
67 * off the Boot module's frequency boost (see snippet below), then the default
68 * reset frequency values will be used.
69 *
70 * @p(code)
71 * var Boot = xdc.module('ti.catalog.msp430.init.Boot');
72 * Boot.configureDCO = false;
73 * @p
74 *
75 * Currently the reset and Boot module boost values are fixed, as shown below.
76 * In future releases these values may made changeable.
77 *
78 * The default reset values are:
79 *
80 * @p(code)
81 * ACLK = 32768 Hz
82 * SMCLK = 1000000 Hz
83 * @p
84 *
85 * The default Boot module boost values are:
86 *
87 * @p(code)
88 * ACLK = 32768 Hz
89 * SMCLK = 8192000 Hz
90 * @p
91 *
92 * Note: This module allows query of the CPU clock (MCLK) frequency via the
93 * ClockFreqs_getFrequency() API. But MCLK cannot be configured with this
94 * module. Since MCLK is the CPU frequency, it is configured in the BIOS
95 * module. For example:
96 *
97 * @p(code)
98 * var BIOS = xdc.useModule('ti.sysbios.BIOS');
99 * BIOS.cpuFreq.lo = 25000000;
100 * BIOS.cpuFreq.hi = 0;
101 * @p
102 *
103 * @p(html)
104 * <h3> Calling Context </h3>
105 * <table border="1" cellpadding="3">
106 * <colgroup span="1"></colgroup> <colgroup span="5" align="center"></colgroup>
107 *
108 * <tr><th> Function </th><th> Hwi </th><th> Swi </th><th> Task </th><th> Main </th><th> Startup </th></tr>
109 * <!-- -->
110 * <tr><td> {@link #getFrequency} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td></tr>
111 * <tr><td colspan="6"> Definitions: <br />
112 * <ul>
113 * <li> <b>Hwi</b>: API is callable from a Hwi thread. </li>
114 * <li> <b>Swi</b>: API is callable from a Swi thread. </li>
115 * <li> <b>Task</b>: API is callable from a Task thread. </li>
116 * <li> <b>Main</b>: API is callable from main(). </li>
117 * <li> <b>Startup</b>: API is callable during any module startup. </li>
118 * </ul>
119 * </td></tr>
120 *
121 * </table>
122 * @p
123 */
124
125 module ClockFreqs
126 {
127 /*! Clocks */
128 enum Clock {
129 Clock_ACLK,
130 Clock_SMCLK,
131 Clock_MCLK
132 };
133
134 /*! ACLK frequency (Hz) */
135 config UInt32 ACLK;
136
137 /*! SMCLK frequency (Hz) */
138 config UInt32 SMCLK;
139
140 /*!
141 * ======== getFrequency ========
142 * Get the frequency for a clock.
143 *
144 */
145 @DirectCall
146 UInt32 getFrequency(Clock clock);
147
148 }
149 150 151 152
153