1 /*
2  * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef __CURRENT_H__
8 #define __CURRENT_H__
9 
10 #include "thread.h"
11 #include "spm.h"
12 
13 #if CONFIG_TFM_SPM_BACKEND_SFN != 1
14 /* Get current component */
15 #define GET_CURRENT_COMPONENT()  GET_CTX_OWNER(CURRENT_THREAD->p_context_ctrl)
16 /* Set current component */
17 #define SET_CURRENT_COMPONENT(p) THRD_UPDATE_CUR_CTXCTRL(&(p)->ctx_ctrl)
18 #else
19 extern struct partition_t *p_current_partition;
20 /* Get current component */
21 #define GET_CURRENT_COMPONENT()  p_current_partition
22 /* Set current component */
23 #define SET_CURRENT_COMPONENT(p) p_current_partition = p
24 #endif
25 
26 #endif /* __CURRENT_H__ */
27