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 * ======== TimestampProvider ========
42 * MSP430 Timestamp Provider
43 *
44 * @p(html)
45 * <h3> Calling Context </h3>
46 * <table border="1" cellpadding="3">
47 * <colgroup span="1"></colgroup> <colgroup span="5" align="center"></colgroup>
48 *
49 * <tr><th> Function </th><th> Hwi </th><th> Swi </th><th> Task </th><th> Main** </th><th> Startup*** </th></tr>
50 * <!-- -->
51 * <tr><td> {@link #get32} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> N </td></tr>
52 * <tr><td> {@link #get64} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> N </td></tr>
53 * <tr><td> {@link #getFreq} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> N </td></tr>
54 *
55 * </table>
56 * @p
57 */
58
59 @ModuleStartup
60
61 module TimestampProvider inherits ti.sysbios.interfaces.ITimestamp
62 {
63
64
65 /*! Input clock sources for dedicated Timestamp timer */
66 enum Source {
67 Source_ACLK, /*! ACLK */
68 Source_SMCLK /*! SMCLK */
69 };
70
71 /*!
72 * ======== timerId ========
73 * Id of the timer to use for creating timestamps
74 *
75 * A value of {@link Timer#ANY Timer.ANY} (-1) indicates any timer
76 * supported by {@link Timer} is ok.
77 */
78 config UInt timerId = Timer.ANY;
79
80 /*!
81 *
82 * ======== useClockTimer ========
83 * Use the same timer as Clock
84 *
85 * Set this parameter when you want TimestampProvider to use the same
86 * timer as the BIOS {@link ti.sysbios.knl.Clock Clock} module.
87 *
88 * This parameter overrides the {@link #timerId timeId} setting.
89 */
90 config Bool useClockTimer;
91
92 /*!
93 *
94 * ======== clockSource ========
95 * Input clock source for dedicated timer
96 *
97 * If the TimestampProvider is to use a different timer than the one
98 * used by the {@link ti.sysbios.knl.Clock Clock} module, this
99 * parameter specifies the input clock source for that dedicated timer.
100 *
101 * For example, to use a dedicated timer for Timestamps, and to have it
102 * run off of SMCLK, add the following to the application config script:
103 *
104 * @p(code)
105 * var Timestamp = xdc.useModule('ti.sysbios.family.msp430.TimestampProvider');
106 * Timestamp.useClockTimer = false;
107 * Timestamp.clockSource = Timestamp.Source_SMCLK;
108 * @p
109 */
110 config Source clockSource = Source_ACLK;
111
112 /*!
113 * ======== startTimer ========
114 * Function that starts timer before main
115 *
116 * @_nodoc Internal use.
117 */
118 Void startTimer();
119
120 /*!
121 * ======== rolloverFunc ========
122 * Timer rollover interrupt handler
123 *
124 * @_nodoc Internal use.
125 */
126 Void rolloverFunc(UArg unused);
127
128 internal:
129
130 131 132
133 struct Module_State {
134 Timer.Handle timer;
135 volatile UInt32 rollovers;
136 }
137 }