RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GUIDRV_SLin_Private.h Source File

GUIDRV_SLin_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_SLin.h
00040 Purpose     : Interface definition for GUIDRV_SLin driver
00041 ---------------------------END-OF-HEADER------------------------------
00042 */
00043 
00044 #include "GUIDRV_SLin.h"
00045 #include "GUIDRV_NoOpt_1_8.h"
00046 
00047 #ifndef GUIDRV_SLIN_PRIVATE_H
00048 #define GUIDRV_SLIN_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 //
00061 // Use unique context identified
00062 //
00063 #define DRIVER_CONTEXT DRIVER_CONTEXT_SLIN
00064 
00065 /*********************************************************************
00066 *
00067 *       Types
00068 *
00069 **********************************************************************
00070 */
00071 typedef struct DRIVER_CONTEXT DRIVER_CONTEXT;
00072 
00073 /*********************************************************************
00074 *
00075 *       MANAGE_VRAM_CONTEXT
00076 */
00077 typedef struct {
00078   //
00079   // Should be the same for all controllers
00080   //
00081   U8   (* pfReadVMEM )  (DRIVER_CONTEXT * pContext, U32 Off);
00082   void (* pfWriteVMEM)  (DRIVER_CONTEXT * pContext, U32 Off, U8 Data);
00083   void (* pfWritePixels)(DRIVER_CONTEXT * pContext, U32 Off, U8 Data);
00084   //
00085   // Depends on controller
00086   //
00087   void (* pfSetADDR)    (DRIVER_CONTEXT * pContext, U32 Off);
00088   void (* pfSetWriteNC) (DRIVER_CONTEXT * pContext);
00089   void (* pfSetWriteC)  (DRIVER_CONTEXT * pContext);
00090   void (* pfSendCache)  (DRIVER_CONTEXT * pContext, int x0, int y0, int x1, int y1);
00091   U32  (* pfXY2Off)     (DRIVER_CONTEXT * pContext, int x, int y);
00092   //
00093   // Only used by SSD1848
00094   //
00095   U8   (* pfData)       (U8 Data);
00096   void (* pfPutData)    (DRIVER_CONTEXT * pContext, U32 Off, U8 Data);
00097   U8   (* pfGetData)    (DRIVER_CONTEXT * pContext, U32 Off);
00098   void (* pfWriteData)  (DRIVER_CONTEXT * pContext, U8 Data);
00099   //
00100   // Only used by T6963
00101   //
00102   void (* pfCheckBusy)  (DRIVER_CONTEXT * pContext, U8 Mask);
00103   void (* pfSetOrg)     (DRIVER_CONTEXT * pContext);
00104 } MANAGE_VMEM_API;
00105 
00106 /*********************************************************************
00107 *
00108 *       DRIVER_CONTEXT
00109 */
00110 struct DRIVER_CONTEXT {
00111   //
00112   // Common data
00113   //
00114   int xSize, ySize;
00115   int vxSize, vySize;
00116   int UseCache;
00117   int MemSize;
00118   U32 BufferOffset;
00119   //
00120   // Cache specific data
00121   //
00122   U8 * pVMEM;
00123   int CacheLocked;
00124   int IsDirty;
00125   GUI_RECT DirtyRect;
00126   //
00127   // Driver specific data
00128   //
00129   int FirstSEG;
00130   int FirstCOM;
00131   int UseMirror;   // Used by SSD1848
00132   int CheckBusy;   // Used by T6963
00133   U32 Off;         // Used by T6963
00134   U8  UseDualScan; // Used by T6963
00135   //
00136   // Accelerators for calculation
00137   //
00138   int BytesPerLine;
00139   int BitsPerPixel;
00140   //
00141   // Mirroring (used by UC1617)
00142   //
00143   const U8 * pMirror;
00144   //
00145   // Pointer to driver internal initialization routine
00146   //
00147   void (* pfInit)(GUI_DEVICE * pDevice);
00148   //
00149   // Set if cache is used
00150   //
00151   int  (* pfControlCache)(GUI_DEVICE *  pDevice, int Cmd);
00152   void (* pfRefresh     )(GUI_DEVICE *  pDevice);
00153   //
00154   // API-Tables
00155   //
00156   MANAGE_VMEM_API ManageVMEM_API; // Memory management
00157   GUI_PORT_API    HW_API;         // Hardware routines
00158 };
00159 
00160 /*********************************************************************
00161 *
00162 *       LOG2PHYS_xxx
00163 */
00164 #define LOG2PHYS_X      (                  x    )
00165 #define LOG2PHYS_X_OX   (pContext->xSize - x - 1)
00166 #define LOG2PHYS_X_OY   (                  x    )
00167 #define LOG2PHYS_X_OXY  (pContext->xSize - x - 1)
00168 #define LOG2PHYS_X_OS   (                  y    )
00169 #define LOG2PHYS_X_OSX  (pContext->ySize - y - 1)
00170 #define LOG2PHYS_X_OSY  (                  y    )
00171 #define LOG2PHYS_X_OSXY (pContext->ySize - y - 1)
00172 
00173 #define LOG2PHYS_Y      (                  y    )
00174 #define LOG2PHYS_Y_OX   (                  y    )
00175 #define LOG2PHYS_Y_OY   (pContext->ySize - y - 1)
00176 #define LOG2PHYS_Y_OXY  (pContext->ySize - y - 1)
00177 #define LOG2PHYS_Y_OS   (                  x    )
00178 #define LOG2PHYS_Y_OSX  (                  x    )
00179 #define LOG2PHYS_Y_OSY  (pContext->xSize - x - 1)
00180 #define LOG2PHYS_Y_OSXY (pContext->xSize - x - 1)
00181 
00182 /*********************************************************************
00183 *
00184 *       _SetPixelIndex_##EXT
00185 */
00186 #define DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                                                 \
00187 static void _SetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y, LCD_PIXELINDEX PixelIndex) { \
00188   DRIVER_CONTEXT * pContext;                                                                      \
00189                                                                                                   \
00190   pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;                                               \
00191   _SetPixelIndex(pContext, X_PHYS, Y_PHYS, PixelIndex);                                           \
00192 }
00193 
00194 /*********************************************************************
00195 *
00196 *       _GetPixelIndex_##EXT
00197 */
00198 #define DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                                \
00199 static LCD_PIXELINDEX _GetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y) { \
00200   DRIVER_CONTEXT * pContext;                                                     \
00201   LCD_PIXELINDEX PixelIndex;                                                     \
00202                                                                                  \
00203   pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;                              \
00204   PixelIndex = _GetPixelIndex(pContext, X_PHYS, Y_PHYS);                         \
00205   return PixelIndex;                                                             \
00206 }
00207 
00208 /*********************************************************************
00209 *
00210 *       _GetDevProp_##EXT
00211 */
00212 #define DEFINE_GETDEVPROP(EXT, MX, MY, SWAP)                    \
00213 static I32 _GetDevProp_##EXT(GUI_DEVICE * pDevice, int Index) { \
00214   switch (Index) {                                              \
00215   case LCD_DEVCAP_MIRROR_X: return MX;                          \
00216   case LCD_DEVCAP_MIRROR_Y: return MY;                          \
00217   case LCD_DEVCAP_SWAP_XY:  return SWAP;                        \
00218   }                                                             \
00219   return _GetDevProp(pDevice, Index);                           \
00220 }
00221 
00222 /*********************************************************************
00223 *
00224 *       DEFINE_FUNCTIONS
00225 */
00226 #define DEFINE_FUNCTIONS(EXT, X_PHYS, Y_PHYS, MX, MY, SWAP) \
00227   DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                 \
00228   DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS)                 \
00229   DEFINE_GETDEVPROP(EXT, MX, MY, SWAP)                      \
00230   DEFINE_GUI_DEVICE_API(EXT)
00231 
00232 /*********************************************************************
00233 *
00234 *       Private functions
00235 *
00236 **********************************************************************
00237 */
00238 void (*GUIDRV__SLin_GetDevFunc(GUI_DEVICE ** ppDevice, int Index))(void);
00239 void   GUIDRV__SLin_SetOrg    (GUI_DEVICE *  pDevice,  int x, int y);
00240 I32    GUIDRV__SLin_GetDevProp(GUI_DEVICE *  pDevice,  int Index);
00241 void   GUIDRV__SLin_GetRect   (GUI_DEVICE *  pDevice,  LCD_RECT * pRect);
00242 
00243 void   GUIDRV__SLin_SendCache (DRIVER_CONTEXT * pContext, int x0, int y0, int x1, int y1);
00244 void   GUIDRV__SLin_WriteVMEM (DRIVER_CONTEXT * pContext, U32 Off, U8 Data, int x, int y);
00245 
00246 #if defined(__cplusplus)
00247 }
00248 #endif
00249 
00250 #endif
00251 
00252 /*************************** End of file ****************************/