build(ffa): introduce assert macro

Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Change-Id: I2e7c7320574de056bac6c685cc3ef86330186664
diff --git a/inc/hf/assert.h b/inc/hf/assert.h
new file mode 100644
index 0000000..197c5d6
--- /dev/null
+++ b/inc/hf/assert.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2021 The Hafnium Authors.
+ *
+ * Use of this source code is governed by a BSD-style
+ * license that can be found in the LICENSE file or at
+ * https://opensource.org/licenses/BSD-3-Clause.
+ */
+
+#pragma once
+
+#if !defined(__cplusplus)
+
+#include "hf/panic.h"
+
+#ifndef PLAT_LOG_LEVEL_ASSERT
+#define PLAT_LOG_LEVEL_ASSERT LOG_LEVEL
+#endif
+
+#if ENABLE_ASSERTIONS
+#if PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_VERBOSE
+#define assert(e) \
+	((e) ? (void)0 : panic("ASSERT: %s:%d:%s\n", __FILE__, __LINE__, #e))
+#elif PLAT_LOG_LEVEL_ASSERT >= LOG_LEVEL_INFO
+#define assert(e) ((e) ? (void)0 : panic("ASSERT: %s:%d\n", __FILE__, __LINE__))
+#else
+#define assert(e) ((e) ? (void)0 : panic("ASSERT\n"))
+#endif
+#else
+#define assert(e) ((void)0)
+#endif /* ENABLE_ASSERTIONS */
+
+#endif /* !defined(__cplusplus) */
diff --git a/inc/hf/check.h b/inc/hf/check.h
index 1ec51bb..1456459 100644
--- a/inc/hf/check.h
+++ b/inc/hf/check.h
@@ -17,10 +17,10 @@
  * Do not use if the condition could ever be legitimately false e.g. when
  * processing external inputs.
  */
-#define CHECK(x)                                                              \
-	do {                                                                  \
-		if (!(x)) {                                                   \
-			panic("assertion failed (%s) at %s:%d", #x, __FILE__, \
-			      __LINE__);                                      \
-		}                                                             \
+#define CHECK(x)                                                          \
+	do {                                                              \
+		if (!(x)) {                                               \
+			panic("check failed (%s) at %s:%d", #x, __FILE__, \
+			      __LINE__);                                  \
+		}                                                         \
 	} while (0)