1 /******************************************************************************
2 *  Filename:       aon_event.h
3 *  Revised:        2020-02-14 11:30:20 +0100 (Fri, 14 Feb 2020)
4 *  Revision:       56760
5 *
6 *  Description:    Defines and prototypes for the AON Event fabric.
7 *
8 *  Copyright (c) 2015 - 2017, Texas Instruments Incorporated
9 *  All rights reserved.
10 *
11 *  Redistribution and use in source and binary forms, with or without
12 *  modification, are permitted provided that the following conditions are met:
13 *
14 *  1) Redistributions of source code must retain the above copyright notice,
15 *     this list of conditions and the following disclaimer.
16 *
17 *  2) Redistributions in binary form must reproduce the above copyright notice,
18 *     this list of conditions and the following disclaimer in the documentation
19 *     and/or other materials provided with the distribution.
20 *
21 *  3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 *     be used to endorse or promote products derived from this software without
23 *     specific prior written permission.
24 *
25 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 *  POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 //*****************************************************************************
40 //
41 //! \addtogroup aon_group
42 //! @{
43 //! \addtogroup aonevent_api
44 //! @{
45 //
46 //*****************************************************************************
47 
48 #ifndef __AON_EVENT_H__
49 #define __AON_EVENT_H__
50 
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include "../inc/hw_types.h"
65 #include "../inc/hw_memmap.h"
66 #include "../inc/hw_aon_event.h"
67 #include "debug.h"
68 
69 //*****************************************************************************
70 //
71 // Support for DriverLib in ROM:
72 // This section renames all functions that are not "static inline", so that
73 // calling these functions will default to implementation in flash. At the end
74 // of this file a second renaming will change the defaults to implementation in
75 // ROM for available functions.
76 //
77 // To force use of the implementation in flash, e.g. for debugging:
78 // - Globally: Define DRIVERLIB_NOROM at project level
79 // - Per function: Use prefix "NOROM_" when calling the function
80 //
81 //*****************************************************************************
82 #if !defined(DOXYGEN)
83     #define AONEventMcuWakeUpSet            NOROM_AONEventMcuWakeUpSet
84     #define AONEventMcuWakeUpGet            NOROM_AONEventMcuWakeUpGet
85     #define AONEventMcuSet                  NOROM_AONEventMcuSet
86     #define AONEventMcuGet                  NOROM_AONEventMcuGet
87 #endif
88 
89 //*****************************************************************************
90 //
91 // Event sources for the event AON fabric.
92 // Note: Events are level-triggered active high
93 //
94 //*****************************************************************************
95 #define AON_EVENT_IOEV_MCU_WU        0 // Edge detect event from DIOs which have enabled contribution to IOEV_MCU_WU
96 #define AON_EVENT_AUX_TIMER2_EV0     1 // Event 0 from AUX Timer2
97 #define AON_EVENT_AUX_TIMER2_EV1     2 // Event 1 from AUX Timer2
98 #define AON_EVENT_AUX_TIMER2_EV2     3 // Event 2 from AUX Timer2
99 #define AON_EVENT_AUX_TIMER2_EV3     4 // Event 3 from AUX Timer2
100 #define AON_EVENT_BATMON_BATT_UL     5 // BATMON event: Battery level above upper limit
101 #define AON_EVENT_BATMON_BATT_LL     6 // BATMON event: Battery level below lower limit
102 #define AON_EVENT_BATMON_TEMP_UL     7 // BATMON event: Temperature level above upper limit
103 #define AON_EVENT_BATMON_TEMP_LL     8 // BATMON event: Temperature level below lower limit
104 #define AON_EVENT_BATMON_COMBINED    9 // Combined event from BATMON
105 #define AON_EVENT_IO                32 // Edge detect on any DIO. Edge detect is enabled and configured in IOC.
106                                        // Event ID 33 is reserved for future use
107                                        // Event ID 34 is reserved for future use
108 #define AON_EVENT_RTC_CH0           35 // RTC channel 0
109 #define AON_EVENT_RTC_CH1           36 // RTC channel 1
110 #define AON_EVENT_RTC_CH2           37 // RTC channel 2
111 #define AON_EVENT_RTC_CH0_DLY       38 // RTC channel 0 - delayed event
112 #define AON_EVENT_RTC_CH1_DLY       39 // RTC channel 1 - delayed event
113 #define AON_EVENT_RTC_CH2_DLY       40 // RTC channel 2 - delayed event
114 #define AON_EVENT_RTC_COMB_DLY      41 // RTC combined delayed event
115 #define AON_EVENT_RTC_UPD           42 // RTC Update Tick (16 kHz signal, i.e. event line toggles value every 32 kHz clock period)
116 #define AON_EVENT_JTAG              43 // JTAG generated event
117 #define AON_EVENT_AUX_SWEV0         44 // AUX Software triggered event #0
118 #define AON_EVENT_AUX_SWEV1         45 // AUX Software triggered event #1
119 #define AON_EVENT_AUX_SWEV2         46 // AUX Software triggered event #2
120 #define AON_EVENT_AUX_COMPA         47 // Comparator A triggered (synchronized in AUX)
121 #define AON_EVENT_AUX_COMPB         48 // Comparator B triggered (synchronized in AUX)
122 #define AON_EVENT_AUX_ADC_DONE      49 // ADC conversion completed
123 #define AON_EVENT_AUX_TDC_DONE      50 // TDC completed or timed out
124 #define AON_EVENT_AUX_TIMER0_EV     51 // Timer 0 event
125 #define AON_EVENT_AUX_TIMER1_EV     52 // Timer 1 event
126 #define AON_EVENT_BATMON_TEMP       53 // BATMON temperature update event
127 #define AON_EVENT_BATMON_VOLT       54 // BATMON voltage update event
128 #define AON_EVENT_AUX_COMPB_ASYNC   55 // Comparator B triggered. Asynchronous signal directly from the AUX Comparator B
129 #define AON_EVENT_AUX_COMPB_ASYNC_N 56 // Comparator B not triggered. Asynchronous signal directly from the AUX Comparator B
130                                        // Event ID 57-62 is reserved for future use
131 #define AON_EVENT_NONE              63 // No event, always low
132 
133 // Keeping backward compatibility until major revision number is incremented
134 #define AON_EVENT_RTC0     ( AON_EVENT_RTC_CH0 )
135 
136 //*****************************************************************************
137 //
138 // Values that can be passed to AONEventMCUWakeUpSet() and returned
139 // by AONEventMCUWakeUpGet().
140 //
141 //*****************************************************************************
142 #define AON_EVENT_MCU_WU0 0     // Programmable MCU wake-up event 0
143 #define AON_EVENT_MCU_WU1 1     // Programmable MCU wake-up event 1
144 #define AON_EVENT_MCU_WU2 2     // Programmable MCU wake-up event 2
145 #define AON_EVENT_MCU_WU3 3     // Programmable MCU wake-up event 3
146 #define AON_EVENT_MCU_WU4 4     // Programmable MCU wake-up event 4
147 #define AON_EVENT_MCU_WU5 5     // Programmable MCU wake-up event 5
148 #define AON_EVENT_MCU_WU6 6     // Programmable MCU wake-up event 6
149 #define AON_EVENT_MCU_WU7 7     // Programmable MCU wake-up event 7
150 
151 //*****************************************************************************
152 //
153 // Values that can be passed to AONEventMcuSet() and AONEventMcuGet()
154 //
155 //*****************************************************************************
156 #define AON_EVENT_MCU_EVENT0 0  // Programmable event source fed to MCU event fabric (first of 3)
157 #define AON_EVENT_MCU_EVENT1 1  // Programmable event source fed to MCU event fabric (second of 3)
158 #define AON_EVENT_MCU_EVENT2 2  // Programmable event source fed to MCU event fabric (third of 3)
159 
160 //*****************************************************************************
161 //
162 // API Functions and prototypes
163 //
164 //*****************************************************************************
165 
166 //*****************************************************************************
167 //
168 //! \brief Select event source for the specified MCU wake-up programmable event.
169 //!
170 //! The AON event fabric has several programmable events that can wake up the MCU.
171 //!
172 //! \note The programmable event sources are effectively OR'ed together
173 //!  to form a single wake-up event.
174 //!
175 //! \param ui32MCUWUEvent is one of the programmable MCU wake-up event sources.
176 //! - \ref AON_EVENT_MCU_WU0
177 //! - \ref AON_EVENT_MCU_WU1
178 //! - \ref AON_EVENT_MCU_WU2
179 //! - \ref AON_EVENT_MCU_WU3
180 //! - \ref AON_EVENT_MCU_WU4
181 //! - \ref AON_EVENT_MCU_WU5
182 //! - \ref AON_EVENT_MCU_WU6
183 //! - \ref AON_EVENT_MCU_WU7
184 //! \param ui32EventSrc is an event source for the event AON fabric.
185 //! - \ref AON_EVENT_IOEV_MCU_WU       : Edge detect event from DIOs which have enabled contribution to IOEV_MCU_WU
186 //! - \ref AON_EVENT_AUX_TIMER2_EV0    : Event 0 from AUX Timer2
187 //! - \ref AON_EVENT_AUX_TIMER2_EV1    : Event 1 from AUX Timer2
188 //! - \ref AON_EVENT_AUX_TIMER2_EV2    : Event 2 from AUX Timer2
189 //! - \ref AON_EVENT_AUX_TIMER2_EV3    : Event 3 from AUX Timer2
190 //! - \ref AON_EVENT_BATMON_BATT_UL    : BATMON event: Battery level above upper limit
191 //! - \ref AON_EVENT_BATMON_BATT_LL    : BATMON event: Battery level below lower limit
192 //! - \ref AON_EVENT_BATMON_TEMP_UL    : BATMON event: Temperature level above upper limit
193 //! - \ref AON_EVENT_BATMON_TEMP_LL    : BATMON event: Temperature level below lower limit
194 //! - \ref AON_EVENT_BATMON_COMBINED   : Combined event from BATMON
195 //! - \ref AON_EVENT_IO                : Edge detect on any DIO. Edge detect is enabled and configured in IOC.
196 //! - \ref AON_EVENT_RTC_CH0           : RTC channel 0
197 //! - \ref AON_EVENT_RTC_CH1           : RTC channel 1
198 //! - \ref AON_EVENT_RTC_CH2           : RTC channel 2
199 //! - \ref AON_EVENT_RTC_CH0_DLY       : RTC channel 0 - delayed event
200 //! - \ref AON_EVENT_RTC_CH1_DLY       : RTC channel 1 - delayed event
201 //! - \ref AON_EVENT_RTC_CH2_DLY       : RTC channel 2 - delayed event
202 //! - \ref AON_EVENT_RTC_COMB_DLY      : RTC combined delayed event
203 //! - \ref AON_EVENT_RTC_UPD           : RTC Update Tick (16 kHz signal, i.e. event line toggles value every 32 kHz clock period)
204 //! - \ref AON_EVENT_JTAG              : JTAG generated event
205 //! - \ref AON_EVENT_AUX_SWEV0         : AUX Software triggered event #0
206 //! - \ref AON_EVENT_AUX_SWEV1         : AUX Software triggered event #1
207 //! - \ref AON_EVENT_AUX_SWEV2         : AUX Software triggered event #2
208 //! - \ref AON_EVENT_AUX_COMPA         : Comparator A triggered (synchronized in AUX)
209 //! - \ref AON_EVENT_AUX_COMPB         : Comparator B triggered (synchronized in AUX)
210 //! - \ref AON_EVENT_AUX_ADC_DONE      : ADC conversion completed
211 //! - \ref AON_EVENT_AUX_TDC_DONE      : TDC completed or timed out
212 //! - \ref AON_EVENT_AUX_TIMER0_EV     : Timer 0 event
213 //! - \ref AON_EVENT_AUX_TIMER1_EV     : Timer 1 event
214 //! - \ref AON_EVENT_BATMON_TEMP       : BATMON temperature update event
215 //! - \ref AON_EVENT_BATMON_VOLT       : BATMON voltage update event
216 //! - \ref AON_EVENT_AUX_COMPB_ASYNC   : Comparator B triggered. Asynchronous signal directly from the AUX Comparator B
217 //! - \ref AON_EVENT_AUX_COMPB_ASYNC_N : Comparator B not triggered. Asynchronous signal directly from the AUX Comparator B
218 //! - \ref AON_EVENT_NONE              : No event, always low
219 //!
220 //! \return None
221 //!
222 //! \sa AONEventMcuWakeUpGet()
223 //
224 //*****************************************************************************
225 extern void AONEventMcuWakeUpSet(uint32_t ui32MCUWUEvent,
226                                  uint32_t ui32EventSrc);
227 
228 //*****************************************************************************
229 //
230 //! \brief Get event source for the specified MCU wake-up programmable event.
231 //!
232 //! \param ui32MCUWUEvent is one of the programmable MCU wake-up event sources.
233 //! - \ref AON_EVENT_MCU_WU0
234 //! - \ref AON_EVENT_MCU_WU1
235 //! - \ref AON_EVENT_MCU_WU2
236 //! - \ref AON_EVENT_MCU_WU3
237 //! - \ref AON_EVENT_MCU_WU4
238 //! - \ref AON_EVENT_MCU_WU5
239 //! - \ref AON_EVENT_MCU_WU6
240 //! - \ref AON_EVENT_MCU_WU7
241 //!
242 //! \return Returns the event source for the event AON fabric.
243 //! - \ref AON_EVENT_IOEV_MCU_WU       : Edge detect event from DIOs which have enabled contribution to IOEV_MCU_WU
244 //! - \ref AON_EVENT_AUX_TIMER2_EV0    : Event 0 from AUX Timer2
245 //! - \ref AON_EVENT_AUX_TIMER2_EV1    : Event 1 from AUX Timer2
246 //! - \ref AON_EVENT_AUX_TIMER2_EV2    : Event 2 from AUX Timer2
247 //! - \ref AON_EVENT_AUX_TIMER2_EV3    : Event 3 from AUX Timer2
248 //! - \ref AON_EVENT_BATMON_BATT_UL    : BATMON event: Battery level above upper limit
249 //! - \ref AON_EVENT_BATMON_BATT_LL    : BATMON event: Battery level below lower limit
250 //! - \ref AON_EVENT_BATMON_TEMP_UL    : BATMON event: Temperature level above upper limit
251 //! - \ref AON_EVENT_BATMON_TEMP_LL    : BATMON event: Temperature level below lower limit
252 //! - \ref AON_EVENT_BATMON_COMBINED   : Combined event from BATMON
253 //! - \ref AON_EVENT_IO                : Edge detect on any DIO. Edge detect is enabled and configured in IOC.
254 //! - \ref AON_EVENT_RTC_CH0           : RTC channel 0
255 //! - \ref AON_EVENT_RTC_CH1           : RTC channel 1
256 //! - \ref AON_EVENT_RTC_CH2           : RTC channel 2
257 //! - \ref AON_EVENT_RTC_CH0_DLY       : RTC channel 0 - delayed event
258 //! - \ref AON_EVENT_RTC_CH1_DLY       : RTC channel 1 - delayed event
259 //! - \ref AON_EVENT_RTC_CH2_DLY       : RTC channel 2 - delayed event
260 //! - \ref AON_EVENT_RTC_COMB_DLY      : RTC combined delayed event
261 //! - \ref AON_EVENT_RTC_UPD           : RTC Update Tick (16 kHz signal, i.e. event line toggles value every 32 kHz clock period)
262 //! - \ref AON_EVENT_JTAG              : JTAG generated event
263 //! - \ref AON_EVENT_AUX_SWEV0         : AUX Software triggered event #0
264 //! - \ref AON_EVENT_AUX_SWEV1         : AUX Software triggered event #1
265 //! - \ref AON_EVENT_AUX_SWEV2         : AUX Software triggered event #2
266 //! - \ref AON_EVENT_AUX_COMPA         : Comparator A triggered (synchronized in AUX)
267 //! - \ref AON_EVENT_AUX_COMPB         : Comparator B triggered (synchronized in AUX)
268 //! - \ref AON_EVENT_AUX_ADC_DONE      : ADC conversion completed
269 //! - \ref AON_EVENT_AUX_TDC_DONE      : TDC completed or timed out
270 //! - \ref AON_EVENT_AUX_TIMER0_EV     : Timer 0 event
271 //! - \ref AON_EVENT_AUX_TIMER1_EV     : Timer 1 event
272 //! - \ref AON_EVENT_BATMON_TEMP       : BATMON temperature update event
273 //! - \ref AON_EVENT_BATMON_VOLT       : BATMON voltage update event
274 //! - \ref AON_EVENT_AUX_COMPB_ASYNC   : Comparator B triggered. Asynchronous signal directly from the AUX Comparator B
275 //! - \ref AON_EVENT_AUX_COMPB_ASYNC_N : Comparator B not triggered. Asynchronous signal directly from the AUX Comparator B
276 //! - \ref AON_EVENT_NONE              : No event, always low
277 //!
278 //! \sa AONEventMcuWakeUpSet()
279 //
280 //*****************************************************************************
281 extern uint32_t AONEventMcuWakeUpGet(uint32_t ui32MCUWUEvent);
282 
283 //*****************************************************************************
284 //
285 //! \brief Select event source for the specified programmable event forwarded to the
286 //! MCU event fabric.
287 //!
288 //! The AON event fabric has a total of three programmable events that can
289 //! be forwarded to the MCU event fabric.
290 //!
291 //! \note The three programmable event sources are forwarded to the MCU Event
292 //! Fabric as:
293 //! - AON_PROG0
294 //! - AON_PROG1
295 //! - AON_PROG2
296 //!
297 //! \param ui32MCUEvent is one of three programmable events forwarded to the
298 //! MCU event fabric.
299 //! - \ref AON_EVENT_MCU_EVENT0
300 //! - \ref AON_EVENT_MCU_EVENT1
301 //! - \ref AON_EVENT_MCU_EVENT2
302 //! \param ui32EventSrc is an event source for the event AON fabric.
303 //! - \ref AON_EVENT_IOEV_MCU_WU       : Edge detect event from DIOs which have enabled contribution to IOEV_MCU_WU
304 //! - \ref AON_EVENT_AUX_TIMER2_EV0    : Event 0 from AUX Timer2
305 //! - \ref AON_EVENT_AUX_TIMER2_EV1    : Event 1 from AUX Timer2
306 //! - \ref AON_EVENT_AUX_TIMER2_EV2    : Event 2 from AUX Timer2
307 //! - \ref AON_EVENT_AUX_TIMER2_EV3    : Event 3 from AUX Timer2
308 //! - \ref AON_EVENT_BATMON_BATT_UL    : BATMON event: Battery level above upper limit
309 //! - \ref AON_EVENT_BATMON_BATT_LL    : BATMON event: Battery level below lower limit
310 //! - \ref AON_EVENT_BATMON_TEMP_UL    : BATMON event: Temperature level above upper limit
311 //! - \ref AON_EVENT_BATMON_TEMP_LL    : BATMON event: Temperature level below lower limit
312 //! - \ref AON_EVENT_BATMON_COMBINED   : Combined event from BATMON
313 //! - \ref AON_EVENT_IO                : Edge detect on any DIO. Edge detect is enabled and configured in IOC.
314 //! - \ref AON_EVENT_RTC_CH0           : RTC channel 0
315 //! - \ref AON_EVENT_RTC_CH1           : RTC channel 1
316 //! - \ref AON_EVENT_RTC_CH2           : RTC channel 2
317 //! - \ref AON_EVENT_RTC_CH0_DLY       : RTC channel 0 - delayed event
318 //! - \ref AON_EVENT_RTC_CH1_DLY       : RTC channel 1 - delayed event
319 //! - \ref AON_EVENT_RTC_CH2_DLY       : RTC channel 2 - delayed event
320 //! - \ref AON_EVENT_RTC_COMB_DLY      : RTC combined delayed event
321 //! - \ref AON_EVENT_RTC_UPD           : RTC Update Tick (16 kHz signal, i.e. event line toggles value every 32 kHz clock period)
322 //! - \ref AON_EVENT_JTAG              : JTAG generated event
323 //! - \ref AON_EVENT_AUX_SWEV0         : AUX Software triggered event #0
324 //! - \ref AON_EVENT_AUX_SWEV1         : AUX Software triggered event #1
325 //! - \ref AON_EVENT_AUX_SWEV2         : AUX Software triggered event #2
326 //! - \ref AON_EVENT_AUX_COMPA         : Comparator A triggered (synchronized in AUX)
327 //! - \ref AON_EVENT_AUX_COMPB         : Comparator B triggered (synchronized in AUX)
328 //! - \ref AON_EVENT_AUX_ADC_DONE      : ADC conversion completed
329 //! - \ref AON_EVENT_AUX_TDC_DONE      : TDC completed or timed out
330 //! - \ref AON_EVENT_AUX_TIMER0_EV     : Timer 0 event
331 //! - \ref AON_EVENT_AUX_TIMER1_EV     : Timer 1 event
332 //! - \ref AON_EVENT_BATMON_TEMP       : BATMON temperature update event
333 //! - \ref AON_EVENT_BATMON_VOLT       : BATMON voltage update event
334 //! - \ref AON_EVENT_AUX_COMPB_ASYNC   : Comparator B triggered. Asynchronous signal directly from the AUX Comparator B
335 //! - \ref AON_EVENT_AUX_COMPB_ASYNC_N : Comparator B not triggered. Asynchronous signal directly from the AUX Comparator B
336 //! - \ref AON_EVENT_NONE              : No event, always low
337 //!
338 //! \return None
339 //!
340 //! \sa AONEventMcuGet()
341 //
342 //*****************************************************************************
343 extern void AONEventMcuSet(uint32_t ui32MCUEvent, uint32_t ui32EventSrc);
344 
345 //*****************************************************************************
346 //
347 //! \brief Get source for the specified programmable event forwarded to the MCU event
348 //! fabric.
349 //!
350 //! The AON event fabric has a total of three programmable events that can
351 //! be forwarded to the MCU event fabric.
352 //!
353 //! \param ui32MCUEvent is one of three programmable events forwarded to the
354 //! MCU event fabric.
355 //! - \ref AON_EVENT_MCU_EVENT0
356 //! - \ref AON_EVENT_MCU_EVENT1
357 //! - \ref AON_EVENT_MCU_EVENT2
358 //!
359 //! \return Returns the event source for the event AON fabric.
360 //! - \ref AON_EVENT_IOEV_MCU_WU       : Edge detect event from DIOs which have enabled contribution to IOEV_MCU_WU
361 //! - \ref AON_EVENT_AUX_TIMER2_EV0    : Event 0 from AUX Timer2
362 //! - \ref AON_EVENT_AUX_TIMER2_EV1    : Event 1 from AUX Timer2
363 //! - \ref AON_EVENT_AUX_TIMER2_EV2    : Event 2 from AUX Timer2
364 //! - \ref AON_EVENT_AUX_TIMER2_EV3    : Event 3 from AUX Timer2
365 //! - \ref AON_EVENT_BATMON_BATT_UL    : BATMON event: Battery level above upper limit
366 //! - \ref AON_EVENT_BATMON_BATT_LL    : BATMON event: Battery level below lower limit
367 //! - \ref AON_EVENT_BATMON_TEMP_UL    : BATMON event: Temperature level above upper limit
368 //! - \ref AON_EVENT_BATMON_TEMP_LL    : BATMON event: Temperature level below lower limit
369 //! - \ref AON_EVENT_BATMON_COMBINED   : Combined event from BATMON
370 //! - \ref AON_EVENT_IO                : Edge detect on any DIO. Edge detect is enabled and configured in IOC.
371 //! - \ref AON_EVENT_RTC_CH0           : RTC channel 0
372 //! - \ref AON_EVENT_RTC_CH1           : RTC channel 1
373 //! - \ref AON_EVENT_RTC_CH2           : RTC channel 2
374 //! - \ref AON_EVENT_RTC_CH0_DLY       : RTC channel 0 - delayed event
375 //! - \ref AON_EVENT_RTC_CH1_DLY       : RTC channel 1 - delayed event
376 //! - \ref AON_EVENT_RTC_CH2_DLY       : RTC channel 2 - delayed event
377 //! - \ref AON_EVENT_RTC_COMB_DLY      : RTC combined delayed event
378 //! - \ref AON_EVENT_RTC_UPD           : RTC Update Tick (16 kHz signal, i.e. event line toggles value every 32 kHz clock period)
379 //! - \ref AON_EVENT_JTAG              : JTAG generated event
380 //! - \ref AON_EVENT_AUX_SWEV0         : AUX Software triggered event #0
381 //! - \ref AON_EVENT_AUX_SWEV1         : AUX Software triggered event #1
382 //! - \ref AON_EVENT_AUX_SWEV2         : AUX Software triggered event #2
383 //! - \ref AON_EVENT_AUX_COMPA         : Comparator A triggered (synchronized in AUX)
384 //! - \ref AON_EVENT_AUX_COMPB         : Comparator B triggered (synchronized in AUX)
385 //! - \ref AON_EVENT_AUX_ADC_DONE      : ADC conversion completed
386 //! - \ref AON_EVENT_AUX_TDC_DONE      : TDC completed or timed out
387 //! - \ref AON_EVENT_AUX_TIMER0_EV     : Timer 0 event
388 //! - \ref AON_EVENT_AUX_TIMER1_EV     : Timer 1 event
389 //! - \ref AON_EVENT_BATMON_TEMP       : BATMON temperature update event
390 //! - \ref AON_EVENT_BATMON_VOLT       : BATMON voltage update event
391 //! - \ref AON_EVENT_AUX_COMPB_ASYNC   : Comparator B triggered. Asynchronous signal directly from the AUX Comparator B
392 //! - \ref AON_EVENT_AUX_COMPB_ASYNC_N : Comparator B not triggered. Asynchronous signal directly from the AUX Comparator B
393 //! - \ref AON_EVENT_NONE              : No event, always low
394 //!
395 //! \sa AONEventMcuSet()
396 //
397 //*****************************************************************************
398 extern uint32_t AONEventMcuGet(uint32_t ui32MCUEvent);
399 
400 //*****************************************************************************
401 //
402 //! \brief Select event source forwarded to AON Real Time Clock (RTC).
403 //!
404 //! A programmable event can be forwarded to the AON real time clock
405 //! for triggering a capture event on RTC channel 1.
406 //!
407 //! \param ui32EventSrc is an event source for the event AON fabric.
408 //! - \ref AON_EVENT_IOEV_MCU_WU       : Edge detect event from DIOs which have enabled contribution to IOEV_MCU_WU
409 //! - \ref AON_EVENT_AUX_TIMER2_EV0    : Event 0 from AUX Timer2
410 //! - \ref AON_EVENT_AUX_TIMER2_EV1    : Event 1 from AUX Timer2
411 //! - \ref AON_EVENT_AUX_TIMER2_EV2    : Event 2 from AUX Timer2
412 //! - \ref AON_EVENT_AUX_TIMER2_EV3    : Event 3 from AUX Timer2
413 //! - \ref AON_EVENT_BATMON_BATT_UL    : BATMON event: Battery level above upper limit
414 //! - \ref AON_EVENT_BATMON_BATT_LL    : BATMON event: Battery level below lower limit
415 //! - \ref AON_EVENT_BATMON_TEMP_UL    : BATMON event: Temperature level above upper limit
416 //! - \ref AON_EVENT_BATMON_TEMP_LL    : BATMON event: Temperature level below lower limit
417 //! - \ref AON_EVENT_BATMON_COMBINED   : Combined event from BATMON
418 //! - \ref AON_EVENT_IO                : Edge detect on any DIO. Edge detect is enabled and configured in IOC.
419 //! - \ref AON_EVENT_RTC_CH0           : RTC channel 0
420 //! - \ref AON_EVENT_RTC_CH1           : RTC channel 1
421 //! - \ref AON_EVENT_RTC_CH2           : RTC channel 2
422 //! - \ref AON_EVENT_RTC_CH0_DLY       : RTC channel 0 - delayed event
423 //! - \ref AON_EVENT_RTC_CH1_DLY       : RTC channel 1 - delayed event
424 //! - \ref AON_EVENT_RTC_CH2_DLY       : RTC channel 2 - delayed event
425 //! - \ref AON_EVENT_RTC_COMB_DLY      : RTC combined delayed event
426 //! - \ref AON_EVENT_RTC_UPD           : RTC Update Tick (16 kHz signal, i.e. event line toggles value every 32 kHz clock period)
427 //! - \ref AON_EVENT_JTAG              : JTAG generated event
428 //! - \ref AON_EVENT_AUX_SWEV0         : AUX Software triggered event #0
429 //! - \ref AON_EVENT_AUX_SWEV1         : AUX Software triggered event #1
430 //! - \ref AON_EVENT_AUX_SWEV2         : AUX Software triggered event #2
431 //! - \ref AON_EVENT_AUX_COMPA         : Comparator A triggered (synchronized in AUX)
432 //! - \ref AON_EVENT_AUX_COMPB         : Comparator B triggered (synchronized in AUX)
433 //! - \ref AON_EVENT_AUX_ADC_DONE      : ADC conversion completed
434 //! - \ref AON_EVENT_AUX_TDC_DONE      : TDC completed or timed out
435 //! - \ref AON_EVENT_AUX_TIMER0_EV     : Timer 0 event
436 //! - \ref AON_EVENT_AUX_TIMER1_EV     : Timer 1 event
437 //! - \ref AON_EVENT_BATMON_TEMP       : BATMON temperature update event
438 //! - \ref AON_EVENT_BATMON_VOLT       : BATMON voltage update event
439 //! - \ref AON_EVENT_AUX_COMPB_ASYNC   : Comparator B triggered. Asynchronous signal directly from the AUX Comparator B
440 //! - \ref AON_EVENT_AUX_COMPB_ASYNC_N : Comparator B not triggered. Asynchronous signal directly from the AUX Comparator B
441 //! - \ref AON_EVENT_NONE              : No event, always low
442 //!
443 //! \return None
444 //!
445 //! \sa AONEventRtcGet()
446 //
447 //*****************************************************************************
448 __STATIC_INLINE void
AONEventRtcSet(uint32_t ui32EventSrc)449 AONEventRtcSet(uint32_t ui32EventSrc)
450 {
451     uint32_t ui32Ctrl;
452 
453     // Check the arguments.
454     ASSERT(ui32EventSrc <= AON_EVENT_NONE);
455 
456     ui32Ctrl = HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL);
457     ui32Ctrl &= ~(AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_M);
458     ui32Ctrl |= (ui32EventSrc & 0x3f) << AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_S;
459 
460     HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL) = ui32Ctrl;
461 }
462 
463 //*****************************************************************************
464 //
465 //! \brief Get event source forwarded to AON Real Time Clock (RTC).
466 //!
467 //! A programmable event can be forwarded to the AON real time clock
468 //! for triggering a capture event on RTC channel 1.
469 //!
470 //! \return Returns the event source to the event AON fabric.
471 //! - \ref AON_EVENT_IOEV_MCU_WU       : Edge detect event from DIOs which have enabled contribution to IOEV_MCU_WU
472 //! - \ref AON_EVENT_AUX_TIMER2_EV0    : Event 0 from AUX Timer2
473 //! - \ref AON_EVENT_AUX_TIMER2_EV1    : Event 1 from AUX Timer2
474 //! - \ref AON_EVENT_AUX_TIMER2_EV2    : Event 2 from AUX Timer2
475 //! - \ref AON_EVENT_AUX_TIMER2_EV3    : Event 3 from AUX Timer2
476 //! - \ref AON_EVENT_BATMON_BATT_UL    : BATMON event: Battery level above upper limit
477 //! - \ref AON_EVENT_BATMON_BATT_LL    : BATMON event: Battery level below lower limit
478 //! - \ref AON_EVENT_BATMON_TEMP_UL    : BATMON event: Temperature level above upper limit
479 //! - \ref AON_EVENT_BATMON_TEMP_LL    : BATMON event: Temperature level below lower limit
480 //! - \ref AON_EVENT_BATMON_COMBINED   : Combined event from BATMON
481 //! - \ref AON_EVENT_IO                : Edge detect on any DIO. Edge detect is enabled and configured in IOC.
482 //! - \ref AON_EVENT_RTC_CH0           : RTC channel 0
483 //! - \ref AON_EVENT_RTC_CH1           : RTC channel 1
484 //! - \ref AON_EVENT_RTC_CH2           : RTC channel 2
485 //! - \ref AON_EVENT_RTC_CH0_DLY       : RTC channel 0 - delayed event
486 //! - \ref AON_EVENT_RTC_CH1_DLY       : RTC channel 1 - delayed event
487 //! - \ref AON_EVENT_RTC_CH2_DLY       : RTC channel 2 - delayed event
488 //! - \ref AON_EVENT_RTC_COMB_DLY      : RTC combined delayed event
489 //! - \ref AON_EVENT_RTC_UPD           : RTC Update Tick (16 kHz signal, i.e. event line toggles value every 32 kHz clock period)
490 //! - \ref AON_EVENT_JTAG              : JTAG generated event
491 //! - \ref AON_EVENT_AUX_SWEV0         : AUX Software triggered event #0
492 //! - \ref AON_EVENT_AUX_SWEV1         : AUX Software triggered event #1
493 //! - \ref AON_EVENT_AUX_SWEV2         : AUX Software triggered event #2
494 //! - \ref AON_EVENT_AUX_COMPA         : Comparator A triggered (synchronized in AUX)
495 //! - \ref AON_EVENT_AUX_COMPB         : Comparator B triggered (synchronized in AUX)
496 //! - \ref AON_EVENT_AUX_ADC_DONE      : ADC conversion completed
497 //! - \ref AON_EVENT_AUX_TDC_DONE      : TDC completed or timed out
498 //! - \ref AON_EVENT_AUX_TIMER0_EV     : Timer 0 event
499 //! - \ref AON_EVENT_AUX_TIMER1_EV     : Timer 1 event
500 //! - \ref AON_EVENT_BATMON_TEMP       : BATMON temperature update event
501 //! - \ref AON_EVENT_BATMON_VOLT       : BATMON voltage update event
502 //! - \ref AON_EVENT_AUX_COMPB_ASYNC   : Comparator B triggered. Asynchronous signal directly from the AUX Comparator B
503 //! - \ref AON_EVENT_AUX_COMPB_ASYNC_N : Comparator B not triggered. Asynchronous signal directly from the AUX Comparator B
504 //! - \ref AON_EVENT_NONE              : No event, always low
505 //!
506 //! \sa AONEventRtcSet()
507 //
508 //*****************************************************************************
509 __STATIC_INLINE uint32_t
AONEventRtcGet(void)510 AONEventRtcGet(void)
511 {
512     uint32_t ui32EventSrc;
513 
514     // Return the active event.
515     ui32EventSrc = HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL);
516 
517     return ((ui32EventSrc & AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_M) >>
518             AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_S);
519 }
520 
521 //*****************************************************************************
522 //
523 // Support for DriverLib in ROM:
524 // Redirect to implementation in ROM when available.
525 //
526 //*****************************************************************************
527 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
528     #include "../driverlib/rom.h"
529     #ifdef ROM_AONEventMcuWakeUpSet
530         #undef  AONEventMcuWakeUpSet
531         #define AONEventMcuWakeUpSet            ROM_AONEventMcuWakeUpSet
532     #endif
533     #ifdef ROM_AONEventMcuWakeUpGet
534         #undef  AONEventMcuWakeUpGet
535         #define AONEventMcuWakeUpGet            ROM_AONEventMcuWakeUpGet
536     #endif
537     #ifdef ROM_AONEventMcuSet
538         #undef  AONEventMcuSet
539         #define AONEventMcuSet                  ROM_AONEventMcuSet
540     #endif
541     #ifdef ROM_AONEventMcuGet
542         #undef  AONEventMcuGet
543         #define AONEventMcuGet                  ROM_AONEventMcuGet
544     #endif
545 #endif
546 
547 //*****************************************************************************
548 //
549 // Mark the end of the C bindings section for C++ compilers.
550 //
551 //*****************************************************************************
552 #ifdef __cplusplus
553 }
554 #endif
555 
556 #endif //  __AON_EVENT_H__
557 
558 //*****************************************************************************
559 //
560 //! Close the Doxygen group.
561 //! @}
562 //! @}
563 //
564 //*****************************************************************************
565