Mistake on this page?
Report an issue in GitHub or email us
tfm_arch_v8m.h
1 /*
2  * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef __TFM_ARCH_V8M_H__
8 #define __TFM_ARCH_V8M_H__
9 
10 #include "cmsis.h"
11 
12 #define XPSR_T32 0x01000000
13 #define LR_UNPRIVILEGED 0xfffffffd
14 
15 /* This header file collects the ARCH related operations. */
17  uint32_t r0;
18  uint32_t r1;
19  uint32_t r2;
20  uint32_t r3;
21  uint32_t r12;
22  uint32_t ra_lr;
23  uint32_t ra;
24  uint32_t xpsr;
25 };
26 
28  uint32_t r4;
29  uint32_t r5;
30  uint32_t r6;
31  uint32_t r7;
32  uint32_t r8;
33  uint32_t r9;
34  uint32_t r10;
35  uint32_t r11;
36  uint32_t sp;
37  uint32_t sp_limit;
38  uint32_t dummy;
39  uint32_t lr;
40 };
41 
43  struct tfm_state_context_ext ctxb;
44 };
45 
46 #define TFM_STATE_1ST_ARG(ctx) \
47  (((struct tfm_state_context_base *)(ctx)->ctxb.sp)->r0)
48 #define TFM_STATE_2ND_ARG(ctx) \
49  (((struct tfm_state_context_base *)(ctx)->ctxb.sp)->r1)
50 #define TFM_STATE_3RD_ARG(ctx) \
51  (((struct tfm_state_context_base *)(ctx)->ctxb.sp)->r2)
52 #define TFM_STATE_4TH_ARG(ctx) \
53  (((struct tfm_state_context_base *)(ctx)->ctxb.sp)->r3)
54 #define TFM_STATE_RET_VAL(ctx) \
55  (((struct tfm_state_context_base *)(ctx)->ctxb.sp)->r0)
56 
57 __STATIC_INLINE void tfm_trigger_pendsv(void)
58 {
59  SCB->ICSR = SCB_ICSR_PENDSVSET_Msk;
60 }
61 
62 void tfm_initialize_context(struct tfm_state_context *ctx,
63  uint32_t r0, uint32_t ra,
64  uint32_t sp, uint32_t sp_limit);
65 
66 #endif
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.