diff options
Diffstat (limited to 'firmware/target/coldfire/iaudio/m5')
-rw-r--r-- | firmware/target/coldfire/iaudio/m5/lcd-as-m5.S | 93 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/m5/lcd-m5.c | 15 |
2 files changed, 92 insertions, 16 deletions
diff --git a/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S b/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S index 4a88dc92b0..7e89815ec8 100644 --- a/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S +++ b/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S | |||
@@ -41,18 +41,18 @@ lcd_write_command: | |||
41 | lcd_write_command_ex: | 41 | lcd_write_command_ex: |
42 | lea.l 0xf0008000, %a0 | 42 | lea.l 0xf0008000, %a0 |
43 | 43 | ||
44 | move.l (4, %sp), %d0 /* Command */ | 44 | move.l (4, %sp), %d0 /* Command */ |
45 | move.w %d0, (%a0)+ /* Write to LCD, set A0 = 1 */ | 45 | move.w %d0, (%a0)+ /* Write to LCD, set A0 = 1 */ |
46 | 46 | ||
47 | move.l (8, %sp), %d0 /* Data */ | 47 | move.l (8, %sp), %d0 /* Data */ |
48 | cmp.l #-1, %d0 /* -1? */ | 48 | cmp.l #-1, %d0 /* -1? */ |
49 | beq.b .last | 49 | beq.b .last |
50 | move.w %d0, (%a0) /* Write to LCD */ | 50 | move.w %d0, (%a0) /* Write to LCD */ |
51 | 51 | ||
52 | move.l (12, %sp), %d0 /* Data */ | 52 | move.l (12, %sp), %d0 /* Data */ |
53 | cmp.l #-1, %d0 /* -1? */ | 53 | cmp.l #-1, %d0 /* -1? */ |
54 | beq.b .last | 54 | beq.b .last |
55 | move.w %d0, (%a0) /* Write to LCD */ | 55 | move.w %d0, (%a0) /* Write to LCD */ |
56 | 56 | ||
57 | .last: | 57 | .last: |
58 | rts | 58 | rts |
@@ -65,19 +65,80 @@ lcd_write_command_ex: | |||
65 | .type lcd_write_data,@function | 65 | .type lcd_write_data,@function |
66 | 66 | ||
67 | lcd_write_data: | 67 | lcd_write_data: |
68 | move.l (4,%sp), %a0 /* Data pointer */ | 68 | movem.l (4, %sp), %a0-%a1 /* Data pointer */ |
69 | move.l (8,%sp), %d0 /* Length */ | 69 | move.l %a1, %d0 /* Length */ |
70 | |||
71 | lea 0xf0008002, %a1 | 70 | lea 0xf0008002, %a1 |
71 | |||
72 | .loop: | 72 | .loop: |
73 | /* When running in IRAM, this loop takes 10 cycles plus the LCD write. | 73 | /* When running in IRAM, this loop takes 10 cycles plus the LCD write. |
74 | The 10 cycles are necessary to follow the LCD timing specs | 74 | The 10 cycles are necessary to follow the LCD timing specs |
75 | at 140MHz */ | 75 | at 140MHz */ |
76 | nop /* 3(0/0) */ | 76 | nop /* 3(0/0) */ |
77 | move.b (%a0)+, %d1 /* 3(1/0) */ | 77 | move.b (%a0)+, %d1 /* 3(1/0) */ |
78 | move.w %d1, (%a1) /* 1(0/1) */ | 78 | move.w %d1, (%a1) /* 1(0/1) */ |
79 | subq.l #1, %d0 /* 1(0/0) */ | 79 | subq.l #1, %d0 /* 1(0/0) */ |
80 | bne .loop /* 2(0/0) */ | 80 | bne .loop /* 2(0/0) */ |
81 | rts | 81 | rts |
82 | .wd_end: | 82 | .wd_end: |
83 | .size lcd_write_data,.wd_end-lcd_write_data | 83 | .size lcd_write_data,.wd_end-lcd_write_data |
84 | |||
85 | |||
86 | .align 2 | ||
87 | .global lcd_grey_data | ||
88 | .type lcd_grey_data,@function | ||
89 | |||
90 | lcd_grey_data: | ||
91 | lea.l (-4*4, %sp), %sp | ||
92 | movem.l %d2-%d5, (%sp) | ||
93 | movem.l (4*4+4, %sp), %a0-%a1 /* Data pointer */ | ||
94 | move.l %a1, %d0 /* Length */ | ||
95 | lea 0xf0008002, %a1 /* LCD data port */ | ||
96 | move.l #0xff00ff00, %d2 /* mask for splitting value/phase pairs */ | ||
97 | |||
98 | .greyloop: | ||
99 | movem.l (%a0), %d4-%d5 /* fetch 4 pixel phase/value pairs at once */ | ||
100 | /* %d4 = p0v0p1v1, %d5 = p2v2p3v3 */ | ||
101 | move.l %d2, %d3 /* copy mask */ | ||
102 | and.l %d4, %d3 /* %d3 = p0--p1-- */ | ||
103 | eor.l %d3, %d4 /* %d4 = --v0--v1 */ | ||
104 | lsr.l #8, %d3 /* %d3 = --p0--p1 */ | ||
105 | |||
106 | bclr.l #23, %d3 /* Z = !(p0 & 0x80); p0 &= ~0x80; */ | ||
107 | seq.b %d1 /* %d1 = ........................00000000 */ | ||
108 | lsl.l #2, %d1 /* %d1 = ......................00000000.. */ | ||
109 | bclr.l #7, %d3 /* Z = !(p1 & 0x80); p1 &= ~0x80; */ | ||
110 | seq.b %d1 /* %d1 = ......................0011111111 */ | ||
111 | lsl.l #2, %d1 /* %d1 = ....................0011111111.. */ | ||
112 | |||
113 | add.l %d4, %d3 /* p0 += v0; p1 += v1; */ | ||
114 | move.b %d3, (2, %a0) /* store p1 */ | ||
115 | swap %d3 | ||
116 | move.b %d3, (%a0) /* store p0 */ | ||
117 | |||
118 | move.l %d2, %d3 /* copy mask */ | ||
119 | and.l %d5, %d3 /* %d3 = p2--p3-- */ | ||
120 | eor.l %d3, %d5 /* %d5 = --v2--v3 */ | ||
121 | lsr.l #8, %d3 /* %d3 = --p2--p3 */ | ||
122 | |||
123 | bclr.l #23, %d3 /* Z = !(p2 & 0x80); p2 &= ~0x80; */ | ||
124 | seq.b %d1 /* %d1 = ....................001122222222 */ | ||
125 | lsl.l #2, %d1 /* %d1 = ..................001122222222.. */ | ||
126 | bclr.l #7, %d3 /* Z = !(p3 & 0x80); p3 &= ~0x80; */ | ||
127 | seq.b %d1 /* %d1 = ..................00112233333333 */ | ||
128 | lsr.l #6, %d1 /* %d1 = ........................00112233 */ | ||
129 | |||
130 | add.l %d5, %d3 /* p2 += v2; p3 += v3; */ | ||
131 | move.b %d3, (6, %a0) /* store p3 */ | ||
132 | swap %d3 | ||
133 | move.b %d3, (4, %a0) /* store p2 */ | ||
134 | |||
135 | move.w %d1, (%a1) /* write pixel block */ | ||
136 | addq.l #8, %a0 /* advance address pointer */ | ||
137 | subq.l #1, %d0 /* any blocks left? */ | ||
138 | bne.b .greyloop | ||
139 | |||
140 | movem.l (%sp), %d2-%d5 | ||
141 | lea.l (4*4, %sp), %sp | ||
142 | rts | ||
143 | .gd_end: | ||
144 | .size lcd_grey_data,.gd_end-lcd_grey_data | ||
diff --git a/firmware/target/coldfire/iaudio/m5/lcd-m5.c b/firmware/target/coldfire/iaudio/m5/lcd-m5.c index 2af46b3145..4f963795c7 100644 --- a/firmware/target/coldfire/iaudio/m5/lcd-m5.c +++ b/firmware/target/coldfire/iaudio/m5/lcd-m5.c | |||
@@ -171,6 +171,21 @@ void lcd_blit(const unsigned char* data, int x, int by, int width, | |||
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | /* Performance function that works with an external buffer | ||
175 | note that by and bheight are in 4-pixel units! */ | ||
176 | void lcd_grey_phase_blit(const struct grey_data *data, int x, int by, | ||
177 | int width, int bheight, int stride) | ||
178 | { | ||
179 | stride <<= 2; /* 4 pixels per block */ | ||
180 | while (bheight--) | ||
181 | { | ||
182 | lcd_write_command_ex(LCD_CNTL_PAGE, by++, -1); | ||
183 | lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1); | ||
184 | lcd_write_command(LCD_CNTL_DATA_WRITE); | ||
185 | lcd_grey_data(data, width); | ||
186 | data += stride; | ||
187 | } | ||
188 | } | ||
174 | 189 | ||
175 | /* Update the display. | 190 | /* Update the display. |
176 | This must be called after all other LCD functions that change the display. */ | 191 | This must be called after all other LCD functions that change the display. */ |