Index: umsboot/drawing.S |
— | — | @@ -25,26 +25,6 @@ |
26 | 26 | #include "global.h"
|
27 | 27 |
|
28 | 28 |
|
29 | | -.section .icode.get_font_width, "ax", %progbits
|
30 | | -.align 2
|
31 | | -.global get_font_width
|
32 | | -.type get_font_width, %function
|
33 | | -get_font_width:
|
34 | | - mov r0, #6
|
35 | | - mov pc, lr
|
36 | | -.size get_font_width, .-get_font_width
|
37 | | -
|
38 | | -
|
39 | | -.section .icode.get_font_height, "ax", %progbits
|
40 | | -.align 2
|
41 | | -.global get_font_height
|
42 | | -.type get_font_height, %function
|
43 | | -get_font_height:
|
44 | | - mov r0, #8
|
45 | | - mov pc, lr
|
46 | | -.size get_font_height, .-get_font_height
|
47 | | -
|
48 | | -
|
49 | 29 | .section .icode.rendertext, "ax", %progbits
|
50 | 30 | .align 2
|
51 | 31 | .global rendertext
|
— | — | @@ -69,88 +49,7 @@ |
70 | 50 | .size rendertext, .-rendertext
|
71 | 51 |
|
72 | 52 |
|
73 | | -.section .icode.renderfillrect, "ax", %progbits
|
74 | | -.align 2
|
75 | | -.global renderfillrect
|
76 | | -.type renderfillrect, %function
|
77 | | -renderfillrect:
|
78 | | - ldr r12, [sp,#8]
|
79 | | - mla r1, r12, r2, r1
|
80 | | -#if (LCD_BYTESPERPIXEL == 1)
|
81 | | - add r0, r0, r1
|
82 | | -#elif (LCD_BYTESPERPIXEL == 2)
|
83 | | - add r0, r0, r1,lsl#1
|
84 | | -#elif (LCD_BYTESPERPIXEL == 4)
|
85 | | - add r0, r0, r1,lsl#2
|
86 | | -#else
|
87 | | -#error Unknown number of bytes per pixel!
|
88 | | -#endif
|
89 | | - ldmfd sp, {r1,r2}
|
90 | | -renderfillrect_y:
|
91 | | - cmp r1, #0
|
92 | | - moveq pc, lr
|
93 | | - sub r1, r1, #1
|
94 | | - mov r12, r3
|
95 | | -renderfillrect_x:
|
96 | | - cmp r12, #0
|
97 | | - beq renderfillrect_y
|
98 | | - sub r12, r12, #1
|
99 | | -#if (LCD_BYTESPERPIXEL == 1)
|
100 | | - strb r2, [r0], #1
|
101 | | -#elif (LCD_BYTESPERPIXEL == 2)
|
102 | | - strh r2, [r0], #2
|
103 | | -#elif (LCD_BYTESPERPIXEL == 4)
|
104 | | - str r2, [r0], #4
|
105 | | -#else
|
106 | | -#error Unknown number of bytes per pixel!
|
107 | | -#endif
|
108 | | - b renderfillrect_x
|
109 | | -.size renderfillrect, .-renderfillrect
|
110 | | -
|
111 | | -
|
112 | 53 | #if (LCD_BYTESPERPIXEL == 2)
|
113 | | -.section .icode.renderbmp, "ax", %progbits
|
114 | | -.align 2
|
115 | | -.global renderbmp
|
116 | | -.type renderbmp, %function
|
117 | | -renderbmp:
|
118 | | - mov r2, r2,lsl#1
|
119 | | - ldrh r3, [r1]
|
120 | | - sub r3, r3, #0x4d00
|
121 | | - subs r3, r3, #0x42
|
122 | | - movne pc, lr
|
123 | | - stmfd sp!, {r4,lr}
|
124 | | - ldrh r4, [r1,#18]
|
125 | | - ldrh r12, [r1,#20]
|
126 | | - orr r4, r4, r12,lsl#16
|
127 | | - ldrh r3, [r1,#22]
|
128 | | - ldrh r12, [r1,#24]
|
129 | | - orr r3, r3, r12,lsl#16
|
130 | | - ldrh lr, [r1,#10]
|
131 | | - ldrh r12, [r1,#12]
|
132 | | - orr lr, lr, r12,lsl#16
|
133 | | - add r1, r1, lr
|
134 | | - mul lr, r2, r3
|
135 | | - add r0, r0, lr
|
136 | | -renderbmp_row:
|
137 | | - mov r12, r4
|
138 | | - sub r0, r0, r2
|
139 | | -renderbmp_pixel:
|
140 | | - ldrb lr, [r1,#1]
|
141 | | - strb lr, [r0], #1
|
142 | | - ldrb lr, [r1], #2
|
143 | | - strb lr, [r0], #1
|
144 | | - subs r12, r12, #1
|
145 | | - bne renderbmp_pixel
|
146 | | - tst r4, #1
|
147 | | - addne r1, r1, #2
|
148 | | - sub r0, r0, r4,lsl#1
|
149 | | - subs r3, r3, #1
|
150 | | - bne renderbmp_row
|
151 | | - ldmfd sp!, {r4,pc}
|
152 | | -.size renderbmp, .-renderbmp
|
153 | | -
|
154 | | -
|
155 | 54 | .section .icode.renderchar, "ax", %progbits
|
156 | 55 | .align 2
|
157 | 56 | .global renderchar
|
Index: umsboot/target/ipodclassic/interrupt.c |
— | — | @@ -37,14 +37,7 @@ |
38 | 38 | default_interrupt(INT_IRQ5);
|
39 | 39 | default_interrupt(INT_IRQ6);
|
40 | 40 | default_interrupt(INT_IRQ7);
|
41 | | -default_interrupt(INT_TIMERA);
|
42 | | -default_interrupt(INT_TIMERB);
|
43 | | -default_interrupt(INT_TIMERC);
|
44 | | -default_interrupt(INT_TIMERD);
|
45 | | -default_interrupt(INT_TIMERE);
|
46 | | -default_interrupt(INT_TIMERF);
|
47 | | -default_interrupt(INT_TIMERG);
|
48 | | -default_interrupt(INT_TIMERH);
|
| 41 | +default_interrupt(INT_TIMER);
|
49 | 42 | default_interrupt(INT_IRQ9);
|
50 | 43 | default_interrupt(INT_IRQ10);
|
51 | 44 | default_interrupt(INT_IRQ11);
|
— | — | @@ -60,14 +53,7 @@ |
61 | 54 | default_interrupt(INT_DMAC0C5);
|
62 | 55 | default_interrupt(INT_DMAC0C6);
|
63 | 56 | default_interrupt(INT_DMAC0C7);
|
64 | | -default_interrupt(INT_DMAC1C0);
|
65 | | -default_interrupt(INT_DMAC1C1);
|
66 | | -default_interrupt(INT_DMAC1C2);
|
67 | | -default_interrupt(INT_DMAC1C3);
|
68 | | -default_interrupt(INT_DMAC1C4);
|
69 | | -default_interrupt(INT_DMAC1C5);
|
70 | | -default_interrupt(INT_DMAC1C6);
|
71 | | -default_interrupt(INT_DMAC1C7);
|
| 57 | +default_interrupt(INT_DMAC1);
|
72 | 58 | default_interrupt(INT_IRQ18);
|
73 | 59 | default_interrupt(INT_USB_FUNC);
|
74 | 60 | default_interrupt(INT_IRQ20);
|
— | — | @@ -82,38 +68,6 @@ |
83 | 69 | default_interrupt(INT_IRQ29);
|
84 | 70 | default_interrupt(INT_IRQ30);
|
85 | 71 | default_interrupt(INT_IRQ31);
|
86 | | -default_interrupt(INT_IRQ32);
|
87 | | -default_interrupt(INT_IRQ33);
|
88 | | -default_interrupt(INT_IRQ34);
|
89 | | -default_interrupt(INT_IRQ35);
|
90 | | -default_interrupt(INT_IRQ36);
|
91 | | -default_interrupt(INT_IRQ37);
|
92 | | -default_interrupt(INT_IRQ38);
|
93 | | -default_interrupt(INT_IRQ39);
|
94 | | -default_interrupt(INT_IRQ40);
|
95 | | -default_interrupt(INT_IRQ41);
|
96 | | -default_interrupt(INT_IRQ42);
|
97 | | -default_interrupt(INT_IRQ43);
|
98 | | -default_interrupt(INT_IRQ44);
|
99 | | -default_interrupt(INT_IRQ45);
|
100 | | -default_interrupt(INT_IRQ46);
|
101 | | -default_interrupt(INT_IRQ47);
|
102 | | -default_interrupt(INT_IRQ48);
|
103 | | -default_interrupt(INT_IRQ49);
|
104 | | -default_interrupt(INT_IRQ50);
|
105 | | -default_interrupt(INT_IRQ51);
|
106 | | -default_interrupt(INT_IRQ52);
|
107 | | -default_interrupt(INT_IRQ53);
|
108 | | -default_interrupt(INT_IRQ54);
|
109 | | -default_interrupt(INT_IRQ55);
|
110 | | -default_interrupt(INT_IRQ56);
|
111 | | -default_interrupt(INT_IRQ57);
|
112 | | -default_interrupt(INT_IRQ58);
|
113 | | -default_interrupt(INT_IRQ59);
|
114 | | -default_interrupt(INT_IRQ60);
|
115 | | -default_interrupt(INT_IRQ61);
|
116 | | -default_interrupt(INT_IRQ62);
|
117 | | -default_interrupt(INT_IRQ63);
|
118 | 72 |
|
119 | 73 |
|
120 | 74 | static int current_irq;
|
— | — | @@ -124,28 +78,9 @@ |
125 | 79 | panicf(PANIC_FATAL, "Unhandled IRQ %d!", current_irq);
|
126 | 80 | }
|
127 | 81 |
|
128 | | -static void (* timervector[])(void) IDATA_ATTR =
|
129 | | -{
|
130 | | - INT_TIMERA,INT_TIMERB,INT_TIMERC,INT_TIMERD,INT_TIMERE,INT_TIMERF,INT_TIMERG,INT_TIMERH
|
131 | | -};
|
132 | | -
|
133 | | -void INT_TIMER(void) ICODE_ATTR;
|
134 | | -void INT_TIMER()
|
135 | | -{
|
136 | | - if (TACON & 0x00038000) timervector[0]();
|
137 | | - if (TBCON & 0x00038000) timervector[1]();
|
138 | | - if (TCCON & 0x00038000) timervector[2]();
|
139 | | - if (TDCON & 0x00038000) timervector[3]();
|
140 | | - if (TECON & 0x00038000) timervector[4]();
|
141 | | - if (TFCON & 0x00038000) timervector[5]();
|
142 | | - if (TGCON & 0x00038000) timervector[6]();
|
143 | | - if (THCON & 0x00038000) timervector[7]();
|
144 | | -}
|
145 | | -
|
146 | 82 | static void (* dmavector[])(void) IDATA_ATTR =
|
147 | 83 | {
|
148 | | - INT_DMAC0C0,INT_DMAC0C1,INT_DMAC0C2,INT_DMAC0C3,INT_DMAC0C4,INT_DMAC0C5,INT_DMAC0C6,INT_DMAC0C7,
|
149 | | - INT_DMAC1C0,INT_DMAC1C1,INT_DMAC1C2,INT_DMAC1C3,INT_DMAC1C4,INT_DMAC1C5,INT_DMAC1C6,INT_DMAC1C7
|
| 84 | + INT_DMAC0C0,INT_DMAC0C1,INT_DMAC0C2,INT_DMAC0C3,INT_DMAC0C4,INT_DMAC0C5,INT_DMAC0C6,INT_DMAC0C7
|
150 | 85 | };
|
151 | 86 |
|
152 | 87 | void INT_DMAC0(void) ICODE_ATTR;
|
— | — | @@ -162,52 +97,28 @@ |
163 | 98 | if (intsts & 0x80) dmavector[7]();
|
164 | 99 | }
|
165 | 100 |
|
166 | | -void INT_DMAC1(void) ICODE_ATTR;
|
167 | | -void INT_DMAC1()
|
168 | | -{
|
169 | | - uint32_t intsts = DMAC1INTSTS;
|
170 | | - if (intsts & 1) dmavector[8]();
|
171 | | - if (intsts & 2) dmavector[9]();
|
172 | | - if (intsts & 4) dmavector[10]();
|
173 | | - if (intsts & 8) dmavector[11]();
|
174 | | - if (intsts & 0x10) dmavector[12]();
|
175 | | - if (intsts & 0x20) dmavector[13]();
|
176 | | - if (intsts & 0x40) dmavector[14]();
|
177 | | - if (intsts & 0x80) dmavector[15]();
|
178 | | -}
|
179 | | -
|
180 | 101 | static void (* irqvector[])(void) IDATA_ATTR =
|
181 | 102 | {
|
182 | 103 | INT_IRQ0,INT_IRQ1,INT_IRQ2,INT_IRQ3,INT_IRQ4,INT_IRQ5,INT_IRQ6,INT_IRQ7,
|
183 | 104 | INT_TIMER,INT_IRQ9,INT_IRQ10,INT_IRQ11,INT_IRQ12,INT_IRQ13,INT_IRQ14,INT_IRQ15,
|
184 | 105 | INT_DMAC0,INT_DMAC1,INT_IRQ18,INT_USB_FUNC,INT_IRQ20,INT_IRQ21,INT_IRQ22,INT_IRQ23,
|
185 | | - INT_IRQ24,INT_IRQ25,INT_IRQ26,INT_IRQ27,INT_IRQ28,INT_IRQ29,INT_IRQ30,INT_IRQ31,
|
186 | | - INT_IRQ32,INT_IRQ33,INT_IRQ34,INT_IRQ35,INT_IRQ36,INT_IRQ37,INT_IRQ38,INT_IRQ39,
|
187 | | - INT_IRQ40,INT_IRQ41,INT_IRQ42,INT_IRQ43,INT_IRQ55,INT_IRQ56,INT_IRQ57,INT_IRQ58,
|
188 | | - INT_IRQ48,INT_IRQ49,INT_IRQ50,INT_IRQ51,INT_IRQ52,INT_IRQ53,INT_IRQ54,INT_IRQ55,
|
189 | | - INT_IRQ56,INT_IRQ57,INT_IRQ58,INT_IRQ59,INT_IRQ60,INT_IRQ61,INT_IRQ62,INT_IRQ63
|
| 106 | + INT_IRQ24,INT_IRQ25,INT_IRQ26,INT_IRQ27,INT_IRQ28,INT_IRQ29,INT_IRQ30,INT_IRQ31
|
190 | 107 | };
|
191 | 108 |
|
192 | 109 | void irqhandler(void)
|
193 | 110 | {
|
194 | 111 | void* dummy = VIC0ADDRESS;
|
195 | | - dummy = VIC1ADDRESS;
|
196 | 112 | uint32_t irqs0 = VIC0IRQSTATUS;
|
197 | | - uint32_t irqs1 = VIC1IRQSTATUS;
|
198 | 113 | for (current_irq = 0; irqs0; current_irq++, irqs0 >>= 1)
|
199 | 114 | if (irqs0 & 1)
|
200 | 115 | irqvector[current_irq]();
|
201 | | - for (current_irq = 32; irqs1; current_irq++, irqs1 >>= 1)
|
202 | | - if (irqs1 & 1)
|
203 | | - irqvector[current_irq]();
|
204 | 116 | VIC0ADDRESS = NULL;
|
205 | | - VIC1ADDRESS = NULL;
|
206 | 117 | }
|
207 | 118 |
|
208 | 119 | void interrupt_enable(int irq, bool state)
|
209 | 120 | {
|
210 | | - if (state) VICINTENABLE(irq >> 5) = 1 << (irq & 0x1f);
|
211 | | - else VICINTENCLEAR(irq >> 5) = 1 << (irq & 0x1f);
|
| 121 | + if (state) VICINTENABLE(0) = 1 << irq;
|
| 122 | + else VICINTENCLEAR(0) = 1 << irq;
|
212 | 123 | }
|
213 | 124 |
|
214 | 125 | void interrupt_set_handler(int irq, void* handler)
|
— | — | @@ -216,12 +127,6 @@ |
217 | 128 | else irqvector[irq] = unhandled_irq;
|
218 | 129 | }
|
219 | 130 |
|
220 | | -void int_timer_set_handler(int timer, void* handler)
|
221 | | -{
|
222 | | - if (handler) timervector[timer] = handler;
|
223 | | - else timervector[timer] = unhandled_irq;
|
224 | | -}
|
225 | | -
|
226 | 131 | void int_dma_set_handler(int channel, void* handler)
|
227 | 132 | {
|
228 | 133 | if (handler) dmavector[channel] = handler;
|
— | — | @@ -231,11 +136,9 @@ |
232 | 137 | void interrupt_init(void)
|
233 | 138 | {
|
234 | 139 | VIC0INTENABLE = 1 << IRQ_DMAC0;
|
235 | | - VIC0INTENABLE = 1 << IRQ_DMAC1;
|
236 | 140 | }
|
237 | 141 |
|
238 | 142 | void interrupt_shutdown(void)
|
239 | 143 | {
|
240 | 144 | VIC0INTENCLEAR = 0xffffffff;
|
241 | | - VIC1INTENCLEAR = 0xffffffff;
|
242 | 145 | }
|
Index: umsboot/lcdconsole.c |
— | — | @@ -88,11 +88,6 @@ |
89 | 89 | while (*string) lcdconsole_putc_noblit(*string++, fgcolor, bgcolor);
|
90 | 90 | }
|
91 | 91 |
|
92 | | -void lcdconsole_write_noblit(const char* string, size_t length, int fgcolor, int bgcolor)
|
93 | | -{
|
94 | | - while (length--) lcdconsole_putc_noblit(*string++, fgcolor, bgcolor);
|
95 | | -}
|
96 | | -
|
97 | 92 | void lcdconsole_update()
|
98 | 93 | {
|
99 | 94 | uint32_t mode = enter_critical_section();
|
— | — | @@ -110,12 +105,6 @@ |
111 | 106 | framebuf, 0);
|
112 | 107 | }
|
113 | 108 |
|
114 | | -void lcdconsole_putc(char string, int fgcolor, int bgcolor)
|
115 | | -{
|
116 | | - lcdconsole_putc_noblit(string, fgcolor, bgcolor);
|
117 | | - lcdconsole_update();
|
118 | | -}
|
119 | | -
|
120 | 109 | void lcdconsole_puts(const char* string, int fgcolor, int bgcolor)
|
121 | 110 | {
|
122 | 111 | while (*string) lcdconsole_putc_noblit(*string++, fgcolor, bgcolor);
|
— | — | @@ -122,12 +111,6 @@ |
123 | 112 | lcdconsole_update();
|
124 | 113 | }
|
125 | 114 |
|
126 | | -void lcdconsole_write(const char* string, size_t length, int fgcolor, int bgcolor)
|
127 | | -{
|
128 | | - while (length--) lcdconsole_putc_noblit(*string++, fgcolor, bgcolor);
|
129 | | - lcdconsole_update();
|
130 | | -}
|
131 | | -
|
132 | 115 | void lcdconsole_callback()
|
133 | 116 | {
|
134 | 117 | if (lcdconsole_needs_update)
|
— | — | @@ -140,23 +123,3 @@ |
141 | 124 | lcdconsole_needs_update = false;
|
142 | 125 | }
|
143 | 126 | }
|
144 | | -
|
145 | | -int lcdconsole_get_current_x()
|
146 | | -{
|
147 | | - return (current_col + 1) * FONT_WIDTH + OFFSETX;
|
148 | | -}
|
149 | | -
|
150 | | -int lcdconsole_get_current_y()
|
151 | | -{
|
152 | | - return current_row * FONT_HEIGHT + OFFSETY;
|
153 | | -}
|
154 | | -
|
155 | | -int lcdconsole_get_lineend_x()
|
156 | | -{
|
157 | | - return LCDCONSOLE_COLS * FONT_WIDTH + OFFSETX - 1;
|
158 | | -}
|
159 | | -
|
160 | | -int lcdconsole_get_lineend_y()
|
161 | | -{
|
162 | | - return (current_row + 1) * FONT_HEIGHT + OFFSETY - 1;
|
163 | | -}
|