Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
pl110.h
Go to the documentation of this file.
1/*
2 * This file is part of the Ultibo project, https://ultibo.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2026 Garry Wood <garry@softoz.com.au>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26#ifndef _ULTIBO_PL110_H
27#define _ULTIBO_PL110_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "ultibo/framebuffer.h"
34
36#define PL110_FRAMEBUFFER_DESCRIPTION "ARM PrimeCell PL110 Color LCD"
37
38#define PL110_MAX_PHYSICALWIDTH 1024
39#define PL110_MAX_PHYSICALHEIGHT 1024
40
42#define PL110_MODE_UNKNOWN 0
43#define PL110_MODE_VGA 1
44#define PL110_MODE_SVGA 2
45#define PL110_MODE_TFT 3
46#define PL110_MODE_STN 4
47
49#define PL110_CLCD_TIMING0 0x00000000
50#define PL110_CLCD_TIMING1 0x00000004
51#define PL110_CLCD_TIMING2 0x00000008
52#define PL110_CLCD_TIMING3 0x0000000c
53#define PL110_CLCD_UPBASE 0x00000010
54#define PL110_CLCD_LPBASE 0x00000014
55#define PL110_CLCD_CONTROL 0x00000018
56#define PL110_CLCD_IMSC 0x0000001c
57#define PL110_CLCD_RIS 0x00000020
58#define PL110_CLCD_MIS 0x00000024
59#define PL110_CLCD_ICR 0x00000028
60#define PL110_CLCD_UPCURR 0x0000002C
61#define PL110_CLCD_LPCURR 0x00000030
62#define PL110_CLCD_PALETTE 0x00000200
63
65#define PL110_CLCD_TIMING0_HBP (0xFF << 24)
66#define PL110_CLCD_TIMING0_HFP (0xFF << 16)
67#define PL110_CLCD_TIMING0_HSW (0xFF << 8)
68#define PL110_CLCD_TIMING0_PPL (0xFC << 2)
69
71#define PL110_CLCD_TIMING1_VBP (0xFF << 24)
72#define PL110_CLCD_TIMING1_VFP (0xFF << 16)
73#define PL110_CLCD_TIMING1_VSW (0xFC << 10)
74#define PL110_CLCD_TIMING1_LPP (0x3FF << 0)
75
77#define PL110_CLCD_TIMING2_PCD_HI (0x1F << 27)
78#define PL110_CLCD_TIMING2_BCD (1 << 26)
79#define PL110_CLCD_TIMING2_CPL (0x3FF << 16)
80#define PL110_CLCD_TIMING2_IOE (1 << 14)
81#define PL110_CLCD_TIMING2_IPC (1 << 13)
82#define PL110_CLCD_TIMING2_IHS (1 << 12)
83#define PL110_CLCD_TIMING2_IVS (1 << 11)
84#define PL110_CLCD_TIMING2_ACB (0x1F << 6)
85#define PL110_CLCD_TIMING2_CLKSEL (1 << 5)
86#define PL110_CLCD_TIMING2_PCD_LO (0x1F << 0)
87
89#define PL110_CLCD_TIMING3_LEE (1 << 16)
90#define PL110_CLCD_TIMING3_LED (0x3F << 0)
91
93#define PL110_CLCD_CONTROL_LCDEN (1 << 0)
94#define PL110_CLCD_CONTROL_LCDBPP1 (0 << 1)
95#define PL110_CLCD_CONTROL_LCDBPP2 (1 << 1)
96#define PL110_CLCD_CONTROL_LCDBPP4 (2 << 1)
97#define PL110_CLCD_CONTROL_LCDBPP8 (3 << 1)
98#define PL110_CLCD_CONTROL_LCDBPP16 (4 << 1)
99#define PL110_CLCD_CONTROL_LCDBPP16_565 (6 << 1)
100#define PL110_CLCD_CONTROL_LCDBPP16_444 (7 << 1)
101#define PL110_CLCD_CONTROL_LCDBPP24 (5 << 1)
102#define PL110_CLCD_CONTROL_LCDBW (1 << 4)
103#define PL110_CLCD_CONTROL_LCDTFT (1 << 5)
104#define PL110_CLCD_CONTROL_LCDMONO8 (1 << 6)
105#define PL110_CLCD_CONTROL_LCDDUAL (1 << 7)
106#define PL110_CLCD_CONTROL_BGR (1 << 8)
107#define PL110_CLCD_CONTROL_BEBO (1 << 9)
108#define PL110_CLCD_CONTROL_BEPO (1 << 10)
109#define PL110_CLCD_CONTROL_LCDPWR (1 << 11)
110#define PL110_CLCD_CONTROL_LCDVCOMP_VSYNC (0 << 12)
111#define PL110_CLCD_CONTROL_LCDVCOMP_BPORCH (1 << 12)
112#define PL110_CLCD_CONTROL_LCDVCOMP_VIDEO (2 << 12)
113#define PL110_CLCD_CONTROL_LCDVCOMP_FPORCH (3 << 12)
114#define PL110_CLCD_CONTROL_LDMAFIFOTIME (1 << 15)
115#define PL110_CLCD_CONTROL_WATERMARK (1 << 16)
116
118#define PL110_CONTROL_VGA PL110_CLCD_CONTROL_LCDTFT | PL110_CLCD_CONTROL_LCDVCOMP_BPORCH
119#define PL110_CONTROL_SVGA PL110_CLCD_CONTROL_LCDTFT | PL110_CLCD_CONTROL_LCDVCOMP_BPORCH
120
122#define PL110_TIMING0_VGA 0x3F1F3F9C
123#define PL110_TIMING0_SVGA 0x1313A4C4
124
126#define PL110_TIMING1_VGA 0x090B61DF
127#define PL110_TIMING1_SVGA 0x0505F657
128
130#define PL110_TIMING2_VGA 0x067F1800
131#define PL110_TIMING2_SVGA 0x071F1800
132
137{
138 uint32_t timing0;
139 uint32_t timing1;
140 uint32_t timing2;
141 uint32_t timing3;
142 uint32_t upbase;
143 uint32_t lpbase;
144 uint32_t control;
145 uint32_t imsc;
146 uint32_t ris;
147 uint32_t mis;
148 uint32_t icr;
149 uint32_t upcurr;
150 uint32_t lpcurr;
151
152};
153
154
157{
158 // Framebuffer Properties
160 // PL110 Properties
161 uint32_t mode;
162 uint32_t depth;
163 uint32_t width;
164 uint32_t height;
165 uint32_t rotation;
166 // Driver Properties
167 uint32_t control;
168 uint32_t timing0;
169 uint32_t timing1;
170 uint32_t timing2;
171 uint32_t timing3;
173};
174
176
187FRAMEBUFFER_DEVICE * STDCALL pl110_framebuffer_create_vga(size_t address, char *name, uint32_t rotation, uint32_t width, uint32_t height, uint32_t depth);
188
199FRAMEBUFFER_DEVICE * STDCALL pl110_framebuffer_create_svga(size_t address, char *name, uint32_t rotation, uint32_t width, uint32_t height, uint32_t depth);
200
207
208#ifdef __cplusplus
209}
210#endif
211
212#endif // _ULTIBO_PL110_H
struct _FRAMEBUFFER_DEVICE FRAMEBUFFER_DEVICE
Definition framebuffer.h:112
#define STDCALL
Definition globaltypes.h:45
FRAMEBUFFER_DEVICE *STDCALL pl110_framebuffer_create_svga(size_t address, char *name, uint32_t rotation, uint32_t width, uint32_t height, uint32_t depth)
Create, register and allocate a new PL110 Framebuffer device which can be accessed using the framebuf...
FRAMEBUFFER_DEVICE *STDCALL pl110_framebuffer_create_vga(size_t address, char *name, uint32_t rotation, uint32_t width, uint32_t height, uint32_t depth)
Create, register and allocate a new PL110 Framebuffer device which can be accessed using the framebuf...
struct _PL110_FRAMEBUFFER PL110_FRAMEBUFFER
Definition pl110.h:155
struct _PL110_CLCD_REGISTERS PL110_CLCD_REGISTERS
Definition pl110.h:135
uint32_t STDCALL pl110_framebuffer_destroy(FRAMEBUFFER_DEVICE *framebuffer)
Release, deregister and destroy a PL110 Framebuffer device created by this driver.
Definition pl110.h:137
uint32_t timing3
Line End Control Register.
Definition pl110.h:141
uint32_t upcurr
Upper Panel Current Address Value Registers.
Definition pl110.h:149
uint32_t ris
Raw Interrupt Status Register.
Definition pl110.h:146
uint32_t lpcurr
Lower Panel Current Address Value Registers.
Definition pl110.h:150
uint32_t timing1
Vertical Axis Panel Control Register.
Definition pl110.h:139
uint32_t imsc
Interrupt Mask Set/Clear Register.
Definition pl110.h:145
uint32_t lpbase
Lower Panel Frame Base Address Registers.
Definition pl110.h:143
uint32_t timing0
Horizontal Axis Panel Control Register.
Definition pl110.h:138
uint32_t icr
Interrupt Clear Register.
Definition pl110.h:148
uint32_t upbase
Upper Panel Frame Base Address Registers.
Definition pl110.h:142
uint32_t timing2
Clock and Signal Polarity Control Register.
Definition pl110.h:140
uint32_t control
Control Register.
Definition pl110.h:144
uint32_t mis
Masked Interrupt Status Register.
Definition pl110.h:147
Definition pl110.h:157
uint32_t timing3
Preset Timing2 register value.
Definition pl110.h:171
uint32_t width
Framebuffer width in pixels.
Definition pl110.h:163
uint32_t timing1
Preset Timing1 register value.
Definition pl110.h:169
uint32_t height
Framebuffer height in pixels.
Definition pl110.h:164
uint32_t mode
PL110 framebuffer mode (eg PL110_MODE_TFT).
Definition pl110.h:161
uint32_t timing0
Preset Timing0 register value.
Definition pl110.h:168
FRAMEBUFFER_DEVICE framebuffer
Definition pl110.h:159
PL110_CLCD_REGISTERS * registers
PL110 registers.
Definition pl110.h:172
uint32_t rotation
Framebuffer rotation (eg FRAMEBUFFER_ROTATION_180).
Definition pl110.h:165
uint32_t timing2
Preset Timing2 register value.
Definition pl110.h:170
uint32_t depth
Framebuffer color depth (eg FRAMEBUFFER_DEPTH_16).
Definition pl110.h:162
uint32_t control
Preset Control register value.
Definition pl110.h:167