]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core/src/Ref_Trustzone.txt
Added MISRA 2012 improvements.
[cmsis] / CMSIS / DoxyGen / Core / src / Ref_Trustzone.txt
1 /**
2 \defgroup trustzone_functions TrustZone for ARMv8-M
3 \brief Functions that related to optional ARMv8-M security extension
4 \details
5 The ARMv8-M architecture has optional ARMv8-M security extension based on ARM TrustZone technology.
6 To access ARM TrustZone extensions for ARMv8-M additional CMSIS functions are provided:
7  - \ref nvic_trustzone_functions
8  - \ref systick_trustzone_functions
9  - \ref sau_trustzone_functions
10  - \ref coreregister_trustzone_functions
11
12 @{
13 */
14
15 /**
16   \defgroup nvic_trustzone_functions NVIC Functions
17   \brief Nested Vector Interrupt Controller (NVIC) functions related to TrustZone for ARMv8-M 
18   @{
19 */
20
21 /**
22   \brief   Set Priority Grouping (non-secure)
23   \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence.
24            The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
25            Only values from 0..7 are used.
26            In case of a conflict between priority grouping and available
27            priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
28   \param [in]      PriorityGroup  Priority grouping field.
29   \note    Only available for ARMv8-M Mainline. 
30   \sa     
31     - \ref NVIC_SetPriorityGrouping
32  */
33 void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup);
34
35 /**
36   \brief   Get Priority Grouping (non-secure)
37   \details Reads the priority grouping field from the non-secure NVIC when in secure state.
38   \return                Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
39   \note    Only available for ARMv8-M Mainline. 
40   \sa     
41     - \ref NVIC_GetPriorityGrouping
42  */
43 uint32_t TZ_NVIC_GetPriorityGrouping_NS(void);
44
45 /**
46   \brief   Enable External Interrupt (non-secure)
47   \details Enables a device-specific interrupt in the non-secure NVIC when in secure state.
48   \param [in]      IRQn  External interrupt number. Value cannot be negative.
49   \sa     
50     - \ref NVIC_EnableIRQ
51  */
52 void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn);
53
54
55 /**
56   \brief   Get Interrupt Enable status (non-secure)
57   \details Returns a device specific interrupt enable status from the non-secure NVIC interrupt controller when in secure state.
58   \param [in]      IRQn  Interrupt number.
59   \return             0  Interrupt is not enabled.
60   \return             1  Interrupt is enabled.
61   \sa     
62     - \ref NVIC_EnableIRQ; NVIC_DisableIRQ;
63  */
64 uint32_t TZ_NVIC_GetEnableIRQ_NS(IRQn_Type IRQn);
65
66 /**
67   \brief   Disable External Interrupt (non-secure)
68   \details Disables a device-specific interrupt in the non-secure NVIC when in secure state.
69   \param [in]      IRQn  External interrupt number. Value cannot be negative.
70   \sa     
71     - \ref NVIC_DisableIRQ
72  */
73 void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn);
74
75 /**
76   \brief   Get Pending Interrupt (non-secure)
77   \details Reads the pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified interrupt.
78   \param [in]      IRQn  Interrupt number.
79   \return             0  Interrupt status is not pending.
80   \return             1  Interrupt status is pending.
81   \sa     
82     - \ref NVIC_GetPendingIRQ
83  */
84 uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn);
85
86 /**
87   \brief   Set Pending Interrupt (non-secure)
88   \details Sets the pending bit of an non-secure external interrupt when in secure state.
89   \param [in]      IRQn  Interrupt number. Value cannot be negative.
90   \sa     
91     - \ref NVIC_SetPendingIRQ
92  */
93 void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn);
94
95 /**
96   \brief   Clear Pending Interrupt (non-secure)
97   \details Clears the pending bit of an non-secure external interrupt when in secure state.
98   \param [in]      IRQn  External interrupt number. Value cannot be negative.
99   \sa     
100     - \ref NVIC_ClearPendingIRQ
101  */
102 void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn);
103
104 /**
105   \brief   Get Active Interrupt (non-secure)
106   \details Reads the active register in non-secure NVIC when in secure state and returns the active bit.
107   \param [in]      IRQn  Interrupt number.
108   \return             0  Interrupt status is not active.
109   \return             1  Interrupt status is active.
110   \sa     
111     - \ref NVIC_GetActive
112  */
113 uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn);
114
115 /**
116   \brief   Set Interrupt Priority (non-secure)
117   \details Sets the priority of an non-secure interrupt when in secure state.
118   \note    The priority cannot be set for every core interrupt.
119   \param [in]      IRQn  Interrupt number.
120   \param [in]  priority  Priority to set.
121   \sa     
122     - \ref NVIC_SetPriority
123  */
124 void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority);
125
126 /**
127   \brief   Get Interrupt Priority (non-secure)
128   \details Reads the priority of an non-secure interrupt when in secure state.
129            The interrupt number can be positive to specify an external (device specific) interrupt,
130            or negative to specify an internal (core) interrupt.
131   \param [in]   IRQn  Interrupt number.
132   \return             Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
133   \sa     
134     - \ref NVIC_GetPriority
135  */
136 uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn);
137
138 /** close nvic_trustzone_functions
139   @}
140 */
141
142
143 /**
144   \defgroup systick_trustzone_functions SysTick Functions
145   \brief SysTick functions related to TrustZone for ARMv8-M.
146   @{
147 */
148
149 /**
150   \brief   System Tick Configuration (non-secure)
151   \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
152            Counter is in free running mode to generate periodic interrupts.
153   \param [in]  ticks  Number of ticks between two interrupts.
154   \return          0  Function succeeded.
155   \return          1  Function failed.
156   \note    When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
157            function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
158            must contain a vendor-specific implementation of this function.
159   \sa     
160     - \ref SysTick_Config
161  */
162 uint32_t TZ_SysTick_Config_NS(uint32_t ticks);
163
164 /** close systick_trustzone_functions
165   @}
166 */
167
168
169 /**
170   \defgroup sau_trustzone_functions SAU Functions
171   \brief Secure Attribution Unit (SAU) functions related to TrustZone for ARMv8-M.
172   @{
173 \details
174 The Secure Attribution Unit (SAU) functions SAU 
175
176 \note
177 A SAU is always present if the security extension is available.
178 The functionality differs if the SAU contains SAU regions.
179 If SAU regions are available is configured with the macro __SAUREGION_PRESENT (see \ref core_config_sect).
180
181  */
182
183 /**
184 \brief   Setup Secure Attribute Unit (SAU) and non-secure interrupts
185 \details 
186 The function \ref TZ_SAU_Setup uses the settings in the \ref partition_h_pg to initialize
187 the Secure Attribute Unit (SAU) and define non-secure interrupts.  It is called from
188 the function \ref SystemInit.
189  */
190 void TZ_SAU_Setup (void);
191
192 /**
193   \brief   Enable Security Attribution Unit (SAU)
194   \details Enables the Security Attribution Unit (SAU).
195  */
196 void TZ_SAU_Enable(void);
197
198 /**
199   \brief   Disable Security Attribution Unit (SAU)
200   \details Disables the Security Attribution Unit (SAU).
201  */
202 void TZ_SAU_Disable(void);
203
204 /** close sau_trustzone_functions
205   @}
206 */
207
208
209 /**
210   \defgroup coreregister_trustzone_functions Core Register Access Functions
211   \brief Core register Access functions related to TrustZone for ARMv8-M .
212   @{
213 */
214
215 /**
216   \brief   Get Control register (non-secure)
217   \details Returns the content of the non-secure Control register when in secure mode.
218   \return               non-secure Control register value
219   \sa     
220     - \ref __get_CONTROL; CONTROL_Type 
221  */
222 uint32_t __TZ_get_CONTROL_NS(void);
223
224 /**
225   \brief   Set Control register (non-secure)
226   \details Writes the given value to the non-secure Control register when in secure state.
227   \param [in]    control  Control register value to set
228   \sa     
229     - \ref __set_CONTROL; CONTROL_Type 
230  */
231 void __TZ_set_CONTROL_NS(uint32_t control);
232
233 /**
234   \brief   Get Process Stack Pointer (non-secure)
235   \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
236   \return               PSP register value
237   \sa     
238     - \ref __get_PSP
239  */
240 uint32_t __TZ_get_PSP_NS(void);
241
242 /**
243   \brief   Set Process Stack Pointer (non-secure)
244   \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
245   \param [in]    topOfProcStack  Process Stack Pointer value to set
246   \sa     
247     - \ref __set_PSP
248  */
249 void __TZ_set_PSP_NS(uint32_t topOfProcStack);
250
251 /**
252   \brief   Get Main Stack Pointer (non-secure)
253   \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
254   \return               MSP register value
255   \sa     
256     - \ref __get_MSP
257  */
258 uint32_t __TZ_get_MSP_NS(void);
259
260 /**
261   \brief   Set Main Stack Pointer (non-secure)
262   \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
263   \param [in]    topOfMainStack  Main Stack Pointer value to set
264   \sa     
265     - \ref __set_MSP
266  */
267 void __TZ_set_MSP_NS(uint32_t topOfMainStack);
268
269 /**
270   \brief   Get Priority Mask (non-secure)
271   \details Returns the current state of the non-secure priority mask bit from the Priority Mask register when in secure state.
272   \return               Priority Mask value
273   \sa     
274     - \ref __get_PRIMASK
275  */
276 uint32_t __TZ_get_PRIMASK_NS(void);
277
278 /**
279   \brief   Set Priority Mask (non-secure)
280   \details Assigns the given value to the non-secure Priority Mask register when in secure state.
281   \param [in]    priMask  Priority Mask
282   \sa     
283     - \ref __set_PRIMASK
284  */
285 void __TZ_set_PRIMASK_NS(uint32_t priMask);
286
287 /**
288   \brief   Get Base Priority (non-secure)
289   \details Returns the current value of the non-secure Base Priority register when in secure state.
290   \return               Base Priority register value
291   \sa     
292     - \ref __get_BASEPRI
293  */
294 uint32_t __TZ_get_BASEPRI_NS(void);
295
296 /**
297   \brief   Set Base Priority (non-secure)
298   \details Assigns the given value to the non-secure Base Priority register when in secure state.
299   \param [in]    basePri  Base Priority value to set
300   \sa     
301     - \ref __set_BASEPRI
302  */
303 void __TZ_set_BASEPRI_NS(uint32_t basePri);
304
305 /**
306   \brief   Get Fault Mask (non-secure)
307   \details Returns the current value of the non-secure Fault Mask register when in secure state.
308   \return               Fault Mask register value
309   \sa     
310     - \ref __get_FAULTMASK
311  */
312 uint32_t __TZ_get_FAULTMASK_NS(void);
313
314 /**
315   \brief   Set Fault Mask (non-secure)
316   \details Assigns the given value to the non-secure Fault Mask register when in secure state.
317   \param [in]    faultMask  Fault Mask value to set
318   \sa     
319     - \ref __set_FAULTMASK
320  */
321 void __TZ_set_FAULTMASK_NS(uint32_t faultMask);
322
323 /**
324   \brief   Get Process Stack Pointer Limit (non-secure)
325   \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
326   \return               PSPLIM register value
327   \note    Only available for ARMv8-M Mainline. 
328  */
329 uint32_t __TZ_get_PSPLIM_NS(void);
330
331 /**
332   \brief   Set Process Stack Pointer (non-secure)
333   \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
334   \param [in]    ProcStackPtrLimit  Process Stack Pointer Limit value to set
335   \note    Only available for ARMv8-M Mainline. 
336  */
337 void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit);
338
339 /**
340   \brief   Get Main Stack Pointer Limit (non-secure)
341   \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
342   \return               MSPLIM register value
343   \note    Only available for ARMv8-M Mainline. 
344  */
345 uint32_t __TZ_get_MSPLIM_NS(void);
346
347 /**
348   \brief   Set Main Stack Pointer Limit (non-secure)
349   \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
350   \param [in]    MainStackPtrLimit  Main Stack Pointer value to set
351   \note    Only available for ARMv8-M Mainline. 
352  */
353 void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit);
354
355 /** close coreregister_trustzone_functions
356   @}
357 */
358
359
360 /** close trustzone_functions
361 @}
362 */