1 /* 2 * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 #ifndef LIBTEEOS_SRE_TYPEDEF_H 13 #define LIBTEEOS_SRE_TYPEDEF_H 14 15 #include <stdio.h> 16 #include <stdint.h> 17 18 #ifdef __cplusplus 19 #if __cplusplus 20 extern "C" { 21 #endif /* __cpluscplus */ 22 #endif /* __cpluscplus */ 23 24 #ifndef SRE_TYPE_DEF 25 #define SRE_TYPE_DEF 26 27 typedef unsigned char UINT8; 28 typedef unsigned short UINT16; 29 typedef unsigned int UINT32; 30 typedef signed char INT8; 31 typedef signed short INT16; 32 typedef signed int INT32; 33 typedef float FLOAT; 34 typedef double DOUBLE; 35 typedef char CHAR; 36 37 typedef unsigned int BOOL; 38 typedef uint64_t UINT64; 39 typedef int64_t INT64; 40 typedef unsigned int UINTPTR; 41 typedef signed int INTPTR; 42 typedef signed char s8; 43 typedef unsigned char u8; 44 45 typedef signed short s16; 46 typedef unsigned short u16; 47 48 typedef signed int s32; 49 typedef unsigned int u32; 50 51 typedef int64_t s64; 52 typedef uint64_t u64; 53 54 #ifndef VOID 55 #define VOID void 56 #endif 57 58 #endif /* end of #ifndef SRE_TYPE_DEF */ 59 60 #ifndef FALSE 61 #define FALSE ((BOOL)0) 62 #endif 63 64 #ifndef TRUE 65 #define TRUE ((BOOL)1) 66 #endif 67 68 #ifndef NULL 69 #define NULL ((VOID *)0) 70 #endif 71 72 #ifndef SRE_OK 73 #define SRE_OK (0) 74 #endif 75 76 #define OS_ERROR (UINT32)(-1) 77 #define OS_ERROR_A64 (UINT64)(-1) 78 79 #define SET_BIT(map, bit) (map |= (1UL << (bit))) 80 #define CLR_BIT(map, bit) (map &= (~(1UL << (bit)))) 81 82 /* interrupt type id */ 83 typedef UINT32 HWI_HANDLE_T; 84 85 /* interrupt prior */ 86 typedef UINT16 HWI_PRIOR_T; 87 88 /* interrupt mode */ 89 typedef UINT16 HWI_MODE_T; 90 91 /* interrupt agru type */ 92 typedef UINT32 HWI_ARG_T; 93 94 /* Physical address in the system */ 95 #ifndef PADDR_T_DEFINED 96 typedef uint64_t paddr_t; 97 #define PADDR_T_DEFINED 98 #endif 99 100 #ifdef __cplusplus 101 #if __cplusplus 102 } 103 #endif /* __cpluscplus */ 104 #endif /* __cpluscplus */ 105 106 #endif 107