2 \defgroup trustzone_functions TrustZone for ARMv8-M
\r
3 \brief Functions that related to optional ARMv8-M security extension
\r
5 The ARMv8-M architecture has optional ARMv8-M security extension based on ARM TrustZone technology.
\r
6 To access ARM TrustZone extensions for ARMv8-M additional CMSIS functions are provided:
\r
7 - \ref nvic_trustzone_functions
\r
8 - \ref systick_trustzone_functions
\r
9 - \ref sau_trustzone_functions
\r
10 - \ref coreregister_trustzone_functions
\r
16 \defgroup nvic_trustzone_functions NVIC Functions
\r
17 \brief Nested Vector Interrupt Controller (NVIC) functions related to TrustZone for ARMv8-M
\r
22 \brief Set Priority Grouping (non-secure)
\r
23 \details Sets the non-secure priority grouping field when in secure state using the required unlock sequence.
\r
24 The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field.
\r
25 Only values from 0..7 are used.
\r
26 In case of a conflict between priority grouping and available
\r
27 priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set.
\r
28 \param [in] PriorityGroup Priority grouping field.
\r
29 \note Only available for ARMv8-M Mainline.
\r
31 - \ref NVIC_SetPriorityGrouping
\r
33 void TZ_NVIC_SetPriorityGrouping_NS(uint32_t PriorityGroup);
\r
36 \brief Get Priority Grouping (non-secure)
\r
37 \details Reads the priority grouping field from the non-secure NVIC when in secure state.
\r
38 \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field).
\r
39 \note Only available for ARMv8-M Mainline.
\r
41 - \ref NVIC_GetPriorityGrouping
\r
43 uint32_t TZ_NVIC_GetPriorityGrouping_NS(void);
\r
46 \brief Enable External Interrupt (non-secure)
\r
47 \details Enables a device-specific interrupt in the non-secure NVIC when in secure state.
\r
48 \param [in] IRQn External interrupt number. Value cannot be negative.
\r
50 - \ref NVIC_EnableIRQ
\r
52 void TZ_NVIC_EnableIRQ_NS(IRQn_Type IRQn);
\r
55 \brief Disable External Interrupt (non-secure)
\r
56 \details Disables a device-specific interrupt in the non-secure NVIC when in secure state.
\r
57 \param [in] IRQn External interrupt number. Value cannot be negative.
\r
59 - \ref NVIC_DisableIRQ
\r
61 void TZ_NVIC_DisableIRQ_NS(IRQn_Type IRQn);
\r
64 \brief Get Pending Interrupt (non-secure)
\r
65 \details Reads the pending register in the non-secure NVIC when in secure state and returns the pending bit for the specified interrupt.
\r
66 \param [in] IRQn Interrupt number.
\r
67 \return 0 Interrupt status is not pending.
\r
68 \return 1 Interrupt status is pending.
\r
70 - \ref NVIC_GetPendingIRQ
\r
72 uint32_t TZ_NVIC_GetPendingIRQ_NS(IRQn_Type IRQn);
\r
75 \brief Set Pending Interrupt (non-secure)
\r
76 \details Sets the pending bit of an non-secure external interrupt when in secure state.
\r
77 \param [in] IRQn Interrupt number. Value cannot be negative.
\r
79 - \ref NVIC_SetPendingIRQ
\r
81 void TZ_NVIC_SetPendingIRQ_NS(IRQn_Type IRQn);
\r
84 \brief Clear Pending Interrupt (non-secure)
\r
85 \details Clears the pending bit of an non-secure external interrupt when in secure state.
\r
86 \param [in] IRQn External interrupt number. Value cannot be negative.
\r
88 - \ref NVIC_ClearPendingIRQ
\r
90 void TZ_NVIC_ClearPendingIRQ_NS(IRQn_Type IRQn);
\r
93 \brief Get Active Interrupt (non-secure)
\r
94 \details Reads the active register in non-secure NVIC when in secure state and returns the active bit.
\r
95 \param [in] IRQn Interrupt number.
\r
96 \return 0 Interrupt status is not active.
\r
97 \return 1 Interrupt status is active.
\r
99 - \ref NVIC_GetActive
\r
101 uint32_t TZ_NVIC_GetActive_NS(IRQn_Type IRQn);
\r
104 \brief Set Interrupt Priority (non-secure)
\r
105 \details Sets the priority of an non-secure interrupt when in secure state.
\r
106 \note The priority cannot be set for every core interrupt.
\r
107 \param [in] IRQn Interrupt number.
\r
108 \param [in] priority Priority to set.
\r
110 - \ref NVIC_SetPriority
\r
112 void TZ_NVIC_SetPriority_NS(IRQn_Type IRQn, uint32_t priority);
\r
115 \brief Get Interrupt Priority (non-secure)
\r
116 \details Reads the priority of an non-secure interrupt when in secure state.
\r
117 The interrupt number can be positive to specify an external (device specific) interrupt,
\r
118 or negative to specify an internal (core) interrupt.
\r
119 \param [in] IRQn Interrupt number.
\r
120 \return Interrupt Priority. Value is aligned automatically to the implemented priority bits of the microcontroller.
\r
122 - \ref NVIC_GetPriority
\r
124 uint32_t TZ_NVIC_GetPriority_NS(IRQn_Type IRQn);
\r
126 /** close nvic_trustzone_functions
\r
132 \defgroup systick_trustzone_functions SysTick Functions
\r
133 \brief SysTick functions related to TrustZone for ARMv8-M.
\r
138 \brief System Tick Configuration (non-secure)
\r
139 \details Initializes the non-secure System Timer and its interrupt when in secure state, and starts the System Tick Timer.
\r
140 Counter is in free running mode to generate periodic interrupts.
\r
141 \param [in] ticks Number of ticks between two interrupts.
\r
142 \return 0 Function succeeded.
\r
143 \return 1 Function failed.
\r
144 \note When the variable <b>__Vendor_SysTickConfig</b> is set to 1, then the
\r
145 function <b>TZ_SysTick_Config_NS</b> is not included. In this case, the file <b><i>device</i>.h</b>
\r
146 must contain a vendor-specific implementation of this function.
\r
148 - \ref SysTick_Config
\r
150 uint32_t TZ_SysTick_Config_NS(uint32_t ticks);
\r
152 /** close systick_trustzone_functions
\r
158 \defgroup sau_trustzone_functions SAU Functions
\r
159 \brief Secure Attribution Unit (SAU) functions related to TrustZone for ARMv8-M.
\r
162 The Secure Attribution Unit (SAU) functions SAU
\r
165 TZ_SAU_* functions are only available if macro __SAU_PRESENT is set to 1.
\r
170 \brief Setup Secure Attribute Unit (SAU) and non-secure interrupts
\r
172 The function \ref TZ_SAU_Setup uses the settings in the \ref partition_h_pg to initialize
\r
173 the Secure Attribute Unit (SAU) and define non-secure interrupts. It is called from
\r
174 the function \ref SystemInit.
\r
176 void TZ_SAU_Setup (void);
\r
179 \brief Enable Security Attribution Unit (SAU)
\r
180 \details Enables the Security Attribution Unit (SAU).
\r
182 void TZ_SAU_Enable(void);
\r
185 \brief Disable Security Attribution Unit (SAU)
\r
186 \details Disables the Security Attribution Unit (SAU).
\r
188 void TZ_SAU_Disable(void);
\r
190 /** close sau_trustzone_functions
\r
196 \defgroup coreregister_trustzone_functions Core Register Access Functions
\r
197 \brief Core register Access functions related to TrustZone for ARMv8-M .
\r
202 \brief Get Control register (non-secure)
\r
203 \details Returns the content of the non-secure Control register when in secure mode.
\r
204 \return non-secure Control register value
\r
206 - \ref __get_CONTROL; CONTROL_Type
\r
208 uint32_t __TZ_get_CONTROL_NS(void);
\r
211 \brief Set Control register (non-secure)
\r
212 \details Writes the given value to the non-secure Control register when in secure state.
\r
213 \param [in] control Control register value to set
\r
215 - \ref __set_CONTROL; CONTROL_Type
\r
217 void __TZ_set_CONTROL_NS(uint32_t control);
\r
220 \brief Get Process Stack Pointer (non-secure)
\r
221 \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state.
\r
222 \return PSP register value
\r
226 uint32_t __TZ_get_PSP_NS(void);
\r
229 \brief Set Process Stack Pointer (non-secure)
\r
230 \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state.
\r
231 \param [in] topOfProcStack Process Stack Pointer value to set
\r
235 void __TZ_set_PSP_NS(uint32_t topOfProcStack);
\r
238 \brief Get Main Stack Pointer (non-secure)
\r
239 \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state.
\r
240 \return MSP register value
\r
244 uint32_t __TZ_get_MSP_NS(void);
\r
247 \brief Set Main Stack Pointer (non-secure)
\r
248 \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state.
\r
249 \param [in] topOfMainStack Main Stack Pointer value to set
\r
253 void __TZ_set_MSP_NS(uint32_t topOfMainStack);
\r
256 \brief Get Priority Mask (non-secure)
\r
257 \details Returns the current state of the non-secure priority mask bit from the Priority Mask register when in secure state.
\r
258 \return Priority Mask value
\r
260 - \ref __get_PRIMASK
\r
262 uint32_t __TZ_get_PRIMASK_NS(void);
\r
265 \brief Set Priority Mask (non-secure)
\r
266 \details Assigns the given value to the non-secure Priority Mask register when in secure state.
\r
267 \param [in] priMask Priority Mask
\r
269 - \ref __set_PRIMASK
\r
271 void __TZ_set_PRIMASK_NS(uint32_t priMask);
\r
274 \brief Get Base Priority (non-secure)
\r
275 \details Returns the current value of the non-secure Base Priority register when in secure state.
\r
276 \return Base Priority register value
\r
278 - \ref __get_BASEPRI
\r
280 uint32_t __TZ_get_BASEPRI_NS(void);
\r
283 \brief Set Base Priority (non-secure)
\r
284 \details Assigns the given value to the non-secure Base Priority register when in secure state.
\r
285 \param [in] basePri Base Priority value to set
\r
287 - \ref __set_BASEPRI
\r
289 void __TZ_set_BASEPRI_NS(uint32_t basePri);
\r
292 \brief Get Fault Mask (non-secure)
\r
293 \details Returns the current value of the non-secure Fault Mask register when in secure state.
\r
294 \return Fault Mask register value
\r
296 - \ref __get_FAULTMASK
\r
298 uint32_t __TZ_get_FAULTMASK_NS(void);
\r
301 \brief Set Fault Mask (non-secure)
\r
302 \details Assigns the given value to the non-secure Fault Mask register when in secure state.
\r
303 \param [in] faultMask Fault Mask value to set
\r
305 - \ref __set_FAULTMASK
\r
307 void __TZ_set_FAULTMASK_NS(uint32_t faultMask);
\r
310 \brief Get Process Stack Pointer Limit (non-secure)
\r
311 \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
\r
312 \return PSPLIM register value
\r
313 \note Only available for ARMv8-M Mainline.
\r
315 uint32_t __TZ_get_PSPLIM_NS(void);
\r
318 \brief Set Process Stack Pointer (non-secure)
\r
319 \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state.
\r
320 \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set
\r
321 \note Only available for ARMv8-M Mainline.
\r
323 void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit);
\r
326 \brief Get Main Stack Pointer Limit (non-secure)
\r
327 \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state.
\r
328 \return MSPLIM register value
\r
329 \note Only available for ARMv8-M Mainline.
\r
331 uint32_t __TZ_get_MSPLIM_NS(void);
\r
334 \brief Set Main Stack Pointer Limit (non-secure)
\r
335 \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state.
\r
336 \param [in] MainStackPtrLimit Main Stack Pointer value to set
\r
337 \note Only available for ARMv8-M Mainline.
\r
339 void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit);
\r
341 /** close coreregister_trustzone_functions
\r
346 /** close trustzone_functions
\r