1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 Netronome Systems, Inc. 3 * All rights reserved. 4 */ 5 6 #ifndef __NFP_PLATFORM_H__ 7 #define __NFP_PLATFORM_H__ 8 9 #include <fcntl.h> 10 #include <unistd.h> 11 #include <stdint.h> 12 #include <string.h> 13 #include <stdlib.h> 14 #include <ctype.h> 15 #include <inttypes.h> 16 #include <sys/stat.h> 17 #include <limits.h> 18 #include <errno.h> 19 20 #ifndef BIT_ULL 21 #define BIT(x) (1 << (x)) 22 #define BIT_ULL(x) (1ULL << (x)) 23 #endif 24 25 #ifndef ARRAY_SIZE 26 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 27 #endif 28 29 #define NFP_ERRNO(err) (errno = (err), -1) 30 #define NFP_ERRNO_RET(err, ret) (errno = (err), (ret)) 31 #define NFP_NOERR(errv) (errno) 32 #define NFP_ERRPTR(err) (errno = (err), NULL) 33 #define NFP_PTRERR(errv) (errno) 34 35 #endif /* __NFP_PLATFORM_H__ */ 36