NXP
/
rt1050_emwin_gui_demo
RT1050 GUI demo using emWin library
emwin/emWin_header/GUIDRV_SPage_Private.h@0:dd702039127a, 2018-09-20 (annotated)
- Committer:
- alejandroRL
- Date:
- Thu Sep 20 19:16:34 2018 +0000
- Revision:
- 0:dd702039127a
emWin GUI Demo for RT1050
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alejandroRL | 0:dd702039127a | 1 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 2 | * SEGGER Microcontroller GmbH & Co. KG * |
alejandroRL | 0:dd702039127a | 3 | * Solutions for real time microcontroller applications * |
alejandroRL | 0:dd702039127a | 4 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 5 | * * |
alejandroRL | 0:dd702039127a | 6 | * (c) 1996 - 2016 SEGGER Microcontroller GmbH & Co. KG * |
alejandroRL | 0:dd702039127a | 7 | * * |
alejandroRL | 0:dd702039127a | 8 | * Internet: www.segger.com Support: support@segger.com * |
alejandroRL | 0:dd702039127a | 9 | * * |
alejandroRL | 0:dd702039127a | 10 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 11 | |
alejandroRL | 0:dd702039127a | 12 | ** emWin V5.38 - Graphical user interface for embedded applications ** |
alejandroRL | 0:dd702039127a | 13 | All Intellectual Property rights in the Software belongs to SEGGER. |
alejandroRL | 0:dd702039127a | 14 | emWin is protected by international copyright laws. Knowledge of the |
alejandroRL | 0:dd702039127a | 15 | source code may not be used to write a similar product. This file may |
alejandroRL | 0:dd702039127a | 16 | only be used in accordance with the following terms: |
alejandroRL | 0:dd702039127a | 17 | |
alejandroRL | 0:dd702039127a | 18 | The software has been licensed to NXP Semiconductors USA, Inc. whose |
alejandroRL | 0:dd702039127a | 19 | registered office is situated at 411 E. Plumeria Drive, San Jose, |
alejandroRL | 0:dd702039127a | 20 | CA 95134, USA solely for the purposes of creating libraries for |
alejandroRL | 0:dd702039127a | 21 | NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and |
alejandroRL | 0:dd702039127a | 22 | distributed under the terms and conditions of the NXP End User License |
alejandroRL | 0:dd702039127a | 23 | Agreement. |
alejandroRL | 0:dd702039127a | 24 | Full source code is available at: www.segger.com |
alejandroRL | 0:dd702039127a | 25 | |
alejandroRL | 0:dd702039127a | 26 | We appreciate your understanding and fairness. |
alejandroRL | 0:dd702039127a | 27 | ---------------------------------------------------------------------- |
alejandroRL | 0:dd702039127a | 28 | Licensing information |
alejandroRL | 0:dd702039127a | 29 | |
alejandroRL | 0:dd702039127a | 30 | Licensor: SEGGER Microcontroller Systems LLC |
alejandroRL | 0:dd702039127a | 31 | Licensed to: NXP Semiconductors, 1109 McKay Dr, M/S 76, San Jose, CA 95131, USA |
alejandroRL | 0:dd702039127a | 32 | Licensed SEGGER software: emWin |
alejandroRL | 0:dd702039127a | 33 | License number: GUI-00186 |
alejandroRL | 0:dd702039127a | 34 | License model: emWin License Agreement, dated August 20th 2011 |
alejandroRL | 0:dd702039127a | 35 | Licensed product: - |
alejandroRL | 0:dd702039127a | 36 | Licensed platform: NXP's ARM 7/9, Cortex-M0,M3,M4 |
alejandroRL | 0:dd702039127a | 37 | Licensed number of seats: - |
alejandroRL | 0:dd702039127a | 38 | ---------------------------------------------------------------------- |
alejandroRL | 0:dd702039127a | 39 | File : GUIDRV_SPage_Private.h |
alejandroRL | 0:dd702039127a | 40 | Purpose : Private interface of GUIDRV_SPage driver |
alejandroRL | 0:dd702039127a | 41 | ---------------------------END-OF-HEADER------------------------------ |
alejandroRL | 0:dd702039127a | 42 | */ |
alejandroRL | 0:dd702039127a | 43 | |
alejandroRL | 0:dd702039127a | 44 | #include "GUIDRV_SPage.h" |
alejandroRL | 0:dd702039127a | 45 | #include "GUIDRV_NoOpt_1_8.h" |
alejandroRL | 0:dd702039127a | 46 | |
alejandroRL | 0:dd702039127a | 47 | #ifndef GUIDRV_SPAGE_PRIVATE_H |
alejandroRL | 0:dd702039127a | 48 | #define GUIDRV_SPAGE_PRIVATE_H |
alejandroRL | 0:dd702039127a | 49 | |
alejandroRL | 0:dd702039127a | 50 | #if defined(__cplusplus) |
alejandroRL | 0:dd702039127a | 51 | extern "C" { /* Make sure we have C-declarations in C++ programs */ |
alejandroRL | 0:dd702039127a | 52 | #endif |
alejandroRL | 0:dd702039127a | 53 | |
alejandroRL | 0:dd702039127a | 54 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 55 | * |
alejandroRL | 0:dd702039127a | 56 | * Defines |
alejandroRL | 0:dd702039127a | 57 | * |
alejandroRL | 0:dd702039127a | 58 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 59 | */ |
alejandroRL | 0:dd702039127a | 60 | #define SPAGE_MAX_NUM_DUMMY_READS 5 |
alejandroRL | 0:dd702039127a | 61 | |
alejandroRL | 0:dd702039127a | 62 | // |
alejandroRL | 0:dd702039127a | 63 | // Use unique context identified |
alejandroRL | 0:dd702039127a | 64 | // |
alejandroRL | 0:dd702039127a | 65 | #define DRIVER_CONTEXT DRIVER_CONTEXT_SPAGE |
alejandroRL | 0:dd702039127a | 66 | |
alejandroRL | 0:dd702039127a | 67 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 68 | * |
alejandroRL | 0:dd702039127a | 69 | * Types |
alejandroRL | 0:dd702039127a | 70 | * |
alejandroRL | 0:dd702039127a | 71 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 72 | */ |
alejandroRL | 0:dd702039127a | 73 | typedef struct DRIVER_CONTEXT DRIVER_CONTEXT; |
alejandroRL | 0:dd702039127a | 74 | |
alejandroRL | 0:dd702039127a | 75 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 76 | * |
alejandroRL | 0:dd702039127a | 77 | * DRIVER_CONTEXT |
alejandroRL | 0:dd702039127a | 78 | */ |
alejandroRL | 0:dd702039127a | 79 | struct DRIVER_CONTEXT { |
alejandroRL | 0:dd702039127a | 80 | // |
alejandroRL | 0:dd702039127a | 81 | // Common data |
alejandroRL | 0:dd702039127a | 82 | // |
alejandroRL | 0:dd702039127a | 83 | int xSize, ySize; |
alejandroRL | 0:dd702039127a | 84 | int vxSize, vySize; |
alejandroRL | 0:dd702039127a | 85 | int NumDummyReads; |
alejandroRL | 0:dd702039127a | 86 | int BitsPerPixel; |
alejandroRL | 0:dd702039127a | 87 | int NumPages; |
alejandroRL | 0:dd702039127a | 88 | // |
alejandroRL | 0:dd702039127a | 89 | // Driver specific data |
alejandroRL | 0:dd702039127a | 90 | // |
alejandroRL | 0:dd702039127a | 91 | int FirstSEG; |
alejandroRL | 0:dd702039127a | 92 | int FirstCOM; |
alejandroRL | 0:dd702039127a | 93 | // |
alejandroRL | 0:dd702039127a | 94 | // Accelerators for calculation |
alejandroRL | 0:dd702039127a | 95 | // |
alejandroRL | 0:dd702039127a | 96 | int BytesPerLine; |
alejandroRL | 0:dd702039127a | 97 | // |
alejandroRL | 0:dd702039127a | 98 | // Cache |
alejandroRL | 0:dd702039127a | 99 | // |
alejandroRL | 0:dd702039127a | 100 | U8 * pVRAM; |
alejandroRL | 0:dd702039127a | 101 | int CacheLocked; |
alejandroRL | 0:dd702039127a | 102 | int CacheStat; |
alejandroRL | 0:dd702039127a | 103 | int xOff; |
alejandroRL | 0:dd702039127a | 104 | U16 * pDirtyMin; |
alejandroRL | 0:dd702039127a | 105 | U16 * pDirtyMax; |
alejandroRL | 0:dd702039127a | 106 | // |
alejandroRL | 0:dd702039127a | 107 | // Pointer to driver internal initialization routine |
alejandroRL | 0:dd702039127a | 108 | // |
alejandroRL | 0:dd702039127a | 109 | void (* pfInit)(GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 110 | // |
alejandroRL | 0:dd702039127a | 111 | // Display controller specific functions |
alejandroRL | 0:dd702039127a | 112 | // |
alejandroRL | 0:dd702039127a | 113 | void (* pfSetAddrW) (DRIVER_CONTEXT * pContext, int Column, int Page); |
alejandroRL | 0:dd702039127a | 114 | void (* pfSetAddrR) (DRIVER_CONTEXT * pContext, int Column, int Page); |
alejandroRL | 0:dd702039127a | 115 | U8 (* pfReadVMem) (DRIVER_CONTEXT * pContext, int Column, int Page); |
alejandroRL | 0:dd702039127a | 116 | void (* pfWriteVMem)(DRIVER_CONTEXT * pContext, int Column, int Page, U8 Data); |
alejandroRL | 0:dd702039127a | 117 | // |
alejandroRL | 0:dd702039127a | 118 | // Writing and reading data, makes it possible to mirror pixels if required |
alejandroRL | 0:dd702039127a | 119 | // |
alejandroRL | 0:dd702039127a | 120 | U8 (* pfReadData) (U8 * pData); |
alejandroRL | 0:dd702039127a | 121 | void (* pfWriteData)(U8 * pData, U8 Data); |
alejandroRL | 0:dd702039127a | 122 | void (* pfWrite) (DRIVER_CONTEXT * pContext, U8 Data); |
alejandroRL | 0:dd702039127a | 123 | // |
alejandroRL | 0:dd702039127a | 124 | // Hardware routines |
alejandroRL | 0:dd702039127a | 125 | // |
alejandroRL | 0:dd702039127a | 126 | GUI_PORT_API HW_API; |
alejandroRL | 0:dd702039127a | 127 | }; |
alejandroRL | 0:dd702039127a | 128 | |
alejandroRL | 0:dd702039127a | 129 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 130 | * |
alejandroRL | 0:dd702039127a | 131 | * LOG2PHYS_xxx |
alejandroRL | 0:dd702039127a | 132 | */ |
alejandroRL | 0:dd702039127a | 133 | #define LOG2PHYS_X ( x ) |
alejandroRL | 0:dd702039127a | 134 | #define LOG2PHYS_X_OX (pContext->xSize - x - 1) |
alejandroRL | 0:dd702039127a | 135 | #define LOG2PHYS_X_OY ( x ) |
alejandroRL | 0:dd702039127a | 136 | #define LOG2PHYS_X_OXY (pContext->xSize - x - 1) |
alejandroRL | 0:dd702039127a | 137 | #define LOG2PHYS_X_OS ( y ) |
alejandroRL | 0:dd702039127a | 138 | #define LOG2PHYS_X_OSX (pContext->ySize - y - 1) |
alejandroRL | 0:dd702039127a | 139 | #define LOG2PHYS_X_OSY ( y ) |
alejandroRL | 0:dd702039127a | 140 | #define LOG2PHYS_X_OSXY (pContext->ySize - y - 1) |
alejandroRL | 0:dd702039127a | 141 | |
alejandroRL | 0:dd702039127a | 142 | #define LOG2PHYS_Y ( y ) |
alejandroRL | 0:dd702039127a | 143 | #define LOG2PHYS_Y_OX ( y ) |
alejandroRL | 0:dd702039127a | 144 | #define LOG2PHYS_Y_OY (pContext->ySize - y - 1) |
alejandroRL | 0:dd702039127a | 145 | #define LOG2PHYS_Y_OXY (pContext->ySize - y - 1) |
alejandroRL | 0:dd702039127a | 146 | #define LOG2PHYS_Y_OS ( x ) |
alejandroRL | 0:dd702039127a | 147 | #define LOG2PHYS_Y_OSX ( x ) |
alejandroRL | 0:dd702039127a | 148 | #define LOG2PHYS_Y_OSY (pContext->xSize - x - 1) |
alejandroRL | 0:dd702039127a | 149 | #define LOG2PHYS_Y_OSXY (pContext->xSize - x - 1) |
alejandroRL | 0:dd702039127a | 150 | |
alejandroRL | 0:dd702039127a | 151 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 152 | * |
alejandroRL | 0:dd702039127a | 153 | * _SetPixelIndex_##EXT |
alejandroRL | 0:dd702039127a | 154 | */ |
alejandroRL | 0:dd702039127a | 155 | #define DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ |
alejandroRL | 0:dd702039127a | 156 | static void _SetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y, LCD_PIXELINDEX PixelIndex) { \ |
alejandroRL | 0:dd702039127a | 157 | DRIVER_CONTEXT * pContext; \ |
alejandroRL | 0:dd702039127a | 158 | \ |
alejandroRL | 0:dd702039127a | 159 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; \ |
alejandroRL | 0:dd702039127a | 160 | _SetPixelIndex(pContext, X_PHYS, Y_PHYS, PixelIndex); \ |
alejandroRL | 0:dd702039127a | 161 | } |
alejandroRL | 0:dd702039127a | 162 | |
alejandroRL | 0:dd702039127a | 163 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 164 | * |
alejandroRL | 0:dd702039127a | 165 | * _GetPixelIndex_##EXT |
alejandroRL | 0:dd702039127a | 166 | */ |
alejandroRL | 0:dd702039127a | 167 | #define DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ |
alejandroRL | 0:dd702039127a | 168 | static LCD_PIXELINDEX _GetPixelIndex_##EXT(GUI_DEVICE * pDevice, int x, int y) { \ |
alejandroRL | 0:dd702039127a | 169 | DRIVER_CONTEXT * pContext; \ |
alejandroRL | 0:dd702039127a | 170 | LCD_PIXELINDEX PixelIndex; \ |
alejandroRL | 0:dd702039127a | 171 | \ |
alejandroRL | 0:dd702039127a | 172 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; \ |
alejandroRL | 0:dd702039127a | 173 | PixelIndex = _GetPixelIndex(pContext, X_PHYS, Y_PHYS); \ |
alejandroRL | 0:dd702039127a | 174 | return PixelIndex; \ |
alejandroRL | 0:dd702039127a | 175 | } |
alejandroRL | 0:dd702039127a | 176 | |
alejandroRL | 0:dd702039127a | 177 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 178 | * |
alejandroRL | 0:dd702039127a | 179 | * _GetDevProp_##EXT |
alejandroRL | 0:dd702039127a | 180 | */ |
alejandroRL | 0:dd702039127a | 181 | #define DEFINE_GETDEVPROP(EXT, MX, MY, SWAP) \ |
alejandroRL | 0:dd702039127a | 182 | static I32 _GetDevProp_##EXT(GUI_DEVICE * pDevice, int Index) { \ |
alejandroRL | 0:dd702039127a | 183 | switch (Index) { \ |
alejandroRL | 0:dd702039127a | 184 | case LCD_DEVCAP_MIRROR_X: return MX; \ |
alejandroRL | 0:dd702039127a | 185 | case LCD_DEVCAP_MIRROR_Y: return MY; \ |
alejandroRL | 0:dd702039127a | 186 | case LCD_DEVCAP_SWAP_XY: return SWAP; \ |
alejandroRL | 0:dd702039127a | 187 | } \ |
alejandroRL | 0:dd702039127a | 188 | return _GetDevProp(pDevice, Index); \ |
alejandroRL | 0:dd702039127a | 189 | } |
alejandroRL | 0:dd702039127a | 190 | |
alejandroRL | 0:dd702039127a | 191 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 192 | * |
alejandroRL | 0:dd702039127a | 193 | * DEFINE_FUNCTIONS |
alejandroRL | 0:dd702039127a | 194 | */ |
alejandroRL | 0:dd702039127a | 195 | #define DEFINE_FUNCTIONS(EXT, X_PHYS, Y_PHYS, MX, MY, SWAP) \ |
alejandroRL | 0:dd702039127a | 196 | DEFINE_SETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ |
alejandroRL | 0:dd702039127a | 197 | DEFINE_GETPIXELINDEX(EXT, X_PHYS, Y_PHYS) \ |
alejandroRL | 0:dd702039127a | 198 | DEFINE_GETDEVPROP(EXT, MX, MY, SWAP) \ |
alejandroRL | 0:dd702039127a | 199 | DEFINE_GUI_DEVICE_API(EXT) |
alejandroRL | 0:dd702039127a | 200 | |
alejandroRL | 0:dd702039127a | 201 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 202 | * |
alejandroRL | 0:dd702039127a | 203 | * Private functions, common |
alejandroRL | 0:dd702039127a | 204 | * |
alejandroRL | 0:dd702039127a | 205 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 206 | */ |
alejandroRL | 0:dd702039127a | 207 | void (*GUIDRV__SPage_GetDevFunc(GUI_DEVICE ** ppDevice, int Index))(void); |
alejandroRL | 0:dd702039127a | 208 | void GUIDRV__SPage_SetOrg (GUI_DEVICE * pDevice, int x, int y); |
alejandroRL | 0:dd702039127a | 209 | I32 GUIDRV__SPage_GetDevProp(GUI_DEVICE * pDevice, int Index); |
alejandroRL | 0:dd702039127a | 210 | void GUIDRV__SPage_GetRect (GUI_DEVICE * pDevice, LCD_RECT * pRect); |
alejandroRL | 0:dd702039127a | 211 | int GUIDRV__SPage_Init (GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 212 | |
alejandroRL | 0:dd702039127a | 213 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 214 | * |
alejandroRL | 0:dd702039127a | 215 | * Private functions, cache related |
alejandroRL | 0:dd702039127a | 216 | * |
alejandroRL | 0:dd702039127a | 217 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 218 | */ |
alejandroRL | 0:dd702039127a | 219 | void GUIDRV__SPage_WriteCache (DRIVER_CONTEXT * pContext, int x, int Page, U8 Data); |
alejandroRL | 0:dd702039127a | 220 | U8 GUIDRV__SPage_ReadCache (DRIVER_CONTEXT * pContext, int x, int Page); |
alejandroRL | 0:dd702039127a | 221 | void GUIDRV__SPage_FlushCache (DRIVER_CONTEXT * pContext); |
alejandroRL | 0:dd702039127a | 222 | void GUIDRV__SPage_AddDirtyRect(DRIVER_CONTEXT * pContext, int Page0, int Page1, int x0, int x1); |
alejandroRL | 0:dd702039127a | 223 | int GUIDRV__SPage_ControlCache(GUI_DEVICE * pDevice, int Cmd); |
alejandroRL | 0:dd702039127a | 224 | |
alejandroRL | 0:dd702039127a | 225 | /********************************************************************* |
alejandroRL | 0:dd702039127a | 226 | * |
alejandroRL | 0:dd702039127a | 227 | * Simulation (Segger internal use only) |
alejandroRL | 0:dd702039127a | 228 | * |
alejandroRL | 0:dd702039127a | 229 | ********************************************************************** |
alejandroRL | 0:dd702039127a | 230 | */ |
alejandroRL | 0:dd702039127a | 231 | #if defined(WIN32) && defined(LCD_SIMCONTROLLER) |
alejandroRL | 0:dd702039127a | 232 | |
alejandroRL | 0:dd702039127a | 233 | extern GUI_PORT_API SIM_SPage_HW_API; |
alejandroRL | 0:dd702039127a | 234 | |
alejandroRL | 0:dd702039127a | 235 | void SIM_SPage_SetFunc1502 (GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 236 | void SIM_SPage_SetFunc1510 (GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 237 | void SIM_SPage_SetFunc1512 (GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 238 | void SIM_SPage_SetFunc1802 (GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 239 | void SIM_SPage_SetFunc1638 (GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 240 | void SIM_SPage_SetFunc75256(GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 241 | void SIM_SPage_SetFunc75320(GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 242 | void SIM_SPage_SetFunc7591 (GUI_DEVICE * pDevice); |
alejandroRL | 0:dd702039127a | 243 | void SIM_SPage_Config (GUI_DEVICE * pDevice, int xSize, int ySize, int FirstSEG, int FirstCOM, int BitsPerPixel, int NumDummyReads); |
alejandroRL | 0:dd702039127a | 244 | |
alejandroRL | 0:dd702039127a | 245 | #endif |
alejandroRL | 0:dd702039127a | 246 | |
alejandroRL | 0:dd702039127a | 247 | #if defined(__cplusplus) |
alejandroRL | 0:dd702039127a | 248 | } |
alejandroRL | 0:dd702039127a | 249 | #endif |
alejandroRL | 0:dd702039127a | 250 | |
alejandroRL | 0:dd702039127a | 251 | #endif /* GUIDRV_SPAGE_PRIVATE_H */ |
alejandroRL | 0:dd702039127a | 252 | |
alejandroRL | 0:dd702039127a | 253 | /*************************** End of file ****************************/ |