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

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?

UserRevisionLine numberNew 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 : GUI_SetOrientationC0.c
NirT 0:c00e6c923941 30 Purpose : Runtime display orientation without cache
NirT 0:c00e6c923941 31 ---------------------------END-OF-HEADER------------------------------
NirT 0:c00e6c923941 32 */
NirT 0:c00e6c923941 33
NirT 0:c00e6c923941 34 #include "GUI_SetOrientation.h"
NirT 0:c00e6c923941 35
NirT 0:c00e6c923941 36 /*********************************************************************
NirT 0:c00e6c923941 37 *
NirT 0:c00e6c923941 38 * Defines
NirT 0:c00e6c923941 39 *
NirT 0:c00e6c923941 40 **********************************************************************
NirT 0:c00e6c923941 41 */
NirT 0:c00e6c923941 42 #define XY2PTR(x, y) (PIXEL *)(pContext->pData + y * pContext->BytesPerLine + x * pContext->pDrawingAPI->BytesPerPixel)
NirT 0:c00e6c923941 43
NirT 0:c00e6c923941 44 /*********************************************************************
NirT 0:c00e6c923941 45 *
NirT 0:c00e6c923941 46 * Static code
NirT 0:c00e6c923941 47 *
NirT 0:c00e6c923941 48 **********************************************************************
NirT 0:c00e6c923941 49 */
NirT 0:c00e6c923941 50 /*********************************************************************
NirT 0:c00e6c923941 51 *
NirT 0:c00e6c923941 52 * Static code
NirT 0:c00e6c923941 53 *
NirT 0:c00e6c923941 54 **********************************************************************
NirT 0:c00e6c923941 55 */
NirT 0:c00e6c923941 56 /*********************************************************************
NirT 0:c00e6c923941 57 *
NirT 0:c00e6c923941 58 * _Sort
NirT 0:c00e6c923941 59 *
NirT 0:c00e6c923941 60 * Purpose:
NirT 0:c00e6c923941 61 * Sorts the values pointed by the given pointers. Please note that
NirT 0:c00e6c923941 62 * the same static function is also in GUI_SetOrientationC0.h
NirT 0:c00e6c923941 63 * to enable better compiler optimization.
NirT 0:c00e6c923941 64 */
NirT 0:c00e6c923941 65 static void _Sort(int * p0, int * p1) {
NirT 0:c00e6c923941 66 int temp;
NirT 0:c00e6c923941 67
NirT 0:c00e6c923941 68 if (*p0 > *p1) {
NirT 0:c00e6c923941 69 temp = *p0;
NirT 0:c00e6c923941 70 *p0 = *p1;
NirT 0:c00e6c923941 71 *p1 = temp;
NirT 0:c00e6c923941 72 }
NirT 0:c00e6c923941 73 }
NirT 0:c00e6c923941 74
NirT 0:c00e6c923941 75 /*********************************************************************
NirT 0:c00e6c923941 76 *
NirT 0:c00e6c923941 77 * Static code: Bitmap drawing routines
NirT 0:c00e6c923941 78 *
NirT 0:c00e6c923941 79 **********************************************************************
NirT 0:c00e6c923941 80 */
NirT 0:c00e6c923941 81 /*********************************************************************
NirT 0:c00e6c923941 82 *
NirT 0:c00e6c923941 83 * Draw Bitmap 1 BPP
NirT 0:c00e6c923941 84 */
NirT 0:c00e6c923941 85 static void _DrawBitLine1BPP(GUI_DEVICE * pDevice, unsigned x, unsigned y, U8 const * p, int Diff, int xsize, const LCD_PIXELINDEX * pTrans) {
NirT 0:c00e6c923941 86 LCD_PIXELINDEX IndexMask, Index0, Index1, Pixel;
NirT 0:c00e6c923941 87 unsigned (* pfGetPixelIndex)(GUI_DEVICE *, int, int);
NirT 0:c00e6c923941 88 PIXEL * pData;
NirT 0:c00e6c923941 89 int x_phys, y_phys;
NirT 0:c00e6c923941 90 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 91
NirT 0:c00e6c923941 92 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 93 Index0 = *(pTrans + 0);
NirT 0:c00e6c923941 94 Index1 = *(pTrans + 1);
NirT 0:c00e6c923941 95 x += Diff;
NirT 0:c00e6c923941 96 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
NirT 0:c00e6c923941 97 pData = XY2PTR(x_phys, y_phys);
NirT 0:c00e6c923941 98 switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
NirT 0:c00e6c923941 99 case 0:
NirT 0:c00e6c923941 100 do {
NirT 0:c00e6c923941 101 *pData = (PIXEL)(*p & (0x80 >> Diff)) ? Index1 : Index0;
NirT 0:c00e6c923941 102 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 103 if (++Diff == 8) {
NirT 0:c00e6c923941 104 Diff = 0;
NirT 0:c00e6c923941 105 p++;
NirT 0:c00e6c923941 106 }
NirT 0:c00e6c923941 107 } while (--xsize);
NirT 0:c00e6c923941 108 break;
NirT 0:c00e6c923941 109 case LCD_DRAWMODE_TRANS:
NirT 0:c00e6c923941 110 do {
NirT 0:c00e6c923941 111 if (*p & (0x80 >> Diff)) {
NirT 0:c00e6c923941 112 *pData = Index1;
NirT 0:c00e6c923941 113 }
NirT 0:c00e6c923941 114 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 115 if (++Diff == 8) {
NirT 0:c00e6c923941 116 Diff = 0;
NirT 0:c00e6c923941 117 p++;
NirT 0:c00e6c923941 118 }
NirT 0:c00e6c923941 119 } while (--xsize);
NirT 0:c00e6c923941 120 break;
NirT 0:c00e6c923941 121 case LCD_DRAWMODE_XOR | LCD_DRAWMODE_TRANS:
NirT 0:c00e6c923941 122 case LCD_DRAWMODE_XOR:
NirT 0:c00e6c923941 123 pfGetPixelIndex = pDevice->pDeviceAPI->pfGetPixelIndex;
NirT 0:c00e6c923941 124 IndexMask = pDevice->pColorConvAPI->pfGetIndexMask();
NirT 0:c00e6c923941 125 do {
NirT 0:c00e6c923941 126 if (*p & (0x80 >> Diff)) {
NirT 0:c00e6c923941 127 Pixel = pfGetPixelIndex(pDevice, x, y);
NirT 0:c00e6c923941 128 Pixel ^= IndexMask;
NirT 0:c00e6c923941 129 *pData = Pixel;
NirT 0:c00e6c923941 130 }
NirT 0:c00e6c923941 131 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 132 x++;
NirT 0:c00e6c923941 133 if (++Diff == 8) {
NirT 0:c00e6c923941 134 Diff = 0;
NirT 0:c00e6c923941 135 p++;
NirT 0:c00e6c923941 136 }
NirT 0:c00e6c923941 137 } while (--xsize);
NirT 0:c00e6c923941 138 break;
NirT 0:c00e6c923941 139 }
NirT 0:c00e6c923941 140 }
NirT 0:c00e6c923941 141
NirT 0:c00e6c923941 142 /*********************************************************************
NirT 0:c00e6c923941 143 *
NirT 0:c00e6c923941 144 * Draw Bitmap 2 BPP
NirT 0:c00e6c923941 145 */
NirT 0:c00e6c923941 146 static void _DrawBitLine2BPP(GUI_DEVICE * pDevice, int x, int y, U8 const * p, int Diff, int xsize, const LCD_PIXELINDEX * pTrans) {
NirT 0:c00e6c923941 147 LCD_PIXELINDEX Pixels, PixelIndex;
NirT 0:c00e6c923941 148 int CurrentPixel, Shift, Index;
NirT 0:c00e6c923941 149 PIXEL * pData;
NirT 0:c00e6c923941 150 int x_phys, y_phys;
NirT 0:c00e6c923941 151 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 152
NirT 0:c00e6c923941 153 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 154 Pixels = *p;
NirT 0:c00e6c923941 155 CurrentPixel = Diff;
NirT 0:c00e6c923941 156 x += Diff;
NirT 0:c00e6c923941 157 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
NirT 0:c00e6c923941 158 pData = XY2PTR(x_phys, y_phys);
NirT 0:c00e6c923941 159 switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
NirT 0:c00e6c923941 160 case 0:
NirT 0:c00e6c923941 161 if (pTrans) {
NirT 0:c00e6c923941 162 do {
NirT 0:c00e6c923941 163 Shift = (3 - CurrentPixel) << 1;
NirT 0:c00e6c923941 164 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
NirT 0:c00e6c923941 165 PixelIndex = *(pTrans + Index);
NirT 0:c00e6c923941 166 *pData = (PIXEL)PixelIndex;
NirT 0:c00e6c923941 167 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 168 if (++CurrentPixel == 4) {
NirT 0:c00e6c923941 169 CurrentPixel = 0;
NirT 0:c00e6c923941 170 Pixels = *(++p);
NirT 0:c00e6c923941 171 }
NirT 0:c00e6c923941 172 } while (--xsize);
NirT 0:c00e6c923941 173 } else {
NirT 0:c00e6c923941 174 do {
NirT 0:c00e6c923941 175 Shift = (3 - CurrentPixel) << 1;
NirT 0:c00e6c923941 176 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
NirT 0:c00e6c923941 177 *pData = (PIXEL)Index;
NirT 0:c00e6c923941 178 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 179 if (++CurrentPixel == 4) {
NirT 0:c00e6c923941 180 CurrentPixel = 0;
NirT 0:c00e6c923941 181 Pixels = *(++p);
NirT 0:c00e6c923941 182 }
NirT 0:c00e6c923941 183 } while (--xsize);
NirT 0:c00e6c923941 184 }
NirT 0:c00e6c923941 185 break;
NirT 0:c00e6c923941 186 case LCD_DRAWMODE_TRANS:
NirT 0:c00e6c923941 187 if (pTrans) {
NirT 0:c00e6c923941 188 do {
NirT 0:c00e6c923941 189 Shift = (3 - CurrentPixel) << 1;
NirT 0:c00e6c923941 190 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
NirT 0:c00e6c923941 191 if (Index) {
NirT 0:c00e6c923941 192 PixelIndex = *(pTrans + Index);
NirT 0:c00e6c923941 193 *pData = (PIXEL)PixelIndex;
NirT 0:c00e6c923941 194 }
NirT 0:c00e6c923941 195 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 196 if (++CurrentPixel == 4) {
NirT 0:c00e6c923941 197 CurrentPixel = 0;
NirT 0:c00e6c923941 198 Pixels = *(++p);
NirT 0:c00e6c923941 199 }
NirT 0:c00e6c923941 200 } while (--xsize);
NirT 0:c00e6c923941 201 } else {
NirT 0:c00e6c923941 202 do {
NirT 0:c00e6c923941 203 Shift = (3 - CurrentPixel) << 1;
NirT 0:c00e6c923941 204 Index = (Pixels & (0xC0 >> (6 - Shift))) >> Shift;
NirT 0:c00e6c923941 205 if (Index) {
NirT 0:c00e6c923941 206 *pData = (PIXEL)Index;
NirT 0:c00e6c923941 207 }
NirT 0:c00e6c923941 208 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 209 if (++CurrentPixel == 4) {
NirT 0:c00e6c923941 210 CurrentPixel = 0;
NirT 0:c00e6c923941 211 Pixels = *(++p);
NirT 0:c00e6c923941 212 }
NirT 0:c00e6c923941 213 } while (--xsize);
NirT 0:c00e6c923941 214 }
NirT 0:c00e6c923941 215 break;
NirT 0:c00e6c923941 216 }
NirT 0:c00e6c923941 217 }
NirT 0:c00e6c923941 218
NirT 0:c00e6c923941 219 /*********************************************************************
NirT 0:c00e6c923941 220 *
NirT 0:c00e6c923941 221 * Draw Bitmap 4 BPP
NirT 0:c00e6c923941 222 */
NirT 0:c00e6c923941 223 static void _DrawBitLine4BPP(GUI_DEVICE * pDevice, int x, int y, U8 const * p, int Diff, int xsize, const LCD_PIXELINDEX * pTrans) {
NirT 0:c00e6c923941 224 LCD_PIXELINDEX Pixels, PixelIndex;
NirT 0:c00e6c923941 225 int CurrentPixel, Shift, Index;
NirT 0:c00e6c923941 226 PIXEL * pData;
NirT 0:c00e6c923941 227 int x_phys, y_phys;
NirT 0:c00e6c923941 228 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 229
NirT 0:c00e6c923941 230 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 231 Pixels = *p;
NirT 0:c00e6c923941 232 CurrentPixel = Diff;
NirT 0:c00e6c923941 233 x += Diff;
NirT 0:c00e6c923941 234 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
NirT 0:c00e6c923941 235 pData = XY2PTR(x_phys, y_phys);
NirT 0:c00e6c923941 236 switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
NirT 0:c00e6c923941 237 case 0:
NirT 0:c00e6c923941 238 if (pTrans) {
NirT 0:c00e6c923941 239 do {
NirT 0:c00e6c923941 240 Shift = (1 - CurrentPixel) << 2;
NirT 0:c00e6c923941 241 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
NirT 0:c00e6c923941 242 PixelIndex = *(pTrans + Index);
NirT 0:c00e6c923941 243 *pData = (PIXEL)PixelIndex;
NirT 0:c00e6c923941 244 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 245 if (++CurrentPixel == 2) {
NirT 0:c00e6c923941 246 CurrentPixel = 0;
NirT 0:c00e6c923941 247 Pixels = *(++p);
NirT 0:c00e6c923941 248 }
NirT 0:c00e6c923941 249 } while (--xsize);
NirT 0:c00e6c923941 250 } else {
NirT 0:c00e6c923941 251 do {
NirT 0:c00e6c923941 252 Shift = (1 - CurrentPixel) << 2;
NirT 0:c00e6c923941 253 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
NirT 0:c00e6c923941 254 *pData = (PIXEL)Index;
NirT 0:c00e6c923941 255 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 256 if (++CurrentPixel == 2) {
NirT 0:c00e6c923941 257 CurrentPixel = 0;
NirT 0:c00e6c923941 258 Pixels = *(++p);
NirT 0:c00e6c923941 259 }
NirT 0:c00e6c923941 260 } while (--xsize);
NirT 0:c00e6c923941 261 }
NirT 0:c00e6c923941 262 break;
NirT 0:c00e6c923941 263 case LCD_DRAWMODE_TRANS:
NirT 0:c00e6c923941 264 if (pTrans) {
NirT 0:c00e6c923941 265 do {
NirT 0:c00e6c923941 266 Shift = (1 - CurrentPixel) << 2;
NirT 0:c00e6c923941 267 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
NirT 0:c00e6c923941 268 if (Index) {
NirT 0:c00e6c923941 269 PixelIndex = *(pTrans + Index);
NirT 0:c00e6c923941 270 *pData = (PIXEL)PixelIndex;
NirT 0:c00e6c923941 271 }
NirT 0:c00e6c923941 272 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 273 if (++CurrentPixel == 2) {
NirT 0:c00e6c923941 274 CurrentPixel = 0;
NirT 0:c00e6c923941 275 Pixels = *(++p);
NirT 0:c00e6c923941 276 }
NirT 0:c00e6c923941 277 } while (--xsize);
NirT 0:c00e6c923941 278 } else {
NirT 0:c00e6c923941 279 do {
NirT 0:c00e6c923941 280 Shift = (1 - CurrentPixel) << 2;
NirT 0:c00e6c923941 281 Index = (Pixels & (0xF0 >> (4 - Shift))) >> Shift;
NirT 0:c00e6c923941 282 if (Index) {
NirT 0:c00e6c923941 283 *pData = (PIXEL)Index;
NirT 0:c00e6c923941 284 }
NirT 0:c00e6c923941 285 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 286 if (++CurrentPixel == 2) {
NirT 0:c00e6c923941 287 CurrentPixel = 0;
NirT 0:c00e6c923941 288 Pixels = *(++p);
NirT 0:c00e6c923941 289 }
NirT 0:c00e6c923941 290 } while (--xsize);
NirT 0:c00e6c923941 291 }
NirT 0:c00e6c923941 292 break;
NirT 0:c00e6c923941 293 }
NirT 0:c00e6c923941 294 }
NirT 0:c00e6c923941 295
NirT 0:c00e6c923941 296 /*********************************************************************
NirT 0:c00e6c923941 297 *
NirT 0:c00e6c923941 298 * Draw Bitmap 8 BPP
NirT 0:c00e6c923941 299 */
NirT 0:c00e6c923941 300 static void _DrawBitLine8BPP(GUI_DEVICE * pDevice, int x, int y, U8 const * p, int xsize, const LCD_PIXELINDEX * pTrans) {
NirT 0:c00e6c923941 301 LCD_PIXELINDEX Pixel;
NirT 0:c00e6c923941 302 PIXEL * pData;
NirT 0:c00e6c923941 303 int x_phys, y_phys;
NirT 0:c00e6c923941 304 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 305
NirT 0:c00e6c923941 306 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 307 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
NirT 0:c00e6c923941 308 pData = XY2PTR(x_phys, y_phys);
NirT 0:c00e6c923941 309 switch (GUI_pContext->DrawMode & (LCD_DRAWMODE_TRANS | LCD_DRAWMODE_XOR)) {
NirT 0:c00e6c923941 310 case 0:
NirT 0:c00e6c923941 311 if (pTrans) {
NirT 0:c00e6c923941 312 do {
NirT 0:c00e6c923941 313 Pixel = *p++;
NirT 0:c00e6c923941 314 *pData = (PIXEL)*(pTrans + Pixel);
NirT 0:c00e6c923941 315 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 316 } while (--xsize);
NirT 0:c00e6c923941 317 } else {
NirT 0:c00e6c923941 318 do {
NirT 0:c00e6c923941 319 *pData = (PIXEL)*p++;
NirT 0:c00e6c923941 320 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 321 } while (--xsize);
NirT 0:c00e6c923941 322 }
NirT 0:c00e6c923941 323 break;
NirT 0:c00e6c923941 324 case LCD_DRAWMODE_TRANS:
NirT 0:c00e6c923941 325 if (pTrans) {
NirT 0:c00e6c923941 326 do {
NirT 0:c00e6c923941 327 Pixel = *p++;
NirT 0:c00e6c923941 328 if (Pixel) {
NirT 0:c00e6c923941 329 *pData = (PIXEL)*(pTrans + Pixel);
NirT 0:c00e6c923941 330 }
NirT 0:c00e6c923941 331 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 332 } while (--xsize);
NirT 0:c00e6c923941 333 } else {
NirT 0:c00e6c923941 334 do {
NirT 0:c00e6c923941 335 Pixel = *p++;
NirT 0:c00e6c923941 336 if (Pixel) {
NirT 0:c00e6c923941 337 *pData = (PIXEL)Pixel;
NirT 0:c00e6c923941 338 }
NirT 0:c00e6c923941 339 pData += pContext->PixelOffset;
NirT 0:c00e6c923941 340 } while (--xsize);
NirT 0:c00e6c923941 341 }
NirT 0:c00e6c923941 342 break;
NirT 0:c00e6c923941 343 }
NirT 0:c00e6c923941 344 }
NirT 0:c00e6c923941 345
NirT 0:c00e6c923941 346 /*********************************************************************
NirT 0:c00e6c923941 347 *
NirT 0:c00e6c923941 348 * Draw Bitmap 16 BPP
NirT 0:c00e6c923941 349 */
NirT 0:c00e6c923941 350 static void _DrawBitLine16BPP(GUI_DEVICE * pDevice, int x, int y, U16 const * p, int xsize) {
NirT 0:c00e6c923941 351 PIXEL * pData;
NirT 0:c00e6c923941 352 int x_phys, y_phys, PixelOffset;
NirT 0:c00e6c923941 353 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 354
NirT 0:c00e6c923941 355 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 356 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
NirT 0:c00e6c923941 357 pData = XY2PTR(x_phys, y_phys);
NirT 0:c00e6c923941 358 PixelOffset = pContext->PixelOffset;
NirT 0:c00e6c923941 359 do {
NirT 0:c00e6c923941 360 *pData = (PIXEL)*p++;
NirT 0:c00e6c923941 361 pData += PixelOffset;
NirT 0:c00e6c923941 362 } while (--xsize);
NirT 0:c00e6c923941 363 }
NirT 0:c00e6c923941 364
NirT 0:c00e6c923941 365 /*********************************************************************
NirT 0:c00e6c923941 366 *
NirT 0:c00e6c923941 367 * Draw Bitmap 32 BPP
NirT 0:c00e6c923941 368 */
NirT 0:c00e6c923941 369 static void _DrawBitLine32BPP(GUI_DEVICE * pDevice, int x, int y, U32 const * p, int xsize) {
NirT 0:c00e6c923941 370 PIXEL * pData;
NirT 0:c00e6c923941 371 int x_phys, y_phys, PixelOffset;
NirT 0:c00e6c923941 372 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 373
NirT 0:c00e6c923941 374 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 375 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
NirT 0:c00e6c923941 376 pData = XY2PTR(x_phys, y_phys);
NirT 0:c00e6c923941 377 PixelOffset = pContext->PixelOffset;
NirT 0:c00e6c923941 378 do {
NirT 0:c00e6c923941 379 *pData = (PIXEL)*p++;
NirT 0:c00e6c923941 380 pData += PixelOffset;
NirT 0:c00e6c923941 381 } while (--xsize);
NirT 0:c00e6c923941 382 }
NirT 0:c00e6c923941 383
NirT 0:c00e6c923941 384 /*********************************************************************
NirT 0:c00e6c923941 385 *
NirT 0:c00e6c923941 386 * Static code: API functions for drawing operations, no cache
NirT 0:c00e6c923941 387 *
NirT 0:c00e6c923941 388 **********************************************************************
NirT 0:c00e6c923941 389 */
NirT 0:c00e6c923941 390 /*********************************************************************
NirT 0:c00e6c923941 391 *
NirT 0:c00e6c923941 392 * _DrawBitmap_CX
NirT 0:c00e6c923941 393 */
NirT 0:c00e6c923941 394 static void _DrawBitmap_CX(GUI_DEVICE * pDevice, int x0, int y0,
NirT 0:c00e6c923941 395 int xSize, int ySize,
NirT 0:c00e6c923941 396 int BitsPerPixel,
NirT 0:c00e6c923941 397 int BytesPerLine,
NirT 0:c00e6c923941 398 const U8 * pData, int Diff,
NirT 0:c00e6c923941 399 const LCD_PIXELINDEX * pTrans) {
NirT 0:c00e6c923941 400 int x0_phys, y0_phys, x1_phys, y1_phys;
NirT 0:c00e6c923941 401 int i;
NirT 0:c00e6c923941 402 PIXEL * pDataBM;
NirT 0:c00e6c923941 403 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 404
NirT 0:c00e6c923941 405 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 406 switch (BitsPerPixel) {
NirT 0:c00e6c923941 407 case 1:
NirT 0:c00e6c923941 408 for (i = 0; i < ySize; i++) {
NirT 0:c00e6c923941 409 _DrawBitLine1BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
NirT 0:c00e6c923941 410 pData += BytesPerLine;
NirT 0:c00e6c923941 411 }
NirT 0:c00e6c923941 412 break;
NirT 0:c00e6c923941 413 case 2:
NirT 0:c00e6c923941 414 for (i = 0; i < ySize; i++) {
NirT 0:c00e6c923941 415 _DrawBitLine2BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
NirT 0:c00e6c923941 416 pData += BytesPerLine;
NirT 0:c00e6c923941 417 }
NirT 0:c00e6c923941 418 break;
NirT 0:c00e6c923941 419 case 4:
NirT 0:c00e6c923941 420 for (i = 0; i < ySize; i++) {
NirT 0:c00e6c923941 421 _DrawBitLine4BPP(pDevice, x0, i + y0, pData, Diff, xSize, pTrans);
NirT 0:c00e6c923941 422 pData += BytesPerLine;
NirT 0:c00e6c923941 423 }
NirT 0:c00e6c923941 424 break;
NirT 0:c00e6c923941 425 case 8:
NirT 0:c00e6c923941 426 for (i = 0; i < ySize; i++) {
NirT 0:c00e6c923941 427 _DrawBitLine8BPP(pDevice, x0, i + y0, pData, xSize, pTrans);
NirT 0:c00e6c923941 428 pData += BytesPerLine;
NirT 0:c00e6c923941 429 }
NirT 0:c00e6c923941 430 break;
NirT 0:c00e6c923941 431 case 16:
NirT 0:c00e6c923941 432 for (i = 0; i < ySize; i++) {
NirT 0:c00e6c923941 433 _DrawBitLine16BPP(pDevice, x0, i + y0, (U16 *)pData, xSize);
NirT 0:c00e6c923941 434 pData += BytesPerLine;
NirT 0:c00e6c923941 435 }
NirT 0:c00e6c923941 436 break;
NirT 0:c00e6c923941 437 case 32:
NirT 0:c00e6c923941 438 for (i = 0; i < ySize; i++) {
NirT 0:c00e6c923941 439 _DrawBitLine32BPP(pDevice, x0, i + y0, (U32 *)pData, xSize);
NirT 0:c00e6c923941 440 pData += BytesPerLine;
NirT 0:c00e6c923941 441 }
NirT 0:c00e6c923941 442 break;
NirT 0:c00e6c923941 443 }
NirT 0:c00e6c923941 444
NirT 0:c00e6c923941 445 pContext->pfLog2Phys(pContext, x0 + Diff, y0, &x0_phys, &y0_phys);
NirT 0:c00e6c923941 446 pContext->pfLog2Phys(pContext, x0 + Diff + xSize - 1, y0 + ySize - 1, &x1_phys, &y1_phys);
NirT 0:c00e6c923941 447 _Sort(&x0_phys, &x1_phys);
NirT 0:c00e6c923941 448 _Sort(&y0_phys, &y1_phys);
NirT 0:c00e6c923941 449 pDataBM = XY2PTR(x0_phys, y0_phys);
NirT 0:c00e6c923941 450 pDevice = pDevice->pNext;
NirT 0:c00e6c923941 451 pDevice->pDeviceAPI->pfDrawBitmap(pDevice,
NirT 0:c00e6c923941 452 x0_phys, y0_phys,
NirT 0:c00e6c923941 453 x1_phys - x0_phys + 1,
NirT 0:c00e6c923941 454 y1_phys - y0_phys + 1,
NirT 0:c00e6c923941 455 pContext->pDrawingAPI->BytesPerPixel << 3,
NirT 0:c00e6c923941 456 pContext->pDrawingAPI->BytesPerPixel * pContext->vxSize,
NirT 0:c00e6c923941 457 (U8 *)pDataBM, 0, NULL);
NirT 0:c00e6c923941 458 }
NirT 0:c00e6c923941 459
NirT 0:c00e6c923941 460 /*********************************************************************
NirT 0:c00e6c923941 461 *
NirT 0:c00e6c923941 462 * _GetPixelIndex_CX
NirT 0:c00e6c923941 463 */
NirT 0:c00e6c923941 464 static unsigned int _GetPixelIndex_CX(GUI_DEVICE * pDevice, int x, int y) {
NirT 0:c00e6c923941 465 PIXEL * pData;
NirT 0:c00e6c923941 466 PIXEL Pixel;
NirT 0:c00e6c923941 467 int x_phys, y_phys;
NirT 0:c00e6c923941 468 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 469
NirT 0:c00e6c923941 470 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 471 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
NirT 0:c00e6c923941 472 pData = XY2PTR(x_phys, y_phys);
NirT 0:c00e6c923941 473 Pixel = *pData;
NirT 0:c00e6c923941 474 return Pixel;
NirT 0:c00e6c923941 475 }
NirT 0:c00e6c923941 476
NirT 0:c00e6c923941 477 /*********************************************************************
NirT 0:c00e6c923941 478 *
NirT 0:c00e6c923941 479 * _SetPixelIndex_CX
NirT 0:c00e6c923941 480 */
NirT 0:c00e6c923941 481 static void _SetPixelIndex_CX(GUI_DEVICE * pDevice, int x, int y, int PixelIndex) {
NirT 0:c00e6c923941 482 PIXEL * pData;
NirT 0:c00e6c923941 483 int x_phys, y_phys;
NirT 0:c00e6c923941 484 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 485
NirT 0:c00e6c923941 486 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 487 pContext->pfLog2Phys(pContext, x, y, &x_phys, &y_phys);
NirT 0:c00e6c923941 488 pData = XY2PTR(x_phys, y_phys);
NirT 0:c00e6c923941 489 *pData = (PIXEL)PixelIndex;
NirT 0:c00e6c923941 490 pDevice = pDevice->pNext;
NirT 0:c00e6c923941 491 pDevice->pDeviceAPI->pfSetPixelIndex(pDevice, x_phys, y_phys, PixelIndex);
NirT 0:c00e6c923941 492 }
NirT 0:c00e6c923941 493
NirT 0:c00e6c923941 494 /*********************************************************************
NirT 0:c00e6c923941 495 *
NirT 0:c00e6c923941 496 * _XorPixel_CX
NirT 0:c00e6c923941 497 */
NirT 0:c00e6c923941 498 static void _XorPixel_CX(GUI_DEVICE * pDevice, int x, int y) {
NirT 0:c00e6c923941 499 PIXEL Pixel, IndexMask;
NirT 0:c00e6c923941 500
NirT 0:c00e6c923941 501 IndexMask = pDevice->pColorConvAPI->pfGetIndexMask();
NirT 0:c00e6c923941 502 Pixel = pDevice->pDeviceAPI->pfGetPixelIndex(pDevice, x, y);
NirT 0:c00e6c923941 503 Pixel ^= IndexMask;
NirT 0:c00e6c923941 504 pDevice->pDeviceAPI->pfSetPixelIndex(pDevice, x, y, Pixel);
NirT 0:c00e6c923941 505 }
NirT 0:c00e6c923941 506
NirT 0:c00e6c923941 507 /*********************************************************************
NirT 0:c00e6c923941 508 *
NirT 0:c00e6c923941 509 * _DrawHLine_CX
NirT 0:c00e6c923941 510 */
NirT 0:c00e6c923941 511 static void _DrawHLine_CX(GUI_DEVICE * pDevice, int x0, int y, int x1) {
NirT 0:c00e6c923941 512 pDevice->pDeviceAPI->pfFillRect(pDevice, x0, y, x1, y);
NirT 0:c00e6c923941 513 }
NirT 0:c00e6c923941 514
NirT 0:c00e6c923941 515 /*********************************************************************
NirT 0:c00e6c923941 516 *
NirT 0:c00e6c923941 517 * _DrawVLine_CX
NirT 0:c00e6c923941 518 */
NirT 0:c00e6c923941 519 static void _DrawVLine_CX(GUI_DEVICE * pDevice, int x, int y0, int y1) {
NirT 0:c00e6c923941 520 pDevice->pDeviceAPI->pfFillRect(pDevice, x, y0, x, y1);
NirT 0:c00e6c923941 521 }
NirT 0:c00e6c923941 522
NirT 0:c00e6c923941 523 /*********************************************************************
NirT 0:c00e6c923941 524 *
NirT 0:c00e6c923941 525 * _FillRect_CX
NirT 0:c00e6c923941 526 */
NirT 0:c00e6c923941 527 static void _FillRect_CX(GUI_DEVICE * pDevice, int x0, int y0, int x1, int y1) {
NirT 0:c00e6c923941 528 PIXEL * pData;
NirT 0:c00e6c923941 529 PIXEL * pLine;
NirT 0:c00e6c923941 530 PIXEL * pPixel;
NirT 0:c00e6c923941 531 PIXEL Pixel, IndexMask;
NirT 0:c00e6c923941 532 int x0_phys, y0_phys, x1_phys, y1_phys;
NirT 0:c00e6c923941 533 int NumPixels, NumLines;
NirT 0:c00e6c923941 534 DRIVER_CONTEXT * pContext;
NirT 0:c00e6c923941 535
NirT 0:c00e6c923941 536 pContext = (DRIVER_CONTEXT *)pDevice->u.pContext;
NirT 0:c00e6c923941 537 pContext->pfLog2Phys(pContext, x0, y0, &x0_phys, &y0_phys);
NirT 0:c00e6c923941 538 pContext->pfLog2Phys(pContext, x1, y1, &x1_phys, &y1_phys);
NirT 0:c00e6c923941 539 _Sort(&x0_phys, &x1_phys);
NirT 0:c00e6c923941 540 _Sort(&y0_phys, &y1_phys);
NirT 0:c00e6c923941 541 pData = pLine = XY2PTR(x0_phys, y0_phys);
NirT 0:c00e6c923941 542 NumLines = y1_phys - y0_phys + 1;
NirT 0:c00e6c923941 543 if (GUI_pContext->DrawMode & LCD_DRAWMODE_XOR) {
NirT 0:c00e6c923941 544 IndexMask = pDevice->pColorConvAPI->pfGetIndexMask();
NirT 0:c00e6c923941 545 do {
NirT 0:c00e6c923941 546 pPixel = pLine;
NirT 0:c00e6c923941 547 NumPixels = x1_phys - x0_phys + 1;
NirT 0:c00e6c923941 548 do {
NirT 0:c00e6c923941 549 *pPixel++ ^= IndexMask;
NirT 0:c00e6c923941 550 } while (--NumPixels);
NirT 0:c00e6c923941 551 pLine += pContext->vxSize;
NirT 0:c00e6c923941 552 } while (--NumLines);
NirT 0:c00e6c923941 553 } else {
NirT 0:c00e6c923941 554 Pixel = (PIXEL)LCD__GetColorIndex();
NirT 0:c00e6c923941 555 if (sizeof(Pixel) == 1) {
NirT 0:c00e6c923941 556 NumPixels = x1_phys - x0_phys + 1;
NirT 0:c00e6c923941 557 do {
NirT 0:c00e6c923941 558 GUI_MEMSET((U8 *)pLine, Pixel, NumPixels);
NirT 0:c00e6c923941 559 pLine += pContext->vxSize;
NirT 0:c00e6c923941 560 } while (--NumLines);
NirT 0:c00e6c923941 561 } else {
NirT 0:c00e6c923941 562 do {
NirT 0:c00e6c923941 563 pPixel = pLine;
NirT 0:c00e6c923941 564 NumPixels = x1_phys - x0_phys + 1;
NirT 0:c00e6c923941 565 do {
NirT 0:c00e6c923941 566 *pPixel++ = Pixel;
NirT 0:c00e6c923941 567 } while (--NumPixels);
NirT 0:c00e6c923941 568 pLine += pContext->vxSize;
NirT 0:c00e6c923941 569 } while (--NumLines);
NirT 0:c00e6c923941 570 }
NirT 0:c00e6c923941 571 }
NirT 0:c00e6c923941 572 pDevice = pDevice->pNext;
NirT 0:c00e6c923941 573 pDevice->pDeviceAPI->pfDrawBitmap(pDevice,
NirT 0:c00e6c923941 574 x0_phys, y0_phys,
NirT 0:c00e6c923941 575 x1_phys - x0_phys + 1,
NirT 0:c00e6c923941 576 y1_phys - y0_phys + 1,
NirT 0:c00e6c923941 577 pContext->pDrawingAPI->BytesPerPixel << 3,
NirT 0:c00e6c923941 578 pContext->pDrawingAPI->BytesPerPixel * pContext->vxSize,
NirT 0:c00e6c923941 579 (U8 *)pData, 0, NULL);
NirT 0:c00e6c923941 580 }
NirT 0:c00e6c923941 581
NirT 0:c00e6c923941 582 /*********************************************************************
NirT 0:c00e6c923941 583 *
NirT 0:c00e6c923941 584 * Static data: Drawing API(s)
NirT 0:c00e6c923941 585 *
NirT 0:c00e6c923941 586 **********************************************************************
NirT 0:c00e6c923941 587 */
NirT 0:c00e6c923941 588 /*********************************************************************
NirT 0:c00e6c923941 589 *
NirT 0:c00e6c923941 590 * GUI_OrientationAPI_CX
NirT 0:c00e6c923941 591 */
NirT 0:c00e6c923941 592 const GUI_ORIENTATION_API API_NAME = {
NirT 0:c00e6c923941 593 _DrawBitmap_CX,
NirT 0:c00e6c923941 594 _DrawHLine_CX,
NirT 0:c00e6c923941 595 _DrawVLine_CX,
NirT 0:c00e6c923941 596 _FillRect_CX,
NirT 0:c00e6c923941 597 _GetPixelIndex_CX,
NirT 0:c00e6c923941 598 _SetPixelIndex_CX,
NirT 0:c00e6c923941 599 _XorPixel_CX,
NirT 0:c00e6c923941 600 BYTES_PER_PIXEL
NirT 0:c00e6c923941 601 };
NirT 0:c00e6c923941 602
NirT 0:c00e6c923941 603 /*************************** End of file ****************************/