Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
tz-target-cfg.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017-2019 Arm Limited
3
* Copyright (c) 2020 Nordic Semiconductor ASA
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
/* This file has been modified for use in the Contiki-NG operating system. */
19
20
#ifndef __TZ_TARGET_CFG_H__
21
#define __TZ_TARGET_CFG_H__
22
23
/**
24
* \file tz-target-cfg.h
25
* \brief nRF5340 target configuration header
26
*
27
* This file contains the platform specific functions to configure
28
* the Cortex-M33 core, memory permissions and security attribution
29
* on the nRF5340 platform.
30
*
31
* Memory permissions and security attribution are configured via
32
* the System Protection Unit (SPU) which is the nRF specific Implementation
33
* Defined Attribution Unit (IDAU).
34
*/
35
36
/**
37
* \brief A convenient struct to include all required Non-Secure state configuration.
38
*/
39
typedef
struct
tz_nonsecure_setup_conf
{
40
uint32_t msp_ns;
41
uint32_t psp_ns;
42
uint32_t vtor_ns;
43
struct
{
44
uint32_t npriv : 1;
45
uint32_t spsel : 1;
46
uint32_t reserved : 30;
47
} control_ns;
48
}
tz_nonsecure_setup_conf_t
;
49
50
/**
51
* \brief Configure nonsecure vtor offset
52
*/
53
void
configure_nonsecure_vtor_offset
(uint32_t vtor_ns);
54
55
/**
56
* \brief Store the addresses of memory regions
57
*/
58
struct
memory_region_limits
{
59
uint32_t non_secure_code_start;
60
uint32_t non_secure_partition_base;
61
uint32_t non_secure_partition_limit;
62
uint32_t veneer_base;
63
uint32_t veneer_limit;
64
#ifdef BL2
65
uint32_t secondary_partition_base;
66
uint32_t secondary_partition_limit;
67
#endif
/* BL2 */
68
};
69
70
/**
71
* \brief Holds the data necessary to do isolation for a specific peripheral.
72
*/
73
struct
platform_data_t
{
74
uint32_t periph_start;
75
uint32_t periph_limit;
76
};
77
78
/**
79
* \brief Configures peripheral permissions via the System Protection Unit.
80
*
81
* The function does the following:
82
* - grants Non-Secure access to nRF peripherals that are not Secure-only
83
* - grants Non-Secure access to DDPI channels
84
* - grants Non-Secure access to GPIO pins
85
*/
86
void
spu_periph_init_cfg
(
void
);
87
88
/**
89
* \brief Setup nonsecure state
90
*/
91
void
tz_nonsecure_state_setup
(
const
tz_nonsecure_setup_conf_t
*p_ns_conf);
92
93
/**
94
* \brief Restrict access to peripheral to secure
95
*/
96
void
spu_periph_configure_to_secure
(uint32_t periph_num);
97
98
/**
99
* \brief Allow non-secure access to peripheral
100
*/
101
void
spu_periph_configure_to_non_secure
(uint32_t periph_num);
102
103
/**
104
* \brief Configures the NRF_UARTE0 non-secure
105
*/
106
void
spu_periph_config_uarte
(
void
);
107
108
/**
109
* \brief Configures SAU and IDAU.
110
*/
111
void
sau_and_idau_cfg
(
void
);
112
113
/**
114
* \brief Configure rom, ram and peripherials non-secure
115
*/
116
void
non_secure_configuration
(
void
);
117
118
/**
119
* \brief Enables the fault handlers and sets priorities.
120
*/
121
void
enable_fault_handlers
(
void
);
122
123
/**
124
* \brief Configures the system reset request properties
125
*/
126
void
system_reset_cfg
(
void
);
127
128
/**
129
* \brief Configures all external interrupts to target the
130
* NS state, apart for the ones associated to secure
131
* peripherals (plus SPU)
132
*/
133
void
nvic_interrupt_target_state_cfg
(
void
);
134
135
/**
136
* \brief This function enable the interrupts associated
137
* to the secure peripherals (plus the isolation boundary violation
138
* interrupts)
139
*/
140
void
nvic_interrupt_enable
(
void
);
141
142
/**
143
* \brief Report and clear any SPU violation captured by the previous
144
* boot's SPU_IRQHandler. Should be called early in secure
145
* initialization to surface the cause of an unexpected reset.
146
*/
147
void
spu_report_violation
(
void
);
148
149
#endif
/* __TZ_TARGET_CFG_H__ */
memory_region_limits
Store the addresses of memory regions.
Definition
tz-target-cfg.h:58
platform_data_t
Holds the data necessary to do isolation for a specific peripheral.
Definition
tz-target-cfg.h:73
tz_nonsecure_setup_conf
A convenient struct to include all required Non-Secure state configuration.
Definition
tz-target-cfg.h:39
spu_periph_configure_to_secure
void spu_periph_configure_to_secure(uint32_t periph_num)
Restrict access to peripheral to secure.
Definition
tz-target-cfg.c:392
spu_periph_init_cfg
void spu_periph_init_cfg(void)
Configures peripheral permissions via the System Protection Unit.
Definition
tz-target-cfg.c:198
system_reset_cfg
void system_reset_cfg(void)
Configures the system reset request properties.
Definition
tz-target-cfg.c:65
spu_periph_config_uarte
void spu_periph_config_uarte(void)
Configures the NRF_UARTE0 non-secure.
Definition
tz-target-cfg.c:404
tz_nonsecure_state_setup
void tz_nonsecure_state_setup(const tz_nonsecure_setup_conf_t *p_ns_conf)
Setup nonsecure state.
Definition
tz-target-cfg.c:461
spu_periph_configure_to_non_secure
void spu_periph_configure_to_non_secure(uint32_t periph_num)
Allow non-secure access to peripheral.
Definition
tz-target-cfg.c:398
sau_and_idau_cfg
void sau_and_idau_cfg(void)
Configures SAU and IDAU.
Definition
tz-target-cfg.c:188
configure_nonsecure_vtor_offset
void configure_nonsecure_vtor_offset(uint32_t vtor_ns)
Configure nonsecure vtor offset.
Definition
tz-target-cfg.c:425
non_secure_configuration
void non_secure_configuration(void)
Configure rom, ram and peripherials non-secure.
Definition
tz-target-cfg.c:413
tz_nonsecure_setup_conf_t
struct tz_nonsecure_setup_conf tz_nonsecure_setup_conf_t
A convenient struct to include all required Non-Secure state configuration.
nvic_interrupt_target_state_cfg
void nvic_interrupt_target_state_cfg(void)
Configures all external interrupts to target the NS state, apart for the ones associated to secure pe...
Definition
tz-target-cfg.c:80
nvic_interrupt_enable
void nvic_interrupt_enable(void)
This function enable the interrupts associated to the secure peripherals (plus the isolation boundary...
Definition
tz-target-cfg.c:120
enable_fault_handlers
void enable_fault_handlers(void)
Enables the fault handlers and sets priorities.
Definition
tz-target-cfg.c:55
spu_report_violation
void spu_report_violation(void)
Report and clear any SPU violation captured by the previous boot's SPU_IRQHandler.
Definition
tz-target-cfg.c:154
arch
cpu
nrf
nrf5340
tz-target-cfg.h
Generated on
for Contiki-NG by
1.17.0