1 /****************************************************************************** 2 * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 3 * All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 *****************************************************************************/ 18 #pragma once 19 20 #include <stdbool.h> 21 22 typedef unsigned char u8; 23 24 typedef signed char s8; 25 26 typedef unsigned short u16; 27 28 typedef signed short s16; 29 30 typedef int s32; 31 32 typedef unsigned int u32; 33 34 typedef long long s64; 35 36 typedef unsigned long long u64; 37 38 #ifndef NULL 39 40 #endif 41 42 #ifndef __cplusplus 43 44 #ifndef FALSE 45 #define FALSE 0 46 #endif 47 #ifndef TRUE 48 #define TRUE (!FALSE) 49 #endif 50 51 #endif 52 53 // There is no way to directly recognise whether a typedef is defined 54 // http://stackoverflow.com/questions/3517174/how-to-check-if-a-datatype-is-defined-with-typedef 55 #ifdef __GNUC__ 56 57 #endif 58 59 #ifndef WIN32 60 typedef u32 size_t; 61 #endif 62 63 #define U32_MAX ((u32)0xffffffff) 64 #define U16_MAX ((u16)0xffff) 65 #define U8_MAX ((u8)0xff) 66 #define U31_MAX ((u32)0x7fffffff) 67 #define U15_MAX ((u16)0x7fff) 68 #define U7_MAX ((u8)0x7f) 69 70 #ifdef WIN32 71 #ifndef FALSE 72 #define FALSE 0 73 #endif 74 75 #ifndef TRUE 76 #define TRUE 1 77 #endif 78 #endif 79 80 #define SUCCESS 0x00 81 #define FAILURE 0x01 82 83 typedef u32 UTCTime; 84 typedef u32 arg_t; 85 typedef u32 status_t; 86