this repository aim to make the official ST DISCO F746NG demo from STM32Cube_FW_F7_V1.2.0 working on mbed.
Dependencies: BSP_DISCO_F746NG_patch mbed-rtos mbed
patch/inc/GUIDRV_Lin_Private.h@0:c00e6c923941, 2015-11-02 (annotated)
- Committer:
- NirT
- Date:
- Mon Nov 02 23:38:08 2015 +0000
- Revision:
- 0:c00e6c923941
Error: Incomplete type is not allowed in "patch/LwIP/src/include/lwip/dhcp.h", Line: 83, Col: 4; ; and more like this.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
NirT | 0:c00e6c923941 | 1 | /********************************************************************* |
NirT | 0:c00e6c923941 | 2 | * SEGGER Microcontroller GmbH & Co. KG * |
NirT | 0:c00e6c923941 | 3 | * Solutions for real time microcontroller applications * |
NirT | 0:c00e6c923941 | 4 | ********************************************************************** |
NirT | 0:c00e6c923941 | 5 | * * |
NirT | 0:c00e6c923941 | 6 | * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG * |
NirT | 0:c00e6c923941 | 7 | * * |
NirT | 0:c00e6c923941 | 8 | * Internet: www.segger.com Support: support@segger.com * |
NirT | 0:c00e6c923941 | 9 | * * |
NirT | 0:c00e6c923941 | 10 | ********************************************************************** |
NirT | 0:c00e6c923941 | 11 | |
NirT | 0:c00e6c923941 | 12 | ** emWin V5.28 - Graphical user interface for embedded applications ** |
NirT | 0:c00e6c923941 | 13 | All Intellectual Property rights in the Software belongs to SEGGER. |
NirT | 0:c00e6c923941 | 14 | emWin is protected by international copyright laws. Knowledge of the |
NirT | 0:c00e6c923941 | 15 | source code may not be used to write a similar product. This file may |
NirT | 0:c00e6c923941 | 16 | only be used in accordance with the following terms: |
NirT | 0:c00e6c923941 | 17 | |
NirT | 0:c00e6c923941 | 18 | The software has been licensed to STMicroelectronics International |
NirT | 0:c00e6c923941 | 19 | N.V. a Dutch company with a Swiss branch and its headquarters in Plan- |
NirT | 0:c00e6c923941 | 20 | les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the |
NirT | 0:c00e6c923941 | 21 | purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_ |
NirT | 0:c00e6c923941 | 22 | troller products commercialized by Licensee only, sublicensed and dis_ |
NirT | 0:c00e6c923941 | 23 | tributed under the terms and conditions of the End User License Agree_ |
NirT | 0:c00e6c923941 | 24 | ment supplied by STMicroelectronics International N.V. |
NirT | 0:c00e6c923941 | 25 | Full source code is available at: www.segger.com |
NirT | 0:c00e6c923941 | 26 | |
NirT | 0:c00e6c923941 | 27 | We appreciate your understanding and fairness. |
NirT | 0:c00e6c923941 | 28 | ---------------------------------------------------------------------- |
NirT | 0:c00e6c923941 | 29 | File : GUIDRV_Lin_Private.h |
NirT | 0:c00e6c923941 | 30 | Purpose : Common definitions and common code for all LIN-drivers |
NirT | 0:c00e6c923941 | 31 | ---------------------------END-OF-HEADER------------------------------ |
NirT | 0:c00e6c923941 | 32 | */ |
NirT | 0:c00e6c923941 | 33 | |
NirT | 0:c00e6c923941 | 34 | #ifndef GUIDRV_LIN_PRIVATE_H |
NirT | 0:c00e6c923941 | 35 | #define GUIDRV_LIN_PRIVATE_H |
NirT | 0:c00e6c923941 | 36 | |
NirT | 0:c00e6c923941 | 37 | #include <string.h> |
NirT | 0:c00e6c923941 | 38 | |
NirT | 0:c00e6c923941 | 39 | #if defined(__cplusplus) |
NirT | 0:c00e6c923941 | 40 | extern "C" { /* Make sure we have C-declarations in C++ programs */ |
NirT | 0:c00e6c923941 | 41 | #endif |
NirT | 0:c00e6c923941 | 42 | |
NirT | 0:c00e6c923941 | 43 | /********************************************************************* |
NirT | 0:c00e6c923941 | 44 | * |
NirT | 0:c00e6c923941 | 45 | * Common definitions for all variants of the LIN driver |
NirT | 0:c00e6c923941 | 46 | * |
NirT | 0:c00e6c923941 | 47 | ********************************************************************** |
NirT | 0:c00e6c923941 | 48 | */ |
NirT | 0:c00e6c923941 | 49 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 50 | // |
NirT | 0:c00e6c923941 | 51 | // Simulation prototypes |
NirT | 0:c00e6c923941 | 52 | // |
NirT | 0:c00e6c923941 | 53 | U16 SIM_Lin_ReadMem16 (unsigned int Off); |
NirT | 0:c00e6c923941 | 54 | U32 SIM_Lin_ReadMem32 (unsigned int Off); |
NirT | 0:c00e6c923941 | 55 | U8 SIM_Lin_ReadMem08p (U8 * p); |
NirT | 0:c00e6c923941 | 56 | U32 SIM_Lin_ReadMem32p (U32 * p); |
NirT | 0:c00e6c923941 | 57 | void SIM_Lin_WriteMem16 (unsigned int Off, U16 Data); |
NirT | 0:c00e6c923941 | 58 | void SIM_Lin_WriteMem32 (unsigned int Off, U32 Data); |
NirT | 0:c00e6c923941 | 59 | void SIM_Lin_WriteMem08p(U8 * p, U8 Data); |
NirT | 0:c00e6c923941 | 60 | void SIM_Lin_WriteMem16p(U16 * p, U16 Data); |
NirT | 0:c00e6c923941 | 61 | void SIM_Lin_WriteMem32p(U32 * p, U32 Data); |
NirT | 0:c00e6c923941 | 62 | void SIM_Lin_memcpy (void * pDst, const void * pSrc, int Len); |
NirT | 0:c00e6c923941 | 63 | void SIM_Lin_memset (void * pDst, U8 Value, U32 Len); |
NirT | 0:c00e6c923941 | 64 | void SIM_Lin_SetVRAMAddr(int LayerIndex, void * pVRAM); |
NirT | 0:c00e6c923941 | 65 | void SIM_Lin_SetVRAMSize(int LayerIndex, int vxSize, int vySize, int xSize, int ySize); |
NirT | 0:c00e6c923941 | 66 | void SIM_Lin_CopyBuffer (int IndexSrc, int IndexDst); |
NirT | 0:c00e6c923941 | 67 | void SIM_Lin_ShowBuffer (int Index); |
NirT | 0:c00e6c923941 | 68 | // |
NirT | 0:c00e6c923941 | 69 | // Access macro definition for internal simulation |
NirT | 0:c00e6c923941 | 70 | // |
NirT | 0:c00e6c923941 | 71 | #define LCD_READ_MEM16(VRAMAddr, Off) SIM_Lin_ReadMem16(Off) |
NirT | 0:c00e6c923941 | 72 | #define LCD_READ_MEM32(VRAMAddr, Off) SIM_Lin_ReadMem32(Off) |
NirT | 0:c00e6c923941 | 73 | #define LCD_READ_MEM08P(p) SIM_Lin_ReadMem08p(p) |
NirT | 0:c00e6c923941 | 74 | #define LCD_READ_MEM32P(p) SIM_Lin_ReadMem32p(p) |
NirT | 0:c00e6c923941 | 75 | #define LCD_WRITE_MEM16(VRAMAddr, Off, Data) SIM_Lin_WriteMem16(Off, Data) |
NirT | 0:c00e6c923941 | 76 | #define LCD_WRITE_MEM32(VRAMAddr, Off, Data) SIM_Lin_WriteMem32(Off, Data) |
NirT | 0:c00e6c923941 | 77 | #define LCD_WRITE_MEM08P(p, Data) SIM_Lin_WriteMem08p(p, Data) |
NirT | 0:c00e6c923941 | 78 | #define LCD_WRITE_MEM16P(p, Data) SIM_Lin_WriteMem16p(p, Data) |
NirT | 0:c00e6c923941 | 79 | #define LCD_WRITE_MEM32P(p, Data) SIM_Lin_WriteMem32p(p, Data) |
NirT | 0:c00e6c923941 | 80 | #undef GUI_MEMCPY |
NirT | 0:c00e6c923941 | 81 | #define GUI_MEMCPY(pDst, pSrc, Len) SIM_Lin_memcpy(pDst, pSrc, Len) |
NirT | 0:c00e6c923941 | 82 | #undef GUI_MEMSET |
NirT | 0:c00e6c923941 | 83 | #define GUI_MEMSET(pDst, Value, Len) SIM_Lin_memset(pDst, Value, Len) |
NirT | 0:c00e6c923941 | 84 | #else |
NirT | 0:c00e6c923941 | 85 | // |
NirT | 0:c00e6c923941 | 86 | // Access macro definition for hardware |
NirT | 0:c00e6c923941 | 87 | // |
NirT | 0:c00e6c923941 | 88 | #define LCD_READ_MEM16(VRAMAddr, Off) (*((U16 *)VRAMAddr + (U32)Off)) |
NirT | 0:c00e6c923941 | 89 | #define LCD_READ_MEM32(VRAMAddr, Off) (*((U32 *)VRAMAddr + (U32)Off)) |
NirT | 0:c00e6c923941 | 90 | #define LCD_READ_MEM08P(p) (*((U8 *)p)) |
NirT | 0:c00e6c923941 | 91 | #define LCD_READ_MEM32P(p) (*((U32 *)p)) |
NirT | 0:c00e6c923941 | 92 | #define LCD_WRITE_MEM16(VRAMAddr, Off, Data) *((U16 *)VRAMAddr + (U32)Off) = Data |
NirT | 0:c00e6c923941 | 93 | #define LCD_WRITE_MEM32(VRAMAddr, Off, Data) *((U32 *)VRAMAddr + (U32)Off) = Data |
NirT | 0:c00e6c923941 | 94 | #define LCD_WRITE_MEM08P(p, Data) *((U8 *)p) = Data |
NirT | 0:c00e6c923941 | 95 | #define LCD_WRITE_MEM16P(p, Data) *((U16 *)p) = Data |
NirT | 0:c00e6c923941 | 96 | #define LCD_WRITE_MEM32P(p, Data) *((U32 *)p) = Data |
NirT | 0:c00e6c923941 | 97 | #endif |
NirT | 0:c00e6c923941 | 98 | |
NirT | 0:c00e6c923941 | 99 | #define WRITE_MEM16(VRAMAddr, Off, Data) LCD_WRITE_MEM16(VRAMAddr, Off, Data) |
NirT | 0:c00e6c923941 | 100 | #define WRITE_MEM32(VRAMAddr, Off, Data) LCD_WRITE_MEM32(VRAMAddr, Off, Data) |
NirT | 0:c00e6c923941 | 101 | #define READ_MEM08P(p) LCD_READ_MEM08P(p) |
NirT | 0:c00e6c923941 | 102 | #define READ_MEM16(VRAMAddr, Off) LCD_READ_MEM16(VRAMAddr, Off) |
NirT | 0:c00e6c923941 | 103 | #define READ_MEM32(VRAMAddr, Off) LCD_READ_MEM32(VRAMAddr, Off) |
NirT | 0:c00e6c923941 | 104 | #define READ_MEM32P(p) LCD_READ_MEM32P(p) |
NirT | 0:c00e6c923941 | 105 | #define WRITE_MEM08P(p, Data) LCD_WRITE_MEM08P(p, Data) |
NirT | 0:c00e6c923941 | 106 | #define WRITE_MEM16P(p, Data) LCD_WRITE_MEM16P(p, Data) |
NirT | 0:c00e6c923941 | 107 | #define WRITE_MEM32P(p, Data) LCD_WRITE_MEM32P(p, Data) |
NirT | 0:c00e6c923941 | 108 | |
NirT | 0:c00e6c923941 | 109 | #define OFF2PTR08(VRAMAddr, Off) (U8 *)((U8 *)VRAMAddr + (Off )) |
NirT | 0:c00e6c923941 | 110 | #define OFF2PTR16(VRAMAddr, Off) (U16 *)((U8 *)VRAMAddr + (Off << 1)) |
NirT | 0:c00e6c923941 | 111 | #define OFF2PTR32(VRAMAddr, Off) (U32 *)((U8 *)VRAMAddr + (Off << 2)) |
NirT | 0:c00e6c923941 | 112 | |
NirT | 0:c00e6c923941 | 113 | // |
NirT | 0:c00e6c923941 | 114 | // Definition of default members for DRIVER_CONTEXT structure |
NirT | 0:c00e6c923941 | 115 | // |
NirT | 0:c00e6c923941 | 116 | #define DEFAULT_CONTEXT_MEMBERS \ |
NirT | 0:c00e6c923941 | 117 | U32 VRAMAddr; \ |
NirT | 0:c00e6c923941 | 118 | U32 BaseAddr; \ |
NirT | 0:c00e6c923941 | 119 | int BufferIndex; \ |
NirT | 0:c00e6c923941 | 120 | int xSize, ySize; \ |
NirT | 0:c00e6c923941 | 121 | int vxSize, vySize; \ |
NirT | 0:c00e6c923941 | 122 | int vxSizePhys; \ |
NirT | 0:c00e6c923941 | 123 | int xPos, yPos; \ |
NirT | 0:c00e6c923941 | 124 | int Alpha; \ |
NirT | 0:c00e6c923941 | 125 | int IsVisible; \ |
NirT | 0:c00e6c923941 | 126 | void (* pfFillRect) (int /* LayerIndex */, \ |
NirT | 0:c00e6c923941 | 127 | int /* x0 */, \ |
NirT | 0:c00e6c923941 | 128 | int /* y0 */, \ |
NirT | 0:c00e6c923941 | 129 | int /* x1 */, \ |
NirT | 0:c00e6c923941 | 130 | int /* y1 */, \ |
NirT | 0:c00e6c923941 | 131 | U32 /* PixelIndex */); \ |
NirT | 0:c00e6c923941 | 132 | void (* pfCopyBuffer)(int /* LayerIndex */, \ |
NirT | 0:c00e6c923941 | 133 | int /* IndexSrc */, \ |
NirT | 0:c00e6c923941 | 134 | int /* IndexDst */); \ |
NirT | 0:c00e6c923941 | 135 | void (* pfDrawBMP1) (int /* LayerIndex */, \ |
NirT | 0:c00e6c923941 | 136 | int /* x */, \ |
NirT | 0:c00e6c923941 | 137 | int /* y */, \ |
NirT | 0:c00e6c923941 | 138 | U8 const * /* p */, \ |
NirT | 0:c00e6c923941 | 139 | int /* Diff */, \ |
NirT | 0:c00e6c923941 | 140 | int /* xSize */, \ |
NirT | 0:c00e6c923941 | 141 | int /* ySize */, \ |
NirT | 0:c00e6c923941 | 142 | int /* BytesPerLine */, \ |
NirT | 0:c00e6c923941 | 143 | const LCD_PIXELINDEX * /* pTrans */); \ |
NirT | 0:c00e6c923941 | 144 | void (* pfDrawBMP8) (int /* LayerIndex */, \ |
NirT | 0:c00e6c923941 | 145 | int /* x */, \ |
NirT | 0:c00e6c923941 | 146 | int /* y */, \ |
NirT | 0:c00e6c923941 | 147 | U8 const * /* p */, \ |
NirT | 0:c00e6c923941 | 148 | int /* xSize */, \ |
NirT | 0:c00e6c923941 | 149 | int /* ySize */, \ |
NirT | 0:c00e6c923941 | 150 | int /* BytesPerLine */, \ |
NirT | 0:c00e6c923941 | 151 | const LCD_PIXELINDEX * /* pTrans */); \ |
NirT | 0:c00e6c923941 | 152 | void (* pfCopyRect) (int /* LayerIndex */, \ |
NirT | 0:c00e6c923941 | 153 | int /* x0 */, \ |
NirT | 0:c00e6c923941 | 154 | int /* y0 */, \ |
NirT | 0:c00e6c923941 | 155 | int /* x1 */, \ |
NirT | 0:c00e6c923941 | 156 | int /* y1 */, \ |
NirT | 0:c00e6c923941 | 157 | int /* xSize */, \ |
NirT | 0:c00e6c923941 | 158 | int /* ySize */); |
NirT | 0:c00e6c923941 | 159 | |
NirT | 0:c00e6c923941 | 160 | #ifndef PRIVATE_CONTEXT_MEMBERS |
NirT | 0:c00e6c923941 | 161 | #define PRIVATE_CONTEXT_MEMBERS |
NirT | 0:c00e6c923941 | 162 | #endif |
NirT | 0:c00e6c923941 | 163 | |
NirT | 0:c00e6c923941 | 164 | // |
NirT | 0:c00e6c923941 | 165 | // Definition of default function management for _GetDevFunc() |
NirT | 0:c00e6c923941 | 166 | // |
NirT | 0:c00e6c923941 | 167 | #define DEFAULT_MANAGEMENT_GETDEVFUNC() \ |
NirT | 0:c00e6c923941 | 168 | case LCD_DEVFUNC_SET_VRAM_ADDR: \ |
NirT | 0:c00e6c923941 | 169 | return (void (*)(void))_SetVRAMAddr; \ |
NirT | 0:c00e6c923941 | 170 | case LCD_DEVFUNC_SET_VSIZE: \ |
NirT | 0:c00e6c923941 | 171 | return (void (*)(void))_SetVSize; \ |
NirT | 0:c00e6c923941 | 172 | case LCD_DEVFUNC_SET_SIZE: \ |
NirT | 0:c00e6c923941 | 173 | return (void (*)(void))_SetSize; \ |
NirT | 0:c00e6c923941 | 174 | case LCD_DEVFUNC_SETPOS: \ |
NirT | 0:c00e6c923941 | 175 | return (void (*)(void))_SetPos; \ |
NirT | 0:c00e6c923941 | 176 | case LCD_DEVFUNC_GETPOS: \ |
NirT | 0:c00e6c923941 | 177 | return (void (*)(void))_GetPos; \ |
NirT | 0:c00e6c923941 | 178 | case LCD_DEVFUNC_SETALPHA: \ |
NirT | 0:c00e6c923941 | 179 | return (void (*)(void))_SetAlpha; \ |
NirT | 0:c00e6c923941 | 180 | case LCD_DEVFUNC_SETVIS: \ |
NirT | 0:c00e6c923941 | 181 | return (void (*)(void))_SetVis; \ |
NirT | 0:c00e6c923941 | 182 | case LCD_DEVFUNC_INIT: \ |
NirT | 0:c00e6c923941 | 183 | return (void (*)(void))_Init; \ |
NirT | 0:c00e6c923941 | 184 | case LCD_DEVFUNC_ON: \ |
NirT | 0:c00e6c923941 | 185 | return (void (*)(void))_On; \ |
NirT | 0:c00e6c923941 | 186 | case LCD_DEVFUNC_OFF: \ |
NirT | 0:c00e6c923941 | 187 | return (void (*)(void))_Off; \ |
NirT | 0:c00e6c923941 | 188 | case LCD_DEVFUNC_ALPHAMODE: \ |
NirT | 0:c00e6c923941 | 189 | return (void (*)(void))_SetAlphaMode; \ |
NirT | 0:c00e6c923941 | 190 | case LCD_DEVFUNC_CHROMAMODE: \ |
NirT | 0:c00e6c923941 | 191 | return (void (*)(void))_SetChromaMode; \ |
NirT | 0:c00e6c923941 | 192 | case LCD_DEVFUNC_CHROMA: \ |
NirT | 0:c00e6c923941 | 193 | return (void (*)(void))_SetChroma; \ |
NirT | 0:c00e6c923941 | 194 | case LCD_DEVFUNC_COPYBUFFER: \ |
NirT | 0:c00e6c923941 | 195 | return (void (*)(void))_CopyBuffer; \ |
NirT | 0:c00e6c923941 | 196 | case LCD_DEVFUNC_SHOWBUFFER: \ |
NirT | 0:c00e6c923941 | 197 | return (void (*)(void))_ShowBuffer; \ |
NirT | 0:c00e6c923941 | 198 | case LCD_DEVFUNC_SETFUNC: \ |
NirT | 0:c00e6c923941 | 199 | return (void (*)(void))_SetDevFunc; \ |
NirT | 0:c00e6c923941 | 200 | case LCD_DEVFUNC_FILLRECT: \ |
NirT | 0:c00e6c923941 | 201 | return (void (*)(void))((DRIVER_CONTEXT *)(*ppDevice)->u.pContext)->pfFillRect; \ |
NirT | 0:c00e6c923941 | 202 | case LCD_DEVFUNC_DRAWBMP_1BPP: \ |
NirT | 0:c00e6c923941 | 203 | return (void (*)(void))((DRIVER_CONTEXT *)(*ppDevice)->u.pContext)->pfDrawBMP1; \ |
NirT | 0:c00e6c923941 | 204 | case LCD_DEVFUNC_DRAWBMP_8BPP: \ |
NirT | 0:c00e6c923941 | 205 | return (void (*)(void))((DRIVER_CONTEXT *)(*ppDevice)->u.pContext)->pfDrawBMP8; \ |
NirT | 0:c00e6c923941 | 206 | case LCD_DEVFUNC_COPYRECT: \ |
NirT | 0:c00e6c923941 | 207 | return (void (*)(void))((DRIVER_CONTEXT *)(*ppDevice)->u.pContext)->pfCopyRect; |
NirT | 0:c00e6c923941 | 208 | |
NirT | 0:c00e6c923941 | 209 | // |
NirT | 0:c00e6c923941 | 210 | // Definition of private function management for _GetDevFunc() |
NirT | 0:c00e6c923941 | 211 | // |
NirT | 0:c00e6c923941 | 212 | #ifndef PRIVATE_MANAGEMENT_GETDEVFUNC |
NirT | 0:c00e6c923941 | 213 | #define PRIVATE_MANAGEMENT_GETDEVFUNC() |
NirT | 0:c00e6c923941 | 214 | #endif |
NirT | 0:c00e6c923941 | 215 | |
NirT | 0:c00e6c923941 | 216 | // |
NirT | 0:c00e6c923941 | 217 | // Definition of default function management for _SetDevFunc() |
NirT | 0:c00e6c923941 | 218 | // |
NirT | 0:c00e6c923941 | 219 | #define DEFAULT_MANAGEMENT_SETDEVFUNC() \ |
NirT | 0:c00e6c923941 | 220 | case LCD_DEVFUNC_FILLRECT: \ |
NirT | 0:c00e6c923941 | 221 | pContext->pfFillRect = (void (*)(int LayerIndex, int x0, int y0, int x1, int y1, U32 PixelIndex))pFunc; \ |
NirT | 0:c00e6c923941 | 222 | break; \ |
NirT | 0:c00e6c923941 | 223 | case LCD_DEVFUNC_COPYBUFFER: \ |
NirT | 0:c00e6c923941 | 224 | pContext->pfCopyBuffer = (void (*)(int LayerIndex, int IndexSrc, int IndexDst))pFunc; \ |
NirT | 0:c00e6c923941 | 225 | break; \ |
NirT | 0:c00e6c923941 | 226 | case LCD_DEVFUNC_DRAWBMP_1BPP: \ |
NirT | 0:c00e6c923941 | 227 | pContext->pfDrawBMP1 = (void (*)(int LayerIndex, int x, int y, U8 const * p, int Diff, int xSize, int ySize, int BytesPerLine, const LCD_PIXELINDEX * pTrans))pFunc; \ |
NirT | 0:c00e6c923941 | 228 | break; \ |
NirT | 0:c00e6c923941 | 229 | case LCD_DEVFUNC_DRAWBMP_8BPP: \ |
NirT | 0:c00e6c923941 | 230 | pContext->pfDrawBMP8 = (void (*)(int LayerIndex, int x, int y, U8 const * p, int xSize, int ySize, int BytesPerLine, const LCD_PIXELINDEX * pTrans))pFunc; \ |
NirT | 0:c00e6c923941 | 231 | break; \ |
NirT | 0:c00e6c923941 | 232 | case LCD_DEVFUNC_COPYRECT: \ |
NirT | 0:c00e6c923941 | 233 | pContext->pfCopyRect = (void (*)(int LayerIndex, int x0, int y0, int x1, int y1, int xSize, int ySize))pFunc; \ |
NirT | 0:c00e6c923941 | 234 | break; |
NirT | 0:c00e6c923941 | 235 | |
NirT | 0:c00e6c923941 | 236 | // |
NirT | 0:c00e6c923941 | 237 | // Definition of private function management for _GetDevFunc() |
NirT | 0:c00e6c923941 | 238 | // |
NirT | 0:c00e6c923941 | 239 | #ifndef PRIVATE_MANAGEMENT_SETDEVFUNC |
NirT | 0:c00e6c923941 | 240 | #define PRIVATE_MANAGEMENT_SETDEVFUNC() |
NirT | 0:c00e6c923941 | 241 | #endif |
NirT | 0:c00e6c923941 | 242 | |
NirT | 0:c00e6c923941 | 243 | // |
NirT | 0:c00e6c923941 | 244 | // Endian related definitions |
NirT | 0:c00e6c923941 | 245 | // |
NirT | 0:c00e6c923941 | 246 | #ifndef LCD_MIRROR |
NirT | 0:c00e6c923941 | 247 | #define LCD_MIRROR 0 |
NirT | 0:c00e6c923941 | 248 | #endif |
NirT | 0:c00e6c923941 | 249 | |
NirT | 0:c00e6c923941 | 250 | #if (LCD_MIRROR == 2) |
NirT | 0:c00e6c923941 | 251 | #define MIRROR(x) x = ((x & 0x000000ffUL) << 8) \ |
NirT | 0:c00e6c923941 | 252 | | ((x & 0x0000ff00UL) >> 8) \ |
NirT | 0:c00e6c923941 | 253 | | ((x & 0x00ff0000UL) << 8) \ |
NirT | 0:c00e6c923941 | 254 | | ((x & 0xff000000UL) >> 8) |
NirT | 0:c00e6c923941 | 255 | #else |
NirT | 0:c00e6c923941 | 256 | #define MIRROR(x) x = ((x & 0x000000ffUL) << 24) \ |
NirT | 0:c00e6c923941 | 257 | | ((x & 0x0000ff00UL) << 8) \ |
NirT | 0:c00e6c923941 | 258 | | ((x & 0x00ff0000UL) >> 8) \ |
NirT | 0:c00e6c923941 | 259 | | ((x & 0xff000000UL) >> 24) |
NirT | 0:c00e6c923941 | 260 | #endif |
NirT | 0:c00e6c923941 | 261 | |
NirT | 0:c00e6c923941 | 262 | /********************************************************************* |
NirT | 0:c00e6c923941 | 263 | * |
NirT | 0:c00e6c923941 | 264 | * Types |
NirT | 0:c00e6c923941 | 265 | * |
NirT | 0:c00e6c923941 | 266 | ********************************************************************** |
NirT | 0:c00e6c923941 | 267 | */ |
NirT | 0:c00e6c923941 | 268 | // |
NirT | 0:c00e6c923941 | 269 | // DRIVER_CONTEXT structure consisting of default and private members |
NirT | 0:c00e6c923941 | 270 | // |
NirT | 0:c00e6c923941 | 271 | typedef struct { |
NirT | 0:c00e6c923941 | 272 | DEFAULT_CONTEXT_MEMBERS |
NirT | 0:c00e6c923941 | 273 | PRIVATE_CONTEXT_MEMBERS |
NirT | 0:c00e6c923941 | 274 | } DRIVER_CONTEXT; |
NirT | 0:c00e6c923941 | 275 | |
NirT | 0:c00e6c923941 | 276 | /********************************************************************* |
NirT | 0:c00e6c923941 | 277 | * |
NirT | 0:c00e6c923941 | 278 | * Static code (common for all) |
NirT | 0:c00e6c923941 | 279 | * |
NirT | 0:c00e6c923941 | 280 | ********************************************************************** |
NirT | 0:c00e6c923941 | 281 | */ |
NirT | 0:c00e6c923941 | 282 | /********************************************************************* |
NirT | 0:c00e6c923941 | 283 | * |
NirT | 0:c00e6c923941 | 284 | * _InitOnce |
NirT | 0:c00e6c923941 | 285 | * |
NirT | 0:c00e6c923941 | 286 | * Purpose: |
NirT | 0:c00e6c923941 | 287 | * Allocates a fixed block for the context of the driver |
NirT | 0:c00e6c923941 | 288 | * |
NirT | 0:c00e6c923941 | 289 | * Return value: |
NirT | 0:c00e6c923941 | 290 | * 0 on success, 1 on error |
NirT | 0:c00e6c923941 | 291 | */ |
NirT | 0:c00e6c923941 | 292 | static int _InitOnce(GUI_DEVICE * pDevice) { |
NirT | 0:c00e6c923941 | 293 | if (pDevice->u.pContext == NULL) { |
NirT | 0:c00e6c923941 | 294 | pDevice->u.pContext = GUI_ALLOC_GetFixedBlock(sizeof(DRIVER_CONTEXT)); |
NirT | 0:c00e6c923941 | 295 | GUI__memset((U8 *)pDevice->u.pContext, 0, sizeof(DRIVER_CONTEXT)); |
NirT | 0:c00e6c923941 | 296 | } |
NirT | 0:c00e6c923941 | 297 | return pDevice->u.pContext ? 0 : 1; |
NirT | 0:c00e6c923941 | 298 | } |
NirT | 0:c00e6c923941 | 299 | |
NirT | 0:c00e6c923941 | 300 | /********************************************************************* |
NirT | 0:c00e6c923941 | 301 | * |
NirT | 0:c00e6c923941 | 302 | * _GetRect |
NirT | 0:c00e6c923941 | 303 | * |
NirT | 0:c00e6c923941 | 304 | * Purpose: |
NirT | 0:c00e6c923941 | 305 | * Returns the display size. |
NirT | 0:c00e6c923941 | 306 | */ |
NirT | 0:c00e6c923941 | 307 | static void _GetRect(GUI_DEVICE * pDevice, LCD_RECT * pRect) { |
NirT | 0:c00e6c923941 | 308 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 309 | |
NirT | 0:c00e6c923941 | 310 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 311 | pRect->x0 = 0; |
NirT | 0:c00e6c923941 | 312 | pRect->y0 = 0; |
NirT | 0:c00e6c923941 | 313 | pRect->x1 = pContext->vxSize - 1; |
NirT | 0:c00e6c923941 | 314 | pRect->y1 = pContext->vySize - 1; |
NirT | 0:c00e6c923941 | 315 | } |
NirT | 0:c00e6c923941 | 316 | |
NirT | 0:c00e6c923941 | 317 | /********************************************************************* |
NirT | 0:c00e6c923941 | 318 | * |
NirT | 0:c00e6c923941 | 319 | * _SetPos |
NirT | 0:c00e6c923941 | 320 | * |
NirT | 0:c00e6c923941 | 321 | * Purpose: |
NirT | 0:c00e6c923941 | 322 | * Sets the position of the given layer by sending a LCD_X_SETPOS command to LCD_X_DisplayDriver() |
NirT | 0:c00e6c923941 | 323 | * (Requires special hardware support.) |
NirT | 0:c00e6c923941 | 324 | */ |
NirT | 0:c00e6c923941 | 325 | static void _SetPos(GUI_DEVICE * pDevice, int xPos, int yPos) { |
NirT | 0:c00e6c923941 | 326 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 327 | LCD_X_SETPOS_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 328 | |
NirT | 0:c00e6c923941 | 329 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 330 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 331 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 332 | pContext->xPos = xPos; |
NirT | 0:c00e6c923941 | 333 | pContext->yPos = yPos; |
NirT | 0:c00e6c923941 | 334 | Data.xPos = xPos; |
NirT | 0:c00e6c923941 | 335 | Data.yPos = yPos; |
NirT | 0:c00e6c923941 | 336 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETPOS, (void *)&Data); |
NirT | 0:c00e6c923941 | 337 | } |
NirT | 0:c00e6c923941 | 338 | } |
NirT | 0:c00e6c923941 | 339 | |
NirT | 0:c00e6c923941 | 340 | /********************************************************************* |
NirT | 0:c00e6c923941 | 341 | * |
NirT | 0:c00e6c923941 | 342 | * _GetPos |
NirT | 0:c00e6c923941 | 343 | * |
NirT | 0:c00e6c923941 | 344 | * Purpose: |
NirT | 0:c00e6c923941 | 345 | * Returns the position of the given layer. |
NirT | 0:c00e6c923941 | 346 | */ |
NirT | 0:c00e6c923941 | 347 | static void _GetPos(GUI_DEVICE * pDevice, int * pxPos, int * pyPos) { |
NirT | 0:c00e6c923941 | 348 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 349 | |
NirT | 0:c00e6c923941 | 350 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 351 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 352 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 353 | *pxPos = pContext->xPos; |
NirT | 0:c00e6c923941 | 354 | *pyPos = pContext->yPos; |
NirT | 0:c00e6c923941 | 355 | } |
NirT | 0:c00e6c923941 | 356 | } |
NirT | 0:c00e6c923941 | 357 | |
NirT | 0:c00e6c923941 | 358 | /********************************************************************* |
NirT | 0:c00e6c923941 | 359 | * |
NirT | 0:c00e6c923941 | 360 | * _SetAlpha |
NirT | 0:c00e6c923941 | 361 | * |
NirT | 0:c00e6c923941 | 362 | * Purpose: |
NirT | 0:c00e6c923941 | 363 | * Sets the alpha value of the given layer by sending a LCD_X_SETALPHA command to LCD_X_DisplayDriver() |
NirT | 0:c00e6c923941 | 364 | * (Requires special hardware support.) |
NirT | 0:c00e6c923941 | 365 | */ |
NirT | 0:c00e6c923941 | 366 | static void _SetAlpha(GUI_DEVICE * pDevice, int Alpha) { |
NirT | 0:c00e6c923941 | 367 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 368 | LCD_X_SETALPHA_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 369 | |
NirT | 0:c00e6c923941 | 370 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 371 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 372 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 373 | pContext->Alpha = Alpha; |
NirT | 0:c00e6c923941 | 374 | Data.Alpha = Alpha; |
NirT | 0:c00e6c923941 | 375 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETALPHA, (void *)&Data); |
NirT | 0:c00e6c923941 | 376 | } |
NirT | 0:c00e6c923941 | 377 | } |
NirT | 0:c00e6c923941 | 378 | |
NirT | 0:c00e6c923941 | 379 | /********************************************************************* |
NirT | 0:c00e6c923941 | 380 | * |
NirT | 0:c00e6c923941 | 381 | * _SetVis |
NirT | 0:c00e6c923941 | 382 | * |
NirT | 0:c00e6c923941 | 383 | * Purpose: |
NirT | 0:c00e6c923941 | 384 | * Sets the visibility of the given layer by sending a LCD_X_SETVIS command to LCD_X_DisplayDriver() |
NirT | 0:c00e6c923941 | 385 | * (Requires special hardware support.) |
NirT | 0:c00e6c923941 | 386 | */ |
NirT | 0:c00e6c923941 | 387 | static void _SetVis(GUI_DEVICE * pDevice, int OnOff) { |
NirT | 0:c00e6c923941 | 388 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 389 | LCD_X_SETVIS_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 390 | |
NirT | 0:c00e6c923941 | 391 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 392 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 393 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 394 | pContext->IsVisible = OnOff; |
NirT | 0:c00e6c923941 | 395 | Data.OnOff = OnOff; |
NirT | 0:c00e6c923941 | 396 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETVIS, (void *)&Data); |
NirT | 0:c00e6c923941 | 397 | } |
NirT | 0:c00e6c923941 | 398 | } |
NirT | 0:c00e6c923941 | 399 | |
NirT | 0:c00e6c923941 | 400 | /********************************************************************* |
NirT | 0:c00e6c923941 | 401 | * |
NirT | 0:c00e6c923941 | 402 | * _Init |
NirT | 0:c00e6c923941 | 403 | * |
NirT | 0:c00e6c923941 | 404 | * Purpose: |
NirT | 0:c00e6c923941 | 405 | * Called during the initialization process of emWin. |
NirT | 0:c00e6c923941 | 406 | */ |
NirT | 0:c00e6c923941 | 407 | static int _Init(GUI_DEVICE * pDevice) { |
NirT | 0:c00e6c923941 | 408 | int r; |
NirT | 0:c00e6c923941 | 409 | |
NirT | 0:c00e6c923941 | 410 | r = _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 411 | r |= LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_INITCONTROLLER, NULL); |
NirT | 0:c00e6c923941 | 412 | return r; |
NirT | 0:c00e6c923941 | 413 | } |
NirT | 0:c00e6c923941 | 414 | |
NirT | 0:c00e6c923941 | 415 | /********************************************************************* |
NirT | 0:c00e6c923941 | 416 | * |
NirT | 0:c00e6c923941 | 417 | * _On |
NirT | 0:c00e6c923941 | 418 | * |
NirT | 0:c00e6c923941 | 419 | * Purpose: |
NirT | 0:c00e6c923941 | 420 | * Sends a LCD_X_ON command to LCD_X_DisplayDriver(). |
NirT | 0:c00e6c923941 | 421 | */ |
NirT | 0:c00e6c923941 | 422 | static void _On (GUI_DEVICE * pDevice) { |
NirT | 0:c00e6c923941 | 423 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_ON, NULL); |
NirT | 0:c00e6c923941 | 424 | } |
NirT | 0:c00e6c923941 | 425 | |
NirT | 0:c00e6c923941 | 426 | /********************************************************************* |
NirT | 0:c00e6c923941 | 427 | * |
NirT | 0:c00e6c923941 | 428 | * _Off |
NirT | 0:c00e6c923941 | 429 | * |
NirT | 0:c00e6c923941 | 430 | * Purpose: |
NirT | 0:c00e6c923941 | 431 | * Sends a LCD_X_OFF command to LCD_X_DisplayDriver(). |
NirT | 0:c00e6c923941 | 432 | */ |
NirT | 0:c00e6c923941 | 433 | static void _Off (GUI_DEVICE * pDevice) { |
NirT | 0:c00e6c923941 | 434 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_OFF, NULL); |
NirT | 0:c00e6c923941 | 435 | } |
NirT | 0:c00e6c923941 | 436 | |
NirT | 0:c00e6c923941 | 437 | /********************************************************************* |
NirT | 0:c00e6c923941 | 438 | * |
NirT | 0:c00e6c923941 | 439 | * _SetAlphaMode |
NirT | 0:c00e6c923941 | 440 | * |
NirT | 0:c00e6c923941 | 441 | * Purpose: |
NirT | 0:c00e6c923941 | 442 | * Sets the alpha mode of the given layer by sending a LCD_X_SETALPHAMODE command to LCD_X_DisplayDriver() |
NirT | 0:c00e6c923941 | 443 | * (Requires special hardware support.) |
NirT | 0:c00e6c923941 | 444 | */ |
NirT | 0:c00e6c923941 | 445 | static void _SetAlphaMode(GUI_DEVICE * pDevice, int AlphaMode) { |
NirT | 0:c00e6c923941 | 446 | LCD_X_SETALPHAMODE_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 447 | |
NirT | 0:c00e6c923941 | 448 | Data.AlphaMode = AlphaMode; |
NirT | 0:c00e6c923941 | 449 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETALPHAMODE, (void *)&Data); |
NirT | 0:c00e6c923941 | 450 | } |
NirT | 0:c00e6c923941 | 451 | |
NirT | 0:c00e6c923941 | 452 | /********************************************************************* |
NirT | 0:c00e6c923941 | 453 | * |
NirT | 0:c00e6c923941 | 454 | * _SetChromaMode |
NirT | 0:c00e6c923941 | 455 | * |
NirT | 0:c00e6c923941 | 456 | * Purpose: |
NirT | 0:c00e6c923941 | 457 | * Sets the chroma mode of the given layer by sending a LCD_X_SETCHROMAMODE command to LCD_X_DisplayDriver() |
NirT | 0:c00e6c923941 | 458 | * (Requires special hardware support.) |
NirT | 0:c00e6c923941 | 459 | */ |
NirT | 0:c00e6c923941 | 460 | static void _SetChromaMode(GUI_DEVICE * pDevice, int ChromaMode) { |
NirT | 0:c00e6c923941 | 461 | LCD_X_SETCHROMAMODE_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 462 | |
NirT | 0:c00e6c923941 | 463 | Data.ChromaMode = ChromaMode; |
NirT | 0:c00e6c923941 | 464 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETCHROMAMODE, (void *)&Data); |
NirT | 0:c00e6c923941 | 465 | } |
NirT | 0:c00e6c923941 | 466 | |
NirT | 0:c00e6c923941 | 467 | /********************************************************************* |
NirT | 0:c00e6c923941 | 468 | * |
NirT | 0:c00e6c923941 | 469 | * _SetChroma |
NirT | 0:c00e6c923941 | 470 | * |
NirT | 0:c00e6c923941 | 471 | * Purpose: |
NirT | 0:c00e6c923941 | 472 | * Sets the chroma values of the given layer by sending a LCD_X_SETCHROMA command to LCD_X_DisplayDriver() |
NirT | 0:c00e6c923941 | 473 | * (Requires special hardware support.) |
NirT | 0:c00e6c923941 | 474 | */ |
NirT | 0:c00e6c923941 | 475 | static void _SetChroma(GUI_DEVICE * pDevice, LCD_COLOR ChromaMin, LCD_COLOR ChromaMax) { |
NirT | 0:c00e6c923941 | 476 | LCD_X_SETCHROMA_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 477 | |
NirT | 0:c00e6c923941 | 478 | Data.ChromaMin = ChromaMin; |
NirT | 0:c00e6c923941 | 479 | Data.ChromaMax = ChromaMax; |
NirT | 0:c00e6c923941 | 480 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETCHROMA, (void *)&Data); |
NirT | 0:c00e6c923941 | 481 | } |
NirT | 0:c00e6c923941 | 482 | |
NirT | 0:c00e6c923941 | 483 | /********************************************************************* |
NirT | 0:c00e6c923941 | 484 | * |
NirT | 0:c00e6c923941 | 485 | * _CopyBuffer |
NirT | 0:c00e6c923941 | 486 | * |
NirT | 0:c00e6c923941 | 487 | * Purpose: |
NirT | 0:c00e6c923941 | 488 | * Copies the source buffer to the destination buffer and routes |
NirT | 0:c00e6c923941 | 489 | * further drawing operations to the destination buffer. |
NirT | 0:c00e6c923941 | 490 | * |
NirT | 0:c00e6c923941 | 491 | * (Required for using multiple buffers) |
NirT | 0:c00e6c923941 | 492 | */ |
NirT | 0:c00e6c923941 | 493 | static void _CopyBuffer(GUI_DEVICE * pDevice, int IndexSrc, int IndexDst) { |
NirT | 0:c00e6c923941 | 494 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 495 | #if (!defined(WIN32) | defined(GUIDRV_SLAYER)) |
NirT | 0:c00e6c923941 | 496 | U32 AddrSrc, AddrDst; |
NirT | 0:c00e6c923941 | 497 | I32 BufferSize; |
NirT | 0:c00e6c923941 | 498 | int BitsPerPixel; |
NirT | 0:c00e6c923941 | 499 | #endif |
NirT | 0:c00e6c923941 | 500 | |
NirT | 0:c00e6c923941 | 501 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 502 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 503 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 504 | if (IndexSrc != IndexDst) { |
NirT | 0:c00e6c923941 | 505 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 506 | SIM_Lin_CopyBuffer(IndexSrc, IndexDst); |
NirT | 0:c00e6c923941 | 507 | #else |
NirT | 0:c00e6c923941 | 508 | BitsPerPixel = pDevice->pDeviceAPI->pfGetDevProp(pDevice, LCD_DEVCAP_BITSPERPIXEL); |
NirT | 0:c00e6c923941 | 509 | BufferSize = (((U32)pContext->xSize * pContext->ySize * BitsPerPixel) >> 3); |
NirT | 0:c00e6c923941 | 510 | AddrSrc = pContext->BaseAddr + BufferSize * IndexSrc; |
NirT | 0:c00e6c923941 | 511 | AddrDst = pContext->BaseAddr + BufferSize * IndexDst; |
NirT | 0:c00e6c923941 | 512 | if (pContext->pfCopyBuffer) { |
NirT | 0:c00e6c923941 | 513 | // |
NirT | 0:c00e6c923941 | 514 | // Use custom callback function for copy operation |
NirT | 0:c00e6c923941 | 515 | // |
NirT | 0:c00e6c923941 | 516 | pContext->pfCopyBuffer(pDevice->LayerIndex, IndexSrc, IndexDst); |
NirT | 0:c00e6c923941 | 517 | } else { |
NirT | 0:c00e6c923941 | 518 | // |
NirT | 0:c00e6c923941 | 519 | // Calculate pointers for copy operation |
NirT | 0:c00e6c923941 | 520 | // |
NirT | 0:c00e6c923941 | 521 | GUI_MEMCPY((void *)AddrDst, (void *)AddrSrc, BufferSize); |
NirT | 0:c00e6c923941 | 522 | } |
NirT | 0:c00e6c923941 | 523 | // |
NirT | 0:c00e6c923941 | 524 | // Set destination buffer as target for further drawing operations |
NirT | 0:c00e6c923941 | 525 | // |
NirT | 0:c00e6c923941 | 526 | pContext->VRAMAddr = AddrDst; |
NirT | 0:c00e6c923941 | 527 | #endif |
NirT | 0:c00e6c923941 | 528 | } |
NirT | 0:c00e6c923941 | 529 | } |
NirT | 0:c00e6c923941 | 530 | } |
NirT | 0:c00e6c923941 | 531 | |
NirT | 0:c00e6c923941 | 532 | /********************************************************************* |
NirT | 0:c00e6c923941 | 533 | * |
NirT | 0:c00e6c923941 | 534 | * _ShowBuffer |
NirT | 0:c00e6c923941 | 535 | * |
NirT | 0:c00e6c923941 | 536 | * Purpose: |
NirT | 0:c00e6c923941 | 537 | * Sends a LCD_X_SHOWBUFFER command to LCD_X_DisplayDriver() to make the given buffer visible. |
NirT | 0:c00e6c923941 | 538 | * |
NirT | 0:c00e6c923941 | 539 | * (Required for using multiple buffers) |
NirT | 0:c00e6c923941 | 540 | */ |
NirT | 0:c00e6c923941 | 541 | static void _ShowBuffer(GUI_DEVICE * pDevice, int Index) { |
NirT | 0:c00e6c923941 | 542 | LCD_X_SHOWBUFFER_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 543 | |
NirT | 0:c00e6c923941 | 544 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 545 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 546 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 547 | SIM_Lin_ShowBuffer(Index); |
NirT | 0:c00e6c923941 | 548 | #else |
NirT | 0:c00e6c923941 | 549 | Data.Index = Index; |
NirT | 0:c00e6c923941 | 550 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SHOWBUFFER, (void *)&Data); |
NirT | 0:c00e6c923941 | 551 | #endif |
NirT | 0:c00e6c923941 | 552 | } |
NirT | 0:c00e6c923941 | 553 | } |
NirT | 0:c00e6c923941 | 554 | |
NirT | 0:c00e6c923941 | 555 | /********************************************************************* |
NirT | 0:c00e6c923941 | 556 | * |
NirT | 0:c00e6c923941 | 557 | * _SetOrg |
NirT | 0:c00e6c923941 | 558 | * |
NirT | 0:c00e6c923941 | 559 | * Purpose: |
NirT | 0:c00e6c923941 | 560 | * Calls the driver callback function with the display origin to be set |
NirT | 0:c00e6c923941 | 561 | */ |
NirT | 0:c00e6c923941 | 562 | static void _SetOrg(GUI_DEVICE * pDevice, int x, int y) { |
NirT | 0:c00e6c923941 | 563 | #if (!defined(WIN32) | defined(GUIDRV_SLAYER)) |
NirT | 0:c00e6c923941 | 564 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 565 | int Orientation; |
NirT | 0:c00e6c923941 | 566 | #endif |
NirT | 0:c00e6c923941 | 567 | LCD_X_SETORG_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 568 | |
NirT | 0:c00e6c923941 | 569 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 570 | LCDSIM_SetOrg(x, y, pDevice->LayerIndex); |
NirT | 0:c00e6c923941 | 571 | #else |
NirT | 0:c00e6c923941 | 572 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 573 | Orientation = LCD_GetMirrorXEx(pDevice->LayerIndex) * GUI_MIRROR_X; |
NirT | 0:c00e6c923941 | 574 | Orientation |= LCD_GetMirrorYEx(pDevice->LayerIndex) * GUI_MIRROR_Y; |
NirT | 0:c00e6c923941 | 575 | Orientation |= LCD_GetSwapXYEx (pDevice->LayerIndex) * GUI_SWAP_XY; |
NirT | 0:c00e6c923941 | 576 | switch (Orientation) { |
NirT | 0:c00e6c923941 | 577 | case 0: |
NirT | 0:c00e6c923941 | 578 | Data.xPos = x; |
NirT | 0:c00e6c923941 | 579 | Data.yPos = y; |
NirT | 0:c00e6c923941 | 580 | break; |
NirT | 0:c00e6c923941 | 581 | case GUI_MIRROR_X: |
NirT | 0:c00e6c923941 | 582 | Data.xPos = pContext->vxSize - pContext->xSize - x; |
NirT | 0:c00e6c923941 | 583 | Data.yPos = y; |
NirT | 0:c00e6c923941 | 584 | break; |
NirT | 0:c00e6c923941 | 585 | case GUI_MIRROR_Y: |
NirT | 0:c00e6c923941 | 586 | Data.xPos = x; |
NirT | 0:c00e6c923941 | 587 | Data.yPos = pContext->vySize - pContext->ySize - y; |
NirT | 0:c00e6c923941 | 588 | break; |
NirT | 0:c00e6c923941 | 589 | case GUI_MIRROR_X | GUI_MIRROR_Y: |
NirT | 0:c00e6c923941 | 590 | Data.xPos = pContext->vxSize - pContext->xSize - x; |
NirT | 0:c00e6c923941 | 591 | Data.yPos = pContext->vySize - pContext->ySize - y; |
NirT | 0:c00e6c923941 | 592 | break; |
NirT | 0:c00e6c923941 | 593 | case GUI_SWAP_XY: |
NirT | 0:c00e6c923941 | 594 | Data.xPos = y; |
NirT | 0:c00e6c923941 | 595 | Data.yPos = x; |
NirT | 0:c00e6c923941 | 596 | break; |
NirT | 0:c00e6c923941 | 597 | case GUI_SWAP_XY | GUI_MIRROR_X: |
NirT | 0:c00e6c923941 | 598 | Data.xPos = pContext->vySize - pContext->ySize - y; |
NirT | 0:c00e6c923941 | 599 | Data.yPos = x; |
NirT | 0:c00e6c923941 | 600 | break; |
NirT | 0:c00e6c923941 | 601 | case GUI_SWAP_XY | GUI_MIRROR_Y: |
NirT | 0:c00e6c923941 | 602 | Data.xPos = y; |
NirT | 0:c00e6c923941 | 603 | Data.yPos = pContext->vxSize - pContext->xSize - x; |
NirT | 0:c00e6c923941 | 604 | break; |
NirT | 0:c00e6c923941 | 605 | case GUI_SWAP_XY | GUI_MIRROR_X | GUI_MIRROR_Y: |
NirT | 0:c00e6c923941 | 606 | Data.xPos = pContext->vySize - pContext->ySize - y; |
NirT | 0:c00e6c923941 | 607 | Data.yPos = pContext->vxSize - pContext->xSize - x; |
NirT | 0:c00e6c923941 | 608 | break; |
NirT | 0:c00e6c923941 | 609 | } |
NirT | 0:c00e6c923941 | 610 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETORG, (void *)&Data); |
NirT | 0:c00e6c923941 | 611 | #endif |
NirT | 0:c00e6c923941 | 612 | } |
NirT | 0:c00e6c923941 | 613 | |
NirT | 0:c00e6c923941 | 614 | /********************************************************************* |
NirT | 0:c00e6c923941 | 615 | * |
NirT | 0:c00e6c923941 | 616 | * _SetVRAMAddr |
NirT | 0:c00e6c923941 | 617 | */ |
NirT | 0:c00e6c923941 | 618 | static void _SetVRAMAddr(GUI_DEVICE * pDevice, void * pVRAM) { |
NirT | 0:c00e6c923941 | 619 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 620 | LCD_X_SETVRAMADDR_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 621 | |
NirT | 0:c00e6c923941 | 622 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 623 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 624 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 625 | pContext->VRAMAddr = pContext->BaseAddr = (U32)pVRAM; |
NirT | 0:c00e6c923941 | 626 | Data.pVRAM = pVRAM; |
NirT | 0:c00e6c923941 | 627 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETVRAMADDR, (void *)&Data); |
NirT | 0:c00e6c923941 | 628 | } |
NirT | 0:c00e6c923941 | 629 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 630 | SIM_Lin_SetVRAMAddr(pDevice->LayerIndex, pVRAM); |
NirT | 0:c00e6c923941 | 631 | #endif |
NirT | 0:c00e6c923941 | 632 | } |
NirT | 0:c00e6c923941 | 633 | |
NirT | 0:c00e6c923941 | 634 | /********************************************************************* |
NirT | 0:c00e6c923941 | 635 | * |
NirT | 0:c00e6c923941 | 636 | * _SetVSize |
NirT | 0:c00e6c923941 | 637 | */ |
NirT | 0:c00e6c923941 | 638 | static void _SetVSize(GUI_DEVICE * pDevice, int xSize, int ySize) { |
NirT | 0:c00e6c923941 | 639 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 640 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 641 | int NumBuffers; |
NirT | 0:c00e6c923941 | 642 | #endif |
NirT | 0:c00e6c923941 | 643 | |
NirT | 0:c00e6c923941 | 644 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 645 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 646 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 647 | NumBuffers = GUI_MULTIBUF_GetNumBuffers(); |
NirT | 0:c00e6c923941 | 648 | #endif |
NirT | 0:c00e6c923941 | 649 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 650 | if (LCD_GetSwapXYEx(pDevice->LayerIndex)) { |
NirT | 0:c00e6c923941 | 651 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 652 | pContext->vxSize = xSize * NumBuffers; |
NirT | 0:c00e6c923941 | 653 | #else |
NirT | 0:c00e6c923941 | 654 | pContext->vxSize = xSize; |
NirT | 0:c00e6c923941 | 655 | #endif |
NirT | 0:c00e6c923941 | 656 | pContext->vySize = ySize; |
NirT | 0:c00e6c923941 | 657 | pContext->vxSizePhys = ySize; |
NirT | 0:c00e6c923941 | 658 | } else { |
NirT | 0:c00e6c923941 | 659 | pContext->vxSize = xSize; |
NirT | 0:c00e6c923941 | 660 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 661 | pContext->vySize = ySize * NumBuffers; |
NirT | 0:c00e6c923941 | 662 | #else |
NirT | 0:c00e6c923941 | 663 | pContext->vySize = ySize; |
NirT | 0:c00e6c923941 | 664 | #endif |
NirT | 0:c00e6c923941 | 665 | pContext->vxSizePhys = xSize; |
NirT | 0:c00e6c923941 | 666 | } |
NirT | 0:c00e6c923941 | 667 | } |
NirT | 0:c00e6c923941 | 668 | #if defined(WIN32) && !defined(GUIDRV_SLAYER) |
NirT | 0:c00e6c923941 | 669 | SIM_Lin_SetVRAMSize(pDevice->LayerIndex, pContext->vxSize, pContext->vySize, pContext->xSize, pContext->ySize); |
NirT | 0:c00e6c923941 | 670 | #endif |
NirT | 0:c00e6c923941 | 671 | } |
NirT | 0:c00e6c923941 | 672 | |
NirT | 0:c00e6c923941 | 673 | /********************************************************************* |
NirT | 0:c00e6c923941 | 674 | * |
NirT | 0:c00e6c923941 | 675 | * _SetSize |
NirT | 0:c00e6c923941 | 676 | */ |
NirT | 0:c00e6c923941 | 677 | static void _SetSize(GUI_DEVICE * pDevice, int xSize, int ySize) { |
NirT | 0:c00e6c923941 | 678 | DRIVER_CONTEXT * pContext; |
NirT | 0:c00e6c923941 | 679 | LCD_X_SETSIZE_INFO Data = {0}; |
NirT | 0:c00e6c923941 | 680 | |
NirT | 0:c00e6c923941 | 681 | _InitOnce(pDevice); |
NirT | 0:c00e6c923941 | 682 | if (pDevice->u.pContext) { |
NirT | 0:c00e6c923941 | 683 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
NirT | 0:c00e6c923941 | 684 | if (pContext->vxSizePhys == 0) { |
NirT | 0:c00e6c923941 | 685 | if (LCD_GetSwapXYEx(pDevice->LayerIndex)) { |
NirT | 0:c00e6c923941 | 686 | pContext->vxSizePhys = ySize; |
NirT | 0:c00e6c923941 | 687 | } else { |
NirT | 0:c00e6c923941 | 688 | pContext->vxSizePhys = xSize; |
NirT | 0:c00e6c923941 | 689 | } |
NirT | 0:c00e6c923941 | 690 | } |
NirT | 0:c00e6c923941 | 691 | pContext->xSize = xSize; |
NirT | 0:c00e6c923941 | 692 | pContext->ySize = ySize; |
NirT | 0:c00e6c923941 | 693 | Data.xSize = xSize; |
NirT | 0:c00e6c923941 | 694 | Data.ySize = ySize; |
NirT | 0:c00e6c923941 | 695 | LCD_X_DisplayDriver(pDevice->LayerIndex, LCD_X_SETSIZE, (void *)&Data); |
NirT | 0:c00e6c923941 | 696 | } |
NirT | 0:c00e6c923941 | 697 | } |
NirT | 0:c00e6c923941 | 698 | |
NirT | 0:c00e6c923941 | 699 | #if defined(__cplusplus) |
NirT | 0:c00e6c923941 | 700 | } |
NirT | 0:c00e6c923941 | 701 | #endif |
NirT | 0:c00e6c923941 | 702 | |
NirT | 0:c00e6c923941 | 703 | #endif /* GUIDRV_LIN_PRIVATE_H */ |
NirT | 0:c00e6c923941 | 704 | |
NirT | 0:c00e6c923941 | 705 | /*************************** End of file ****************************/ |