Kinetis SDK v.1.2 Demo Applications User's Guide  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lpm_rtos.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, Freescale Semiconductor, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * o Redistributions of source code must retain the above copyright notice, this list
9  * of conditions and the following disclaimer.
10  *
11  * o Redistributions in binary form must reproduce the above copyright notice, this
12  * list of conditions and the following disclaimer in the documentation and/or
13  * other materials provided with the distribution.
14  *
15  * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from this
17  * software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 #ifndef LPM_RTOS_H
31 #define LPM_RTOS_H
32 
34 // Includes
36 // Standard C Included Files
37 #include <stdio.h>
38 // SDK Included Files
39 #include "board.h"
40 #include "fsl_clock_manager.h"
41 #include "fsl_power_manager.h"
42 #include "fsl_pmc_hal.h"
43 #include "fsl_smc_hal.h"
44 #include "fsl_os_abstraction.h"
45 
46 #if (defined BOARD_USE_LPSCI)
47 #include "fsl_lpsci_driver.h"
48 #elif (defined BOARD_USE_LPUART)
49 #include "fsl_lpuart_driver.h"
50 #else
51 #include "fsl_uart_driver.h"
52 #endif // BOARD_USE_LPSCI
53 // Project Included Files
54 
56 // Definitions
58 #if (defined(FSL_FEATURE_SIM_OPT_HAS_RTC_CLOCK_OUT_SELECTION) && FSL_FEATURE_SIM_OPT_HAS_RTC_CLOCK_OUT_SELECTION == 1)
59 /* The RTC instance used for RTC */
60 #define PM_RTOS_DEMO_RTC_FUNC_INSTANCE 0
61 #endif
62 
63 /* The LPTMR instance used for LPTMR */
64 #define PM_RTOS_DEMO_LPTMR_FUNC_INSTANCE 0
65 
66 /* The LLWU wakeup module for RTC */
67 #define PM_RTOS_DEMO_RTC_LLWU_WAKEUP_MODULE kLlwuWakeupModule5
68 
69 /* The LLWU wakeup module for LPTMR */
70 #define PM_RTOS_DEMO_LPTMR_LLWU_WAKEUP_MODULE kLlwuWakeupModule0
71 
72 /************************* Configure for MQX **********************************/
73 #if (defined FSL_RTOS_MQX)
74 #define _MODULE_IRQ_HANDLER(module) MQX_##module##IRQHandler
75 #else
76 #define _MODULE_IRQ_HANDLER(module) module##IRQHandler
77 #endif /* LPM_RTOS_H */
78 #define MODULE_IRQ_HANDLER(module) _MODULE_IRQ_HANDLER(module##_)
79 /******************************************************************************/
80 
82 // Structures & enumerations
85 {
88 };
89 
91 // Variables
93 
94 
96 // Prototypes
98 clock_manager_error_code_t rtos_cm_callback(clock_notify_struct_t *notify, void* callbackData);
99 clock_manager_error_code_t dbg_console_cm_callback(clock_notify_struct_t *notify, void* callbackData);
100 power_manager_error_code_t rtos_pm_callback(power_manager_notify_struct_t * notify,
101  power_manager_callback_data_t * dataPtr);
102 power_manager_error_code_t adc16_pm_callback(power_manager_notify_struct_t * notify, power_manager_callback_data_t * dataPtr);
103 
107 char getInput(void);
108 
112 /*******************************************************************************
113  * ADC
114  ******************************************************************************/
115 #if (ADC_INSTANCE_COUNT > 0)
116 void MODULE_IRQ_HANDLER(ADC0)(void);
117 #endif
118 #if (ADC_INSTANCE_COUNT > 1U)
119 void MODULE_IRQ_HANDLER(ADC1)(void);
120 #endif
121 #if (ADC_INSTANCE_COUNT > 2U)
122 void MODULE_IRQ_HANDLER(ADC2)(void);
123 #endif
124 #if (ADC_INSTANCE_COUNT > 3U)
125 void MODULE_IRQ_HANDLER(ADC3)(void);
126 #endif
127 
128 /*******************************************************************************
129  * UART
130  ******************************************************************************/
131 void PM_DBG_UART_IRQ_HANDLER(void);
132 
133 /*******************************************************************************
134  * RTC
135  ******************************************************************************/
136 #if (defined PM_RTOS_DEMO_RTC_FUNC_INSTANCE)
137 void MODULE_IRQ_HANDLER(RTC)(void);
138 #endif
139 void MODULE_IRQ_HANDLER(LPTMR0)(void);
140 /*******************************************************************************
141  * LLW
142  ******************************************************************************/
143 void MODULE_IRQ_HANDLER(LLWU)(void);
144 
145 #endif
146 
148 // EOF
150 
void MODULE_IRQ_HANDLER() LPTMR0(void)
override the RTC IRQ handler
Definition: demo_apps/power_manager_rtos_demo/fsl_lptmr_irq.c:51
clock_manager_error_code_t rtos_cm_callback(clock_notify_struct_t *notify, void *callbackData)
Definition: rtos_lpm_callback.c:77
char getInput(void)
Definition: demo_apps/power_manager_rtos_demo/main.c:149
void PM_DBG_UART_IRQ_HANDLER(void)
Definition: demo_apps/power_manager_rtos_demo/fsl_uart_irq.c:65
Definition: lpm_rtos.h:87
#define MODULE_IRQ_HANDLER(module)
Definition: lpm_rtos.h:78
void MODULE_IRQ_HANDLER() LLWU(void)
Definition: task_lpm.c:147
power_manager_error_code_t adc16_pm_callback(power_manager_notify_struct_t *notify, power_manager_callback_data_t *dataPtr)
Definition: adc16_lpm_callback.c:41
clock_manager_error_code_t dbg_console_cm_callback(clock_notify_struct_t *notify, void *callbackData)
Definition: debug_console_lpm_callback.c:41
power_manager_error_code_t rtos_pm_callback(power_manager_notify_struct_t *notify, power_manager_callback_data_t *dataPtr)
Definition: rtos_lpm_callback.c:138
Definition: lpm_rtos.h:86
LPM_DEMO_RETURN
Definition: lpm_rtos.h:84