CC13xx Driver Library
aon_event.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: aon_event.h
3 * Revised: 2015-07-16 12:12:04 +0200 (Thu, 16 Jul 2015)
4 * Revision: 44151
5 *
6 * Description: Defines and prototypes for the AON Event fabric.
7 *
8 * Copyright (c) 2015, 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 //
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_device.h>
67 #include <inc/hw_aon_event.h>
68 #include <driverlib/debug.h>
69 
70 //*****************************************************************************
71 //
72 // Support for DriverLib in ROM:
73 // This section renames all functions that are not "static inline", so that
74 // calling these functions will default to implementation in flash. At the end
75 // of this file a second renaming will change the defaults to implementation in
76 // ROM for available functions.
77 //
78 // To force use of the implementation in flash, e.g. for debugging:
79 // - Globally: Define DRIVERLIB_NOROM at project level
80 // - Per function: Use prefix "NOROM_" when calling the function
81 //
82 //*****************************************************************************
83 #if !defined(DOXYGEN)
84  #define AONEventMcuWakeUpSet NOROM_AONEventMcuWakeUpSet
85  #define AONEventMcuWakeUpGet NOROM_AONEventMcuWakeUpGet
86  #define AONEventAuxWakeUpSet NOROM_AONEventAuxWakeUpSet
87  #define AONEventAuxWakeUpGet NOROM_AONEventAuxWakeUpGet
88  #define AONEventMcuSet NOROM_AONEventMcuSet
89  #define AONEventMcuGet NOROM_AONEventMcuGet
90 #endif
91 
92 //*****************************************************************************
93 //
94 // Event sources for the event AON fabric.
95 // Note: Events are level-triggered active high
96 //
97 //*****************************************************************************
98 // AON_EVENT_DIO0 // Edge detect on DIO0. See hw_device.h for DIO-to-PAD mapping.
99 // ... // ...
100 // AON_EVENT_DIO31 // Edge detect on DIO31. See hw_device.h for DIO-to-PAD mapping.
101 #define AON_EVENT_IO 32 // Edge detect on any DIO
102  // Event ID 33 is reserved for future use
103  // Event ID 34 is reserved for future use
104 #define AON_EVENT_RTC_CH0 35 // RTC channel 0
105 #define AON_EVENT_RTC_CH1 36 // RTC channel 1
106 #define AON_EVENT_RTC_CH2 37 // RTC channel 2
107 #define AON_EVENT_RTC_CH0_DLY 38 // RTC channel 0 - delayed event
108 #define AON_EVENT_RTC_CH1_DLY 39 // RTC channel 1 - delayed event
109 #define AON_EVENT_RTC_CH2_DLY 40 // RTC channel 2 - delayed event
110 #define AON_EVENT_RTC_COMB_DLY 41 // RTC combined delayed event
111 #define AON_EVENT_RTC_UPD 42 // RTC Update Tick (16 kHz signal, i.e. event line toggles value every 32 kHz clock period)
112 #define AON_EVENT_JTAG 43 // JTAG generated event
113 #define AON_EVENT_AUX_SWEV0 44 // AUX Software triggered event #0
114 #define AON_EVENT_AUX_SWEV1 45 // AUX Software triggered event #1
115 #define AON_EVENT_AUX_SWEV2 46 // AUX Software triggered event #2
116 #define AON_EVENT_AUX_COMPA 47 // Comparator A triggered (synchronized in AUX)
117 #define AON_EVENT_AUX_COMPB 48 // Comparator B triggered (synchronized in AUX)
118 #define AON_EVENT_AUX_ADC_DONE 49 // ADC conversion completed
119 #define AON_EVENT_AUX_TDC_DONE 50 // TDC completed or timed out
120 #define AON_EVENT_AUX_TIMER0_EV 51 // Timer 0 event
121 #define AON_EVENT_AUX_TIMER1_EV 52 // Timer 1 event
122 #define AON_EVENT_BATMON_TEMP 53 // BATMON temperature update event
123 #define AON_EVENT_BATMON_VOLT 54 // BATMON voltage update event
124 #define AON_EVENT_AUX_COMPB_ASYNC 55 // Comparator B triggered. Asynchronous signal directly from the AUX Comparator B
125 #define AON_EVENT_AUX_COMPB_ASYNC_N 56 // Comparator B not triggered. Asynchronous signal directly from the AUX Comparator B
126  // Event ID 57-62 is reserved for future use
127 #define AON_EVENT_NONE 63 // No event, always low
128 
129 //
130 // Keeping backward compatibility until major revision number is incremented
131 //
132 #define AON_EVENT_RTC0 ( AON_EVENT_RTC_CH0 )
133 
134 //*****************************************************************************
135 //
136 // Values that can be passed to AONEventMCUWakeUpSet() and returned
137 // by AONEventMCUWakeUpGet().
138 //
139 //*****************************************************************************
140 #define AON_EVENT_MCU_WU0 0 // Programmable MCU wakeup event 0
141 #define AON_EVENT_MCU_WU1 1 // Programmable MCU wakeup event 1
142 #define AON_EVENT_MCU_WU2 2 // Programmable MCU wakeup event 2
143 #define AON_EVENT_MCU_WU3 3 // Programmable MCU wakeup event 3
144 
145 //*****************************************************************************
146 //
147 // Values that can be passed to AONEventAuxWakeUpSet() and AONEventAuxWakeUpGet()
148 //
149 //*****************************************************************************
150 #define AON_EVENT_AUX_WU0 0 // Programmable AUX wakeup event 0
151 #define AON_EVENT_AUX_WU1 1 // Programmable AUX wakeup event 1
152 #define AON_EVENT_AUX_WU2 2 // Programmable AUX wakeup event 2
153 
154 //*****************************************************************************
155 //
156 // Values that can be passed to AONEventMcuSet() and AONEventMcuGet()
157 //
158 //*****************************************************************************
159 #define AON_EVENT_MCU_EVENT0 0 // Programmable event source fed to MCU event fabric (first of 3)
160 #define AON_EVENT_MCU_EVENT1 1 // Programmable event source fed to MCU event fabric (second of 3)
161 #define AON_EVENT_MCU_EVENT2 2 // Programmable event source fed to MCU event fabric (third of 3)
162 
163 //*****************************************************************************
164 //
165 // API Functions and prototypes
166 //
167 //*****************************************************************************
168 
169 //*****************************************************************************
170 //
216 //
217 //*****************************************************************************
218 extern void AONEventMcuWakeUpSet(uint32_t ui32MCUWUEvent,
219  uint32_t ui32EventSrc);
220 
221 //*****************************************************************************
222 //
265 //
266 //*****************************************************************************
267 extern uint32_t AONEventMcuWakeUpGet(uint32_t ui32MCUWUEvent);
268 
269 //*****************************************************************************
270 //
316 //
317 //*****************************************************************************
318 extern void AONEventAuxWakeUpSet(uint32_t ui32AUXWUEvent,
319  uint32_t ui32EventSrc);
320 
321 //*****************************************************************************
322 //
364 //
365 //*****************************************************************************
366 extern uint32_t AONEventAuxWakeUpGet(uint32_t ui32AUXWUEvent);
367 
368 //*****************************************************************************
369 //
419 //
420 //*****************************************************************************
421 extern void AONEventMcuSet(uint32_t ui32MCUEvent, uint32_t ui32EventSrc);
422 
423 //*****************************************************************************
424 //
467 //
468 //*****************************************************************************
469 extern uint32_t AONEventMcuGet(uint32_t ui32MCUEvent);
470 
471 //*****************************************************************************
472 //
510 //
511 //*****************************************************************************
512 __STATIC_INLINE void
513 AONEventRtcSet(uint32_t ui32EventSrc)
514 {
515  uint32_t ui32Ctrl;
516 
517  //
518  // Check the arguments.
519  //
520  ASSERT(ui32EventSrc <= AON_EVENT_NONE);
521 
522  ui32Ctrl = HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL);
523  ui32Ctrl &= ~(AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_M);
524  ui32Ctrl |= (ui32EventSrc & 0x3f) << AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_S;
525 
526  HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL) = ui32Ctrl;
527 }
528 
529 //*****************************************************************************
530 //
566 //
567 //*****************************************************************************
568 __STATIC_INLINE uint32_t
570 {
571  uint32_t ui32EventSrc;
572 
573  //
574  // Return the active event.
575  //
576  ui32EventSrc = HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL);
577 
578  return ((ui32EventSrc & AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_M) >>
580 }
581 
582 //*****************************************************************************
583 //
584 // Support for DriverLib in ROM:
585 // Redirect to implementation in ROM when available.
586 //
587 //*****************************************************************************
588 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
589  #include <driverlib/rom.h>
590  #ifdef ROM_AONEventMcuWakeUpSet
591  #undef AONEventMcuWakeUpSet
592  #define AONEventMcuWakeUpSet ROM_AONEventMcuWakeUpSet
593  #endif
594  #ifdef ROM_AONEventMcuWakeUpGet
595  #undef AONEventMcuWakeUpGet
596  #define AONEventMcuWakeUpGet ROM_AONEventMcuWakeUpGet
597  #endif
598  #ifdef ROM_AONEventAuxWakeUpSet
599  #undef AONEventAuxWakeUpSet
600  #define AONEventAuxWakeUpSet ROM_AONEventAuxWakeUpSet
601  #endif
602  #ifdef ROM_AONEventAuxWakeUpGet
603  #undef AONEventAuxWakeUpGet
604  #define AONEventAuxWakeUpGet ROM_AONEventAuxWakeUpGet
605  #endif
606  #ifdef ROM_AONEventMcuSet
607  #undef AONEventMcuSet
608  #define AONEventMcuSet ROM_AONEventMcuSet
609  #endif
610  #ifdef ROM_AONEventMcuGet
611  #undef AONEventMcuGet
612  #define AONEventMcuGet ROM_AONEventMcuGet
613  #endif
614 #endif
615 
616 //*****************************************************************************
617 //
618 // Mark the end of the C bindings section for C++ compilers.
619 //
620 //*****************************************************************************
621 #ifdef __cplusplus
622 }
623 #endif
624 
625 #endif // __AON_EVENT_H__
626 
627 //*****************************************************************************
628 //
632 //
633 //*****************************************************************************
#define AON_EVENT_NONE
Definition: aon_event.h:127
void AONEventMcuWakeUpSet(uint32_t ui32MCUWUEvent, uint32_t ui32EventSrc)
Select event source for the specified MCU wakeup programmable event.
Definition: aon_event.c:68
uint32_t AONEventAuxWakeUpGet(uint32_t ui32AUXWUEvent)
Get event source for the specified AUX wakeup programmable event.
Definition: aon_event.c:200
void AONEventAuxWakeUpSet(uint32_t ui32AUXWUEvent, uint32_t ui32EventSrc)
Select event source for the specified AUX wakeup programmable event.
Definition: aon_event.c:161
void AONEventMcuSet(uint32_t ui32MCUEvent, uint32_t ui32EventSrc)
Select event source for the specified programmable event forwarded to the MCU event fabric...
Definition: aon_event.c:243
#define ASSERT(expr)
Definition: debug.h:74
static void AONEventRtcSet(uint32_t ui32EventSrc)
Select event source forwarded to AON Real Time Clock (RTC).
Definition: aon_event.h:513
uint32_t AONEventMcuWakeUpGet(uint32_t ui32MCUWUEvent)
Get event source for the specified MCU wakeup programmable event.
Definition: aon_event.c:113
static uint32_t AONEventRtcGet(void)
Get event source forwarded to AON Real Time Clock (RTC).
Definition: aon_event.h:569
uint32_t AONEventMcuGet(uint32_t ui32MCUEvent)
Get source for the specified programmable event forwarded to the MCU event fabric.
Definition: aon_event.c:283