Global.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH
  3. *
  4. * SPDX-License-Identifier: BSD-1-Clause
  5. */
  6. /*********************************************************************
  7. * SEGGER Microcontroller GmbH *
  8. * The Embedded Experts *
  9. **********************************************************************
  10. * *
  11. * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
  12. * *
  13. * www.segger.com Support: support@segger.com *
  14. * *
  15. **********************************************************************
  16. * *
  17. * SEGGER SystemView * Real-time application analysis *
  18. * *
  19. **********************************************************************
  20. * *
  21. * All rights reserved. *
  22. * *
  23. * SEGGER strongly recommends to not make any changes *
  24. * to or modify the source code of this software in order to stay *
  25. * compatible with the SystemView and RTT protocol, and J-Link. *
  26. * *
  27. * Redistribution and use in source and binary forms, with or *
  28. * without modification, are permitted provided that the following *
  29. * condition is met: *
  30. * *
  31. * o Redistributions of source code must retain the above copyright *
  32. * notice, this condition and the following disclaimer. *
  33. * *
  34. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
  35. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
  36. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
  37. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
  38. * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
  39. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
  40. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
  41. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
  42. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  43. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
  44. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
  45. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
  46. * DAMAGE. *
  47. * *
  48. **********************************************************************
  49. * *
  50. * SystemView version: 3.42 *
  51. * *
  52. **********************************************************************
  53. ----------------------------------------------------------------------
  54. File : Global.h
  55. Purpose : Global types
  56. In case your application already has a Global.h, you should
  57. merge the files. In order to use Segger code, the types
  58. U8, U16, U32, I8, I16, I32 need to be defined in Global.h;
  59. additional definitions do not hurt.
  60. Revision: $Rev: 12501 $
  61. ---------------------------END-OF-HEADER------------------------------
  62. */
  63. #ifndef GLOBAL_H // Guard against multiple inclusion
  64. #define GLOBAL_H
  65. #define U8 unsigned char
  66. #define I8 signed char
  67. #define U16 unsigned short
  68. #define I16 signed short
  69. #ifdef __x86_64__
  70. #define U32 unsigned
  71. #define I32 int
  72. #else
  73. #define U32 unsigned long
  74. #define I32 signed long
  75. #endif
  76. //
  77. // CC_NO_LONG_SUPPORT can be defined to compile test
  78. // without long support for compilers that do not
  79. // support C99 and its long type.
  80. //
  81. #ifdef CC_NO_LONG_SUPPORT
  82. #define PTR_ADDR U32
  83. #else // Supports long type.
  84. #if defined(_WIN32) && !defined(__clang__) && !defined(__MINGW32__)
  85. //
  86. // Microsoft VC6 compiler related
  87. //
  88. #define U64 unsigned __int64
  89. #define U128 unsigned __int128
  90. #define I64 __int64
  91. #define I128 __int128
  92. #if _MSC_VER <= 1200
  93. #define U64_C(x) x##UI64
  94. #else
  95. #define U64_C(x) x##ULL
  96. #endif
  97. #else
  98. //
  99. // C99 compliant compiler
  100. //
  101. #define U64 unsigned long long
  102. #define I64 signed long long
  103. #define U64_C(x) x##ULL
  104. #endif
  105. #if (defined(_WIN64) || defined(__LP64__)) // 64-bit symbols used by Visual Studio and GCC, maybe others as well.
  106. #define PTR_ADDR U64
  107. #else
  108. #define PTR_ADDR U32
  109. #endif
  110. #endif // Supports long type.
  111. #endif // Avoid multiple inclusion
  112. /*************************** End of file ****************************/