summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2008-11-27 21:07:54 +0000
committerRafaël Carré <rafael.carre@gmail.com>2008-11-27 21:07:54 +0000
commit81fe625a6205e9a0a103e76bed13e4701205cf97 (patch)
tree7d037083ea2361cad51fa7a79a8bdfed779993bb
parent6d34e33b94d6074b96917d792dc688c5fbd9356b (diff)
downloadrockbox-81fe625a6205e9a0a103e76bed13e4701205cf97.tar.gz
rockbox-81fe625a6205e9a0a103e76bed13e4701205cf97.zip
Sansa Clip: grey lib support (not calibrated yet)
Declare HAVE_LCD_INVERT Put the framebuffer into IRAM git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19249 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/lib/grey_core.c21
-rw-r--r--firmware/SOURCES1
-rw-r--r--firmware/export/config-clip.h5
-rw-r--r--firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S99
-rw-r--r--firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c30
5 files changed, 143 insertions, 13 deletions
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index 008104a04f..c4eb0fc080 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -207,6 +207,27 @@ static const unsigned char lcdlinear[256] = {
207}; 207};
208#define LCD_SCANRATE 51 /* Hz */ 208#define LCD_SCANRATE 51 /* Hz */
209 209
210#elif defined SANSA_CLIP /* NOT verified */
211static const unsigned char lcdlinear[256] = {
212 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
213 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
214 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
215 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
216 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
217 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
218 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
219112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
220128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
221144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
222160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
223176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
224192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
225208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
226224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
227240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
228};
229#define LCD_SCANRATE 78 /* Hz */
230
210#else /* not yet calibrated targets - generic linear mapping */ 231#else /* not yet calibrated targets - generic linear mapping */
211/* TODO: calibrate iFP7xx */ 232/* TODO: calibrate iFP7xx */
212static const unsigned char lcdlinear[256] = { 233static const unsigned char lcdlinear[256] = {
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 47dcfe5c86..9b576d435a 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1068,6 +1068,7 @@ target/arm/pcm-telechips.c
1068#ifdef SANSA_CLIP 1068#ifdef SANSA_CLIP
1069#ifndef SIMULATOR 1069#ifndef SIMULATOR
1070target/arm/as3525/sansa-clip/lcd-ssd1303.c 1070target/arm/as3525/sansa-clip/lcd-ssd1303.c
1071target/arm/as3525/sansa-clip/lcd-as-clip.S
1071target/arm/as3525/sansa-clip/button-clip.c 1072target/arm/as3525/sansa-clip/button-clip.c
1072target/arm/as3525/sansa-clip/backlight-clip.c 1073target/arm/as3525/sansa-clip/backlight-clip.c
1073target/arm/as3525/as3525-codec.c 1074target/arm/as3525/as3525-codec.c
diff --git a/firmware/export/config-clip.h b/firmware/export/config-clip.h
index 4266b59a7f..d54d4f3488 100644
--- a/firmware/export/config-clip.h
+++ b/firmware/export/config-clip.h
@@ -61,6 +61,9 @@
61/* define this if you can flip your LCD */ 61/* define this if you can flip your LCD */
62#define HAVE_LCD_FLIP 62#define HAVE_LCD_FLIP
63 63
64/* define this if you can invert the pixels */
65#define HAVE_LCD_INVERT
66
64/* Define this if your LCD can set contrast */ 67/* Define this if your LCD can set contrast */
65#define HAVE_LCD_CONTRAST 68#define HAVE_LCD_CONTRAST
66 69
@@ -68,7 +71,7 @@
68#define MAX_CONTRAST_SETTING 50 71#define MAX_CONTRAST_SETTING 50
69#define DEFAULT_CONTRAST_SETTING 30 72#define DEFAULT_CONTRAST_SETTING 30
70 73
71/* #define IRAM_LCDFRAMEBUFFER IDATA_ATTR *//* put the lcd frame buffer in IRAM */ 74#define IRAM_LCDFRAMEBUFFER IDATA_ATTR /* put the lcd frame buffer in IRAM */
72 75
73#define CONFIG_KEYPAD SANSA_CLIP_PAD 76#define CONFIG_KEYPAD SANSA_CLIP_PAD
74 77
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S b/firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S
new file mode 100644
index 0000000000..aab46861ba
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-clip/lcd-as-clip.S
@@ -0,0 +1,99 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Jens Arnold
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "as3525.h"
23
24 .text
25 .align 2
26
27 .global lcd_grey_data
28 .type lcd_grey_data,%function
29
30/* A high performance function to write grey phase data to the display,
31 * one or multiple pixels.
32 *
33 * Arguments:
34 * r0 - pixel value data address
35 * r1 - pixel phase data address
36 * r2 - pixel block count
37 *
38 * Register usage:
39 * r3/r4 - current block of phases
40 * r5/r6 - current block of values
41 * r7 - lcd data accumulator
42 * r8 - phase signs mask
43 * lr - lcd bridge address
44 */
45
46lcd_grey_data:
47 stmfd sp!, {r4-r8, lr}
48 mov r8, #0x80
49 orr r8, r8, r8, lsl #8
50 orr r8, r8, r8, lsl #16
51
52 ldr lr, =GPIOA_BASE
53 mov r3, #(1<<5)
54 str r3, [lr, #(4*(1<<5))] @ set pin D/C# of LCD controller (data)
55
56 ldr lr, =DBOP_BASE
57
58.greyloop:
59 ldmia r1, {r3-r4} /* Fetch 8 pixel phases */
60 ldmia r0!, {r5-r6} /* Fetch 8 pixel values */
61
62 mov r7, #0xff
63 tst r3, #0x80
64 biceq r7, r7, #0x80
65 tst r3, #0x8000
66 biceq r7, r7, #0x40
67 tst r3, #0x800000
68 biceq r7, r7, #0x20
69 tst r3, #0x80000000
70 biceq r7, r7, #0x10
71 bic r3, r3, r8
72 add r3, r3, r5
73
74 tst r4, #0x80
75 biceq r7, r7, #0x08
76 tst r4, #0x8000
77 biceq r7, r7, #0x04
78 tst r4, #0x800000
79 biceq r7, r7, #0x02
80 tst r4, #0x80000000
81 biceq r7, r7, #0x01
82 bic r4, r4, r8
83 add r4, r4, r6
84
85 stmia r1!, {r3-r4}
86
87 orr r7, r7, r7, lsl #8 @ we set 15:13 to the MSb and 3:0 to the LSb
88 strh r7, [lr, #0x10] @ DBOP_DOUT
89
901:
91 ldr r5, [lr, #0xC] @ DBOP_STAT
92 ands r5, r5, #(1<<10) @ wait until push fifo empties
93 beq 1b
94
95 subs r2, r2, #1
96 bne .greyloop
97
98 ldmfd sp!, {r4-r8, pc}
99 .size lcd_grey_data,.-lcd_grey_data
diff --git a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
index f1e1c24b85..703b7e1307 100644
--- a/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
+++ b/firmware/target/arm/as3525/sansa-clip/lcd-ssd1303.c
@@ -88,6 +88,7 @@ void lcd_write_command(int byte)
88 GPIOA_PIN(5) = 0; 88 GPIOA_PIN(5) = 0;
89 89
90 /* Write command */ 90 /* Write command */
91 /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
91 DBOP_DOUT = (byte << 8) | byte; 92 DBOP_DOUT = (byte << 8) | byte;
92 93
93 /* While push fifo is not empty */ 94 /* While push fifo is not empty */
@@ -103,6 +104,7 @@ void lcd_write_data(const fb_data* p_bytes, int count)
103 while (count--) 104 while (count--)
104 { 105 {
105 /* Write pixels */ 106 /* Write pixels */
107 /* Only bits 15:12 and 3:0 of DBOP_DOUT are meaningful */
106 DBOP_DOUT = (*p_bytes << 8) | *p_bytes; 108 DBOP_DOUT = (*p_bytes << 8) | *p_bytes;
107 109
108 p_bytes++; /* next packed pixels */ 110 p_bytes++; /* next packed pixels */
@@ -266,26 +268,30 @@ void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
266 } 268 }
267} 269}
268 270
271/* Helper function for lcd_grey_phase_blit(). */
272void lcd_grey_data(unsigned char *values, unsigned char *phases, int count);
269 273
270/* Performance function that works with an external buffer 274/* Performance function that works with an external buffer
271 note that by and bheight are in 8-pixel units! */ 275 note that by and bheight are in 8-pixel units! */
272void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases, 276void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
273 int x, int by, int width, int bheight, int stride) 277 int x, int by, int width, int bheight, int stride)
274{ 278{
275 /* TODO */
276
277#if 0
278 if(!display_on) 279 if(!display_on)
279 return; 280 return;
280#endif 281
281 282 stride <<= 3; /* 8 pixels per block */
282 (void)values; 283 /* Copy display bitmap to hardware */
283 (void)phases; 284 while (bheight--)
284 (void)x; 285 {
285 (void)by; 286 lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf));
286 (void)width; 287 lcd_write_command (LCD_CNTL_HIGHCOL | (((x+2+xoffset)>>4) & 0xf));
287 (void)bheight; 288 lcd_write_command (LCD_CNTL_LOWCOL | ((x+2+xoffset) & 0xf));
288 (void)stride; 289
290 lcd_grey_data(values, phases, width);
291
292 values += stride;
293 phases += stride;
294 }
289} 295}
290 296
291/* Update the display. 297/* Update the display.