1 /* 2 * Copyright (c) 2009-2022 Huawei Technologies Co., Ltd. All rights reserved. 3 * 4 * UniProton is licensed under Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * http://license.coscl.org.cn/MulanPSL2 8 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 9 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 10 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 11 * See the Mulan PSL v2 for more details. 12 * Create: 2009-12-22 13 * Description: UniProton hi3093 demo 14 */ 15 #ifndef __COMMON_H__ 16 #define __COMMON_H__ 17 18 #include "prt_config.h" 19 20 #define PERI_APB_FREQ 100000000 21 #define UART_BUSY_TIMEOUT 1000000 22 #define ETIME 62 23 24 #define DIV_ROUND_CLOSEST(x, divisor, result) \ 25 ({ \ 26 typeof(x) __x = x; \ 27 typeof(divisor) __d = divisor; \ 28 result = (((typeof(x)) - 1) > 0 || \ 29 ((typeof(divisor)) - 1) > 0 || \ 30 (((__x) > 0) == ((__d) > 0))) ? \ 31 (((__x) + ((__d) / 2)) / (__d)) : \ 32 (((__x) - ((__d) / 2)) / (__d)); \ 33 }) 34 35 #define EPERM 1 /* Operation not permitted */ 36 #define ENOENT 2 /* No such file or directory */ 37 #define ESRCH 3 /* No such process */ 38 #define EINTR 4 /* Interrupted system call */ 39 #define EIO 5 /* I/O error */ 40 #define ENXIO 6 /* No such device or address */ 41 #define E2BIG 7 /* Argument list too long */ 42 #define ENOEXEC 8 /* Exec format error */ 43 #define EBADF 9 /* Bad file number */ 44 #define ECHILD 10 /* No child processes */ 45 #define EAGAIN 11 /* Try again */ 46 #define ENOMEM 12 /* Out of memory */ 47 #define EACCES 13 /* Permission denied */ 48 #define EFAULT 14 /* Bad address */ 49 #define ENOTBLK 15 /* Block device required */ 50 #define EBUSY 16 /* Device or resource busy */ 51 #define EEXIST 17 /* File exists */ 52 #define EXDEV 18 /* Cross-device link */ 53 #define ENODEV 19 /* No such device */ 54 #define ENOTDIR 20 /* Not a directory */ 55 #define EISDIR 21 /* Is a directory */ 56 #define EINVAL 22 /* Invalid argument */ 57 #define ENFILE 23 /* File table overflow */ 58 #define EMFILE 24 /* Too many open files */ 59 #define ENOTTY 25 /* Not a typewriter */ 60 #define ETXTBSY 26 /* Text file busy */ 61 #define EFBIG 27 /* File too large */ 62 #define ENOSPC 28 /* No space left on device */ 63 #define ESPIPE 29 /* Illegal seek */ 64 #define EROFS 30 /* Read-only file system */ 65 #define EMLINK 31 /* Too many links */ 66 #define EPIPE 32 /* Broken pipe */ 67 #define EDOM 33 /* Math argument out of domain of func */ 68 #define ERANGE 34 /* Math result not representable */ 69 70 #endif /* __COMMON_H__ */