📄 global.h
字号:
#define GENERIC // generic pointer to point to application data
// Variables with this attribute can be located in external
// or internal data memory.
#define MEM // Memory attribute to optimize speed and code of pointer access.
#ifndef NEAR
#define NEAR // variables mapped to internal data storage location
#endif
#ifndef FAR
#define FAR far // variables mapped to external data storage location
#endif
#ifndef CONST
#define CONST const // variables mapped to ROM (i.e. flash)
#endif
#define LARGE
#define REENTRANT
#define PUBLIC _far _pascal _export
#ifndef NDEBUG
#ifndef TRACE
#define TRACE trace
#ifdef __cplusplus
extern "C"
{
#endif
void trace (const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif
#endif
#endif
// ------------------ WIN32 ---------------------------------------------
#if (TARGET_SYSTEM == _WIN32_)
#define ROM // code or variables mapped to ROM (i.e. flash)
// usage: CONST BYTE ROM foo = 0x00;
#define HWACC // hardware access through external memory (i.e. CAN)
// These types can be adjusted by users to match application requirements. The goal is to
// minimize code memory and maximize speed.
#define GENERIC // generic pointer to point to application data
// Variables with this attribute can be located in external
// or internal data memory.
#define MEM // Memory attribute to optimize speed and code of pointer access.
#ifndef NEAR
#define NEAR // variables mapped to internal data storage location
#endif
#ifndef FAR
#define FAR // variables mapped to external data storage location
#endif
#ifndef CONST
#define CONST const // variables mapped to ROM (i.e. flash)
#endif
#define LARGE
#define REENTRANT
#define PUBLIC __stdcall
#ifndef QWORD
//#define QWORD long long int // MSVC .NET can use "long long int" too (like GNU)
#define QWORD __int64
#endif
#ifndef NDEBUG
#ifndef TRACE
#define TRACE trace
#ifdef __cplusplus
extern "C"
{
#endif
void trace (const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif
#endif
#endif
#endif // ===> PC
//---------------------------------------------------------------------------
// definitions of basic types
//---------------------------------------------------------------------------
#ifndef _WINDEF_ // defined in WINDEF.H, included by <windows.h>
// --- arithmetic types ---
#ifndef SHORT
#define SHORT short int
#endif
#ifndef USHORT
#define USHORT unsigned short int
#endif
#ifndef INT
#define INT int
#endif
#ifndef UINT
#define UINT unsigned int
#endif
#ifndef LONG
#define LONG long int
#endif
#ifndef ULONG
#define ULONG unsigned long int
#endif
// --- logic types ---
#ifndef BYTE
#define BYTE unsigned char
#endif
#ifndef WORD
#define WORD unsigned short int
#endif
#ifndef DWORD
#define DWORD unsigned long int
#endif
#ifndef BOOL
#define BOOL unsigned char
#endif
// --- alias types ---
#ifndef TRUE
#define TRUE 0xFF
#endif
#ifndef FALSE
#define FALSE 0x00
#endif
#ifndef NULL
#define NULL ((void *) 0)
#endif
#endif
#ifndef _TIME_OF_DAY_DEFINED_
typedef struct
{
unsigned long int m_dwMs;
unsigned short int m_wDays;
} tTimeOfDay;
#define _TIME_OF_DAY_DEFINED_
#endif
//---------------------------------------------------------------------------
// Definition von TRACE
//---------------------------------------------------------------------------
#ifndef NDEBUG
#ifndef TRACE0
#define TRACE0(p0) TRACE(p0)
#endif
#ifndef TRACE1
#define TRACE1(p0, p1) TRACE(p0, p1)
#endif
#ifndef TRACE2
#define TRACE2(p0, p1, p2) TRACE(p0, p1, p2)
#endif
#ifndef TRACE3
#define TRACE3(p0, p1, p2, p3) TRACE(p0, p1, p2, p3)
#endif
#ifndef TRACE4
#define TRACE4(p0, p1, p2, p3, p4) TRACE(p0, p1, p2, p3, p4)
#endif
#ifndef TRACE5
#define TRACE5(p0, p1, p2, p3, p4, p5) TRACE(p0, p1, p2, p3, p4, p5)
#endif
#ifndef TRACE6
#define TRACE6(p0, p1, p2, p3, p4, p5, p6) TRACE(p0, p1, p2, p3, p4, p5, p6)
#endif
#else
#ifndef TRACE0
#define TRACE0(p0)
#endif
#ifndef TRACE1
#define TRACE1(p0, p1)
#endif
#ifndef TRACE2
#define TRACE2(p0, p1, p2)
#endif
#ifndef TRACE3
#define TRACE3(p0, p1, p2, p3)
#endif
#ifndef TRACE4
#define TRACE4(p0, p1, p2, p3, p4)
#endif
#ifndef TRACE5
#define TRACE5(p0, p1, p2, p3, p4, p5)
#endif
#ifndef TRACE6
#define TRACE6(p0, p1, p2, p3, p4, p5, p6)
#endif
#endif
//---------------------------------------------------------------------------
// definition of ASSERT
//---------------------------------------------------------------------------
#ifndef ASSERT
#if !defined (__linux__) && !defined (__KERNEL__)
#include <assert.h>
#ifndef ASSERT
#define ASSERT(p) assert(p)
#endif
#else
#define ASSERT(p)
#endif
#endif
//---------------------------------------------------------------------------
// SYS TEC extensions
//---------------------------------------------------------------------------
// This macro doesn't print out C-file and line number of the failed assertion
// but a string, which exactly names the mistake.
#ifndef NDEBUG
#define ASSERTMSG(expr,string) if (!(expr)) {\
PRINTF0 ("Assertion failed: " string );\
while (1);}
#else
#define ASSERTMSG(expr,string)
#endif
//---------------------------------------------------------------------------
#endif // #ifndef _GLOBAL_H_
// Please keep an empty line at the end of this file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -