1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: osal types header file 15 */ 16 17 #ifndef __OSAL_TYPES_H__ 18 #define __OSAL_TYPES_H__ 19 20 /* 基本数据类型定义 */ 21 typedef unsigned char osal_uchar; 22 typedef unsigned char osal_u8; 23 typedef unsigned short osal_u16; 24 typedef unsigned int osal_u32; 25 typedef unsigned long long osal_u64; 26 typedef unsigned long osal_ulong; 27 typedef char osal_char; 28 typedef signed char osal_s8; 29 typedef short osal_s16; 30 typedef int osal_s32; 31 typedef long long osal_s64; 32 typedef long osal_slong; 33 typedef float osal_float; 34 typedef double osal_double; 35 typedef unsigned long osal_size_t; 36 typedef unsigned long osal_length_t; 37 typedef osal_u32 osal_handle; 38 typedef osal_u8 osal_bool; 39 // typedef unsigned int uintptr_t; 40 typedef void osal_void; 41 typedef void* osal_pvoid; 42 43 typedef osal_u8 osal_byte; 44 typedef osal_byte* osal_pbyte; 45 typedef osal_u32 size_t; 46 typedef unsigned long long uint64_t; 47 48 typedef unsigned int osal_uintptr_t; 49 typedef unsigned int osal_phys_addr_t; 50 typedef unsigned int osal_virt_addr_t; 51 52 /* defines */ 53 #ifndef NULL 54 #ifdef __cplusplus 55 #define NULL 0L 56 #else 57 #define NULL ((void*)0) 58 #endif 59 #endif 60 61 #define OSAL_U32_MAX 0xFFFFFFFF 62 #define OSAL_U64_MAX 0xFFFFFFFFFFFFFFFFUL 63 #define OSAL_U16_MAX 0xFFFF 64 #define OSAL_U8_MAX 0xFF 65 #define OSAL_U4_MAX 0x0f 66 67 #define OSAL_FALSE 0 68 #define OSAL_TRUE 1 69 70 #define OSAL_OK 0 71 #define OSAL_NOK 1 72 73 #ifdef __cplusplus 74 #define OSAL_NULL 0 75 #else 76 #define OSAL_NULL ((void *)0) 77 #endif 78 79 #define OSAL_SYS_WAIT_FOREVER 0xFFFFFFFF 80 81 #endif /* __OSAL_TYPES_H__ */ 82