1 /* 2 * @ : Copyright (c) 2021 Phytium Information Technology, Inc. 3 * 4 * SPDX-License-Identifier: Apache-2.0. 5 * 6 * @Date: 2021-04-07 09:53:07 7 * @LastEditTime: 2021-05-11 10:18:14 8 * @Description: This files is for definition of system-level types 9 * 10 * @Modify History: 11 * Ver Who Date Changes 12 * ----- ------ -------- -------------------------------------- 13 */ 14 15 #ifndef FT_TYPES_H 16 #define FT_TYPES_H 17 #include <stdint.h> 18 #include <stddef.h> 19 20 /* Constant Definitions */ 21 22 #ifndef TRUE 23 #define TRUE 1U 24 #endif 25 26 #ifndef FALSE 27 #define FALSE 0U 28 #endif 29 30 #ifndef NULL 31 #define NULL 0U 32 #endif 33 34 #define FT_NULL NULL 35 36 #define FT_COMPONENT_IS_READLY 0x11111111U 37 #define FT_COMPONENT_IS_STARTED 0x22222222U 38 39 #define __STATIC_INLINE static inline 40 41 #define FT_OUT /* 表示输出参数,指针指向的值会修改,且不会读 */ 42 #define FT_IN /* 表示输入参数,指针指向的值不会修改 */ 43 #define FT_INOUT /* 表示输入输出参数,指针指向的值会修改,且会读取 */ 44 #define FT_IO volatile 45 46 typedef char s8; 47 typedef unsigned char u8; 48 typedef short s16; 49 typedef unsigned short u16; 50 typedef int s32; 51 typedef unsigned int u32; 52 typedef unsigned long long u64; 53 typedef long long s64; 54 typedef int ft_base_t; 55 typedef ft_base_t bool_t; 56 57 typedef intptr_t INTPTR; 58 typedef uintptr_t UINTPTR; 59 typedef ptrdiff_t PTRDIFF; 60 61 #define __STATIC_INLINE static inline 62 #define LOCAL static 63 64 #define LLSB(x) ((x)&0xff) /* 32bit word byte/word swap macros */ 65 #define LNLSB(x) (((x) >> 8) & 0xff) 66 #define LNMSB(x) (((x) >> 16) & 0xff) 67 #define LMSB(x) (((x) >> 24) & 0xff) 68 #define U32SWAP(x) ((LLSB(x) << 24) | \ 69 (LNLSB(x) << 16) | \ 70 (LNMSB(x) << 8) | \ 71 (LMSB(x))) 72 73 #define FT_SWAP32(x) U32SWAP((u32)x) 74 75 #endif // 76