📄 wb_types.h
字号:
//---------------------------------------------------------------------------
//Copyright (C) 2006, Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//--------------------------------------------------------------------------
//
// File: wb_types.h
// Very commonly used types and macros.
//------------------------------------------------------------------------------
#ifndef WB_TYPES_INCLUDED
#define WB_TYPES_INCLUDED
/* If LINT is being used, then redefine offsetof so that it doesn't give errors */
#if defined(_lint) && defined(offsetof)
#undef offsetof
#define offsetof(s,m) (size_t)( (char *)&(((s *)1)->m) - (char *)1 )
#endif
/*** Define some commonly used types. ***/
/* If we are compiling a C program, we need to define bool. If we are
* compiling a C++ program, we should only define bool for versions of the
* compiler below that in MSVC 5, because it is defined as an integral type
* in that release.
*/
#ifndef bool
#if !defined(_MSC_VER)
typedef unsigned char bool;
#elif !defined(__cplusplus)
typedef unsigned char bool;
#endif
#endif
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long dword;
typedef unsigned char uint8;
typedef unsigned short int uint16;
typedef unsigned long int uint32;
typedef signed char int8;
typedef signed short int int16;
typedef signed long int int32;
/*
* These defines are only included to get pre-existing code to compile. Do
* not use them in new code.
*/
#ifndef __GNUC__
typedef unsigned char u8;
typedef unsigned short int u16;
typedef unsigned long int u32;
typedef signed char i8;
typedef signed short int i16;
typedef signed long int i32;
#endif
/* Microsoft C compiler */
#if defined(_MSC_VER)
#pragma warning(disable:4103)
#pragma pack (1)
#define packed
#define interrupt
#define OPTBYTE byte
#define OPTBOOL bool
#define VOLATILE
/* not ANSI */
typedef __int64 int64;
typedef unsigned __int64 uint64;
#define UINT64(X) (X##ui64)
/* ARM/Thumb compiler */
#elif defined(__arm)
#define OPTBYTE byte
#define OPTBOOL byte
#define VOLATILE volatile
#define packed __packed
/* not ANSI */
typedef long long int64;
typedef unsigned long long uint64;
#define UINT64(X) (X##ULL)
#else
typedef long long int64;
#endif
/* Here are some definitions for macros that didn't get defined earlier */
#if !defined(OPTBYTE)
#define OPTBYTE byte
#endif
#if !defined(OPTBOOL)
#define OPTBOOL bool
#endif
#if !defined(VOLATILE)
#define VOLATILE
#endif
// Are these two still needed given the multi-compiler definitions below?
#if !defined(packed)
#define packed
#endif
#if !defined(PACKED)
#define PACKED packed
#endif
#if defined(_MSC_VER)
#pragma pack(push,1)
#define PREPACK
#define POSTPACK
#elif defined(__CC_ARM)
#define PREPACK __packed
#define POSTPACK
#elif defined(__GNUC__)
#define PREPACK
#define POSTPACK __attribute__ ((__packed__))
#else
#error need to figure out packing syntax
#endif
/*** Define some commonly used constant values. ***/
#if !defined(TRUE)
#define TRUE (1)
#define FALSE (0)
#endif
#define SUCCESS TRUE
#define FAIL FALSE
/*** Storage classes and pointers. ***/
#if !defined(NULL)
#define NULL ((void *) 0)
#endif
#if !defined(PUBLIC)
#define PUBLIC
#endif
#if !defined(__cplusplus) && !defined(public)
#define public
#endif
#if !defined(STATIC)
#define STATIC static
#endif
#if !defined(PRIVATE)
#define PRIVATE static
#endif
/* Useful MACRO for variables that are not currently referenced */
/* Prevents compiler warnings and should not produce any code */
#define VARIABLE_INTENTIONALLY_NOT_REFERENCED(x) x=x;
/*
* This type contains a Time Synchronisation Function value. It is a 64bit
* unsigned number although the type is also used by the lower MAC to make
* signed adjustments to the TSF.
*/
#if defined(_MSC_VER) || defined(__arm) || defined (__GNUC__)
typedef int64 TSF;
#endif
#endif // WB_TYPES_INCLUDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -