1
2
3
4
5
6
7
8
9
10
11
12#ifndef _LCD_H_
13#define _LCD_H_
14#include <lcd_console.h>
15#if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
16#include <bmp_layout.h>
17#include <asm/byteorder.h>
18#endif
19
20int bmp_display(ulong addr, int x, int y);
21struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp,
22 void **alloc_addr);
23
24#ifndef CONFIG_DM_VIDEO
25
26extern char lcd_is_enabled;
27extern int lcd_line_length;
28extern struct vidinfo panel_info;
29
30void lcd_ctrl_init(void *lcdbase);
31void lcd_enable(void);
32void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue);
33ulong lcd_setmem(ulong addr);
34
35
36
37
38
39
40
41void lcd_set_flush_dcache(int flush);
42
43#if defined(CONFIG_ATMEL_LCD) || defined(CONFIG_ATMEL_HLCD)
44#include <atmel_lcd.h>
45#elif defined(CONFIG_EXYNOS_FB)
46#include <exynos_lcd.h>
47#else
48typedef struct vidinfo {
49 ushort vl_col;
50 ushort vl_row;
51 ushort vl_rot;
52 u_char vl_bpix;
53 ushort *cmap;
54 void *priv;
55} vidinfo_t;
56
57static __maybe_unused ushort *configuration_get_cmap(void)
58{
59 return panel_info.cmap;
60}
61#endif
62
63ushort *configuration_get_cmap(void);
64
65extern vidinfo_t panel_info;
66
67void lcd_putc(const char c);
68void lcd_puts(const char *s);
69void lcd_printf(const char *fmt, ...);
70void lcd_clear(void);
71int lcd_display_bitmap(ulong bmp_image, int x, int y);
72
73
74
75
76
77
78int lcd_get_pixel_width(void);
79
80
81
82
83
84
85int lcd_get_pixel_height(void);
86
87
88
89
90
91
92int lcd_get_screen_rows(void);
93
94
95
96
97
98
99int lcd_get_screen_columns(void);
100
101
102
103
104
105
106int lcd_getbgcolor(void);
107
108
109
110
111
112
113int lcd_getfgcolor(void);
114
115
116
117
118
119
120
121void lcd_position_cursor(unsigned col, unsigned row);
122
123
124void lcd_show_board_info(void);
125
126
127int lcd_get_size(int *line_length);
128
129
130void lcd_sync(void);
131
132
133
134
135
136
137#define CONFIG_SYS_HIGH 0
138#define CONFIG_SYS_LOW 1
139
140#define LCD_MONOCHROME 0
141#define LCD_COLOR2 1
142#define LCD_COLOR4 2
143#define LCD_COLOR8 3
144#define LCD_COLOR16 4
145#define LCD_COLOR32 5
146
147#if defined(CONFIG_LCD_INFO_BELOW_LOGO)
148#define LCD_INFO_X 0
149#define LCD_INFO_Y (BMP_LOGO_HEIGHT + VIDEO_FONT_HEIGHT)
150#elif defined(CONFIG_LCD_LOGO)
151#define LCD_INFO_X (BMP_LOGO_WIDTH + 4 * VIDEO_FONT_WIDTH)
152#define LCD_INFO_Y VIDEO_FONT_HEIGHT
153#else
154#define LCD_INFO_X VIDEO_FONT_WIDTH
155#define LCD_INFO_Y VIDEO_FONT_HEIGHT
156#endif
157
158
159#ifndef LCD_BPP
160#define LCD_BPP LCD_COLOR8
161#endif
162
163#ifndef LCD_DF
164#define LCD_DF 1
165#endif
166
167
168#define NBITS(bit_code) (1 << (bit_code))
169#define NCOLORS(bit_code) (1 << NBITS(bit_code))
170
171#if LCD_BPP == LCD_COLOR8
172# define CONSOLE_COLOR_BLACK 0
173# define CONSOLE_COLOR_RED 1
174# define CONSOLE_COLOR_GREEN 2
175# define CONSOLE_COLOR_YELLOW 3
176# define CONSOLE_COLOR_BLUE 4
177# define CONSOLE_COLOR_MAGENTA 5
178# define CONSOLE_COLOR_CYAN 6
179# define CONSOLE_COLOR_GREY 14
180# define CONSOLE_COLOR_WHITE 15
181#elif LCD_BPP == LCD_COLOR32
182#define CONSOLE_COLOR_RED 0x00ff0000
183#define CONSOLE_COLOR_GREEN 0x0000ff00
184#define CONSOLE_COLOR_YELLOW 0x00ffff00
185#define CONSOLE_COLOR_BLUE 0x000000ff
186#define CONSOLE_COLOR_MAGENTA 0x00ff00ff
187#define CONSOLE_COLOR_CYAN 0x0000ffff
188#define CONSOLE_COLOR_GREY 0x00aaaaaa
189#define CONSOLE_COLOR_BLACK 0x00000000
190#define CONSOLE_COLOR_WHITE 0x00ffffff
191#define NBYTES(bit_code) (NBITS(bit_code) >> 3)
192#else
193# define CONSOLE_COLOR_BLACK 0x0000
194# define CONSOLE_COLOR_RED 0xF800
195# define CONSOLE_COLOR_GREEN 0x07E0
196# define CONSOLE_COLOR_YELLOW 0xFFE0
197# define CONSOLE_COLOR_BLUE 0x001F
198# define CONSOLE_COLOR_MAGENTA 0xF81F
199# define CONSOLE_COLOR_CYAN 0x07FF
200# define CONSOLE_COLOR_GREY 0xC618
201# define CONSOLE_COLOR_WHITE 0xffff
202#endif
203
204#if LCD_BPP == LCD_COLOR16
205#define fbptr_t ushort
206#elif LCD_BPP == LCD_COLOR32
207#define fbptr_t u32
208#else
209#define fbptr_t uchar
210#endif
211
212#ifndef PAGE_SIZE
213#define PAGE_SIZE 4096
214#endif
215
216#endif
217
218#endif
219