TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
utilities.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef __TFM_UTILS_H__
8 #define __TFM_UTILS_H__
9 
10 #include <stdbool.h>
11 #include <stdio.h>
12 
13 /*
14  * CPU spin here.
15  * Note: this function is used to handle PROGRAMMER ERROR.
16  */
17 void tfm_core_panic(void);
18 
19 /* Core assert and spin */
20 #ifndef NDEBUG
21 #define TFM_CORE_ASSERT(cond) \
22  do { \
23  if (!(cond)) { \
24  while (1) \
25  ; \
26  } \
27  } while (0)
28 #else
29 #define TFM_CORE_ASSERT(cond)
30 #endif
31 
32 /* Get container structure start address from member */
33 #define TFM_GET_CONTAINER_PTR(ptr, type, member) \
34  (type *)((unsigned long)(ptr) - offsetof(type, member))
35 
36 #define ERROR_MSG(msg)
37 
38 bool tfm_is_one_bit_set(uint32_t n);
39 
40 #endif /* __TFM_UTILS_H__ */
void tfm_core_panic(void)
Definition: utilities.c:11
bool tfm_is_one_bit_set(uint32_t n)
Definition: utilities.c:24