freemyipod r515 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r514‎ | r515 | r516 >
Date:22:08, 4 February 2011
Author:theseven
Status:new
Tags:
Comment:
UMSboot: Remove some unused things to make it compile for ipodclassic with the Rockbox toolchain
Modified paths:
  • /umsboot/drawing.S (modified) (history)
  • /umsboot/lcdconsole.c (modified) (history)
  • /umsboot/target/ipodclassic/interrupt.c (modified) (history)

Diff [purge]

Index: umsboot/drawing.S
@@ -25,26 +25,6 @@
2626 #include "global.h"
2727
2828
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 -
4929 .section .icode.rendertext, "ax", %progbits
5030 .align 2
5131 .global rendertext
@@ -69,88 +49,7 @@
7050 .size rendertext, .-rendertext
7151
7252
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 -
11253 #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 -
15554 .section .icode.renderchar, "ax", %progbits
15655 .align 2
15756 .global renderchar
Index: umsboot/target/ipodclassic/interrupt.c
@@ -37,14 +37,7 @@
3838 default_interrupt(INT_IRQ5);
3939 default_interrupt(INT_IRQ6);
4040 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);
4942 default_interrupt(INT_IRQ9);
5043 default_interrupt(INT_IRQ10);
5144 default_interrupt(INT_IRQ11);
@@ -60,14 +53,7 @@
6154 default_interrupt(INT_DMAC0C5);
6255 default_interrupt(INT_DMAC0C6);
6356 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);
7258 default_interrupt(INT_IRQ18);
7359 default_interrupt(INT_USB_FUNC);
7460 default_interrupt(INT_IRQ20);
@@ -82,38 +68,6 @@
8369 default_interrupt(INT_IRQ29);
8470 default_interrupt(INT_IRQ30);
8571 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);
11872
11973
12074 static int current_irq;
@@ -124,28 +78,9 @@
12579 panicf(PANIC_FATAL, "Unhandled IRQ %d!", current_irq);
12680 }
12781
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 -
14682 static void (* dmavector[])(void) IDATA_ATTR =
14783 {
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
15085 };
15186
15287 void INT_DMAC0(void) ICODE_ATTR;
@@ -162,52 +97,28 @@
16398 if (intsts & 0x80) dmavector[7]();
16499 }
165100
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 -
180101 static void (* irqvector[])(void) IDATA_ATTR =
181102 {
182103 INT_IRQ0,INT_IRQ1,INT_IRQ2,INT_IRQ3,INT_IRQ4,INT_IRQ5,INT_IRQ6,INT_IRQ7,
183104 INT_TIMER,INT_IRQ9,INT_IRQ10,INT_IRQ11,INT_IRQ12,INT_IRQ13,INT_IRQ14,INT_IRQ15,
184105 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
190107 };
191108
192109 void irqhandler(void)
193110 {
194111 void* dummy = VIC0ADDRESS;
195 - dummy = VIC1ADDRESS;
196112 uint32_t irqs0 = VIC0IRQSTATUS;
197 - uint32_t irqs1 = VIC1IRQSTATUS;
198113 for (current_irq = 0; irqs0; current_irq++, irqs0 >>= 1)
199114 if (irqs0 & 1)
200115 irqvector[current_irq]();
201 - for (current_irq = 32; irqs1; current_irq++, irqs1 >>= 1)
202 - if (irqs1 & 1)
203 - irqvector[current_irq]();
204116 VIC0ADDRESS = NULL;
205 - VIC1ADDRESS = NULL;
206117 }
207118
208119 void interrupt_enable(int irq, bool state)
209120 {
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;
212123 }
213124
214125 void interrupt_set_handler(int irq, void* handler)
@@ -216,12 +127,6 @@
217128 else irqvector[irq] = unhandled_irq;
218129 }
219130
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 -
226131 void int_dma_set_handler(int channel, void* handler)
227132 {
228133 if (handler) dmavector[channel] = handler;
@@ -231,11 +136,9 @@
232137 void interrupt_init(void)
233138 {
234139 VIC0INTENABLE = 1 << IRQ_DMAC0;
235 - VIC0INTENABLE = 1 << IRQ_DMAC1;
236140 }
237141
238142 void interrupt_shutdown(void)
239143 {
240144 VIC0INTENCLEAR = 0xffffffff;
241 - VIC1INTENCLEAR = 0xffffffff;
242145 }
Index: umsboot/lcdconsole.c
@@ -88,11 +88,6 @@
8989 while (*string) lcdconsole_putc_noblit(*string++, fgcolor, bgcolor);
9090 }
9191
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 -
9792 void lcdconsole_update()
9893 {
9994 uint32_t mode = enter_critical_section();
@@ -110,12 +105,6 @@
111106 framebuf, 0);
112107 }
113108
114 -void lcdconsole_putc(char string, int fgcolor, int bgcolor)
115 -{
116 - lcdconsole_putc_noblit(string, fgcolor, bgcolor);
117 - lcdconsole_update();
118 -}
119 -
120109 void lcdconsole_puts(const char* string, int fgcolor, int bgcolor)
121110 {
122111 while (*string) lcdconsole_putc_noblit(*string++, fgcolor, bgcolor);
@@ -122,12 +111,6 @@
123112 lcdconsole_update();
124113 }
125114
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 -
132115 void lcdconsole_callback()
133116 {
134117 if (lcdconsole_needs_update)
@@ -140,23 +123,3 @@
141124 lcdconsole_needs_update = false;
142125 }
143126 }
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 -}