diff options
Diffstat (limited to 'firmware/target/coldfire/iriver')
-rw-r--r-- | firmware/target/coldfire/iriver/h100/lcd-as-h100.S | 120 | ||||
-rw-r--r-- | firmware/target/coldfire/iriver/h100/lcd-h100.c | 15 |
2 files changed, 106 insertions, 29 deletions
diff --git a/firmware/target/coldfire/iriver/h100/lcd-as-h100.S b/firmware/target/coldfire/iriver/h100/lcd-as-h100.S index c7509871fc..df410fa379 100644 --- a/firmware/target/coldfire/iriver/h100/lcd-as-h100.S +++ b/firmware/target/coldfire/iriver/h100/lcd-as-h100.S | |||
@@ -28,11 +28,10 @@ | |||
28 | .type lcd_write_command,@function | 28 | .type lcd_write_command,@function |
29 | 29 | ||
30 | lcd_write_command: | 30 | lcd_write_command: |
31 | move.l (4,%sp),%d0 | 31 | move.l #~8, %d1 |
32 | lea MBAR2,%a1 | 32 | and.l %d1, (MBAR2+0xb4) |
33 | move.l #~8,%d1 | 33 | move.l (4, %sp), %d0 |
34 | and.l %d1,(0xb4,%a1) | 34 | move.w %d0, 0xf0000000 |
35 | move.w %d0,0xf0000000 | ||
36 | rts | 35 | rts |
37 | .wc_end: | 36 | .wc_end: |
38 | .size lcd_write_command,.wc_end-lcd_write_command | 37 | .size lcd_write_command,.wc_end-lcd_write_command |
@@ -43,26 +42,27 @@ lcd_write_command: | |||
43 | .type lcd_write_command_ex,@function | 42 | .type lcd_write_command_ex,@function |
44 | 43 | ||
45 | lcd_write_command_ex: | 44 | lcd_write_command_ex: |
46 | lea MBAR2,%a1 | 45 | lea.l 0xf0000000, %a0 |
46 | lea.l MBAR2+0xb4, %a1 | ||
47 | 47 | ||
48 | move.l (4,%sp),%d0 /* Command */ | 48 | move.l #~8, %d1 /* Set A0 = 0 */ |
49 | and.l %d1, (%a1) | ||
49 | 50 | ||
50 | move.l #~8,%d1 /* Set A0 = 0 */ | 51 | move.l (4, %sp), %d0 /* Command */ |
51 | and.l %d1,(0xb4,%a1) | 52 | move.w %d0, (%a0) /* Write to LCD */ |
52 | move.w %d0,0xf0000000 /* Write to LCD */ | ||
53 | 53 | ||
54 | not.l %d1 /* Set A0 = 1 */ | 54 | not.l %d1 /* Set A0 = 1 */ |
55 | or.l %d1,(0xb4,%a1) | 55 | or.l %d1, (%a1) |
56 | 56 | ||
57 | move.l (8,%sp),%d0 /* Data */ | 57 | move.l (8, %sp), %d0 /* Data */ |
58 | cmp.l #0xffffffff,%d0 /* -1? */ | 58 | cmp.l #-1, %d0 /* -1? */ |
59 | beq.b .last | 59 | beq.b .last |
60 | move.w %d0,0xf0000000 /* Write to LCD */ | 60 | move.w %d0, (%a0) /* Write to LCD */ |
61 | 61 | ||
62 | move.l (12,%sp),%d0 /* Data */ | 62 | move.l (12, %sp), %d0 /* Data */ |
63 | cmp.l #0xffffffff,%d0 /* -1? */ | 63 | cmp.l #-1, %d0 /* -1? */ |
64 | beq.b .last | 64 | beq.b .last |
65 | move.w %d0,0xf0000000 /* Write to LCD */ | 65 | move.w %d0, (%a0) /* Write to LCD */ |
66 | 66 | ||
67 | .last: | 67 | .last: |
68 | rts | 68 | rts |
@@ -75,22 +75,84 @@ lcd_write_command_ex: | |||
75 | .type lcd_write_data,@function | 75 | .type lcd_write_data,@function |
76 | 76 | ||
77 | lcd_write_data: | 77 | lcd_write_data: |
78 | move.l (4,%sp),%a0 /* Data pointer */ | 78 | movem.l (4, %sp), %a0-%a1 /* Data pointer */ |
79 | move.l (8,%sp),%d0 /* Length */ | 79 | move.l %a1, %d0 /* Length */ |
80 | lea MBAR2,%a1 | 80 | moveq #8, %d1 |
81 | moveq #8,%d1 | 81 | or.l %d1, (MBAR2+0xb4) |
82 | or.l %d1,(0xb4,%a1) | 82 | lea.l 0xf0000000, %a1 |
83 | 83 | ||
84 | lea 0xf0000000,%a1 | ||
85 | .loop: | 84 | .loop: |
86 | /* When running in IRAM, this loop takes 10 cycles plus the LCD write. | 85 | /* When running in IRAM, this loop takes 10 cycles plus the LCD write. |
87 | The 10 cycles are necessary to follow the LCD timing specs | 86 | The 10 cycles are necessary to follow the LCD timing specs |
88 | at 140MHz */ | 87 | at 140MHz */ |
89 | nop /* 3(0/0) */ | 88 | nop /* 3(0/0) */ |
90 | move.b (%a0)+,%d1 /* 3(1/0) */ | 89 | move.b (%a0)+, %d1 /* 3(1/0) */ |
91 | move.w %d1,(%a1) /* 1(0/1) */ | 90 | move.w %d1, (%a1) /* 1(0/1) */ |
92 | subq.l #1,%d0 /* 1(0/0) */ | 91 | subq.l #1, %d0 /* 1(0/0) */ |
93 | bne .loop /* 2(0/0) */ | 92 | bne .loop /* 2(0/0) */ |
94 | rts | 93 | rts |
95 | .wd_end: | 94 | .wd_end: |
96 | .size lcd_write_data,.wd_end-lcd_write_data | 95 | .size lcd_write_data,.wd_end-lcd_write_data |
96 | |||
97 | |||
98 | .align 2 | ||
99 | .global lcd_grey_data | ||
100 | .type lcd_grey_data,@function | ||
101 | |||
102 | lcd_grey_data: | ||
103 | lea.l (-4*4, %sp), %sp | ||
104 | movem.l %d2-%d5, (%sp) | ||
105 | movem.l (4*4+4, %sp), %a0-%a1 /* Data pointer */ | ||
106 | move.l %a1, %d0 /* Length */ | ||
107 | moveq #8, %d1 | ||
108 | or.l %d1, (MBAR2+0xb4) /* A0 = 1 (data) */ | ||
109 | lea 0xf0000000, %a1 /* LCD data port */ | ||
110 | move.l #0xff00ff00, %d2 /* mask for splitting value/phase pairs */ | ||
111 | |||
112 | .greyloop: | ||
113 | movem.l (%a0), %d4-%d5 /* fetch 4 pixel phase/value pairs at once */ | ||
114 | /* %d4 = p0v0p1v1, %d5 = p2v2p3v3 */ | ||
115 | move.l %d2, %d3 /* copy mask */ | ||
116 | and.l %d4, %d3 /* %d3 = p0--p1-- */ | ||
117 | eor.l %d3, %d4 /* %d4 = --v0--v1 */ | ||
118 | lsr.l #8, %d3 /* %d3 = --p0--p1 */ | ||
119 | |||
120 | bclr.l #23, %d3 /* Z = !(p0 & 0x80); p0 &= ~0x80; */ | ||
121 | seq.b %d1 /* %d1 = ........................00000000 */ | ||
122 | lsl.l #2, %d1 /* %d1 = ......................00000000.. */ | ||
123 | bclr.l #7, %d3 /* Z = !(p1 & 0x80); p1 &= ~0x80; */ | ||
124 | seq.b %d1 /* %d1 = ......................0011111111 */ | ||
125 | lsl.l #2, %d1 /* %d1 = ....................0011111111.. */ | ||
126 | |||
127 | add.l %d4, %d3 /* p0 += v0; p1 += v1; */ | ||
128 | move.b %d3, (2, %a0) /* store p1 */ | ||
129 | swap %d3 | ||
130 | move.b %d3, (%a0) /* store p0 */ | ||
131 | |||
132 | move.l %d2, %d3 /* copy mask */ | ||
133 | and.l %d5, %d3 /* %d3 = p2--p3-- */ | ||
134 | eor.l %d3, %d5 /* %d5 = --v2--v3 */ | ||
135 | lsr.l #8, %d3 /* %d3 = --p2--p3 */ | ||
136 | |||
137 | bclr.l #23, %d3 /* Z = !(p2 & 0x80); p2 &= ~0x80; */ | ||
138 | seq.b %d1 /* %d1 = ....................001122222222 */ | ||
139 | lsl.l #2, %d1 /* %d1 = ..................001122222222.. */ | ||
140 | bclr.l #7, %d3 /* Z = !(p3 & 0x80); p3 &= ~0x80; */ | ||
141 | seq.b %d1 /* %d1 = ..................00112233333333 */ | ||
142 | lsr.l #6, %d1 /* %d1 = ........................00112233 */ | ||
143 | |||
144 | add.l %d5, %d3 /* p2 += v2; p3 += v3; */ | ||
145 | move.b %d3, (6, %a0) /* store p3 */ | ||
146 | swap %d3 | ||
147 | move.b %d3, (4, %a0) /* store p2 */ | ||
148 | |||
149 | move.w %d1, (%a1) /* write pixel block */ | ||
150 | addq.l #8, %a0 /* advance address pointer */ | ||
151 | subq.l #1, %d0 /* any blocks left? */ | ||
152 | bne.b .greyloop | ||
153 | |||
154 | movem.l (%sp), %d2-%d5 | ||
155 | lea.l (4*4, %sp), %sp | ||
156 | rts | ||
157 | .gd_end: | ||
158 | .size lcd_grey_data,.gd_end-lcd_grey_data | ||
diff --git a/firmware/target/coldfire/iriver/h100/lcd-h100.c b/firmware/target/coldfire/iriver/h100/lcd-h100.c index a721273384..c17de952c3 100644 --- a/firmware/target/coldfire/iriver/h100/lcd-h100.c +++ b/firmware/target/coldfire/iriver/h100/lcd-h100.c | |||
@@ -180,6 +180,21 @@ void lcd_blit(const unsigned char* data, int x, int by, int width, | |||
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | /* Performance function that works with an external buffer | ||
184 | note that by and bheight are in 4-pixel units! */ | ||
185 | void lcd_grey_phase_blit(const struct grey_data *data, int x, int by, | ||
186 | int width, int bheight, int stride) | ||
187 | { | ||
188 | stride <<= 2; /* 4 pixels per block */ | ||
189 | while (bheight--) | ||
190 | { | ||
191 | lcd_write_command_ex(LCD_CNTL_PAGE, by++, -1); | ||
192 | lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1); | ||
193 | lcd_write_command(LCD_CNTL_DATA_WRITE); | ||
194 | lcd_grey_data(data, width); | ||
195 | data += stride; | ||
196 | } | ||
197 | } | ||
183 | 198 | ||
184 | /* Update the display. | 199 | /* Update the display. |
185 | This must be called after all other LCD functions that change the display. */ | 200 | This must be called after all other LCD functions that change the display. */ |