Headers for emWin lib
Dependents: DISCO-F746NG_rtos_test
emWin_header/GUIDRV_Lin_Opt_8.h@0:1bf8f02b0770, 2016-03-26 (annotated)
- Committer:
- redbird
- Date:
- Sat Mar 26 22:49:50 2016 +0000
- Revision:
- 0:1bf8f02b0770
new code integration
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
redbird | 0:1bf8f02b0770 | 1 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 2 | * SEGGER Microcontroller GmbH & Co. KG * |
redbird | 0:1bf8f02b0770 | 3 | * Solutions for real time microcontroller applications * |
redbird | 0:1bf8f02b0770 | 4 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 5 | * * |
redbird | 0:1bf8f02b0770 | 6 | * (c) 1996 - 2014 SEGGER Microcontroller GmbH & Co. KG * |
redbird | 0:1bf8f02b0770 | 7 | * * |
redbird | 0:1bf8f02b0770 | 8 | * Internet: www.segger.com Support: support@segger.com * |
redbird | 0:1bf8f02b0770 | 9 | * * |
redbird | 0:1bf8f02b0770 | 10 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 11 | |
redbird | 0:1bf8f02b0770 | 12 | ** emWin V5.24 - Graphical user interface for embedded applications ** |
redbird | 0:1bf8f02b0770 | 13 | All Intellectual Property rights in the Software belongs to SEGGER. |
redbird | 0:1bf8f02b0770 | 14 | emWin is protected by international copyright laws. Knowledge of the |
redbird | 0:1bf8f02b0770 | 15 | source code may not be used to write a similar product. This file may |
redbird | 0:1bf8f02b0770 | 16 | only be used in accordance with the following terms: |
redbird | 0:1bf8f02b0770 | 17 | |
redbird | 0:1bf8f02b0770 | 18 | The software has been licensed to NXP Semiconductors USA, Inc. whose |
redbird | 0:1bf8f02b0770 | 19 | registered office is situated at 411 E. Plumeria Drive, San Jose, |
redbird | 0:1bf8f02b0770 | 20 | CA 95134, USA solely for the purposes of creating libraries for |
redbird | 0:1bf8f02b0770 | 21 | NXPs M0, M3/M4 and ARM7/9 processor-based devices, sublicensed and |
redbird | 0:1bf8f02b0770 | 22 | distributed under the terms and conditions of the NXP End User License |
redbird | 0:1bf8f02b0770 | 23 | Agreement. |
redbird | 0:1bf8f02b0770 | 24 | Full source code is available at: www.segger.com |
redbird | 0:1bf8f02b0770 | 25 | |
redbird | 0:1bf8f02b0770 | 26 | We appreciate your understanding and fairness. |
redbird | 0:1bf8f02b0770 | 27 | ---------------------------------------------------------------------- |
redbird | 0:1bf8f02b0770 | 28 | File : GUIDRV_Lin_Opt_8.h |
redbird | 0:1bf8f02b0770 | 29 | Purpose : Optimized routines, included by GUIDRV_Lin_..._8.c |
redbird | 0:1bf8f02b0770 | 30 | ---------------------------END-OF-HEADER------------------------------ |
redbird | 0:1bf8f02b0770 | 31 | */ |
redbird | 0:1bf8f02b0770 | 32 | |
redbird | 0:1bf8f02b0770 | 33 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 34 | * |
redbird | 0:1bf8f02b0770 | 35 | * Static functions |
redbird | 0:1bf8f02b0770 | 36 | * |
redbird | 0:1bf8f02b0770 | 37 | ********************************************************************** |
redbird | 0:1bf8f02b0770 | 38 | */ |
redbird | 0:1bf8f02b0770 | 39 | |
redbird | 0:1bf8f02b0770 | 40 | #ifdef __cplusplus |
redbird | 0:1bf8f02b0770 | 41 | extern "C" { |
redbird | 0:1bf8f02b0770 | 42 | #endif |
redbird | 0:1bf8f02b0770 | 43 | |
redbird | 0:1bf8f02b0770 | 44 | /********************************************************************* |
redbird | 0:1bf8f02b0770 | 45 | * |
redbird | 0:1bf8f02b0770 | 46 | * _FillRectOpt8 |
redbird | 0:1bf8f02b0770 | 47 | * |
redbird | 0:1bf8f02b0770 | 48 | * Purpose: |
redbird | 0:1bf8f02b0770 | 49 | * Optimized filling routine for 8 bpp |
redbird | 0:1bf8f02b0770 | 50 | */ |
redbird | 0:1bf8f02b0770 | 51 | static void _FillRectOpt8(GUI_DEVICE * pDevice, int x0, int y0, int x1, int y1) { |
redbird | 0:1bf8f02b0770 | 52 | DRIVER_CONTEXT * pContext; |
redbird | 0:1bf8f02b0770 | 53 | U32 Data, ColorMask, AndMask, Off0, OffLine; |
redbird | 0:1bf8f02b0770 | 54 | int NumPixel_0, NumPixel_1, RemPixels, NumLines, RemLines, RemItems; |
redbird | 0:1bf8f02b0770 | 55 | LCD_PIXELINDEX ColorIndex; |
redbird | 0:1bf8f02b0770 | 56 | U32 * pDest; |
redbird | 0:1bf8f02b0770 | 57 | |
redbird | 0:1bf8f02b0770 | 58 | pContext = (DRIVER_CONTEXT *)pDevice->u.pContext; |
redbird | 0:1bf8f02b0770 | 59 | ColorIndex = LCD__GetColorIndex(); |
redbird | 0:1bf8f02b0770 | 60 | Off0 = XY2OFF32(pContext->vxSizePhys, x0, y0); |
redbird | 0:1bf8f02b0770 | 61 | RemPixels = x1 - x0 + 1; |
redbird | 0:1bf8f02b0770 | 62 | NumLines = y1 - y0 + 1; |
redbird | 0:1bf8f02b0770 | 63 | OffLine = pContext->vxSizePhys >> 2; |
redbird | 0:1bf8f02b0770 | 64 | NumPixel_0 = x0 & 3; |
redbird | 0:1bf8f02b0770 | 65 | NumPixel_1 = x1 & 3; |
redbird | 0:1bf8f02b0770 | 66 | if (GUI_pContext->DrawMode & LCD_DRAWMODE_XOR) { |
redbird | 0:1bf8f02b0770 | 67 | // |
redbird | 0:1bf8f02b0770 | 68 | // First DWORD |
redbird | 0:1bf8f02b0770 | 69 | // |
redbird | 0:1bf8f02b0770 | 70 | if (NumPixel_0) { |
redbird | 0:1bf8f02b0770 | 71 | for (RemLines = NumLines; RemLines; RemLines--) { |
redbird | 0:1bf8f02b0770 | 72 | pDest = ((U32 *)pContext->VRAMAddr) + Off0 + OffLine * (RemLines - 1); |
redbird | 0:1bf8f02b0770 | 73 | AndMask = ~(0xFFFFFFFF << (8 * NumPixel_0)); |
redbird | 0:1bf8f02b0770 | 74 | if ((RemPixels < 3) && (NumPixel_1)) { |
redbird | 0:1bf8f02b0770 | 75 | AndMask |= ~(0xFFFFFFFF >> (8 * (3 - NumPixel_1))); |
redbird | 0:1bf8f02b0770 | 76 | } |
redbird | 0:1bf8f02b0770 | 77 | #if (LCD_ENDIAN_BIG == 1) |
redbird | 0:1bf8f02b0770 | 78 | MIRROR(AndMask); |
redbird | 0:1bf8f02b0770 | 79 | #endif |
redbird | 0:1bf8f02b0770 | 80 | Data = READ_MEM32P(pDest); |
redbird | 0:1bf8f02b0770 | 81 | Data ^= ~AndMask; |
redbird | 0:1bf8f02b0770 | 82 | WRITE_MEM32P(pDest, Data); |
redbird | 0:1bf8f02b0770 | 83 | } |
redbird | 0:1bf8f02b0770 | 84 | Off0++; |
redbird | 0:1bf8f02b0770 | 85 | RemPixels -= (4 - NumPixel_0); |
redbird | 0:1bf8f02b0770 | 86 | } |
redbird | 0:1bf8f02b0770 | 87 | // |
redbird | 0:1bf8f02b0770 | 88 | // Complete DWORDS |
redbird | 0:1bf8f02b0770 | 89 | // |
redbird | 0:1bf8f02b0770 | 90 | if (RemPixels >= 4) { |
redbird | 0:1bf8f02b0770 | 91 | for (RemLines = NumLines; RemLines; RemLines--) { |
redbird | 0:1bf8f02b0770 | 92 | RemItems = RemPixels; |
redbird | 0:1bf8f02b0770 | 93 | pDest = ((U32 *)pContext->VRAMAddr) + Off0 + OffLine * (RemLines - 1); |
redbird | 0:1bf8f02b0770 | 94 | while (RemItems >= 4) { |
redbird | 0:1bf8f02b0770 | 95 | Data = READ_MEM32P(pDest); |
redbird | 0:1bf8f02b0770 | 96 | Data ^= 0xFFFFFFFF; |
redbird | 0:1bf8f02b0770 | 97 | WRITE_MEM32P(pDest, Data); |
redbird | 0:1bf8f02b0770 | 98 | pDest++; |
redbird | 0:1bf8f02b0770 | 99 | RemItems -= 4; |
redbird | 0:1bf8f02b0770 | 100 | } |
redbird | 0:1bf8f02b0770 | 101 | } |
redbird | 0:1bf8f02b0770 | 102 | Off0 += (RemPixels >> 2); |
redbird | 0:1bf8f02b0770 | 103 | RemPixels -= (RemPixels >> 2) << 2; |
redbird | 0:1bf8f02b0770 | 104 | } |
redbird | 0:1bf8f02b0770 | 105 | // |
redbird | 0:1bf8f02b0770 | 106 | // Last DWORD |
redbird | 0:1bf8f02b0770 | 107 | // |
redbird | 0:1bf8f02b0770 | 108 | if (RemPixels > 0) { |
redbird | 0:1bf8f02b0770 | 109 | for (RemLines = NumLines; RemLines; RemLines--) { |
redbird | 0:1bf8f02b0770 | 110 | pDest = ((U32 *)pContext->VRAMAddr) + Off0 + OffLine * (RemLines - 1); |
redbird | 0:1bf8f02b0770 | 111 | AndMask = 0xFFFFFF00 << (8 * NumPixel_1); |
redbird | 0:1bf8f02b0770 | 112 | #if (LCD_ENDIAN_BIG == 1) |
redbird | 0:1bf8f02b0770 | 113 | MIRROR(AndMask); |
redbird | 0:1bf8f02b0770 | 114 | #endif |
redbird | 0:1bf8f02b0770 | 115 | Data = READ_MEM32P(pDest); |
redbird | 0:1bf8f02b0770 | 116 | Data ^= ~AndMask; |
redbird | 0:1bf8f02b0770 | 117 | WRITE_MEM32P(pDest, Data); |
redbird | 0:1bf8f02b0770 | 118 | } |
redbird | 0:1bf8f02b0770 | 119 | } |
redbird | 0:1bf8f02b0770 | 120 | } else { |
redbird | 0:1bf8f02b0770 | 121 | // |
redbird | 0:1bf8f02b0770 | 122 | // First DWORD |
redbird | 0:1bf8f02b0770 | 123 | // |
redbird | 0:1bf8f02b0770 | 124 | if (NumPixel_0) { |
redbird | 0:1bf8f02b0770 | 125 | for (RemLines = NumLines; RemLines; RemLines--) { |
redbird | 0:1bf8f02b0770 | 126 | pDest = ((U32 *)pContext->VRAMAddr) + Off0 + OffLine * (RemLines - 1); |
redbird | 0:1bf8f02b0770 | 127 | AndMask = ~(0xFFFFFFFF << (8 * NumPixel_0)); |
redbird | 0:1bf8f02b0770 | 128 | if ((RemPixels < 3) && (NumPixel_1)) { |
redbird | 0:1bf8f02b0770 | 129 | AndMask |= ~(0xFFFFFFFF >> (8 * (3 - NumPixel_1))); |
redbird | 0:1bf8f02b0770 | 130 | } |
redbird | 0:1bf8f02b0770 | 131 | ColorMask = (ColorIndex * 0x01010101) & ~AndMask; |
redbird | 0:1bf8f02b0770 | 132 | #if (LCD_ENDIAN_BIG == 1) |
redbird | 0:1bf8f02b0770 | 133 | MIRROR(AndMask); |
redbird | 0:1bf8f02b0770 | 134 | MIRROR(ColorMask); |
redbird | 0:1bf8f02b0770 | 135 | #endif |
redbird | 0:1bf8f02b0770 | 136 | Data = READ_MEM32P(pDest); |
redbird | 0:1bf8f02b0770 | 137 | Data &= AndMask; |
redbird | 0:1bf8f02b0770 | 138 | Data |= ColorMask; |
redbird | 0:1bf8f02b0770 | 139 | WRITE_MEM32P(pDest, Data); |
redbird | 0:1bf8f02b0770 | 140 | } |
redbird | 0:1bf8f02b0770 | 141 | Off0++; |
redbird | 0:1bf8f02b0770 | 142 | RemPixels -= (4 - NumPixel_0); |
redbird | 0:1bf8f02b0770 | 143 | } |
redbird | 0:1bf8f02b0770 | 144 | // |
redbird | 0:1bf8f02b0770 | 145 | // Complete DWORDS |
redbird | 0:1bf8f02b0770 | 146 | // |
redbird | 0:1bf8f02b0770 | 147 | if (RemPixels >= 4) { |
redbird | 0:1bf8f02b0770 | 148 | ColorMask = ColorIndex * 0x01010101; |
redbird | 0:1bf8f02b0770 | 149 | for (RemLines = NumLines; RemLines; RemLines--) { |
redbird | 0:1bf8f02b0770 | 150 | RemItems = RemPixels; |
redbird | 0:1bf8f02b0770 | 151 | pDest = ((U32 *)pContext->VRAMAddr) + Off0 + OffLine * (RemLines - 1);; |
redbird | 0:1bf8f02b0770 | 152 | while (RemItems >= 32) { |
redbird | 0:1bf8f02b0770 | 153 | WRITE_MEM32P(pDest , ColorMask); |
redbird | 0:1bf8f02b0770 | 154 | WRITE_MEM32P(pDest + 1, ColorMask); |
redbird | 0:1bf8f02b0770 | 155 | WRITE_MEM32P(pDest + 2, ColorMask); |
redbird | 0:1bf8f02b0770 | 156 | WRITE_MEM32P(pDest + 3, ColorMask); |
redbird | 0:1bf8f02b0770 | 157 | WRITE_MEM32P(pDest + 4, ColorMask); |
redbird | 0:1bf8f02b0770 | 158 | WRITE_MEM32P(pDest + 5, ColorMask); |
redbird | 0:1bf8f02b0770 | 159 | WRITE_MEM32P(pDest + 6, ColorMask); |
redbird | 0:1bf8f02b0770 | 160 | WRITE_MEM32P(pDest + 7, ColorMask); |
redbird | 0:1bf8f02b0770 | 161 | pDest += 8; |
redbird | 0:1bf8f02b0770 | 162 | RemItems -= 32; |
redbird | 0:1bf8f02b0770 | 163 | } |
redbird | 0:1bf8f02b0770 | 164 | while (RemItems >= 4) { |
redbird | 0:1bf8f02b0770 | 165 | WRITE_MEM32P(pDest, ColorMask); |
redbird | 0:1bf8f02b0770 | 166 | pDest++; |
redbird | 0:1bf8f02b0770 | 167 | RemItems -= 4; |
redbird | 0:1bf8f02b0770 | 168 | } |
redbird | 0:1bf8f02b0770 | 169 | } |
redbird | 0:1bf8f02b0770 | 170 | Off0 += (RemPixels >> 2); |
redbird | 0:1bf8f02b0770 | 171 | RemPixels -= (RemPixels >> 2) << 2; |
redbird | 0:1bf8f02b0770 | 172 | } |
redbird | 0:1bf8f02b0770 | 173 | // |
redbird | 0:1bf8f02b0770 | 174 | // Last DWORD |
redbird | 0:1bf8f02b0770 | 175 | // |
redbird | 0:1bf8f02b0770 | 176 | if (RemPixels > 0) { |
redbird | 0:1bf8f02b0770 | 177 | for (RemLines = NumLines; RemLines; RemLines--) { |
redbird | 0:1bf8f02b0770 | 178 | pDest = ((U32 *)pContext->VRAMAddr) + Off0 + OffLine * (RemLines - 1); |
redbird | 0:1bf8f02b0770 | 179 | AndMask = 0xFFFFFF00 << (8 * NumPixel_1); |
redbird | 0:1bf8f02b0770 | 180 | ColorMask = (ColorIndex * 0x01010101) & ~AndMask; |
redbird | 0:1bf8f02b0770 | 181 | #if (LCD_ENDIAN_BIG == 1) |
redbird | 0:1bf8f02b0770 | 182 | MIRROR(AndMask); |
redbird | 0:1bf8f02b0770 | 183 | MIRROR(ColorMask); |
redbird | 0:1bf8f02b0770 | 184 | #endif |
redbird | 0:1bf8f02b0770 | 185 | Data = READ_MEM32P(pDest); |
redbird | 0:1bf8f02b0770 | 186 | Data &= AndMask; |
redbird | 0:1bf8f02b0770 | 187 | Data |= ColorMask; |
redbird | 0:1bf8f02b0770 | 188 | WRITE_MEM32P(pDest, Data); |
redbird | 0:1bf8f02b0770 | 189 | } |
redbird | 0:1bf8f02b0770 | 190 | } |
redbird | 0:1bf8f02b0770 | 191 | } |
redbird | 0:1bf8f02b0770 | 192 | } |
redbird | 0:1bf8f02b0770 | 193 | |
redbird | 0:1bf8f02b0770 | 194 | #ifdef __cplusplus |
redbird | 0:1bf8f02b0770 | 195 | } |
redbird | 0:1bf8f02b0770 | 196 | #endif |
redbird | 0:1bf8f02b0770 | 197 | /*************************** End of file ****************************/ |