1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
diff --git a/firmware/target/arm/as3525/lcd-as-e200v2-fuze.S b/firmware/target/arm/as3525/lcd-as-e200v2-fuze.S
index 71d997d..e0a3cc4 100644
--- a/firmware/target/arm/as3525/lcd-as-e200v2-fuze.S
+++ b/firmware/target/arm/as3525/lcd-as-e200v2-fuze.S
@@ -51,7 +51,7 @@ lcd_write_yuv420_lines:
                                         @ r0 = yuv_src
                                         @ r1 = width
                                         @ r2 = stride
-    stmfd       sp!, { r4-r10, lr }     @ save non-scratch
+    stmfd       sp!, { r4-r11, lr }     @ save non-scratch
     ldmia       r0, { r4, r5, r6 }      @ r4 = yuv_src[0] = Y'_p
                                         @ r5 = yuv_src[1] = Cb_p
                                         @ r6 = yuv_src[2] = Cr_p
@@ -59,6 +59,9 @@ lcd_write_yuv420_lines:
     sub         r2, r2, #1              @
     mov         r3, #0xC8000000         @
     orr         r3, r3, #0x120000       @ r3 = DBOP_BASE
+    ldr         r12, [r3, #0x8]         @ r11 = DBOP_CTRL
+    orr         r12, r12, #(1<<12|1<<13|1<<14) @ set output width to 32bit
+    str         r12, [r3, #0x8]         @ write back
 10: @ loop line                         @
     ldrb        r7, [r4], #1            @ r7 = *Y'_p++;
     ldrb        r8, [r5], #1            @ r8 = *Cb_p++;
@@ -110,11 +113,7 @@ lcd_write_yuv420_lines:
                                         @
     orr         r0, r0, lr, lsl #11     @ r0 = (r << 11) | b
     orr         r0, r0, r7, lsl #5      @ r0 = (r << 11) | (g << 5) | b
-    strh        r0, [r3, #0x10]         @ write pixel
-1: @ busy                               @
-    ldr         r7, [r3,#0xc]           @ r7 = DBOP_STATUS
-    tst         r7, #DBOP_BUSY          @ fifo not empty?
-    beq         1b                      @
+    mov         r11, r0                  @ save pixel, is getting written later
                                         @
     sub         r7, r12, #16            @ r7 = Y = (Y' - 16)*74
     add         r12, r7, r7, asl #2     @
@@ -143,11 +142,8 @@ lcd_write_yuv420_lines:
                                         @
     orr         r0, r0, lr, lsl #11     @ r0 = (r << 11) | b
     orr         r0, r0, r7, lsl #5      @ r0 = (r << 11) | (g << 5) | b
-    strh        r0, [r3, #0x10]         @ write pixel
-1: @ busy                               @
-    ldr         r7, [r3,#0xc]           @ r7 = DBOP_STATUS
-    tst         r7, #DBOP_BUSY          @ fifo not empty?
-    beq         1b                      @
+    orr         r11, r11, r0, lsl #16    @ get saved pixel
+    str         r11, [r3, #0x10]         @ write pixels
                                         @
     sub         r7, r12, #16            @ r7 = Y = (Y' - 16)*74
     add         r12, r7, r7, asl #2     @
@@ -177,11 +173,7 @@ lcd_write_yuv420_lines:
                                         @
     orr         r0, r0, lr, lsl #11     @ r0 = (r << 11) | b
     orr         r0, r0, r7, lsl #5      @ r0 = (r << 11) | (g << 5) | b
-    strh        r0, [r3, #0x10]         @ write pixel
-1: @ busy                               @
-    ldr         r7, [r3,#0xc]           @ r7 = DBOP_STATUS
-    tst         r7, #DBOP_BUSY          @ fifo not empty?
-    beq         1b                      @
+    mov         r11, r0                 @ save pixel, is getting written later
                                         @
     sub         r7, r12, #16            @ r7 = Y = (Y' - 16)*74
     add         r12, r7, r7, asl #2     @
@@ -204,12 +196,13 @@ lcd_write_yuv420_lines:
     cmp         r7, #63                 @ clamp g
     mvnhi       r7, r7, asr #31         @
     andhi       r7, r7, #63             @
-15: @ no clamp                          @
-                                        @
+15: @ no clamp                           @
+                                         @
     orr         r0, r0, lr, lsl #11     @ r0 = (r << 11) | b
     orr         r0, r0, r7, lsl #5      @ r0 = (r << 11) | (g << 5) | b
-    strh        r0, [r3, #0x10]         @ write pixel
-1: @ busy                               @
+    orr         r11, r11, r0, lsl #16   @ get saved pixel
+    str         r11, [r3, #0x10]        @ write pixels
+1: @ busy                                @
     ldr         r7, [r3,#0xc]           @ r7 = DBOP_STATUS
     tst         r7, #DBOP_BUSY          @ fifo not empty?
     beq         1b                      @
@@ -217,7 +210,7 @@ lcd_write_yuv420_lines:
     subs        r1, r1, #2              @ subtract block from width
     bgt         10b @ loop line         @
                                         @
-    ldmfd       sp!, { r4-r10, pc }     @ restore registers and return
+    ldmfd       sp!, { r4-r11, pc }     @ restore registers and return
     bx          lr                      @
     .ltorg                              @ dump constant pool
     .size   lcd_write_yuv420_lines, .-lcd_write_yuv420_lines
@@ -270,6 +263,10 @@ lcd_write_yuv420_lines_odither:
     mov         r14, r14, lsl #6        @ 0x00 or 0x80
     mov         r3, #0xC8000000         @
     orr         r3, r3, #0x120000       @ r3 = DBOP_BASE
+    ldr         r12, [r3, #0x8]         @ r12 = DBOP_CTRL
+    orr         r12, r12, #(1<<12|1<<13|1<<14) @ set output width to 32bit
+    str         r12, [r3, #0x8]         @ write back
+
 10: @ loop line                         @
                                         @
     ldrb        r7, [r4], #1            @ r7 = *Y'_p++;
@@ -340,11 +337,7 @@ lcd_write_yuv420_lines_odither:
     and         r7, r7, #0x7e00         @ r0 = pixel = (r & 0xf800) |
     orr         r11, r11, r7, lsr #4    @              ((g & 0x7e00) >> 4) |
     orr         r0, r11, r0, lsr #10    @              (b >> 10)
-    strh        r0, [r3, #0x10]         @ write pixel
-1: @ busy                               @
-    ldr         r7, [r3,#0xc]           @ r7 = DBOP_STATUS
-    tst         r7, #DBOP_BUSY          @ fifo not empty?
-    beq         1b                      @
+    mov         r3, r0                 @ store pixel for later
                                         @
     sub         r7, r12, #16            @ r7 = Y = (Y' - 16)*149
     add         r12, r7, r7, asl #2     @
@@ -389,11 +382,10 @@ lcd_write_yuv420_lines_odither:
     and         r7, r7, #0x7e00         @ r0 = pixel = (r & 0xf800) |
     orr         r11, r11, r7, lsr #4    @              ((g & 0x7e00) >> 4) |
     orr         r0, r11, r0, lsr #10    @              (b >> 10)
-    strh        r0, [r3, #0x10]         @ write pixel
-1: @ busy                               @
-    ldr         r7, [r3,#0xc]           @ r7 = DBOP_STATUS
-    tst         r7, #DBOP_BUSY          @ fifo not empty?
-    beq         1b                      @
+    orr         r3, r3, r0, lsl #16
+    mov         r0, #0xC8000000         @
+    orr         r0, r0, #0x120000       @ r3 = DBOP_BASE
+    str         r3, [r0, #0x10]         @ write pixel
                                         @
     sub         r7, r12, #16            @ r7 = Y = (Y' - 16)*149
     add         r12, r7, r7, asl #2     @
@@ -440,11 +432,7 @@ lcd_write_yuv420_lines_odither:
     and         r7, r7, #0x7e00         @ r0 = pixel = (r & 0xf800) |
     orr         r11, r11, r7, lsr #4    @              ((g & 0x7e00) >> 4) |
     orr         r0, r11, r0, lsr #10    @              (b >> 10)
-    strh        r0, [r3, #0x10]         @ write pixel
-1: @ busy                               @
-    ldr         r7, [r3,#0xc]           @ r7 = DBOP_STATUS
-    tst         r7, #DBOP_BUSY          @ fifo not empty?
-    beq         1b                      @
+    mov         r3, r0                  @ store pixel for later
                                         @
     sub         r7, r12, #16            @ r7 = Y = (Y' - 16)*149
     add         r12, r7, r7, asl #2     @
@@ -487,7 +475,10 @@ lcd_write_yuv420_lines_odither:
     and         r7, r7, #0x7e00         @ r0 = pixel = (r & 0xf800) |
     orr         r11, r11, r7, lsr #4    @              ((g & 0x7e00) >> 4) |
     orr         r0, r11, r0, lsr #10    @              (b >> 10)
-    strh        r0, [r3, #0x10]         @ write pixel
+    orr         r3, r3, r0, lsl #16
+    mov         r0, #0xC8000000         @
+    orr         r0, r0, #0x120000       @ r3 = DBOP_BASE
+    str         r3, [r0, #0x10]         @ write pixel
 1: @ busy                               @
     ldr         r7, [r3,#0xc]           @ r7 = DBOP_STATUS
     tst         r7, #DBOP_BUSY          @ fifo not empty?