blob: 63a25bda40b4f37a54a85f208ef0215587d10744 [file] [log] [blame]
Ken Liuf39d8eb2021-10-07 12:55:33 +08001/*
Sherry Zhang049733e2022-04-20 21:37:51 +08002 * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
Ken Liuf39d8eb2021-10-07 12:55:33 +08003 *
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_ipc.h"
12
Sherry Zhang049733e2022-04-20 21:37:51 +080013#if CONFIG_TFM_SPM_BACKEND_SFN != 1
Ken Liuf39d8eb2021-10-07 12:55:33 +080014/* 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)
Sherry Zhang049733e2022-04-20 21:37:51 +080018#else
19extern 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
Ken Liuf39d8eb2021-10-07 12:55:33 +080025
26#endif /* __CURRENT_H__ */