RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SEGGER.h Source File

SEGGER.h

00001 /*********************************************************************
00002 *                SEGGER Microcontroller GmbH & Co. KG                *
00003 *        Solutions for real time microcontroller applications        *
00004 **********************************************************************
00005 *                                                                    *
00006 *        (c) 1996 - 2016  SEGGER Microcontroller GmbH & Co. KG       *
00007 *                                                                    *
00008 *        Internet: www.segger.com    Support:  support@segger.com    *
00009 *                                                                    *
00010 **********************************************************************
00011 
00012 ** emWin V5.38 - Graphical user interface for embedded applications **
00013 All  Intellectual Property rights  in the Software belongs to  SEGGER.
00014 emWin is protected by  international copyright laws.  Knowledge of the
00015 source code may not be used to write a similar product.  This file may
00016 only be used in accordance with the following terms:
00017 
00018 The software has been licensed to  NXP Semiconductors USA, Inc.  whose
00019 registered  office  is  situated  at 411 E. Plumeria Drive, San  Jose,
00020 CA 95134, USA  solely for  the  purposes  of  creating  libraries  for
00021 NXPs M0, M3/M4 and  ARM7/9 processor-based  devices,  sublicensed  and
00022 distributed under the terms and conditions of the NXP End User License
00023 Agreement.
00024 Full source code is available at: www.segger.com
00025 
00026 We appreciate your understanding and fairness.
00027 ----------------------------------------------------------------------
00028 Licensing information
00029 
00030 Licensor:                 SEGGER Microcontroller Systems LLC
00031 Licensed to:              NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA
00032 Licensed SEGGER software: emWin
00033 License number:           GUI-00186
00034 License model:            emWin License Agreement, dated August 20th 2011
00035 Licensed product:         -
00036 Licensed platform:        NXP's ARM 7/9, Cortex-M0,M3,M4
00037 Licensed number of seats: -
00038 ----------------------------------------------------------------------
00039 File    : SEGGER.h
00040 Purpose : Global types etc & general purpose utility functions
00041 Revision: $Rev: 6176 $
00042 ---------------------------END-OF-HEADER------------------------------
00043 */
00044 
00045 #ifndef SEGGER_H            // Guard against multiple inclusion
00046 #define SEGGER_H
00047 
00048 #include <stdarg.h>
00049 #include "Global.h"         // Type definitions: U8, U16, U32, I8, I16, I32
00050 
00051 #if defined(__cplusplus)
00052 extern "C" {     /* Make sure we have C-declarations in C++ programs */
00053 #endif
00054 
00055 /*********************************************************************
00056 *
00057 *       Keywords/specifiers
00058 *
00059 **********************************************************************
00060 */
00061 
00062 #ifndef INLINE
00063   #ifdef _WIN32
00064     //
00065     // Microsoft VC6 and newer.
00066     // Force inlining without cost checking.
00067     //
00068     #define INLINE  __forceinline
00069   #else
00070     #if (defined(__GNUC__))
00071       //
00072       // Force inlining with GCC
00073       //
00074       #define INLINE inline __attribute__((always_inline))
00075     #elif (defined(__ICCARM__) || defined(__CC_ARM) || defined(__RX) || defined(__ICCRX__))
00076       //
00077       // Other known compilers.
00078       //
00079       #define INLINE  inline
00080     #else
00081       //
00082       // Unknown compilers.
00083       //
00084       #define INLINE
00085     #endif
00086   #endif
00087 #endif
00088 
00089 /*********************************************************************
00090 *
00091 *       Function-like macros
00092 *
00093 **********************************************************************
00094 */
00095 
00096 #define SEGGER_COUNTOF(a)          (sizeof((a))/sizeof((a)[0]))
00097 #define SEGGER_MIN(a,b)            (((a) < (b)) ? (a) : (b))
00098 #define SEGGER_MAX(a,b)            (((a) > (b)) ? (a) : (b))
00099 
00100 #ifndef   SEGGER_USE_PARA                   // Some compiler complain about unused parameters.
00101   #define SEGGER_USE_PARA(Para) (void)Para  // This works for most compilers.
00102 #endif
00103 
00104 /*********************************************************************
00105 *
00106 *       Defines
00107 *
00108 **********************************************************************
00109 */
00110 
00111 #define SEGGER_PRINTF_FLAG_ADJLEFT    (1 << 0)
00112 #define SEGGER_PRINTF_FLAG_SIGNFORCE  (1 << 1)
00113 #define SEGGER_PRINTF_FLAG_SIGNSPACE  (1 << 2)
00114 #define SEGGER_PRINTF_FLAG_PRECEED    (1 << 3)
00115 #define SEGGER_PRINTF_FLAG_ZEROPAD    (1 << 4)
00116 #define SEGGER_PRINTF_FLAG_NEGATIVE   (1 << 5)
00117 
00118 /*********************************************************************
00119 *
00120 *       Types
00121 *
00122 **********************************************************************
00123 */
00124 
00125 typedef struct {
00126   char* pBuffer;
00127   int   BufferSize;
00128   int   Cnt;
00129 } SEGGER_BUFFER_DESC;
00130 
00131 typedef struct {
00132   int  CacheLineSize;                                 // 0: No Cache. Most Systems such as ARM9 use a 32 bytes cache line size.
00133   void (*pfDMB)       (void);                         // Optional DMB function for Data Memory Barrier to make sure all memory operations are completed.
00134   void (*pfClean)     (void *p, unsigned NumBytes);   // Optional clean function for cached memory.
00135   void (*pfInvalidate)(void *p, unsigned NumBytes);   // Optional invalidate function for cached memory.
00136 } SEGGER_CACHE_CONFIG;
00137 
00138 typedef struct SEGGER_SNPRINTF_CONTEXT_struct SEGGER_SNPRINTF_CONTEXT;
00139 
00140 struct SEGGER_SNPRINTF_CONTEXT_struct {
00141   void*               pContext;                       // Application specific context.
00142   SEGGER_BUFFER_DESC* pBufferDesc;                    // Buffer descriptor to use for output.
00143   void (*pfFlush)(SEGGER_SNPRINTF_CONTEXT* pContext); // Callback executed once the buffer is full. Callback decides if the buffer gets cleared to store more or not.
00144 };
00145 
00146 typedef struct {
00147   void (*pfStoreChar)       (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, char c);
00148   int  (*pfPrintUnsigned)   (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, U32 v, unsigned Base, char Flags, int Width, int Precision);
00149   int  (*pfPrintInt)        (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, I32 v, unsigned Base, char Flags, int Width, int Precision);
00150 } SEGGER_PRINTF_API;
00151 
00152 typedef void (*SEGGER_pFormatter)(SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, const SEGGER_PRINTF_API* pApi, va_list* pParamList, char Lead, int Width, int Precision);
00153 
00154 typedef struct SEGGER_PRINTF_FORMATTER {
00155   struct SEGGER_PRINTF_FORMATTER* pNext;              // Pointer to next formatter.
00156   SEGGER_pFormatter               pfFormatter;        // Formatter function.
00157   char                            Specifier;          // Format specifier.
00158 } SEGGER_PRINTF_FORMATTER;
00159 
00160 /*********************************************************************
00161 *
00162 *       Utility functions
00163 *
00164 **********************************************************************
00165 */
00166 
00167 void SEGGER_ARM_memcpy(void* pDest, const void* pSrc, int NumBytes);
00168 void SEGGER_memcpy    (void* pDest, const void* pSrc, int NumBytes);
00169 void SEGGER_memxor    (void* pDest, const void* pSrc, unsigned NumBytes);
00170 
00171 void SEGGER_StoreChar    (SEGGER_BUFFER_DESC* pBufferDesc, char c);
00172 void SEGGER_PrintUnsigned(SEGGER_BUFFER_DESC* pBufferDesc, U32 v, unsigned Base, int Precision);
00173 void SEGGER_PrintInt     (SEGGER_BUFFER_DESC* pBufferDesc, I32 v, unsigned Base, int Precision);
00174 int  SEGGER_snprintf     (char* pBuffer, int BufferSize, const char* sFormat, ...);
00175 int  SEGGER_vsnprintf    (char* pBuffer, int BufferSize, const char* sFormat, va_list ParamList);
00176 int  SEGGER_vsnprintfEx  (SEGGER_SNPRINTF_CONTEXT* pContext, const char* sFormat, va_list ParamList);
00177 
00178 int  SEGGER_PRINTF_AddFormatter      (SEGGER_PRINTF_FORMATTER* pFormatter, SEGGER_pFormatter pfFormatter, char c);
00179 void SEGGER_PRINTF_AddDoubleFormatter(void);
00180 void SEGGER_PRINTF_AddIPFormatter    (void);
00181 void SEGGER_PRINTF_AddHTMLFormatter  (void);
00182 
00183 #if defined(__cplusplus)
00184 }                /* Make sure we have C-declarations in C++ programs */
00185 #endif
00186 
00187 #endif                      // Avoid multiple inclusion
00188 
00189 /*************************** End of file ****************************/