blob: ce7a6636b92e3b03d01e8db495b0a8bd602b29be [file] [log] [blame]
Kristofer Jonsson49bdee82020-04-06 13:21:21 +02001/*
2 * Copyright (c) 2019-2020 Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#if !defined ETHOSU_COMMON_H
20#define ETHOSU_COMMON_H
21
22#include "ethosu55_interface.h"
Bhavik Pateldae5be02020-06-18 15:25:15 +020023#include "ethosu_device.h"
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020024
25#if !defined(LOG_ENABLED)
26#define LOG_INFO(format, ...)
27#define LOG_ERR(format, ...)
28#else
29#define LOG_INFO(format, ...) fprintf(stdout, format, ##__VA_ARGS__)
30#define LOG_ERR(format, ...) \
31 fprintf(stderr, format, ##__VA_ARGS__); \
32 fflush(stderr)
33
34#endif
35
36#if defined(ASSERT_DISABLE)
37#define ASSERT(args)
38#else
39#define ASSERT(args) assert(args)
40#endif
41
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020042#define UNUSED(x) ((void)x)
43
44#define VER_STR(X) VNUM_STR(X)
45#define VNUM_STR(X) #X
46
Bhavik Patel8e32b0b2020-06-23 13:48:25 +020047#define MASK_0_31_BITS (0xFFFFFFFF)
48#define MASK_32_47_BITS (0xFFFF00000000)
49
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020050static const __attribute__((section("npu_driver_version"))) char driver_version_str[] = VER_STR(
51 ETHOSU_DRIVER_VERSION_MAJOR) "." VER_STR(ETHOSU_DRIVER_VERSION_MINOR) "." VER_STR(ETHOSU_DRIVER_VERSION_PATCH);
52
53static const __attribute__((section("npu_driver_arch_version"))) char driver_arch_version_str[] =
54 VER_STR(NNX_ARCH_VERSION_MAJOR) "." VER_STR(NNX_ARCH_VERSION_MINOR) "." VER_STR(NNX_ARCH_VERSION_PATCH);
55
Kristofer Jonsson49bdee82020-04-06 13:21:21 +020056#endif // ETHOSU_COMMON_H