1 /*
2 * Copyright (c) 2011-2015, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 /** ============================================================================
33 * @file _IpcPower.h
34 * ============================================================================
35 */
37 #ifndef ti_pm__IpcPower__include
38 #define ti_pm__IpcPower__include
40 #if defined (__cplusplus)
41 extern "C" {
42 #endif
45 /* =============================================================================
46 * Structures & Definitions
47 * =============================================================================
48 */
50 #define MIRQ34_SHIFT 2
51 #define MIRQ37_SHIFT 5
52 #define MIRQ38_SHIFT 6
53 #define MIRQ39_SHIFT 7
55 /*
56 * First 16 interrupts are internal interrupts only and do not
57 * have WUGEN bits, and a WUGEN event register can accomodate
58 * 32 interrupts, with one per bit. So IRQs 17 to 48 are programmed
59 * in EVT0 register and IRQs 49 to 80 are programmed in EVT0
60 * register.
61 */
62 #define MIRQ_SHIFT(irq) (((irq) - 16) % 32)
63 #define IRQWAKEEN_SHIFT(irq) (((irq) - 32) % 32)
65 #define MBX_INT 50
66 #define GPT3_INT 53
67 #define GPT4_INT 54
68 #define GPT9_INT 55
69 #define GPT11_INT 56
70 #define MBX6_U1_INT 66
72 #define DSP_GPT5_INT 67
73 #define DSP_GPT6_INT 68
74 #define DSP_MBX_INT 57
76 #define WUGEN_MAILBOX_BIT (1 << MIRQ34_SHIFT)
77 #define WUGEN_GPT3_BIT (1 << MIRQ37_SHIFT)
78 #define WUGEN_GPT4_BIT (1 << MIRQ38_SHIFT)
79 #define WUGEN_GPT9_BIT (1 << MIRQ39_SHIFT)
81 #define WUGEN_GPT11_BIT (1 << MIRQ_SHIFT(GPT11_INT))
82 #define WUGEN_MBX6_U1_BIT (1 << MIRQ_SHIFT(MBX6_U1_INT))
84 #define DSP_SYS_IRQWAKEEN_GPT5_BIT (1 << IRQWAKEEN_SHIFT(DSP_GPT5_INT))
85 #define DSP_SYS_IRQWAKEEN_GPT6_BIT (1 << IRQWAKEEN_SHIFT(DSP_GPT6_INT))
86 #define DSP1_SYS_IRQWAKEEN_MBX5_U0_BIT (1 << IRQWAKEEN_SHIFT(DSP_MBX_INT))
87 #define DSP2_SYS_IRQWAKEEN_MBX6_U0_BIT (1 << IRQWAKEEN_SHIFT(DSP_MBX_INT))
89 /* Wake-up masks for interrupts 00-31 */
90 #define WUGEN_MEVT0 0x4000100C
91 /* Wake-up masks for interrupts 32-63 */
92 #define WUGEN_MEVT1 0x40001010
93 /* Wake-up masks for interrupts 32-63 */
94 #define DSP_SYS_IRQWAKEEN0 0x01D00020
95 /* Wake-up masks for interrupts 64-95 */
96 #define DSP_SYS_IRQWAKEEN1 0x01D00024
98 /* Enable Mailbox, GPT3, and GPT4 interrupts as Wakeup sources */
99 #define OMAP_IPU_WUGEN_INT_MASK0 0
100 #define OMAP_IPU_WUGEN_INT_MASK1 (WUGEN_MAILBOX_BIT | \
101 WUGEN_GPT3_BIT | \
102 WUGEN_GPT4_BIT)
103 #define VAYU_IPU2_WUGEN_INT_MASK0 0
104 #define VAYU_IPU2_WUGEN_INT_MASK1 (WUGEN_GPT3_BIT | \
105 WUGEN_MBX6_U1_BIT)
106 #define VAYU_IPU1_WUGEN_INT_MASK0 0
107 #define VAYU_IPU1_WUGEN_INT_MASK1 (WUGEN_GPT11_BIT | \
108 WUGEN_MBX6_U1_BIT)
109 #define VAYU_DSP1_WUGEN_INT_MASK0 (DSP1_SYS_IRQWAKEEN_MBX5_U0_BIT)
110 #define VAYU_DSP1_WUGEN_INT_MASK1 (DSP_SYS_IRQWAKEEN_GPT5_BIT)
111 #define VAYU_DSP2_WUGEN_INT_MASK0 (DSP2_SYS_IRQWAKEEN_MBX6_U0_BIT)
112 #define VAYU_DSP2_WUGEN_INT_MASK1 (DSP_SYS_IRQWAKEEN_GPT6_BIT)
114 #define M3_SCR_REG 0xE000ED10
116 #define SLEEPONEXIT_BIT 1
117 #define DEEPSLEEP_BIT 2
118 #define SEVONPEND_BIT 4
120 /* User registered functions storage element */
121 typedef struct IpcPower_CallbackElem {
122 IpcPower_Event event;
123 IpcPower_CallbackFuncPtr callback;
124 Ptr data;
125 struct IpcPower_CallbackElem *next;
126 } IpcPower_CallbackElem;
128 /* Pre-suspend function managing user callbacks */
129 Void IpcPower_preSuspend(Void);
131 /* Post-suspend function managing user callbacks */
132 Void IpcPower_postResume(Void);
134 #if defined (__cplusplus)
135 }
136 #endif /* defined (__cplusplus) */
138 #endif /* ti_ipc__IpcPower__include */