Ken Liu | f39d8eb | 2021-10-07 12:55:33 +0800 | [diff] [blame] | 1 | /* |
Sherry Zhang | 049733e | 2022-04-20 21:37:51 +0800 | [diff] [blame^] | 2 | * Copyright (c) 2021-2022, Arm Limited. All rights reserved. |
Ken Liu | f39d8eb | 2021-10-07 12:55:33 +0800 | [diff] [blame] | 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_ipc.h" |
| 12 | |
Sherry Zhang | 049733e | 2022-04-20 21:37:51 +0800 | [diff] [blame^] | 13 | #if CONFIG_TFM_SPM_BACKEND_SFN != 1 |
Ken Liu | f39d8eb | 2021-10-07 12:55:33 +0800 | [diff] [blame] | 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) |
Sherry Zhang | 049733e | 2022-04-20 21:37:51 +0800 | [diff] [blame^] | 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 |
Ken Liu | f39d8eb | 2021-10-07 12:55:33 +0800 | [diff] [blame] | 25 | |
| 26 | #endif /* __CURRENT_H__ */ |