damon zhang / Mbed OS rt1050_emwin_gui_demo
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GUIDRV_TemplateI_Private.h Source File

GUIDRV_TemplateI_Private.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        : GUIDRV_TemplateI_Private.h
00040 Purpose     : Interface definition for GUIDRV_TemplateI driver
00041 ---------------------------END-OF-HEADER------------------------------
00042 */
00043 
00044 #include "GUIDRV_TemplateI.h"
00045 #include "GUIDRV_NoOpt_1_8.h"
00046 
00047 #ifndef GUIDRV_TEMPLATE_I_PRIVATE_H
00048 #define GUIDRV_TEMPLATE_I_PRIVATE_H
00049 
00050 /*********************************************************************
00051 *
00052 *       Defines
00053 *
00054 **********************************************************************
00055 */
00056 #define PRIVATE_DEVFUNC_ONINITHOOK 0x1000
00057 
00058 //
00059 // Use unique context identified
00060 //
00061 #define DRIVER_CONTEXT DRIVER_CONTEXT_TEMPLATE_I
00062 
00063 /*********************************************************************
00064 *
00065 *       Types
00066 *
00067 **********************************************************************
00068 */
00069 typedef struct DRIVER_CONTEXT DRIVER_CONTEXT;
00070 
00071 typedef void (* T_ONINITHOOK)(DRIVER_CONTEXT * pContext);
00072 
00073 /*********************************************************************
00074 *
00075 *       MANAGE_VMEM_API
00076 */
00077 typedef struct {
00078   //
00079   // TBD: Add private function pointers...
00080   //
00081   int Dummy;
00082 } MANAGE_VMEM_API;
00083 
00084 /*********************************************************************
00085 *
00086 *       DRIVER_CONTEXT
00087 */
00088 struct DRIVER_CONTEXT {
00089   //
00090   // Common data
00091   //
00092   int xSize, ySize;
00093   int vxSize, vySize;
00094   //
00095   // Driver specific data
00096   //
00097   //
00098   // Accelerators for calculation
00099   //
00100   int BytesPerLine;
00101   int BitsPerPixel;
00102   //
00103   // VRAM
00104   //
00105   U8 * pVMEM;
00106   //
00107   // Pointer to driver internal initialization routine
00108   //
00109   void (* pfInit) (GUI_DEVICE * pDevice);
00110   void (* pfCheck)(GUI_DEVICE * pDevice);
00111   //
00112   // API-Tables
00113   //
00114   MANAGE_VMEM_API ManageVMEM_API; // Memory management
00115   GUI_PORT_API    HW_API;         // Hardware routines
00116 };
00117 
00118 /*********************************************************************
00119 *
00120 *       LOG2PHYS_xxx
00121 */
00122 #define LOG2PHYS_X      (                  x    )
00123 #define LOG2PHYS_X_OX   (pContext->xSize - x - 1)
00124 #define LOG2PHYS_X_OY   (                  x    )
00125 #define LOG2PHYS_X_OXY  (pContext->xSize - x - 1)
00126 #define LOG2PHYS_X_OS   (                  y    )
00127 #define LOG2PHYS_X_OSX  (pContext->ySize - y - 1)
00128 #define LOG2PHYS_X_OSY  (                  y    )
00129 #define LOG2PHYS_X_OSXY (pContext->ySize - y - 1)
00130 
00131 #define LOG2PHYS_Y      (                  y    )
00132 #define LOG2PHYS_Y_OX   (                  y    )
00133 #define LOG2PHYS_Y_OY   (pContext->ySize - y - 1)
00134 #define LOG2PHYS_Y_OXY  (pContext->ySize - y - 1)
00135 #define LOG2PHYS_Y_OS   (                  x    )
00136 #define LOG2PHYS_Y_OSX  (                  x    )
00137 #define LOG2PHYS_Y_OSY  (pContext->xSize - x - 1)
00138 #define LOG2PHYS_Y_OSXY (pContext->xSize - x - 1)
00139 
00140 /*********************************************************************
00141 *
00142 *       _SetPixelIndex_##EXT
00143 */
00144 #define DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                                                 \
00145 static void _SetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y, LCD_PIXELINDEX PixelIndex) { \
00146   DRIVER_CONTEXT * pContext;                                                                      \
00147                                                                                                   \
00148   pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;                                               \
00149   pContext->xSize = pContext->xSize; /* Keep compiler happy */                                    \
00150   _SetPixelIndex(pDevice, X_PHYS, Y_PHYS, PixelIndex);                                            \
00151 }
00152 
00153 /*********************************************************************
00154 *
00155 *       _GetPixelIndex_##EXT
00156 */
00157 #define DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                                \
00158 static LCD_PIXELINDEX _GetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y) { \
00159   LCD_PIXELINDEX PixelIndex;                                                     \
00160   DRIVER_CONTEXT * pContext;                                                     \
00161                                                                                  \
00162   pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;                              \
00163   pContext->xSize = pContext->xSize; /* Keep compiler happy */                   \
00164   PixelIndex = _GetPixelIndex(pDevice, X_PHYS, Y_PHYS);                          \
00165   return PixelIndex;                                                             \
00166 }
00167 
00168 /*********************************************************************
00169 *
00170 *       _GetDevProp_##EXT
00171 */
00172 #define DEFINE_GETDEVPROP(EXT, MX, MY, SWAP)                    \
00173 static I32 _GetDevProp_##EXT(GUI_DEVICE * pDevice, int Index) { \
00174   switch (Index) {                                              \
00175   case LCD_DEVCAP_MIRROR_X: return MX;                          \
00176   case LCD_DEVCAP_MIRROR_Y: return MY;                          \
00177   case LCD_DEVCAP_SWAP_XY:  return SWAP;                        \
00178   }                                                             \
00179   return _GetDevProp(pDevice, Index);                           \
00180 }
00181 
00182 /*********************************************************************
00183 *
00184 *       DEFINE_FUNCTIONS
00185 */
00186 #define DEFINE_FUNCTIONS(EXT, X_PHYS, Y_PHYS, MX, MY, SWAP) \
00187   DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                 \
00188   DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                 \
00189   DEFINE_GETDEVPROP(EXT, MX, MY, SWAP)                      \
00190   DEFINE_GUI_DEVICE_API(EXT)
00191 
00192 
00193 /*********************************************************************
00194 *
00195 *       Private functions
00196 *
00197 **********************************************************************
00198 */
00199 void (*GUIDRV__TemplateI_GetDevFunc(GUI_DEVICE ** ppDevice, int Index))(void);
00200 void   GUIDRV__TemplateI_SetOrg    (GUI_DEVICE *  pDevice,  int x, int y);
00201 I32    GUIDRV__TemplateI_GetDevProp(GUI_DEVICE *  pDevice,  int Index);
00202 void   GUIDRV__TemplateI_GetRect   (GUI_DEVICE *  pDevice,  LCD_RECT * pRect);
00203 
00204 #endif
00205 
00206 /*************************** End of file ****************************/