Intel® Quark™ Microcontroller Software Interface 1.4.0 Intel® Quark™ Microcontroller BSP

- Main Page
- Modules
- Data Structures
- Files

- File List

ss_init.c
1 /*
2 * {% copyright %}
3 */
4
5 #include "ss_init.h"
6 #include "qm_mpr.h"
7
8 /* Sensor Subsystem application's pointer to the entry point (Flash0) */
9 #define SS_APP_PTR_ADDR (0x40000000)
10
11 #if (UNIT_TEST)
12 uint32_t __sensor_reset_vector[1];
13 #else
14 extern uint32_t __sensor_reset_vector[];
15 #endif
16
17 /* Set-up an MPR to protect ARC IVT (only ARC will have access to it). */
18 static void sensor_vectors_protect(void)
19 {
20 /*
21 * MPR config:
22 * - Enable and lock MPR
23 * - Allow R/W access to ARC only
24 * - Protect first kB of SRAM (i.e., where ARC IVT is located)
25 */
26 static const qm_mpr_config_t cfg = {
27 .en_lock_mask =
28 QM_SRAM_MPR_EN_MASK_ENABLE | QM_SRAM_MPR_EN_MASK_LOCK,
29 .agent_read_en_mask = QM_SRAM_MPR_AGENT_MASK_SS,
30 .agent_write_en_mask = QM_SRAM_MPR_AGENT_MASK_SS,
31 .up_bound = 0,
32 .low_bound = 0,
33 };
34 qm_mpr_set_config(QM_MPR_1, &cfg);
35 }
36
37 void sensor_activation(void)
38 {
39 /* Write the ARC reset vector.
40 *
41 * The ARC reset vector is in SRAM. The first 4 bytes of the Sensor
42 * Subsystem Flash partition point to the application entry point
43 * (pointer located at SS_APP_PTR_ADDR).
44 * Write the pointer to the application entry point into the reset
45 * vector.
46 */
47 volatile uint32_t *ss_reset_vector = __sensor_reset_vector;
48 volatile uint32_t *sensor_startup = (uint32_t *)SS_APP_PTR_ADDR;
49
50 *ss_reset_vector = *sensor_startup;
51
52 /* Set up an MPR to protect ARC IVT from other agents. */
53 sensor_vectors_protect();
54
55 /* Request ARC Run */
56 QM_SCSS_SS->ss_cfg |= QM_SS_CFG_ARC_RUN_REQ_A;
57 }
qm_mpr_set_config
int qm_mpr_set_config(const qm_mpr_id_t id, const qm_mpr_config_t *const cfg)
Configure SRAM controller's Memory Protection Region.
Definition: qm_mpr.c:24
qm_mpr_config_t::en_lock_mask
uint8_t en_lock_mask
Enable/lock bitmask.
Definition: qm_mpr.h:35
sensor_activation
void sensor_activation(void)
Initialise the sensor subsystem.
Definition: ss_init.c:37
qm_mpr_config_t
SRAM Memory Protection Region configuration type.
Definition: qm_mpr.h:34
QM_MPR_1
Memory Protection Region 1.
Definition: qm_soc_regs.h:1288