RT1050 GUI demo using emWin library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GUIDRV_S1D13781_Private.h Source File

GUIDRV_S1D13781_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_S1D13781_Private.h
00040 Purpose     : Interface definition for GUIDRV_S1D13781 driver
00041 ---------------------------END-OF-HEADER------------------------------
00042 */
00043 
00044 #include "GUIDRV_S1D13781.h"
00045 
00046 #ifndef GUIDRV_S1D13781_PRIVATE_H
00047 #define GUIDRV_S1D13781_PRIVATE_H
00048 
00049 /*********************************************************************
00050 *
00051 *       Defines
00052 *
00053 **********************************************************************
00054 */
00055 #ifndef   LCD_WRITE_BUFFER_SIZE
00056   #define LCD_WRITE_BUFFER_SIZE 500
00057 #endif
00058 
00059 //
00060 // BitBLT registers
00061 //
00062 #define REG_BITBLT_CR0    0x60880
00063 #define REG_BITBLT_CR1    0x60882
00064 #define REG_BITBLT_SR     0x60884
00065 #define REG_BITBLT_CR     0x60886
00066 #define REG_BITBLT_SSAR0  0x60888
00067 #define REG_BITBLT_SSAR1  0x6088A
00068 #define REG_BITBLT_DSAR0  0x6088C
00069 #define REG_BITBLT_DSAR1  0x6088E
00070 #define REG_BITBLT_ROR    0x60890
00071 #define REG_BITBLT_WR     0x60892
00072 #define REG_BITBLT_HR     0x60894
00073 #define REG_BITBLT_BCR0   0x60896
00074 #define REG_BITBLT_BCR1   0x60898
00075 #define REG_BITBLT_FCR0   0x6089A
00076 #define REG_BITBLT_FCR1   0x6089C
00077 
00078 #define REG_BITBLT_CR_MOVEP  (0 << 0)
00079 #define REG_BITBLT_CR_FILL   (1 << 1)
00080 #define REG_BITBLT_CR0_START (1 << 0)
00081 
00082 #define REG_MAIN_XSIZE    0x60824
00083 #define REG_MAIN_YSIZE    0x60828
00084 
00085 #define REG_MAIN_SETUP    0x60840
00086 #define REG_MAIN_SADDR0   0x60842
00087 #define REG_MAIN_SADDR1   0x60844
00088 
00089 #define REG_PIP_SETUP     0x60850
00090 #define REG_PIP_SADDR0    0x60852
00091 #define REG_PIP_SADDR1    0x60854
00092 #define REG_PIP_XSIZE     0x60856
00093 #define REG_PIP_YSIZE     0x60858
00094 #define REG_PIP_XPOS      0x6085A
00095 #define REG_PIP_YPOS      0x6085C
00096 #define REG_PIP_ENABLE    0x60860
00097 
00098 #define REG_PIP_ALPHA     0x60862
00099 #define REG_PIP_TRANS     0x60864
00100 #define REG_PIP_TCOL0     0x60866
00101 #define REG_PIP_TCOL1     0x60868
00102 
00103 #define REG_PCR_DSR       0x60822
00104 #define REG_CR_PSR        0x60802
00105 
00106 //
00107 // Use unique context identified
00108 //
00109 #define DRIVER_CONTEXT DRIVER_CONTEXT_S1D13781
00110 
00111 /*********************************************************************
00112 *
00113 *       Types
00114 *
00115 **********************************************************************
00116 */
00117 typedef struct DRIVER_CONTEXT DRIVER_CONTEXT;
00118 
00119 /*********************************************************************
00120 *
00121 *       MANAGE_VMEM_API
00122 */
00123 typedef struct {
00124   //
00125   // Private function pointers
00126   //
00127   void (* pfWriteDataAuto_8) (DRIVER_CONTEXT * pContext, U32 Addr, U8 Data);
00128   void (* pfWriteDataFlush_8)(DRIVER_CONTEXT * pContext);
00129 
00130   void (* pfWriteDataM_8) (DRIVER_CONTEXT * pContext, U32 Addr, U8 Data, U32 NumItems);
00131   void (* pfWriteDataMP_8)(DRIVER_CONTEXT * pContext, U32 Addr, U8 * pData, U32 NumItems);
00132   U8 * (* pfReadDataM_8)  (DRIVER_CONTEXT * pContext, U32 Addr, U8 * pData, U32 NumItems);
00133   U8   (* pfReadData_8)   (DRIVER_CONTEXT * pContext, U32 Addr);
00134   void (* pfWriteReg)     (DRIVER_CONTEXT * pContext, U32 Addr, U16 Data);
00135   U16  (* pfReadReg)      (DRIVER_CONTEXT * pContext, U32 Addr);
00136 
00137 } MANAGE_VMEM_API;
00138 
00139 /*********************************************************************
00140 *
00141 *       DRIVER_CONTEXT_S1D13781
00142 */
00143 struct DRIVER_CONTEXT {
00144   //
00145   // Common data
00146   //
00147   int xSize, ySize;
00148   int vxSize, vySize;
00149   int MemSize;
00150   int SwapXY;
00151   int XOff;
00152   U32 BufferOffset;
00153   int NumBytesInBuffer;
00154   U32 Addr;
00155   U32 BaseAddr;
00156   int WaitUntilVNDP;
00157   //
00158   // PIP layer
00159   //
00160   int IsVisible;
00161   int xPos, yPos;
00162   //
00163   // Driver specific data
00164   //
00165   int WriteBufferSize;
00166   int WriteBufferSizeNew;
00167   int UseLayer;
00168   U8 aInitialWriteBuffer[10];
00169   //
00170   // Accelerators for calculation
00171   //
00172   int BitsPerPixel;
00173   int BytesPerPixel;
00174   //
00175   // VRAM
00176   //
00177   U8 * pReadBuffer;
00178   U8 * pWriteBuffer;
00179   U8 * pWrite;
00180   //
00181   // API-Tables
00182   //
00183   MANAGE_VMEM_API ManageVMEM_API; // Memory management
00184   GUI_PORT_API    HW_API;         // Hardware routines
00185 };
00186 
00187 /*********************************************************************
00188 *
00189 *       _SetPixelIndex_##EXT
00190 */
00191 #define DEFINE_SETPIXELINDEX(EXT)                                                                 \
00192 static void _SetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y, LCD_PIXELINDEX PixelIndex) { \
00193   DRIVER_CONTEXT_S1D13781 * pContext;                                                             \
00194                                                                                                   \
00195   pContext = (DRIVER_CONTEXT_S1D13781 *)pDevice->u.pContext;                                      \
00196   _SetPixelIndex(pContext, x, y, PixelIndex);                                                     \
00197 }
00198 
00199 /*********************************************************************
00200 *
00201 *       _GetPixelIndex_##EXT
00202 */
00203 #define DEFINE_GETPIXELINDEX(EXT)                                                \
00204 static LCD_PIXELINDEX _GetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y) { \
00205   DRIVER_CONTEXT_S1D13781 * pContext;                                            \
00206   LCD_PIXELINDEX PixelIndex;                                                     \
00207                                                                                  \
00208   pContext = (DRIVER_CONTEXT_S1D13781 *)pDevice->u.pContext;                     \
00209   PixelIndex = _GetPixelIndex(pContext, x, y);                                   \
00210   return PixelIndex;                                                             \
00211 }
00212 
00213 /*********************************************************************
00214 *
00215 *       _GetDevProp_##EXT
00216 */
00217 #define DEFINE_GETDEVPROP(EXT, MX, MY, SWAP)                    \
00218 static I32 _GetDevProp_##EXT(GUI_DEVICE * pDevice, int Index) { \
00219   switch (Index) {                                              \
00220   case LCD_DEVCAP_MIRROR_X: return MX;                          \
00221   case LCD_DEVCAP_MIRROR_Y: return MY;                          \
00222   case LCD_DEVCAP_SWAP_XY:  return SWAP;                        \
00223   }                                                             \
00224   return _GetDevProp(pDevice, Index);                           \
00225 }
00226 
00227 /*********************************************************************
00228 *
00229 *       DEFINE_FUNCTIONS
00230 */
00231 #define DEFINE_FUNCTIONS(EXT, MX, MY, SWAP) \
00232   DEFINE_SETPIXELINDEX(EXT)                 \
00233   DEFINE_GETPIXELINDEX(EXT)                 \
00234   DEFINE_GETDEVPROP(EXT, MX, MY, SWAP)      \
00235   DEFINE_GUI_DEVICE_API(EXT)
00236 
00237 /*********************************************************************
00238 *
00239 *       Private functions
00240 *
00241 **********************************************************************
00242 */
00243 void (*GUIDRV__S1D13781_GetDevFunc(GUI_DEVICE ** ppDevice, int Index))(void);
00244 void   GUIDRV__S1D13781_SetOrg    (GUI_DEVICE *  pDevice,  int x, int y);
00245 I32    GUIDRV__S1D13781_GetDevProp(GUI_DEVICE *  pDevice,  int Index);
00246 void   GUIDRV__S1D13781_GetRect   (GUI_DEVICE *  pDevice,  LCD_RECT * pRect);
00247 int    GUIDRV__S1D13781_InitOnce  (GUI_DEVICE *  pDevice);
00248 int    GUIDRV__S1D13781_Init      (GUI_DEVICE *  pDevice);
00249 
00250 U32    GUIDRV__S1D13781_GetAddr   (DRIVER_CONTEXT * pContext, int x, int y);
00251 
00252 #endif /* GUIDRV_S1D13781_PRIVATE_H */
00253 
00254 /*************************** End of file ****************************/