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.arm.msp432;
39
40 /*!
41 * ======== TimestampProvider ========
42 * MSP432 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 #get16} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> N </td></tr>
52 * <tr><td> {@link #get32} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> N </td></tr>
53 * <tr><td> {@link #get64} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> N </td></tr>
54 * <tr><td> {@link #getFreq} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> N </td></tr>
55 *
56 * </table>
57 * @p
58 */
59
60 @ModuleStartup
61
62 module TimestampProvider inherits ti.sysbios.interfaces.ITimestamp
63 {
64
65
66 /*! Input clock sources for dedicated Timestamp timer */
67 enum Source {
68 Source_ACLK, /*! ACLK */
69 Source_SMCLK /*! SMCLK */
70 };
71
72 /*!
73 * ======== timerId ========
74 * Id of the timer to use for creating timestamps
75 *
76 * A value of {@link Timer#ANY Timer.ANY} (-1) indicates any timer
77 * supported by {@link Timer} is ok.
78 */
79 config UInt timerId = Timer.ANY;
80
81 /*!
82 *
83 * ======== useClockTimer ========
84 * Use the same timer as Clock
85 *
86 * Set this parameter when you want TimestampProvider to use the same
87 * timer as the BIOS {@link ti.sysbios.knl.Clock Clock} module.
88 *
89 * This parameter overrides the {@link #timerId timeId} setting.
90 */
91 config Bool useClockTimer;
92
93 /*!
94 *
95 * ======== clockSource ========
96 * Input clock source for dedicated timer
97 *
98 * If the TimestampProvider is to use a different timer than the one
99 * used by the {@link ti.sysbios.knl.Clock Clock} module, this
100 * parameter specifies the input clock source for that dedicated timer.
101 *
102 * For example, to use a dedicated timer for Timestamps, and to have it
103 * run off of ACLK, add the following to the application config script:
104 *
105 * @p(code)
106 * var Timestamp = xdc.useModule('ti.sysbios.family.arm.msp432.TimestampProvider');
107 * Timestamp.useClockTimer = false;
108 * Timestamp.clockSource = Timestamp.Source_ACLK;
109 * @p
110 */
111 config Source clockSource = Source_SMCLK;
112
113 /*!
114 *
115 * ======== synchronous ========
116 * Selected clock source is synchronous to CPU clock
117 *
118 * If the TimestampProvider is to use a different timer than the one
119 * used by the {@link ti.sysbios.knl.Clock Clock} module, this
120 * parameter specifies if the clock source is synchronous to CPU clock.
121 */
122 config Bool synchronous = false;
123
124 /*!
125 * ======== get16 ========
126 * Return a 16-bit timestamp
127 *
128 * @a(returns)
129 * Returns a 16-bit timestamp value.
130 * Use `{@link #getFreq}` to convert this value into units of real time.
131 */
132 Bits16 get16();
133
134 /*!
135 * ======== startTimer ========
136 * Function that starts timer before main
137 *
138 * @_nodoc Internal use.
139 */
140 Void startTimer();
141
142 /*!
143 * ======== rolloverFunc ========
144 * Timer rollover interrupt handler
145 *
146 * @_nodoc Internal use.
147 */
148 Void rolloverFunc(UArg unused);
149
150 internal:
151
152 153 154
155 struct Module_State {
156 Timer.Handle timer;
157 volatile UInt32 rollovers;
158 }
159 }