Skip to content

Commit 5175ae9

Browse files
committed
[ARC32] add missing includes
1 parent 3e4915e commit 5175ae9

File tree

6 files changed

+3779
-0
lines changed

6 files changed

+3779
-0
lines changed

src/include/arc32/power_states.h

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* Copyright (c) 2016, Intel Corporation
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 are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice,
9+
* this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation
12+
* and/or other materials provided with the distribution.
13+
* 3. Neither the name of the Intel Corporation nor the names of its
14+
* contributors may be used to endorse or promote products derived from this
15+
* software without specific prior written permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
* ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL CORPORATION OR CONTRIBUTORS BE
21+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27+
* POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
#ifndef __POWER_STATES_H__
31+
#define __POWER_STATES_H__
32+
33+
/**
34+
* SoC Power mode control for Quark SE Microcontrollers.
35+
*
36+
* Available SoC states are:
37+
* - Low Power Sensing Standby (LPSS)
38+
* - Sleep
39+
*
40+
* LPSS can only be enabled from the Sensor core,
41+
* refer to @ref ss_power_soc_lpss_enable for further details.
42+
*
43+
* @defgroup groupSoCPower Quark SE SoC Power states
44+
* @{
45+
*/
46+
47+
/**
48+
* Enter SoC sleep state.
49+
*
50+
* Put the SoC into sleep state until next SoC wake event.
51+
*
52+
* - Core well is turned off
53+
* - Always on well is on
54+
* - Hybrid Clock is off
55+
* - RTC Clock is on
56+
*
57+
* Possible SoC wake events are:
58+
* - Low Power Comparator Interrupt
59+
* - AON GPIO Interrupt
60+
* - AON Timer Interrupt
61+
* - RTC Interrupt
62+
*/
63+
void power_soc_sleep(void);
64+
65+
/**
66+
* Enter SoC deep sleep state.
67+
*
68+
* Put the SoC into deep sleep state until next SoC wake event.
69+
*
70+
* - Core well is turned off
71+
* - Always on well is on
72+
* - Hybrid Clock is off
73+
* - RTC Clock is on
74+
*
75+
* Possible SoC wake events are:
76+
* - Low Power Comparator Interrupt
77+
* - AON GPIO Interrupt
78+
* - AON Timer Interrupt
79+
* - RTC Interrupt
80+
*
81+
* This function puts 1P8V regulators and 3P3V into Linear Mode.
82+
*/
83+
void power_soc_deep_sleep(void);
84+
85+
/**
86+
* @}
87+
*/
88+
89+
#endif /* __POWER_STATES_H__ */
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
/*
2+
* Copyright (c) 2016, Intel Corporation
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 are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice,
9+
* this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation
12+
* and/or other materials provided with the distribution.
13+
* 3. Neither the name of the Intel Corporation nor the names of its
14+
* contributors may be used to endorse or promote products derived from this
15+
* software without specific prior written permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
* ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL CORPORATION OR CONTRIBUTORS BE
21+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27+
* POSSIBILITY OF SUCH DAMAGE.
28+
*/
29+
30+
#ifndef __QM_INTERRUPT_ROUTER_REGS_H__
31+
#define __QM_INTERRUPT_ROUTER_REGS_H__
32+
33+
/**
34+
* Quark SE SoC Event Router registers.
35+
*
36+
* @defgroup groupQUARKSESEEVENTROUTER SoC Event Router (SE)
37+
* @{
38+
*/
39+
40+
/**
41+
* Masks for single source interrupts in the Event Router.
42+
* To enable: reg &= ~(MASK)
43+
* To disable: reg |= MASK;
44+
*/
45+
#define QM_IR_INT_LMT_MASK BIT(0)
46+
#define QM_IR_INT_SS_MASK BIT(8)
47+
48+
/* Masks for single source halts in the Event Router. */
49+
#define QM_IR_INT_LMT_HALT_MASK BIT(16)
50+
#define QM_IR_INT_SS_HALT_MASK BIT(24)
51+
52+
/* Event Router Unmask interrupts for a peripheral. */
53+
#define QM_IR_UNMASK_LMT_INTERRUPTS(_peripheral_) \
54+
(_peripheral_ &= ~(QM_IR_INT_LMT_MASK))
55+
#define QM_IR_UNMASK_SS_INTERRUPTS(_peripheral_) \
56+
(_peripheral_ &= ~(QM_IR_INT_SS_MASK))
57+
58+
/* Mask interrupts for a peripheral. */
59+
#define QM_IR_MASK_LMT_INTERRUPTS(_peripheral_) \
60+
(_peripheral_ |= QM_IR_INT_LMT_MASK)
61+
#define QM_IR_MASK_SS_INTERRUPTS(_peripheral_) \
62+
(_peripheral_ |= QM_IR_INT_SS_MASK)
63+
64+
/* Unmask halt for a peripheral. */
65+
#define QM_IR_UNMASK_LMT_HALTS(_peripheral_) \
66+
(_peripheral_ &= ~(QM_IR_INT_LMT_HALT_MASK))
67+
#define QM_IR_UNMASK_SS_HALTS(_peripheral_) \
68+
(_peripheral_ &= ~(QM_IR_INT_SS_HALT_MASK))
69+
70+
/* Mask halt for a peripheral. */
71+
#define QM_IR_MASK_LMT_HALTS(_peripheral_) \
72+
(_peripheral_ |= QM_IR_INT_LMT_HALT_MASK)
73+
#define QM_IR_MASK_SS_HALTS(_peripheral_) \
74+
(_peripheral_ |= QM_IR_INT_SS_HALT_MASK)
75+
76+
#define QM_IR_GET_LMT_MASK(_peripheral_) (_peripheral_ & QM_IR_INT_LMT_MASK)
77+
#define QM_IR_GET_LMT_HALT_MASK(_peripheral_) \
78+
(_peripheral_ & QM_IR_INT_LMT_HALT_MASK)
79+
80+
#define QM_IR_GET_SS_MASK(_peripheral_) (_peripheral_ & QM_IR_INT_SS_MASK)
81+
#define QM_IR_GET_SS_HALT_MASK(_peripheral_) \
82+
(_peripheral_ & QM_IR_INT_SS_HALT_MASK)
83+
84+
/* Define macros for use by the active core. */
85+
#if (QM_LAKEMONT)
86+
#define QM_IR_UNMASK_INTERRUPTS(_peripheral_) \
87+
QM_IR_UNMASK_LMT_INTERRUPTS(_peripheral_)
88+
#define QM_IR_MASK_INTERRUPTS(_peripheral_) \
89+
QM_IR_MASK_LMT_INTERRUPTS(_peripheral_)
90+
#define QM_IR_UNMASK_HALTS(_peripheral_) QM_IR_UNMASK_LMT_HALTS(_peripheral_)
91+
#define QM_IR_MASK_HALTS(_peripheral_) QM_IR_MASK_LMT_HALTS(_peripheral_)
92+
93+
#define QM_IR_INT_MASK QM_IR_INT_LMT_MASK
94+
#define QM_IR_INT_HALT_MASK QM_IR_INT_LMT_HALT_MASK
95+
#define QM_IR_GET_MASK(_peripheral_) QM_IR_GET_LMT_MASK(_peripheral_)
96+
#define QM_IR_GET_HALT_MASK(_peripheral_) QM_IR_GET_LMT_HALT_MASK(_peripheral_)
97+
98+
#elif(QM_SENSOR)
99+
#define QM_IR_UNMASK_INTERRUPTS(_peripheral_) \
100+
QM_IR_UNMASK_SS_INTERRUPTS(_peripheral_)
101+
#define QM_IR_MASK_INTERRUPTS(_peripheral_) \
102+
QM_IR_MASK_SS_INTERRUPTS(_peripheral_)
103+
#define QM_IR_UNMASK_HALTS(_peripheral_) QM_IR_UNMASK_SS_HALTS(_peripheral_)
104+
#define QM_IR_MASK_HALTS(_peripheral_) QM_IR_MASK_SS_HALTS(_peripheral_)
105+
106+
#define QM_IR_INT_MASK QM_IR_INT_SS_MASK
107+
#define QM_IR_INT_HALT_MASK QM_IR_INT_SS_HALT_MASK
108+
#define QM_IR_GET_MASK(_peripheral_) QM_IR_GET_SS_MASK(_peripheral_)
109+
#define QM_IR_GET_HALT_MASK(_peripheral_) QM_IR_GET_SS_HALT_MASK(_peripheral_)
110+
#else
111+
#error "No active core selected."
112+
#endif
113+
114+
/** SS I2C Interrupt register map. */
115+
typedef struct {
116+
QM_RW uint32_t err_mask;
117+
QM_RW uint32_t rx_avail_mask;
118+
QM_RW uint32_t tx_req_mask;
119+
QM_RW uint32_t stop_det_mask;
120+
} int_ss_i2c_reg_t;
121+
122+
/** SS SPI Interrupt register map. */
123+
typedef struct {
124+
QM_RW uint32_t err_int_mask;
125+
QM_RW uint32_t rx_avail_mask;
126+
QM_RW uint32_t tx_req_mask;
127+
} int_ss_spi_reg_t;
128+
129+
/** Interrupt register map. */
130+
typedef struct {
131+
QM_RW uint32_t ss_adc_0_error_int_mask; /**< Sensor ADC 0 Error. */
132+
QM_RW uint32_t ss_adc_0_int_mask; /**< Sensor ADC 0. */
133+
QM_RW uint32_t ss_gpio_0_int_mask; /**< Sensor GPIO 0. */
134+
QM_RW uint32_t ss_gpio_1_int_mask; /**< Sensor GPIO 1. */
135+
int_ss_i2c_reg_t ss_i2c_0_int; /**< Sensor I2C 0 Masks. */
136+
int_ss_i2c_reg_t ss_i2c_1_int; /**< Sensor I2C 1 Masks. */
137+
int_ss_spi_reg_t ss_spi_0_int; /**< Sensor SPI 0 Masks. */
138+
int_ss_spi_reg_t ss_spi_1_int; /**< Sensor SPI 1 Masks. */
139+
QM_RW uint32_t i2c_master_0_int_mask; /**< I2C Master 0. */
140+
QM_RW uint32_t i2c_master_1_int_mask; /**< I2C Master 1. */
141+
QM_R uint32_t reserved;
142+
QM_RW uint32_t spi_master_0_int_mask; /**< SPI Master 0. */
143+
QM_RW uint32_t spi_master_1_int_mask; /**< SPI Master 1. */
144+
QM_RW uint32_t spi_slave_0_int_mask; /**< SPI Slave 0. */
145+
QM_RW uint32_t uart_0_int_mask; /**< UART 0. */
146+
QM_RW uint32_t uart_1_int_mask; /**< UART 1. */
147+
QM_RW uint32_t i2s_0_int_mask; /**< I2S 0. */
148+
QM_RW uint32_t gpio_0_int_mask; /**< GPIO 0. */
149+
QM_RW uint32_t pwm_0_int_mask; /**< PWM 0. */
150+
QM_RW uint32_t usb_0_int_mask; /**< USB 0. */
151+
QM_RW uint32_t rtc_0_int_mask; /**< RTC 0. */
152+
QM_RW uint32_t wdt_0_int_mask; /**< WDT 0. */
153+
QM_RW uint32_t dma_0_int_0_mask; /**< DMA 0 Ch 0. */
154+
QM_RW uint32_t dma_0_int_1_mask; /**< DMA 0 Ch 1. */
155+
QM_RW uint32_t dma_0_int_2_mask; /**< DMA 0 Ch 2. */
156+
QM_RW uint32_t dma_0_int_3_mask; /**< DMA 0 Ch 3. */
157+
QM_RW uint32_t dma_0_int_4_mask; /**< DMA 0 Ch 4. */
158+
QM_RW uint32_t dma_0_int_5_mask; /**< DMA 0 Ch 5. */
159+
QM_RW uint32_t dma_0_int_6_mask; /**< DMA 0 Ch 6. */
160+
QM_RW uint32_t dma_0_int_7_mask; /**< DMA 0 Ch 7. */
161+
/** Mailbox 0 Combined 8 Channel Host and Sensor Masks. */
162+
QM_RW uint32_t mailbox_0_int_mask;
163+
/** Comparator Sensor Halt Mask. */
164+
QM_RW uint32_t comparator_0_ss_halt_int_mask;
165+
/** Comparator Host Halt Mask. */
166+
QM_RW uint32_t comparator_0_host_halt_int_mask;
167+
/** Comparator Sensor Mask. */
168+
QM_RW uint32_t comparator_0_ss_int_mask;
169+
/** Comparator Host Mask. */
170+
QM_RW uint32_t comparator_0_host_int_mask;
171+
QM_RW uint32_t host_bus_error_int_mask; /**< Host bus error. */
172+
QM_RW uint32_t dma_0_error_int_mask; /**< DMA 0 Error. */
173+
QM_RW uint32_t sram_mpr_0_int_mask; /**< SRAM MPR 0. */
174+
QM_RW uint32_t flash_mpr_0_int_mask; /**< Flash MPR 0. */
175+
QM_RW uint32_t flash_mpr_1_int_mask; /**< Flash MPR 1. */
176+
QM_RW uint32_t aonpt_0_int_mask; /**< AONPT 0. */
177+
QM_RW uint32_t adc_0_pwr_int_mask; /**< ADC 0 PWR. */
178+
QM_RW uint32_t adc_0_cal_int_mask; /**< ADC 0 CAL. */
179+
QM_RW uint32_t aon_gpio_0_int_mask; /**< AON GPIO 0. */
180+
QM_RW uint32_t lock_int_mask_reg; /**< Interrupt Mask Lock Register. */
181+
} qm_interrupt_router_reg_t;
182+
183+
/* Number of SCSS interrupt mask registers (excluding mask lock register). */
184+
#define QM_INTERRUPT_ROUTER_MASK_NUMREG \
185+
((sizeof(qm_interrupt_router_reg_t) / sizeof(uint32_t)) - 1)
186+
187+
/* Default POR SCSS interrupt mask (all interrupts masked). */
188+
#define QM_INTERRUPT_ROUTER_MASK_DEFAULT (0xFFFFFFFF)
189+
190+
#if (UNIT_TEST)
191+
qm_interrupt_router_reg_t test_interrupt_router;
192+
#define QM_INTERRUPT_ROUTER \
193+
((qm_interrupt_router_reg_t *)(&test_interrupt_router))
194+
195+
#else
196+
/* System control subsystem interrupt masking register block. */
197+
#define QM_INTERRUPT_ROUTER_BASE (0xB0800400)
198+
#define QM_INTERRUPT_ROUTER \
199+
((qm_interrupt_router_reg_t *)QM_INTERRUPT_ROUTER_BASE)
200+
#endif
201+
202+
#define QM_IR_DMA_ERROR_HOST_MASK (0x000000FF)
203+
#define QM_IR_DMA_ERROR_SS_MASK (0x0000FF00)
204+
205+
/** @} */
206+
207+
#endif /* __QM_INTERRUPT_ROUTER_REGS_H__ */

0 commit comments

Comments
 (0)