1 /* 2 * PROJECT: ReactOS Boot Video Driver for ARM devices 3 * LICENSE: BSD - See COPYING.ARM in root directory 4 * PURPOSE: PrimeCell Color LCD Controller (PL110) definitions 5 * COPYRIGHT: Copyright 2008 ReactOS Portable Systems Group <ros.arm@reactos.org> 6 */ 7 8 #pragma once 9 10 extern PUSHORT VgaArmBase; 11 12 #define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2) 13 #define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1) 14 #define LCDCONTROL_LCDPWR (1 << 11) 15 #define LCDCONTROL_LCDEN (1) 16 #define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1) 17 #define LCDCONTROL_LCDTFT (1 << 5) 18 19 #define PL110_LCDTIMING0 (PVOID)0xE0020000 20 #define PL110_LCDTIMING1 (PVOID)0xE0020004 21 #define PL110_LCDTIMING2 (PVOID)0xE0020008 22 #define PL110_LCDUPBASE (PVOID)0xE0020010 23 #define PL110_LCDLPBASE (PVOID)0xE0020014 24 #define PL110_LCDCONTROL (PVOID)0xE0020018 25 26 #define READ_REGISTER_ULONG(r) (*(volatile ULONG * const)(r)) 27 #define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG *)(r) = (v)) 28 29 #define READ_REGISTER_USHORT(r) (*(volatile USHORT * const)(r)) 30 #define WRITE_REGISTER_USHORT(r, v) (*(volatile USHORT *)(r) = (v)) 31 32 FORCEINLINE 33 USHORT 34 VidpBuildColor( 35 _In_ UCHAR Color) 36 { 37 UCHAR Red, Green, Blue; 38 39 /* Extract color components */ 40 Red = GetRValue(DefaultPalette[Color]) >> 3; 41 Green = GetGValue(DefaultPalette[Color]) >> 3; 42 Blue = GetBValue(DefaultPalette[Color]) >> 3; 43 44 /* Build the 16-bit color mask */ 45 return ((Red & 0x1F) << 11) | ((Green & 0x1F) << 6) | ((Blue & 0x1F)); 46 } 47 48 VOID 49 InitPaletteWithTable( 50 _In_ PULONG Table, 51 _In_ ULONG Count); 52 53 FORCEINLINE 54 VOID 55 SetPixel( 56 _In_ ULONG Left, 57 _In_ ULONG Top, 58 _In_ UCHAR Color) 59 { 60 PUSHORT PixelPosition; 61 62 /* Calculate the pixel position */ 63 PixelPosition = &VgaArmBase[Left + (Top * SCREEN_WIDTH)]; 64 65 /* Set our color */ 66 WRITE_REGISTER_USHORT(PixelPosition, VidpBuildColor(Color)); 67 } 68 69 VOID 70 PreserveRow( 71 _In_ ULONG CurrentTop, 72 _In_ ULONG TopDelta, 73 _In_ BOOLEAN Restore); 74 75 VOID 76 DoScroll( 77 _In_ ULONG Scroll); 78 79 VOID 80 DisplayCharacter( 81 _In_ CHAR Character, 82 _In_ ULONG Left, 83 _In_ ULONG Top, 84 _In_ ULONG TextColor, 85 _In_ ULONG BackColor); 86