connect progress signal directly to the logger.
[Rockbox.git] / firmware / export / lcd-remote.h
blob6d71834fe76045e912047b85ad7d97589d89531d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Richard S. La Charité
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef __LCD_REMOTE_H__
21 #define __LCD_REMOTE_H__
23 #include <stdbool.h>
24 #include "cpu.h"
25 #include "config.h"
26 #include "lcd.h"
28 #ifdef HAVE_REMOTE_LCD
30 #if defined(TARGET_TREE) && !defined(__PCTOOL__)
31 #include "lcd-remote-target.h"
32 #endif
34 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
35 #define REMOTETYPE_UNPLUGGED 0
36 #define REMOTETYPE_H100_LCD 1
37 #define REMOTETYPE_H300_LCD 2
38 #define REMOTETYPE_H300_NONLCD 3
39 int remote_type(void);
40 #endif
42 #define STYLE_DEFAULT 0x00000000
43 #define STYLE_INVERT 0x20000000
45 #if LCD_REMOTE_DEPTH <= 8
46 #if (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) \
47 || (LCD_REMOTE_PIXELFORMAT == HORIZONTAL_INTERLEAVED)
48 typedef unsigned short fb_remote_data;
49 #else
50 typedef unsigned char fb_remote_data;
51 #endif
52 #elif LCD_DEPTH <= 16
53 typedef unsigned short fb_remote_data;
54 #else
55 typedef unsigned long fb_remote_data;
56 #endif
58 /* common functions */
59 void lcd_remote_init(void);
60 void lcd_remote_write_command(int cmd);
61 void lcd_remote_write_command_ex(int cmd, int data);
62 void lcd_remote_write_data(const fb_remote_data *data, int count);
64 /* Low-level drawing function types */
65 typedef void lcd_remote_pixelfunc_type(int x, int y);
66 typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask,
67 unsigned bits);
69 #if LCD_REMOTE_DEPTH > 1 /* greyscale - 8 bit max */
70 #ifdef HAVE_LCD_COLOR
71 extern unsigned lcd_remote_color_to_native(unsigned color);
72 #endif
74 #define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1)
75 /**
76 * On 2 bit for example (y >> (8-DEPTH)) = (y >> 6) = y/64 gives:
77 * |000-063|064-127|128-191|192-255|
78 * | 0 | 1 | 2 | 3 |
80 #define LCD_REMOTE_BRIGHTNESS(y) ((y) >> (8-LCD_REMOTE_DEPTH))
82 #define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0)
83 #define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85)
84 #define LCD_REMOTE_LIGHTGRAY LCD_REMOTE_BRIGHTNESS(170)
85 #define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255)
86 #define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK
87 #define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE
88 #endif
90 /* Frame buffer dimensions (format checks only cover existing targets!) */
91 #if LCD_REMOTE_DEPTH == 1
92 #define LCD_REMOTE_FBHEIGHT ((LCD_REMOTE_HEIGHT+7)/8)
93 #elif LCD_REMOTE_DEPTH == 2
94 #if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
95 #define LCD_REMOTE_FBHEIGHT ((LCD_REMOTE_HEIGHT+7)/8)
96 #endif
97 #endif /* LCD_REMOTE_DEPTH */
98 /* Set defaults if not defined different yet. The defaults apply to both
99 * dimensions for LCD_REMOTE_DEPTH >= 8 */
100 #ifndef LCD_REMOTE_FBWIDTH
101 #define LCD_REMOTE_FBWIDTH LCD_REMOTE_WIDTH
102 #endif
103 #ifndef LCD_REMOTE_FBHEIGHT
104 #define LCD_REMOTE_FBHEIGHT LCD_REMOTE_HEIGHT
105 #endif
106 /* The actual framebuffer */
107 extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
110 extern void lcd_remote_init(void);
111 extern int lcd_remote_default_contrast(void);
112 extern void lcd_remote_set_contrast(int val);
114 extern void lcd_remote_set_viewport(struct viewport* vp);
115 extern void lcd_remote_clear_display(void);
116 extern void lcd_remote_clear_viewport(void);
117 extern void lcd_remote_puts(int x, int y, const unsigned char *str);
118 extern void lcd_remote_puts_style(int x, int y, const unsigned char *str,
119 int style);
120 extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str,
121 int offset);
122 extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str,
123 int style, int offset);
124 extern void lcd_remote_putc(int x, int y, unsigned short ch);
125 extern void lcd_remote_stop_scroll(void);
126 extern void lcd_remote_scroll_speed(int speed);
127 extern void lcd_remote_scroll_delay(int ms);
128 extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str);
129 extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str,
130 int style);
131 extern void lcd_remote_puts_scroll_offset(int x, int y,
132 const unsigned char *str, int offset);
133 extern void lcd_remote_puts_scroll_style_offset(int x, int y,
134 const unsigned char *string,
135 int style, int offset);
137 extern void lcd_remote_update(void);
138 extern void lcd_remote_update_rect(int x, int y, int width, int height);
139 extern void lcd_remote_update_viewport(void);
140 extern void lcd_remote_update_viewport_rect(int x, int y, int width, int height);
142 extern void lcd_remote_set_invert_display(bool yesno);
143 extern void lcd_remote_set_flip(bool yesno);
145 extern void lcd_remote_set_drawmode(int mode);
146 extern int lcd_remote_get_drawmode(void);
147 extern int lcd_remote_getwidth(void);
148 extern int lcd_remote_getheight(void);
149 extern void lcd_remote_setfont(int font);
150 extern int lcd_remote_getfont(void);
151 extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
153 /* low level drawing function pointer arrays */
154 #if LCD_REMOTE_DEPTH > 1
155 extern lcd_remote_pixelfunc_type* const *lcd_remote_pixelfuncs;
156 extern lcd_remote_blockfunc_type* const *lcd_remote_blockfuncs;
157 #else
158 extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8];
159 extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8];
160 #endif
162 extern void lcd_remote_drawpixel(int x, int y);
163 extern void lcd_remote_drawline(int x1, int y1, int x2, int y2);
164 extern void lcd_remote_hline(int x1, int x2, int y);
165 extern void lcd_remote_vline(int x, int y1, int y2);
166 extern void lcd_remote_drawrect(int x, int y, int width, int height);
167 extern void lcd_remote_fillrect(int x, int y, int width, int height);
168 extern void lcd_remote_bitmap_part(const fb_remote_data *src, int src_x,
169 int src_y, int stride, int x, int y,
170 int width, int height);
171 extern void lcd_remote_bitmap(const fb_remote_data *src, int x, int y,
172 int width, int height);
173 extern void lcd_remote_putsxy(int x, int y, const unsigned char *str);
175 extern void lcd_remote_bidir_scroll(int threshold);
176 extern void lcd_remote_scroll_step(int pixels);
178 #if LCD_REMOTE_DEPTH > 1
179 extern void lcd_remote_set_foreground(unsigned foreground);
180 extern unsigned lcd_remote_get_foreground(void);
181 extern void lcd_remote_set_background(unsigned background);
182 extern unsigned lcd_remote_get_background(void);
183 extern void lcd_remote_set_drawinfo(int mode, unsigned foreground,
184 unsigned background);
185 void lcd_remote_set_backdrop(fb_remote_data* backdrop);
186 fb_remote_data* lcd_remote_get_backdrop(void);
188 extern void lcd_remote_mono_bitmap_part(const unsigned char *src, int src_x,
189 int src_y, int stride, int x, int y,
190 int width, int height);
191 extern void lcd_remote_mono_bitmap(const unsigned char *src, int x, int y,
192 int width, int height);
193 extern void lcd_remote_bitmap_transparent_part(const fb_remote_data *src,
194 int src_x, int src_y,
195 int stride, int x, int y,
196 int width, int height);
197 extern void lcd_bitmap_remote_transparent(const fb_remote_data *src, int x,
198 int y, int width, int height);
199 #else /* LCD_REMOTE_DEPTH == 1 */
200 #define lcd_remote_mono_bitmap lcd_remote_bitmap
201 #define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part
202 #endif /* LCD_REMOTE_DEPTH */
204 #endif
205 #endif /* __LCD_REMOTE_H__ */