RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GUIDRV_SPage_Private.h Source File

GUIDRV_SPage_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_SPage_Private.h
00040 Purpose     : Private interface of GUIDRV_SPage driver
00041 ---------------------------END-OF-HEADER------------------------------
00042 */
00043 
00044 #include "GUIDRV_SPage.h"
00045 #include "GUIDRV_NoOpt_1_8.h"
00046 
00047 #ifndef GUIDRV_SPAGE_PRIVATE_H
00048 #define GUIDRV_SPAGE_PRIVATE_H
00049 
00050 #if defined(__cplusplus)
00051 extern "C" {     /* Make sure we have C-declarations in C++ programs */
00052 #endif
00053 
00054 /*********************************************************************
00055 *
00056 *       Defines
00057 *
00058 **********************************************************************
00059 */
00060 #define SPAGE_MAX_NUM_DUMMY_READS 5
00061 
00062 //
00063 // Use unique context identified
00064 //
00065 #define DRIVER_CONTEXT DRIVER_CONTEXT_SPAGE
00066 
00067 /*********************************************************************
00068 *
00069 *       Types
00070 *
00071 **********************************************************************
00072 */
00073 typedef struct DRIVER_CONTEXT DRIVER_CONTEXT;
00074 
00075 /*********************************************************************
00076 *
00077 *       DRIVER_CONTEXT
00078 */
00079 struct DRIVER_CONTEXT {
00080   //
00081   // Common data
00082   //
00083   int xSize, ySize;
00084   int vxSize, vySize;
00085   int NumDummyReads;
00086   int BitsPerPixel;
00087   int NumPages;
00088   //
00089   // Driver specific data
00090   //
00091   int FirstSEG;
00092   int FirstCOM;
00093   //
00094   // Accelerators for calculation
00095   //
00096   int BytesPerLine;
00097   //
00098   // Cache
00099   //
00100   U8 * pVRAM;
00101   int CacheLocked;
00102   int CacheStat;
00103   int xOff;
00104   U16 * pDirtyMin;
00105   U16 * pDirtyMax;
00106   //
00107   // Pointer to driver internal initialization routine
00108   //
00109   void (* pfInit)(GUI_DEVICE * pDevice);
00110   //
00111   // Display controller specific functions
00112   //
00113   void (* pfSetAddrW) (DRIVER_CONTEXT * pContext, int Column, int Page);
00114   void (* pfSetAddrR) (DRIVER_CONTEXT * pContext, int Column, int Page);
00115   U8   (* pfReadVMem) (DRIVER_CONTEXT * pContext, int Column, int Page);
00116   void (* pfWriteVMem)(DRIVER_CONTEXT * pContext, int Column, int Page, U8 Data);
00117   //
00118   // Writing and reading data, makes it possible to mirror pixels if required
00119   //
00120   U8   (* pfReadData) (U8 * pData);
00121   void (* pfWriteData)(U8 * pData, U8 Data);
00122   void (* pfWrite)    (DRIVER_CONTEXT * pContext, U8 Data);
00123   //
00124   // Hardware routines
00125   //
00126   GUI_PORT_API HW_API;
00127 };
00128 
00129 /*********************************************************************
00130 *
00131 *       LOG2PHYS_xxx
00132 */
00133 #define LOG2PHYS_X      (                  x    )
00134 #define LOG2PHYS_X_OX   (pContext->xSize - x - 1)
00135 #define LOG2PHYS_X_OY   (                  x    )
00136 #define LOG2PHYS_X_OXY  (pContext->xSize - x - 1)
00137 #define LOG2PHYS_X_OS   (                  y    )
00138 #define LOG2PHYS_X_OSX  (pContext->ySize - y - 1)
00139 #define LOG2PHYS_X_OSY  (                  y    )
00140 #define LOG2PHYS_X_OSXY (pContext->ySize - y - 1)
00141 
00142 #define LOG2PHYS_Y      (                  y    )
00143 #define LOG2PHYS_Y_OX   (                  y    )
00144 #define LOG2PHYS_Y_OY   (pContext->ySize - y - 1)
00145 #define LOG2PHYS_Y_OXY  (pContext->ySize - y - 1)
00146 #define LOG2PHYS_Y_OS   (                  x    )
00147 #define LOG2PHYS_Y_OSX  (                  x    )
00148 #define LOG2PHYS_Y_OSY  (pContext->xSize - x - 1)
00149 #define LOG2PHYS_Y_OSXY (pContext->xSize - x - 1)
00150 
00151 /*********************************************************************
00152 *
00153 *       _SetPixelIndex_##EXT
00154 */
00155 #define DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                                                 \
00156 static void _SetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y, LCD_PIXELINDEX PixelIndex) { \
00157   DRIVER_CONTEXT * pContext;                                                                      \
00158                                                                                                   \
00159   pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;                                               \
00160   _SetPixelIndex(pContext, X_PHYS, Y_PHYS, PixelIndex);                                           \
00161 }
00162 
00163 /*********************************************************************
00164 *
00165 *       _GetPixelIndex_##EXT
00166 */
00167 #define DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                                \
00168 static LCD_PIXELINDEX _GetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y) { \
00169   DRIVER_CONTEXT * pContext;                                                     \
00170   LCD_PIXELINDEX PixelIndex;                                                     \
00171                                                                                  \
00172   pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;                              \
00173   PixelIndex = _GetPixelIndex(pContext, X_PHYS, Y_PHYS);                         \
00174   return PixelIndex;                                                             \
00175 }
00176 
00177 /*********************************************************************
00178 *
00179 *       _GetDevProp_##EXT
00180 */
00181 #define DEFINE_GETDEVPROP(EXT, MX, MY, SWAP)                    \
00182 static I32 _GetDevProp_##EXT(GUI_DEVICE * pDevice, int Index) { \
00183   switch (Index) {                                              \
00184   case LCD_DEVCAP_MIRROR_X: return MX;                          \
00185   case LCD_DEVCAP_MIRROR_Y: return MY;                          \
00186   case LCD_DEVCAP_SWAP_XY:  return SWAP;                        \
00187   }                                                             \
00188   return _GetDevProp(pDevice, Index);                           \
00189 }
00190 
00191 /*********************************************************************
00192 *
00193 *       DEFINE_FUNCTIONS
00194 */
00195 #define DEFINE_FUNCTIONS(EXT, X_PHYS, Y_PHYS, MX, MY, SWAP) \
00196   DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                 \
00197   DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                 \
00198   DEFINE_GETDEVPROP(EXT, MX, MY, SWAP)                      \
00199   DEFINE_GUI_DEVICE_API(EXT)
00200 
00201 /*********************************************************************
00202 *
00203 *       Private functions, common
00204 *
00205 **********************************************************************
00206 */
00207 void (*GUIDRV__SPage_GetDevFunc(GUI_DEVICE ** ppDevice, int Index))(void);
00208 void   GUIDRV__SPage_SetOrg    (GUI_DEVICE *  pDevice,  int x, int y);
00209 I32    GUIDRV__SPage_GetDevProp(GUI_DEVICE *  pDevice,  int Index);
00210 void   GUIDRV__SPage_GetRect   (GUI_DEVICE *  pDevice,  LCD_RECT * pRect);
00211 int    GUIDRV__SPage_Init      (GUI_DEVICE * pDevice);
00212 
00213 /*********************************************************************
00214 *
00215 *       Private functions, cache related
00216 *
00217 **********************************************************************
00218 */
00219 void GUIDRV__SPage_WriteCache  (DRIVER_CONTEXT * pContext, int x, int Page, U8 Data);
00220 U8   GUIDRV__SPage_ReadCache   (DRIVER_CONTEXT * pContext, int x, int Page);
00221 void GUIDRV__SPage_FlushCache  (DRIVER_CONTEXT * pContext);
00222 void GUIDRV__SPage_AddDirtyRect(DRIVER_CONTEXT * pContext, int Page0, int Page1, int x0, int x1);
00223 int  GUIDRV__SPage_ControlCache(GUI_DEVICE * pDevice, int Cmd);
00224 
00225 /*********************************************************************
00226 *
00227 *       Simulation (Segger internal use only)
00228 *
00229 **********************************************************************
00230 */
00231 #if defined(WIN32) && defined(LCD_SIMCONTROLLER)
00232 
00233   extern GUI_PORT_API SIM_SPage_HW_API;
00234 
00235   void SIM_SPage_SetFunc1502 (GUI_DEVICE * pDevice);
00236   void SIM_SPage_SetFunc1510 (GUI_DEVICE * pDevice);
00237   void SIM_SPage_SetFunc1512 (GUI_DEVICE * pDevice);
00238   void SIM_SPage_SetFunc1802 (GUI_DEVICE * pDevice);
00239   void SIM_SPage_SetFunc1638 (GUI_DEVICE * pDevice);
00240   void SIM_SPage_SetFunc75256(GUI_DEVICE * pDevice);
00241   void SIM_SPage_SetFunc75320(GUI_DEVICE * pDevice);
00242   void SIM_SPage_SetFunc7591 (GUI_DEVICE * pDevice);
00243   void SIM_SPage_Config      (GUI_DEVICE * pDevice, int xSize, int ySize, int FirstSEG, int FirstCOM, int BitsPerPixel, int NumDummyReads);
00244 
00245 #endif
00246 
00247 #if defined(__cplusplus)
00248 }
00249 #endif
00250 
00251 #endif /* GUIDRV_SPAGE_PRIVATE_H */
00252 
00253 /*************************** End of file ****************************/