aboutsummaryrefslogtreecommitdiff
path: root/secure_fw/core/tfm_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'secure_fw/core/tfm_utils.h')
-rw-r--r--secure_fw/core/tfm_utils.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/secure_fw/core/tfm_utils.h b/secure_fw/core/tfm_utils.h
new file mode 100644
index 0000000000..01462bcc6c
--- /dev/null
+++ b/secure_fw/core/tfm_utils.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+#ifndef __TFM_UTILS_H__
+#define __TFM_UTILS_H__
+
+#include <stdio.h>
+
+/* CPU spin here */
+void tfm_panic(void);
+
+/* Assert and spin */
+#define TFM_ASSERT(cond) \
+ do { \
+ if (!(cond)) { \
+ printf("Assert:%s:%d", __FUNCTION__, __LINE__); \
+ while (1) \
+ ; \
+ } \
+ } while (0)
+
+/* Get container structure start address from member */
+#define TFM_GET_CONTAINER_PTR(ptr, type, member) \
+ (type *)((unsigned long)(ptr) - offsetof(type, member))
+
+#endif