aboutsummaryrefslogtreecommitdiff
path: root/secure_fw/core/tfm_utils.h
blob: 01462bcc6cd2b600f96282e965c998639b4c9606 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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