CC26xx Driver Library |

- Main Page
- Related Pages
- CC26xx APIs
- Register Descriptions
- Online Resources

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
aon_event.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: aon_event.h
3 * Revised: 2015-01-14 12:12:44 +0100 (on, 14 jan 2015)
4 * Revision: 42373
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 //
43 //
44 //*****************************************************************************
45
46 #ifndef __AON_EVENT_H__
47 #define __AON_EVENT_H__
48
49 //*****************************************************************************
50 //
51 // If building with a C++ compiler, make all of the definitions in this header
52 // have a C binding.
53 //
54 //*****************************************************************************
55 #ifdef __cplusplus
56 extern "C"
57 {
58 #endif
59
60 #include <stdbool.h>
61 #include <stdint.h>
62 #include <inc/hw_types.h>
63 #include <inc/hw_memmap.h>
64 #include <inc/hw_device.h>
65 #include <inc/hw_aon_event.h>
66 #include <driverlib/debug.h>
67
68 //*****************************************************************************
69 //
70 // Support for DriverLib in ROM:
71 // This section renames all functions that are not "static inline", so that
72 // calling these functions will default to implementation in flash. At the end
73 // of this file a second renaming will change the defaults to implementation in
74 // ROM for available functions.
75 //
76 // To force use of the implementation in flash, e.g. for debugging:
77 // - Globally: Define DRIVERLIB_NOROM at project level
78 // - Per function: Use prefix "NOROM_" when calling the function
79 //
80 // Do not define DRIVERLIB_GENERATE_ROM!
81 //
82 //*****************************************************************************
83 #ifndef DRIVERLIB_GENERATE_ROM
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 #define AON_EVENT_IO0 AON_EVENT_DIO_0 // Edge detect on DIO0
99 #define AON_EVENT_IO1 AON_EVENT_DIO_1 // Edge detect on DIO1
100 #define AON_EVENT_IO2 AON_EVENT_DIO_2 // Edge detect on DIO2
101 #define AON_EVENT_IO3 AON_EVENT_DIO_3 // Edge detect on DIO3
102 #define AON_EVENT_IO4 AON_EVENT_DIO_4 // Edge detect on DIO4
103 #define AON_EVENT_IO5 AON_EVENT_DIO_5 // Edge detect on DIO5
104 #define AON_EVENT_IO6 AON_EVENT_DIO_6 // Edge detect on DIO6
105 #define AON_EVENT_IO7 AON_EVENT_DIO_7 // Edge detect on DIO7
106 #define AON_EVENT_IO8 AON_EVENT_DIO_8 // Edge detect on DIO8
107 #define AON_EVENT_IO9 AON_EVENT_DIO_9 // Edge detect on DIO9
108 #define AON_EVENT_IO10 AON_EVENT_DIO_10 // Edge detect on DIO10
109 #define AON_EVENT_IO11 AON_EVENT_DIO_11 // Edge detect on DIO11
110 #define AON_EVENT_IO12 AON_EVENT_DIO_12 // Edge detect on DIO12
111 #define AON_EVENT_IO13 AON_EVENT_DIO_13 // Edge detect on DIO13
112 #define AON_EVENT_IO14 AON_EVENT_DIO_14 // Edge detect on DIO14
113 #define AON_EVENT_IO15 AON_EVENT_DIO_15 // Edge detect on DIO15
114 #define AON_EVENT_IO16 AON_EVENT_DIO_16 // Edge detect on DIO16
115 #define AON_EVENT_IO17 AON_EVENT_DIO_17 // Edge detect on DIO17
116 #define AON_EVENT_IO18 AON_EVENT_DIO_18 // Edge detect on DIO18
117 #define AON_EVENT_IO19 AON_EVENT_DIO_19 // Edge detect on DIO19
118 #define AON_EVENT_IO20 AON_EVENT_DIO_20 // Edge detect on DIO20
119 #define AON_EVENT_IO21 AON_EVENT_DIO_21 // Edge detect on DIO21
120 #define AON_EVENT_IO22 AON_EVENT_DIO_22 // Edge detect on DIO22
121 #define AON_EVENT_IO23 AON_EVENT_DIO_23 // Edge detect on DIO23
122 #define AON_EVENT_IO24 AON_EVENT_DIO_24 // Edge detect on DIO24
123 #define AON_EVENT_IO25 AON_EVENT_DIO_25 // Edge detect on DIO25
124 #define AON_EVENT_IO26 AON_EVENT_DIO_26 // Edge detect on DIO26
125 #define AON_EVENT_IO27 AON_EVENT_DIO_27 // Edge detect on DIO27
126 #define AON_EVENT_IO28 AON_EVENT_DIO_28 // Edge detect on DIO28
127 #define AON_EVENT_IO29 AON_EVENT_DIO_29 // Edge detect on DIO29
128 #define AON_EVENT_IO30 AON_EVENT_DIO_30 // Edge detect on DIO30
129 #define AON_EVENT_IO31 AON_EVENT_DIO_31 // Edge detect on DIO31
130 #define AON_EVENT_IO 32 // Edge detect on any DIO
131 #define AON_EVENT_SPISRTX 33 // SPIS byte transmitted
132 #define AON_EVENT_SPISCS 34 // SPIS CS_N asserted
133 #define AON_EVENT_RTC0 35 // RTC channel 0
134 #define AON_EVENT_RTC1 36 // RTC channel 1
135 #define AON_EVENT_RTC2 37 // RTC channel 2
136 #define AON_EVENT_RTC0DLY 38 // RTC channel 0 - delayed event
137 #define AON_EVENT_RTC1DLY 39 // RTC channel 1 - delayed event
138 #define AON_EVENT_RTC2DLY 40 // RTC channel 2 - delayed event
139 #define AON_EVENT_RTCDLYC 41 // RTC combined delayed event
140 // Event ID 42 is reserved for future use
141 #define AON_EVENT_JTAG 43 // JTAG generated event
142 #define AON_EVENT_AUX0 44 // SW programmable
143 // default: Statemachine done
144 #define AON_EVENT_AUX1 45 // SW programmable
145 // default: Error event
146 #define AON_EVENT_AUX2 46 // SW programmable
147 // default: RTC Channel 2 clear
148 #define AON_EVENT_AUX_CMPA 47 // Comparator A triggered
149 #define AON_EVENT_AUX_CMPB 48 // Comparator B triggered
150 #define AON_EVENT_AUX_ADC_DONE 49 // ADC conversion completed
151 #define AON_EVENT_AUX_TDC_DONE 50 // TDC completed or timed out
152 #define AON_EVENT_AUX_TIMER0 51 // Timer 0 event
153 #define AON_EVENT_AUX_TIMER1 52 // Timer 1 event
154
155 #define AON_EVENT_BATMON_TEMP 53 //
156 #define AON_EVENT_BATMON_VOLT 54 //
157 // Event ID 55-62 is reserved for future use
158 #define AON_EVENT_NULL 63 // No event
159
160 //*****************************************************************************
161 //
162 // Values that can be passed to AONEventSetMCUWakeUp() and returned
163 // by AONEventGetMCUWakeUp().
164 //
165 //*****************************************************************************
166 #define AON_EVENT_MCU_WU0 0 // Programmable MCU wakeup event 0
167 #define AON_EVENT_MCU_WU1 1 // Programmable MCU wakeup event 1
168 #define AON_EVENT_MCU_WU2 2 // Programmable MCU wakeup event 2
169 #define AON_EVENT_MCU_WU3 3 // Programmable MCU wakeup event 3
170
171 //*****************************************************************************
172 //
173 // Values that can be passed to TBD
174 //
175 //*****************************************************************************
176 #define AON_EVENT_AUX_WU0 0 // Programmable AUX wakeup event 0
177 #define AON_EVENT_AUX_WU1 1 // Programmable AUX wakeup event 1
178 #define AON_EVENT_AUX_WU2 2 // Programmable AUX wakeup event 2
179
180 //*****************************************************************************
181 //
182 // Values that can be passed to TBD
183 //
184 //*****************************************************************************
185 #define AON_EVENT_MCU_EVENT0 0 // Programmable event source fed to
186 // MCU event fabric (first of 3)
187 #define AON_EVENT_MCU_EVENT1 1 // Programmable event source fed to
188 // MCU event fabric (second of 3)
189 #define AON_EVENT_MCU_EVENT2 2 // Programmable event source fed to
190 // MCU event fabric (third of 3)
191
192 //*****************************************************************************
193 //
194 // API Functions and prototypes
195 //
196 //*****************************************************************************
197
198 //*****************************************************************************
199 //
222 //
223 //*****************************************************************************
224 extern void AONEventMcuWakeUpSet(uint32_t ui32MCUWUEvent,
225 uint32_t ui32EventSrc);
226
227 //*****************************************************************************
228 //
248 //
249 //*****************************************************************************
250 extern uint32_t AONEventMcuWakeUpGet(uint32_t ui32MCUWUEvent);
251
252 //*****************************************************************************
253 //
276 //
277 //*****************************************************************************
278 extern void AONEventAuxWakeUpSet(uint32_t ui32AUXWUEvent,
279 uint32_t ui32EventSrc);
280
281 //*****************************************************************************
282 //
301 //
302 //*****************************************************************************
303 extern uint32_t AONEventAuxWakeUpGet(uint32_t ui32AUXWUEvent);
304
305 //*****************************************************************************
306 //
333 //
334 //*****************************************************************************
335 extern void AONEventMcuSet(uint32_t ui32MCUEvent, uint32_t ui32EventSrc);
336
337 //*****************************************************************************
338 //
358 //
359 //*****************************************************************************
360 extern uint32_t AONEventMcuGet(uint32_t ui32MCUEvent);
361
362 //*****************************************************************************
363 //
378 //
379 //*****************************************************************************
380 __STATIC_INLINE void
381 AONEventRtcSet(uint32_t ui32EventSrc)
382 {
383 uint32_t ui32Ctrl;
384
385 //
386 // Check the arguments.
387 //
388 ASSERT(ui32EventSrc <= AON_EVENT_NULL);
389
390 ui32Ctrl = HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL);
391 ui32Ctrl &= ~(AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_M);
392 ui32Ctrl |= (ui32EventSrc & 0x3f) << AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_S;
393
394 HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL) = ui32Ctrl;
395 }
396
397 //*****************************************************************************
398 //
411 //
412 //*****************************************************************************
413 __STATIC_INLINE uint32_t
414 AONEventRtcGet(void)
415 {
416 uint32_t ui32EventSrc;
417
418 //
419 // Return the active event.
420 //
421 ui32EventSrc = HWREG(AON_EVENT_BASE + AON_EVENT_O_RTCSEL);
422
423 return ((ui32EventSrc & AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_M) >>
424 AON_EVENT_RTCSEL_RTC_CH1_CAPT_EV_S);
425 }
426
427 //*****************************************************************************
428 //
429 // Support for DriverLib in ROM:
430 // Redirect to implementation in ROM when available.
431 //
432 //*****************************************************************************
433 #ifndef DRIVERLIB_NOROM
434 #include <driverlib/rom.h>
435 #ifdef ROM_AONEventMcuWakeUpSet
436 #undef AONEventMcuWakeUpSet
437 #define AONEventMcuWakeUpSet ROM_AONEventMcuWakeUpSet
438 #endif
439 #ifdef ROM_AONEventMcuWakeUpGet
440 #undef AONEventMcuWakeUpGet
441 #define AONEventMcuWakeUpGet ROM_AONEventMcuWakeUpGet
442 #endif
443 #ifdef ROM_AONEventAuxWakeUpSet
444 #undef AONEventAuxWakeUpSet
445 #define AONEventAuxWakeUpSet ROM_AONEventAuxWakeUpSet
446 #endif
447 #ifdef ROM_AONEventAuxWakeUpGet
448 #undef AONEventAuxWakeUpGet
449 #define AONEventAuxWakeUpGet ROM_AONEventAuxWakeUpGet
450 #endif
451 #ifdef ROM_AONEventMcuSet
452 #undef AONEventMcuSet
453 #define AONEventMcuSet ROM_AONEventMcuSet
454 #endif
455 #ifdef ROM_AONEventMcuGet
456 #undef AONEventMcuGet
457 #define AONEventMcuGet ROM_AONEventMcuGet
458 #endif
459 #endif
460
461 //*****************************************************************************
462 //
463 // Mark the end of the C bindings section for C++ compilers.
464 //
465 //*****************************************************************************
466 #ifdef __cplusplus
467 }
468 #endif
469
470 #endif // __AON_EVENT_H__
471
472 //*****************************************************************************
473 //
476 //
477 //*****************************************************************************
debug.h
AONEventRtcSet
__STATIC_INLINE void AONEventRtcSet(uint32_t ui32EventSrc)
Select event source forwarded to AON Real Time Clock (RTC).
Definition: aon_event.h:381
ASSERT
#define ASSERT(expr)
Definition: debug.h:65
AONEventMcuWakeUpSet
void AONEventMcuWakeUpSet(uint32_t ui32MCUWUEvent, uint32_t ui32EventSrc)
Select event source for the specified MCU wakeup programmable event.
Definition: aon_event.c:68
AONEventAuxWakeUpGet
uint32_t AONEventAuxWakeUpGet(uint32_t ui32AUXWUEvent)
Get event source for the specified AUX wakeup programmable event.
Definition: aon_event.c:200
AON_EVENT_NULL
#define AON_EVENT_NULL
Definition: aon_event.h:158
AONEventAuxWakeUpSet
void AONEventAuxWakeUpSet(uint32_t ui32AUXWUEvent, uint32_t ui32EventSrc)
Select event source for the specified AUX wakeup programmable event.
Definition: aon_event.c:161
AONEventRtcGet
__STATIC_INLINE uint32_t AONEventRtcGet(void)
Get event source forwarded to AON Real Time Clock (RTC).
Definition: aon_event.h:414
AONEventMcuSet
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
AONEventMcuWakeUpGet
uint32_t AONEventMcuWakeUpGet(uint32_t ui32MCUWUEvent)
Get event source for the specified MCU wakeup programmable event.
Definition: aon_event.c:113
rom.h
AONEventMcuGet
uint32_t AONEventMcuGet(uint32_t ui32MCUEvent)
Get source for the specified programmable event forwarded to the MCU event fabric.
Definition: aon_event.c:283