xref: /optee_os/core/include/kernel/tee_common.h (revision fbe66cf83199aa6a2aca9f93384cf1ad9185a5f6)
11bb92983SJerome Forissier /* SPDX-License-Identifier: BSD-2-Clause */
2b0104773SPascal Brand /*
3b0104773SPascal Brand  * Copyright (c) 2014, STMicroelectronics International N.V.
4b0104773SPascal Brand  */
5*fbe66cf8SEtienne Carriere #ifndef __KERNEL_TEE_COMMON_H
6*fbe66cf8SEtienne Carriere #define __KERNEL_TEE_COMMON_H
7b0104773SPascal Brand 
8b0104773SPascal Brand #include <stdlib.h>
9b0104773SPascal Brand 
10b0104773SPascal Brand #ifdef MEASURE_TIME
11b0104773SPascal Brand /*
12b0104773SPascal Brand  * Initializes mesaure time. Initializes RTT0 to highest possible
13b0104773SPascal Brand  * resolution.
14b0104773SPascal Brand  */
15b0104773SPascal Brand void tee_mtime_init(void);
16b0104773SPascal Brand 
17b0104773SPascal Brand /*
18b0104773SPascal Brand  * Adds a time stamp together the description. Note that only the pointer
19b0104773SPascal Brand  * is copied, not the contents to minimize impact.
20b0104773SPascal Brand  */
21b0104773SPascal Brand void tee_mtime_stamp(const char *descr);
22b0104773SPascal Brand 
23b0104773SPascal Brand /*
24b0104773SPascal Brand  * Prints a report of measured times and reinitializes clears the table of
25b0104773SPascal Brand  * saved time stamps.
26b0104773SPascal Brand  */
27b0104773SPascal Brand void tee_mtime_report(void);
28b0104773SPascal Brand 
29b0104773SPascal Brand void tee_mtime_perftest(void);
30b0104773SPascal Brand #else
31b0104773SPascal Brand /* Empty macros to not have any impact on code when not meassuring time */
32b0104773SPascal Brand #define tee_mtime_init() do { } while (0)
33b0104773SPascal Brand #define tee_mtime_stamp(descr) do { } while (0)
34b0104773SPascal Brand #define tee_mtime_report() do { } while (0)
35b0104773SPascal Brand #define tee_mtime_perftest()  do { } while (0)
36b0104773SPascal Brand #endif
37b0104773SPascal Brand 
38*fbe66cf8SEtienne Carriere #endif /* __KERNEL_TEE_COMMON_H */
39