summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/SOURCES3
-rw-r--r--apps/plugins/lib/grey.h6
-rw-r--r--apps/plugins/lib/grey_core.c87
-rw-r--r--apps/plugins/lib/grey_draw.c2
-rw-r--r--apps/plugins/lib/grey_parm.c4
-rw-r--r--apps/plugins/lib/grey_scroll.c6
6 files changed, 19 insertions, 89 deletions
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index 6a44c80ffa..f1aded6122 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -3,7 +3,8 @@ configfile.c
3fixedpoint.c 3fixedpoint.c
4playback_control.c 4playback_control.c
5rgb_hsv.c 5rgb_hsv.c
6#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) 6#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) \
7 && !defined(IAUDIO_M3) /* TODO: Test whether it can be implemented */
7grey_core.c 8grey_core.c
8grey_draw.c 9grey_draw.c
9grey_parm.c 10grey_parm.c
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index 4298ae3ada..ce37e17829 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -134,8 +134,8 @@ void grey_ub_scroll_down(int count);
134 134
135#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 135#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
136#define _GREY_BSHIFT 0 136#define _GREY_BSHIFT 0
137#else /* vertical packing or vertical interleaved */ 137#else
138#if (LCD_DEPTH == 1) || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) 138#if LCD_DEPTH == 1
139#define _GREY_BSHIFT 3 139#define _GREY_BSHIFT 3
140#elif LCD_DEPTH == 2 140#elif LCD_DEPTH == 2
141#define _GREY_BSHIFT 2 141#define _GREY_BSHIFT 2
@@ -155,7 +155,7 @@ struct _grey_info
155#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 155#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
156 int bx; /* 8-pixel units */ 156 int bx; /* 8-pixel units */
157 int bwidth; /* 8-pixel units */ 157 int bwidth; /* 8-pixel units */
158#else /* vertical packing or vertical interleaved */ 158#else /* vertical packing */
159 int by; /* 4-pixel or 8-pixel units */ 159 int by; /* 4-pixel or 8-pixel units */
160 int bheight; /* 4-pixel or 8-pixel units */ 160 int bheight; /* 4-pixel or 8-pixel units */
161#endif 161#endif
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index ad8f306dea..caa7af2f25 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -26,8 +26,7 @@
26#include "plugin.h" 26#include "plugin.h"
27#include "grey.h" 27#include "grey.h"
28 28
29#if defined(HAVE_ADJUSTABLE_CPU_FREQ) && \ 29#if defined(CPU_PP) && defined(HAVE_ADJUSTABLE_CPU_FREQ)
30 (defined(CPU_PP) || (CONFIG_LCD == LCD_TL0350A))
31#define NEED_BOOST 30#define NEED_BOOST
32#endif 31#endif
33 32
@@ -144,42 +143,6 @@ static const unsigned char lcdlinear[256] = {
144 203, 206, 209, 212, 215, 219, 222, 226, 143 203, 206, 209, 212, 215, 219, 222, 226,
145 229, 233, 236, 240, 244, 248, 251, 255 144 229, 233, 236, 240, 244, 248, 251, 255
146}; 145};
147#elif CONFIG_LCD == LCD_TL0350A
148/* generic linear curve - not yet measured */
149static const unsigned char lcdlinear[256] = {
150 0, 1, 2, 3, 4, 5, 6, 7,
151 8, 9, 10, 11, 12, 13, 14, 15,
152 16, 17, 18, 19, 20, 21, 22, 23,
153 24, 25, 26, 27, 28, 29, 30, 31,
154 32, 33, 34, 35, 36, 37, 38, 39,
155 40, 41, 42, 43, 44, 45, 46, 47,
156 48, 49, 50, 51, 52, 53, 54, 55,
157 56, 57, 58, 59, 60, 61, 62, 63,
158 64, 65, 66, 67, 68, 69, 70, 71,
159 72, 73, 74, 75, 76, 77, 78, 79,
160 80, 81, 82, 83, 84, 85, 86, 87,
161 88, 89, 90, 91, 92, 93, 94, 95,
162 96, 97, 98, 99, 100, 101, 102, 103,
163 104, 105, 106, 107, 108, 109, 110, 111,
164 112, 113, 114, 115, 116, 117, 118, 119,
165 120, 121, 122, 123, 124, 125, 126, 127,
166 128, 129, 130, 131, 132, 133, 134, 135,
167 136, 137, 138, 139, 140, 141, 142, 143,
168 144, 145, 146, 147, 148, 149, 150, 151,
169 152, 153, 154, 155, 156, 157, 158, 159,
170 160, 161, 162, 163, 164, 165, 166, 167,
171 168, 169, 170, 171, 172, 173, 174, 175,
172 176, 177, 178, 179, 180, 181, 182, 183,
173 184, 185, 186, 187, 188, 189, 190, 191,
174 192, 193, 194, 195, 196, 197, 198, 199,
175 200, 201, 202, 203, 204, 205, 206, 207,
176 208, 209, 210, 211, 212, 213, 214, 215,
177 216, 217, 218, 219, 220, 221, 222, 223,
178 224, 225, 226, 227, 228, 229, 230, 231,
179 232, 233, 234, 235, 236, 237, 238, 239,
180 240, 241, 242, 243, 244, 245, 246, 247,
181 248, 249, 250, 251, 252, 253, 254, 255
182};
183#endif 146#endif
184#else /* SIMULATOR */ 147#else /* SIMULATOR */
185/* undo a (generic) PC display gamma of 2.0 to simulate target behaviour */ 148/* undo a (generic) PC display gamma of 2.0 to simulate target behaviour */
@@ -262,7 +225,7 @@ static unsigned long _grey_get_pixel(int x, int y)
262 int yg = y - _grey_info.y; 225 int yg = y - _grey_info.y;
263#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 226#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
264 int idx = _grey_info.width * yg + xg; 227 int idx = _grey_info.width * yg + xg;
265#else /* vertical packing or vertical interleaved */ 228#else
266 int idx = _grey_info.width * (yg & ~_GREY_BMASK) 229 int idx = _grey_info.width * (yg & ~_GREY_BMASK)
267 + (xg << _GREY_BSHIFT) + (~yg & _GREY_BMASK); 230 + (xg << _GREY_BSHIFT) + (~yg & _GREY_BMASK);
268#endif 231#endif
@@ -280,7 +243,7 @@ static void _timer_isr(void)
280 _grey_info.bx, _grey_info.y, 243 _grey_info.bx, _grey_info.y,
281 _grey_info.bwidth, _grey_info.height, 244 _grey_info.bwidth, _grey_info.height,
282 _grey_info.width); 245 _grey_info.width);
283#else /* vertical packing or vertical interleaved */ 246#else
284 _grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases, 247 _grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases,
285 _grey_info.x, _grey_info.by, 248 _grey_info.x, _grey_info.by,
286 _grey_info.width, _grey_info.bheight, 249 _grey_info.width, _grey_info.bheight,
@@ -392,8 +355,8 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
392#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 355#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
393 bdim = (width + 7) >> 3; 356 bdim = (width + 7) >> 3;
394 width = bdim << 3; 357 width = bdim << 3;
395#else /* vertical packing or vertical interleaved */ 358#else /* vertical packing */
396#if (LCD_DEPTH == 1) || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) 359#if LCD_DEPTH == 1
397 bdim = (height + 7) >> 3; 360 bdim = (height + 7) >> 3;
398 height = bdim << 3; 361 height = bdim << 3;
399#elif LCD_DEPTH == 2 362#elif LCD_DEPTH == 2
@@ -445,7 +408,7 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
445#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 408#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
446 _grey_info.bx = 0; 409 _grey_info.bx = 0;
447 _grey_info.bwidth = bdim; 410 _grey_info.bwidth = bdim;
448#else /* vertical packing or vertical interleaved */ 411#else
449 _grey_info.by = 0; 412 _grey_info.by = 0;
450 _grey_info.bheight = bdim; 413 _grey_info.bheight = bdim;
451#endif 414#endif
@@ -528,9 +491,6 @@ void grey_show(bool enable)
528 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); 491 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr);
529#elif CONFIG_LCD == LCD_MROBE100 492#elif CONFIG_LCD == LCD_MROBE100
530 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); /* not calibrated/tested */ 493 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); /* not calibrated/tested */
531#elif CONFIG_LCD == LCD_TL0350A
532 _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 75, 1, _timer_isr); /* verified */
533 /* This is half of the actual frame frequency, but 150Hz is too much */
534#endif /* CONFIG_LCD */ 494#endif /* CONFIG_LCD */
535#endif /* !SIMULATOR */ 495#endif /* !SIMULATOR */
536 _grey_info.rb->screen_dump_set_hook(grey_screendump_hook); 496 _grey_info.rb->screen_dump_set_hook(grey_screendump_hook);
@@ -647,11 +607,8 @@ static void grey_screendump_hook(int fd)
647#elif LCD_DEPTH == 2 607#elif LCD_DEPTH == 2
648 int shift; 608 int shift;
649#endif 609#endif
650#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED 610#endif /* LCD_PIXELFORMAT == VERTICAL_PACKING */
651 unsigned data; 611 unsigned char *lcdptr;
652 int shift;
653#endif /* LCD_PIXELFORMAT */
654 fb_data *lcdptr;
655 unsigned char *clut_entry; 612 unsigned char *clut_entry;
656 unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)]; 613 unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)];
657 614
@@ -703,7 +660,7 @@ static void grey_screendump_hook(int fd)
703 lcdptr++; 660 lcdptr++;
704 } 661 }
705#endif /* LCD_DEPTH */ 662#endif /* LCD_DEPTH */
706#elif LCD_PIXELFORMAT == VERTICAL_PACKING 663#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
707#if LCD_DEPTH == 1 664#if LCD_DEPTH == 1
708 mask = 1 << (y & 7); 665 mask = 1 << (y & 7);
709 lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); 666 lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
@@ -751,32 +708,6 @@ static void grey_screendump_hook(int fd)
751 lcdptr++; 708 lcdptr++;
752 } 709 }
753#endif /* LCD_DEPTH */ 710#endif /* LCD_DEPTH */
754#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
755#if LCD_DEPTH == 2
756 shift = y & 7;
757 lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3);
758
759 for (x = 0; x < LCD_WIDTH; x++)
760 {
761 gx = x - _grey_info.x;
762
763 if (((unsigned)gy < (unsigned)_grey_info.height)
764 && ((unsigned)gx < (unsigned)_grey_info.width))
765 {
766 linebuf[x] = BMP_FIXEDCOLORS
767 + _grey_info.values[_GREY_MULUQ(_grey_info.width,
768 gy & ~_GREY_BMASK)
769 + (gx << _GREY_BSHIFT)
770 + (~gy & _GREY_BMASK)];
771 }
772 else
773 {
774 data = (*lcdptr >> shift) & 0x0101;
775 linebuf[x] = ((data >> 7) | data) & 3;
776 }
777 lcdptr++;
778 }
779#endif /* LCD_DEPTH */
780#endif /* LCD_PIXELFORMAT */ 711#endif /* LCD_PIXELFORMAT */
781 712
782 _grey_info.rb->write(fd, linebuf, BMP_LINESIZE); 713 _grey_info.rb->write(fd, linebuf, BMP_LINESIZE);
diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c
index a1b99fc13b..7b24ba4c70 100644
--- a/apps/plugins/lib/grey_draw.c
+++ b/apps/plugins/lib/grey_draw.c
@@ -630,7 +630,7 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
630 { 630 {
631#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 631#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
632 int idx = _GREY_MULUQ(_grey_info.width, yc); 632 int idx = _GREY_MULUQ(_grey_info.width, yc);
633#else /* vertical packing or vertical interleaved */ 633#else
634 int idx = _GREY_MULUQ(_grey_info.width, yc & ~_GREY_BMASK) 634 int idx = _GREY_MULUQ(_grey_info.width, yc & ~_GREY_BMASK)
635 + (~yc & _GREY_BMASK); 635 + (~yc & _GREY_BMASK);
636#endif /* LCD_PIXELFORMAT */ 636#endif /* LCD_PIXELFORMAT */
diff --git a/apps/plugins/lib/grey_parm.c b/apps/plugins/lib/grey_parm.c
index e4aaec3efd..63d09dfd72 100644
--- a/apps/plugins/lib/grey_parm.c
+++ b/apps/plugins/lib/grey_parm.c
@@ -34,8 +34,8 @@ void grey_set_position(int x, int y)
34#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 34#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
35 _grey_info.bx = (x + 4) >> 3; 35 _grey_info.bx = (x + 4) >> 3;
36 x = 8 * _grey_info.bx; 36 x = 8 * _grey_info.bx;
37#else /* vertical packing or vertical interleaved */ 37#else
38#if (LCD_DEPTH == 1) || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) 38#if LCD_DEPTH == 1
39 _grey_info.by = (y + 4) >> 3; 39 _grey_info.by = (y + 4) >> 3;
40 y = 8 * _grey_info.by; 40 y = 8 * _grey_info.by;
41#elif LCD_DEPTH == 2 41#elif LCD_DEPTH == 2
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c
index ba790b035f..12a27daf23 100644
--- a/apps/plugins/lib/grey_scroll.c
+++ b/apps/plugins/lib/grey_scroll.c
@@ -191,8 +191,7 @@ void grey_ub_scroll_up(int count)
191 _grey_info.fg_brightness : 191 _grey_info.fg_brightness :
192 _grey_info.bg_brightness]; 192 _grey_info.bg_brightness];
193 193
194#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ 194#if LCD_PIXELFORMAT == VERTICAL_PACKING
195 || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
196 if (count & _GREY_BMASK) 195 if (count & _GREY_BMASK)
197 { 196 {
198 /* Scrolling by fractional blocks - move pixel wise. */ 197 /* Scrolling by fractional blocks - move pixel wise. */
@@ -263,8 +262,7 @@ void grey_ub_scroll_down(int count)
263 _grey_info.fg_brightness : 262 _grey_info.fg_brightness :
264 _grey_info.bg_brightness]; 263 _grey_info.bg_brightness];
265 264
266#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \ 265#if LCD_PIXELFORMAT == VERTICAL_PACKING
267 || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
268 if (count & _GREY_BMASK) 266 if (count & _GREY_BMASK)
269 { 267 {
270 /* Scrolling by fractional blocks - move pixel wise. */ 268 /* Scrolling by fractional blocks - move pixel wise. */