Index: emcore/trunk/drawing.S |
— | — | @@ -157,8 +157,8 @@ |
158 | 158 | bne renderchar_x
|
159 | 159 | ldmfd sp!, {r4-r9,pc}
|
160 | 160 |
|
| 161 | +renderchar_native:
|
161 | 162 | #if (LCD_BYTESPERPIXEL == 2)
|
162 | | -renderchar_native:
|
163 | 163 | stmfd sp!, {r4-r7,lr}
|
164 | 164 | ldr r7, [sp,#0x14]
|
165 | 165 | cmn r2, #1
|
— | — | @@ -224,8 +224,49 @@ |
225 | 225 | add r0, r0, #2
|
226 | 226 | ldmfd sp!, {r4-r7,pc}
|
227 | 227 | #else
|
| 228 | +#if (LCD_BYTESPERPIXEL == 4)
|
| 229 | +
|
| 230 | + stmfd sp!, {r4-r7,lr}
|
| 231 | + ldr r7, [sp,#0x14]
|
| 232 | + cmn r2, #1
|
| 233 | + beq renderchar_native_nobg
|
| 234 | + mov r6, r0
|
| 235 | + mov r4, #8
|
| 236 | +renderchar_native_opaquerow:
|
| 237 | + mov r5, #6
|
| 238 | +renderchar_native_opaquecol:
|
| 239 | + str r2, [r6], #4
|
| 240 | + subs r5, r5, #1
|
| 241 | + bne renderchar_native_opaquecol
|
| 242 | + add r6, r6, r7,lsl#1
|
| 243 | + sub r6, r6, #12
|
| 244 | + subs r4, r4, #1
|
| 245 | + bne renderchar_native_opaquerow
|
| 246 | +renderchar_native_nobg:
|
| 247 | + adr r5, renderchar_font
|
| 248 | + sub r3, r3, #0x20
|
| 249 | + cmp r3, #0x5f
|
| 250 | + addcc r5, r3,lsl#2
|
| 251 | + addcc r5, r3
|
| 252 | + mov r3, #5
|
| 253 | +renderchar_native_col:
|
| 254 | + mov r6, r0
|
| 255 | + ldrb r4, [r5], #1
|
| 256 | +renderchar_native_row:
|
| 257 | + tst r4, #1
|
| 258 | + strne r1, [r6]
|
| 259 | + add r6, r6, r7,lsl#2
|
| 260 | + movs r4, r4,lsr#1
|
| 261 | + bne renderchar_native_row
|
| 262 | + add r0, r0, #4
|
| 263 | + subs r3, r3, #1
|
| 264 | + bne renderchar_native_col
|
| 265 | + add r0, r0, #4
|
| 266 | + ldmfd sp!, {r4-r7,pc}
|
| 267 | +#else
|
228 | 268 | #error Unknown number of bytes per pixel!
|
229 | 269 | #endif
|
| 270 | +#endif
|
230 | 271 |
|
231 | 272 | renderchar_font:
|
232 | 273 | .byte 0, 0, 0, 0, 0
|
Index: emcore/trunk/TARGETS |
— | — | @@ -2,3 +2,4 @@ |
3 | 3 | ipodnano3g
|
4 | 4 | ipodnano4g
|
5 | 5 | ipodclassic
|
| 6 | +ipodtouch2g
|
Index: emcore/trunk/target/ipodtouch2g/lcd.c |
— | — | @@ -0,0 +1,156 @@ |
| 2 | +// |
| 3 | +// |
| 4 | +// Copyright 2011 TheSeven |
| 5 | +// |
| 6 | +// |
| 7 | +// This file is part of emCORE. |
| 8 | +// |
| 9 | +// emCORE is free software: you can redistribute it and/or |
| 10 | +// modify it under the terms of the GNU General Public License as |
| 11 | +// published by the Free Software Foundation, either version 2 of the |
| 12 | +// License, or (at your option) any later version. |
| 13 | +// |
| 14 | +// emCORE is distributed in the hope that it will be useful, |
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 17 | +// See the GNU General Public License for more details. |
| 18 | +// |
| 19 | +// You should have received a copy of the GNU General Public License along |
| 20 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>. |
| 21 | +// |
| 22 | +// |
| 23 | + |
| 24 | + |
| 25 | +#include "global.h" |
| 26 | +#include "thread.h" |
| 27 | +#include "util.h" |
| 28 | +#include "lcd.h" |
| 29 | + |
| 30 | + |
| 31 | +static struct mutex lcd_mutex IDATA_ATTR; |
| 32 | +#define fb ((uint32_t*)0x0fc00000) |
| 33 | + |
| 34 | + |
| 35 | +void lcd_init() |
| 36 | +{ |
| 37 | + mutex_init(&lcd_mutex); |
| 38 | +} |
| 39 | + |
| 40 | +int lcd_get_width() |
| 41 | +{ |
| 42 | + return LCD_WIDTH; |
| 43 | +} |
| 44 | + |
| 45 | +int lcd_get_height() |
| 46 | +{ |
| 47 | + return LCD_HEIGHT; |
| 48 | +} |
| 49 | + |
| 50 | +int lcd_get_bytes_per_pixel() |
| 51 | +{ |
| 52 | + return LCD_BYTESPERPIXEL; |
| 53 | +} |
| 54 | + |
| 55 | +int lcd_get_format() |
| 56 | +{ |
| 57 | + return LCD_FORMAT; |
| 58 | +} |
| 59 | + |
| 60 | +void lcd_shutdown() |
| 61 | +{ |
| 62 | +} |
| 63 | + |
| 64 | +bool displaylcd_busy() ICODE_ATTR; |
| 65 | +bool displaylcd_busy() |
| 66 | +{ |
| 67 | + return false; |
| 68 | +} |
| 69 | + |
| 70 | +void displaylcd_sync() ICODE_ATTR; |
| 71 | +void displaylcd_sync() |
| 72 | +{ |
| 73 | +} |
| 74 | + |
| 75 | +void displaylcd_native(unsigned int startx, unsigned int endx, |
| 76 | + unsigned int starty, unsigned int endy, void* data) |
| 77 | +{ |
| 78 | + mutex_lock(&lcd_mutex, TIMEOUT_BLOCK); |
| 79 | + displaylcd_safe_native(startx, endx, starty, endy, data); |
| 80 | + mutex_unlock(&lcd_mutex); |
| 81 | +} |
| 82 | + |
| 83 | +void displaylcd_safe_native(unsigned int startx, unsigned int endx, |
| 84 | + unsigned int starty, unsigned int endy, void* data) |
| 85 | +{ |
| 86 | + int pixels = (endx - startx + 1) * (endy - starty + 1); |
| 87 | + if (pixels <= 0) return; |
| 88 | + uint32_t* ptr = &fb[starty * LCD_WIDTH + startx]; |
| 89 | + int rows = endy - starty + 1; |
| 90 | + int rowsize = (endx - startx + 1) * 4; |
| 91 | + while (rows--) |
| 92 | + { |
| 93 | + memcpy(ptr, data, rowsize); |
| 94 | + ptr += LCD_WIDTH; |
| 95 | + data += rowsize; |
| 96 | + } |
| 97 | +} |
| 98 | + |
| 99 | +void filllcd_native(unsigned int startx, unsigned int endx, |
| 100 | + unsigned int starty, unsigned int endy, int color) |
| 101 | +{ |
| 102 | + int pixels = (endx - startx + 1) * (endy - starty + 1); |
| 103 | + if (pixels <= 0) return; |
| 104 | + uint32_t* ptr = &fb[starty * LCD_WIDTH + startx]; |
| 105 | + int rows = endy - starty + 1; |
| 106 | + int rowsize = (endx - startx + 1) * 4; |
| 107 | + while (rows--) |
| 108 | + { |
| 109 | + int i; |
| 110 | + for (i = 0; i < rowsize; i += 4) fb[i] = color; |
| 111 | + ptr += LCD_WIDTH; |
| 112 | + } |
| 113 | + mutex_unlock(&lcd_mutex); |
| 114 | +} |
| 115 | + |
| 116 | +void displaylcd(unsigned int x, unsigned int y, unsigned int width, unsigned int height, |
| 117 | + void* data, unsigned int datax, unsigned int datay, unsigned int stride) |
| 118 | +{ |
| 119 | + if (width * height <= 0) return; |
| 120 | + mutex_lock(&lcd_mutex, TIMEOUT_BLOCK); |
| 121 | + uint32_t* ptr = &fb[y * LCD_WIDTH + x]; |
| 122 | + uint8_t* inptr = &((uint8_t*)data)[datay * stride + datax]; |
| 123 | + int rowsize = stride * 3; |
| 124 | + while (height--) |
| 125 | + { |
| 126 | + int pixels = width; |
| 127 | + uint8_t* ip = inptr; |
| 128 | + uint32_t* op = ptr; |
| 129 | + while (pixels--) |
| 130 | + { |
| 131 | + uint32_t value = *ip++ << 16; |
| 132 | + value |= *ip++ << 8; |
| 133 | + value |= *ip++; |
| 134 | + *op++ = value; |
| 135 | + } |
| 136 | + inptr += rowsize; |
| 137 | + ptr += LCD_WIDTH; |
| 138 | + } |
| 139 | + mutex_unlock(&lcd_mutex); |
| 140 | +} |
| 141 | + |
| 142 | +void filllcd(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int color) |
| 143 | +{ |
| 144 | + filllcd_native(x, y, width, height, color); |
| 145 | +} |
| 146 | + |
| 147 | +int lcd_translate_color(uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue) |
| 148 | + ICODE_ATTR __attribute__((naked, noinline)); |
| 149 | +int lcd_translate_color(uint8_t alpha, uint8_t red, uint8_t green, uint8_t blue) |
| 150 | +{ |
| 151 | + asm volatile( |
| 152 | + "orr r0, r3, r0,lsl#24 \n\t" |
| 153 | + "orr r1, r2, r1,lsl#8 \n\t" |
| 154 | + "orr r0, r0, r1,lsl#8 \n\t" |
| 155 | + "mov pc, lr \n\t" |
| 156 | + ); |
| 157 | +} |
Index: emcore/trunk/target/ipodtouch2g/ls.x |
— | — | @@ -0,0 +1,101 @@ |
| 2 | +ENTRY(__start)
|
| 3 | +OUTPUT_FORMAT(elf32-littlearm)
|
| 4 | +OUTPUT_ARCH(arm)
|
| 5 | +STARTUP(build/ipodtouch2g/target/ipodtouch2g/crt0.o)
|
| 6 | +
|
| 7 | +MEMORY
|
| 8 | +{
|
| 9 | + INIT : ORIGIN = 0x09000000, LENGTH = 0x06b00000
|
| 10 | + SRAM : ORIGIN = 0x22000000, LENGTH = 0x00100000
|
| 11 | + SDRAM : ORIGIN = 0x0fb00000, LENGTH = 0x00100000
|
| 12 | +}
|
| 13 | +
|
| 14 | +SECTIONS
|
| 15 | +{
|
| 16 | + .inithead :
|
| 17 | + {
|
| 18 | + _initheadstart = .;
|
| 19 | + _poolstart = .;
|
| 20 | + *(.inithead*)
|
| 21 | + . = ALIGN(0x4);
|
| 22 | + _initheadend = .;
|
| 23 | + } > INIT
|
| 24 | +
|
| 25 | + .sram :
|
| 26 | + {
|
| 27 | + _sramstart = .;
|
| 28 | + KEEP(*(.intvect))
|
| 29 | + *(.intvect)
|
| 30 | + *(.icode*)
|
| 31 | + *(.irodata*)
|
| 32 | + *(.idata*)
|
| 33 | + . = ALIGN(0x4);
|
| 34 | + _sramend = .;
|
| 35 | + } > SRAM AT> INIT
|
| 36 | + _sramsource = LOADADDR(.sram);
|
| 37 | +
|
| 38 | + .sdram :
|
| 39 | + {
|
| 40 | + _sdramstart = .;
|
| 41 | + _poolend = .;
|
| 42 | + *(.text*)
|
| 43 | + *(.glue_7)
|
| 44 | + *(.glue_7t)
|
| 45 | + . = ALIGN(0x4);
|
| 46 | + *(.rodata*)
|
| 47 | + . = ALIGN(0x4);
|
| 48 | + *(.data*)
|
| 49 | + . = ALIGN(0x4);
|
| 50 | + _sdramend = .;
|
| 51 | + } > SDRAM AT> INIT
|
| 52 | + _sdramsource = LOADADDR(.sdram);
|
| 53 | +
|
| 54 | + .init :
|
| 55 | + {
|
| 56 | + _initstart = .;
|
| 57 | + *(.initcode*)
|
| 58 | + *(.initrodata*)
|
| 59 | + *(.initdata*)
|
| 60 | + . = ALIGN(0x4);
|
| 61 | + _initend = .;
|
| 62 | + } > INIT
|
| 63 | +
|
| 64 | + .inittail :
|
| 65 | + {
|
| 66 | + _inittailstart = .;
|
| 67 | + *(.inittail*)
|
| 68 | + . = ALIGN(0x4);
|
| 69 | + _inittailend = .;
|
| 70 | + } > INIT
|
| 71 | +
|
| 72 | + .ibss (NOLOAD) :
|
| 73 | + {
|
| 74 | + _ibssstart = .;
|
| 75 | + *(.ibss*)
|
| 76 | + . = ALIGN(0x4);
|
| 77 | + _abortstackstart = .;
|
| 78 | + . += 0x400;
|
| 79 | + _abortstackend = .;
|
| 80 | + _irqstackstart = .;
|
| 81 | + . += 0x400;
|
| 82 | + _irqstackend = .;
|
| 83 | + *(.stack*)
|
| 84 | + . = ALIGN(0x4);
|
| 85 | + _ibssend = .;
|
| 86 | + } > SRAM
|
| 87 | +
|
| 88 | + .bss (NOLOAD) :
|
| 89 | + {
|
| 90 | + _bssstart = .;
|
| 91 | + *(.bss*)
|
| 92 | + *(COMMON)
|
| 93 | + . = ALIGN(0x4);
|
| 94 | + _bssend = .;
|
| 95 | + } > SDRAM
|
| 96 | +
|
| 97 | + /DISCARD/ :
|
| 98 | + {
|
| 99 | + *(.eh_frame)
|
| 100 | + }
|
| 101 | +
|
| 102 | +}
|
Index: emcore/trunk/target/ipodtouch2g/crt0.S |
— | — | @@ -0,0 +1,305 @@ |
| 2 | +@
|
| 3 | +@
|
| 4 | +@ Copyright 2010 TheSeven
|
| 5 | +@
|
| 6 | +@
|
| 7 | +@ This file is part of emCORE.
|
| 8 | +@
|
| 9 | +@ emCORE is free software: you can redistribute it and/or
|
| 10 | +@ modify it under the terms of the GNU General Public License as
|
| 11 | +@ published by the Free Software Foundation, either version 2 of the
|
| 12 | +@ License, or (at your option) any later version.
|
| 13 | +@
|
| 14 | +@ emCORE is distributed in the hope that it will be useful,
|
| 15 | +@ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +@ See the GNU General Public License for more details.
|
| 18 | +@
|
| 19 | +@ You should have received a copy of the GNU General Public License
|
| 20 | +@ along with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +@
|
| 22 | +@
|
| 23 | +
|
| 24 | +
|
| 25 | +.section .intvect,"ax",%progbits
|
| 26 | + ldr pc, =reset_handler
|
| 27 | + ldr pc, =undef_instr_handler
|
| 28 | + ldr pc, =syscall_handler
|
| 29 | + ldr pc, =prefetch_abort_handler
|
| 30 | + ldr pc, =data_abort_handler
|
| 31 | + ldr pc, =reserved_handler
|
| 32 | + ldr pc, =irq_handler
|
| 33 | + ldr pc, =fiq_handler
|
| 34 | +.ltorg
|
| 35 | +
|
| 36 | +
|
| 37 | +.section .inithead,"ax",%progbits
|
| 38 | +.global __start
|
| 39 | +__start:
|
| 40 | + b _start
|
| 41 | +
|
| 42 | +.section .initcode,"ax",%progbits
|
| 43 | +.global _start
|
| 44 | +_start:
|
| 45 | + ldr r0, =0x00450878
|
| 46 | + mcr p15, 0, r0,c1,c0,0
|
| 47 | + ldr r0, =_sramsource
|
| 48 | + ldr r1, =_sramstart
|
| 49 | + ldr r2, =_sramend
|
| 50 | +.copysram:
|
| 51 | + cmp r2, r1
|
| 52 | + ldrhi r3, [r0], #4
|
| 53 | + strhi r3, [r1], #4
|
| 54 | + bhi .copysram
|
| 55 | + ldr r0, =_sdramsource
|
| 56 | + ldr r1, =_sdramstart
|
| 57 | + ldr r2, =_sdramend
|
| 58 | +.copysdram:
|
| 59 | + cmp r2, r1
|
| 60 | + ldrhi r3, [r0], #4
|
| 61 | + strhi r3, [r1], #4
|
| 62 | + bhi .copysdram
|
| 63 | + ldr r0, =_ibssstart
|
| 64 | + ldr r1, =_ibssend
|
| 65 | + mov r2, #0
|
| 66 | +.clearibss:
|
| 67 | + cmp r1, r0
|
| 68 | + strhi r2, [r0], #4
|
| 69 | + bhi .clearibss
|
| 70 | + ldr r0, =_bssstart
|
| 71 | + ldr r1, =_bssend
|
| 72 | +.clearbss:
|
| 73 | + cmp r1, r0
|
| 74 | + strhi r2, [r0], #4
|
| 75 | + bhi .clearbss
|
| 76 | + ldr r1, =0x38200000
|
| 77 | + ldr r0, [r1]
|
| 78 | + orr r0, r0, #1
|
| 79 | + bic r0, r0, #0x10000
|
| 80 | + str r0, [r1]
|
| 81 | + mov r0, #0
|
| 82 | + mcr p15, 0, r0,c7,c5,0
|
| 83 | + add r1, r1, #0x00c00000
|
| 84 | + add r2, r1, #0x00001000
|
| 85 | + add r3, r1, #0x00002000
|
| 86 | + sub r4, r0, #1
|
| 87 | + str r4, [r1,#0x14]
|
| 88 | + str r4, [r2,#0x14]
|
| 89 | + str r4, [r1,#0xf00]
|
| 90 | + str r4, [r2,#0xf00]
|
| 91 | + str r4, [r3,#0x08]
|
| 92 | + str r4, [r3,#0x0c]
|
| 93 | + str r0, [r1,#0x14]
|
| 94 | + str r0, [r2,#0x14]
|
| 95 | + mov r0, #0
|
| 96 | + ldr r1, =0x3c500000
|
| 97 | + str r0, [r1,#0x48]
|
| 98 | + str r0, [r1,#0x4c]
|
| 99 | + msr cpsr_c, #0xd2
|
| 100 | + ldr sp, =_irqstackend
|
| 101 | + msr cpsr_c, #0xd7
|
| 102 | + ldr sp, =_abortstackend
|
| 103 | + msr cpsr_c, #0xdb
|
| 104 | + ldr sp, =_abortstackend
|
| 105 | + msr cpsr_c, #0x1f
|
| 106 | + ldr sp, =_abortstackend
|
| 107 | + bl init
|
| 108 | + bl yield
|
| 109 | + mov r0, #0
|
| 110 | + ldr pc, =idleloop
|
| 111 | +.ltorg
|
| 112 | +
|
| 113 | +
|
| 114 | +.section .icode, "ax", %progbits
|
| 115 | +.align 2
|
| 116 | +idleloop:
|
| 117 | + mcr p15, 0, r0,c7,c0,4
|
| 118 | + b idleloop
|
| 119 | +
|
| 120 | +.global reset
|
| 121 | +.global hang
|
| 122 | +.type reset, %function
|
| 123 | +.type hang, %function
|
| 124 | +reset:
|
| 125 | + msr cpsr_c, #0xd3
|
| 126 | + mov r0, #0x100000
|
| 127 | + mov r1, #0x3c800000
|
| 128 | + str r0, [r1]
|
| 129 | +hang:
|
| 130 | + msr cpsr_c, #0xd3
|
| 131 | + mcr p15, 0, r0,c7,c0,4
|
| 132 | + b hang
|
| 133 | +.size reset, .-reset
|
| 134 | +.size hang, .-hang
|
| 135 | +
|
| 136 | +.type reset_handler, %function
|
| 137 | +reset_handler:
|
| 138 | + stmfd sp, {r10-r12}
|
| 139 | + mov r10, sp
|
| 140 | + mov r11, lr
|
| 141 | + mrs r12, cpsr
|
| 142 | + msr cpsr_c, #0xd7
|
| 143 | + sub sp, sp, #0x44
|
| 144 | + stmia sp!, {r0-r9}
|
| 145 | + sub r0, r10, #0xc
|
| 146 | + ldmia r0, {r0-r2}
|
| 147 | + mov r3, r10
|
| 148 | + mov r4, r11
|
| 149 | + mov r5, r11
|
| 150 | + mov r6, r12
|
| 151 | + stmia sp!, {r0-r6}
|
| 152 | + sub sp, sp, #0x44
|
| 153 | + mov r0, #0
|
| 154 | + adr r1, reset_text
|
| 155 | + mov r2, r11
|
| 156 | + b panic
|
| 157 | +.size reset_handler, .-reset_handler
|
| 158 | +
|
| 159 | +.global undef_instr_handler
|
| 160 | +.type undef_instr_handler, %function
|
| 161 | +undef_instr_handler:
|
| 162 | + sub sp, sp, #0x44
|
| 163 | + stmia sp!, {r0-r12}
|
| 164 | + sub r2, lr, #4
|
| 165 | + mrs r3, spsr
|
| 166 | + mrs r4, cpsr
|
| 167 | + orr r0, r3, #0xc0
|
| 168 | + msr cpsr_c, r0
|
| 169 | + mov r0, sp
|
| 170 | + mov r1, lr
|
| 171 | + msr cpsr_c, r4
|
| 172 | + stmia sp!, {r0-r3}
|
| 173 | + sub sp, sp, #0x44
|
| 174 | + mov r0, #0
|
| 175 | + adr r1, undef_instr_text
|
| 176 | + ldr r3, [r2]
|
| 177 | + b panicf
|
| 178 | +.size undef_instr_handler, .-undef_instr_handler
|
| 179 | +
|
| 180 | +.type prefetch_abort_handler, %function
|
| 181 | +prefetch_abort_handler:
|
| 182 | + sub sp, sp, #0x44
|
| 183 | + stmia sp!, {r0-r12}
|
| 184 | + sub r2, lr, #4
|
| 185 | + mrs r3, spsr
|
| 186 | + mrs r4, cpsr
|
| 187 | + orr r0, r3, #0xc0
|
| 188 | + msr cpsr_c, r0
|
| 189 | + mov r0, sp
|
| 190 | + mov r1, lr
|
| 191 | + msr cpsr_c, r4
|
| 192 | + stmia sp!, {r0-r3}
|
| 193 | + sub sp, sp, #0x44
|
| 194 | + mov r0, #0
|
| 195 | + adr r1, prefetch_abort_text
|
| 196 | + mrc p15, 0, r3,c5,c0,1
|
| 197 | + mov r4, r3,lsr#4
|
| 198 | + and r4, r4, #0xf
|
| 199 | + and r5, r3, #0xf
|
| 200 | + stmfd sp!, {r4-r5}
|
| 201 | + b panicf
|
| 202 | +.size prefetch_abort_handler, .-prefetch_abort_handler
|
| 203 | +
|
| 204 | +.type data_abort_handler, %function
|
| 205 | +data_abort_handler:
|
| 206 | + sub sp, sp, #0x44
|
| 207 | + stmia sp!, {r0-r12}
|
| 208 | + sub r2, lr, #8
|
| 209 | + mrs r3, spsr
|
| 210 | + mrs r4, cpsr
|
| 211 | + orr r0, r3, #0xc0
|
| 212 | + msr cpsr_c, r0
|
| 213 | + mov r0, sp
|
| 214 | + mov r1, lr
|
| 215 | + msr cpsr_c, r4
|
| 216 | + stmia sp!, {r0-r3}
|
| 217 | + sub sp, sp, #0x44
|
| 218 | + mov r0, #0
|
| 219 | + adr r1, data_abort_text
|
| 220 | + mrc p15, 0, r3,c5,c0
|
| 221 | + mov r4, r3,lsr#4
|
| 222 | + and r4, r4, #0xf
|
| 223 | + and r5, r3, #0xf
|
| 224 | + mrc p15, 0, r6,c6,c0
|
| 225 | + stmfd sp!, {r4-r6}
|
| 226 | + b panicf
|
| 227 | +.size data_abort_handler, .-data_abort_handler
|
| 228 | +
|
| 229 | +.type reserved_handler, %function
|
| 230 | +reserved_handler:
|
| 231 | + stmfd sp, {r10-r12}
|
| 232 | + mov r10, sp
|
| 233 | + mov r11, lr
|
| 234 | + mrs r12, cpsr
|
| 235 | + msr cpsr_c, #0xd7
|
| 236 | + sub sp, sp, #0x44
|
| 237 | + stmia sp!, {r0-r9}
|
| 238 | + sub r0, r10, #0xc
|
| 239 | + ldmia r0, {r0-r2}
|
| 240 | + mov r3, r10
|
| 241 | + mov r4, r11
|
| 242 | + mov r5, r11
|
| 243 | + mov r6, r12
|
| 244 | + stmia sp!, {r0-r6}
|
| 245 | + sub sp, sp, #0x44
|
| 246 | + mov r0, #0
|
| 247 | + adr r1, reserved_text
|
| 248 | + mov r2, r11
|
| 249 | + b panic
|
| 250 | +.size reserved_handler, .-reserved_handler
|
| 251 | +
|
| 252 | +.type fiq_handler, %function
|
| 253 | +fiq_handler:
|
| 254 | + mov r0, #2
|
| 255 | + adr r1, fiq_text
|
| 256 | + b panic
|
| 257 | +.size fiq_handler, .-fiq_handler
|
| 258 | +
|
| 259 | +prefetch_abort_text:
|
| 260 | + .ascii "Prefetch abort at %08X!\nFSR: %08X (domain %d, fault %d)\0"
|
| 261 | +
|
| 262 | +reset_text:
|
| 263 | + .ascii "Hit reset vector!\n(Last known PC: %08X)\0"
|
| 264 | +
|
| 265 | +undef_instr_text:
|
| 266 | + .ascii "Undefined instruction at %08X!\n(Opcode: %08X)\0"
|
| 267 | +
|
| 268 | +data_abort_text:
|
| 269 | + .ascii "Data abort at %08X!\nFSR: %08X (domain %d, fault %d)\nAddress: %08X\0"
|
| 270 | +
|
| 271 | +fiq_text:
|
| 272 | + .ascii "Unhandled FIQ!\0"
|
| 273 | +
|
| 274 | +reserved_text:
|
| 275 | + .ascii "Hit reserved exception handler!\n(Last known PC: %08X)\0"
|
| 276 | +
|
| 277 | +syscall_text:
|
| 278 | + .ascii "Unhandled syscall!\0"
|
| 279 | +
|
| 280 | +
|
| 281 | +.section .icode.usec_timer, "ax", %progbits
|
| 282 | +.align 2
|
| 283 | +.global read_native_timer
|
| 284 | +.type read_native_timer, %function
|
| 285 | +read_native_timer:
|
| 286 | + ldr r0, val_3c700000
|
| 287 | + ldr r1, [r0,#0x80]
|
| 288 | + ldr r0, [r0,#0x84]
|
| 289 | + bx lr
|
| 290 | +.size read_native_timer, .-read_native_timer
|
| 291 | +
|
| 292 | +.global read_usec_timer
|
| 293 | +.type read_usec_timer, %function
|
| 294 | +read_usec_timer:
|
| 295 | + ldr r0, val_3c700000
|
| 296 | + ldr r1, [r0,#0x80]
|
| 297 | + ldr r0, [r0,#0x84]
|
| 298 | + mov r0, r0,lsr#5
|
| 299 | + orr r0, r0, r1,lsl#27
|
| 300 | + add r0, r0, r0,asr#2
|
| 301 | + add r0, r0, r0,asr#6
|
| 302 | + bx lr
|
| 303 | +.size read_usec_timer, .-read_usec_timer
|
| 304 | +
|
| 305 | +val_3c700000:
|
| 306 | + .word 0x3c700000
|
Index: emcore/trunk/target/ipodtouch2g/config.h |
— | — | @@ -0,0 +1,40 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2009 TheSeven
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of the Linux4Nano toolkit.
|
| 8 | +//
|
| 9 | +// TheSeven's iBugger is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// TheSeven's iBugger is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with the Linux4Nano toolkit. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#ifndef __CONFIG_H__
|
| 26 | +#define __CONFIG_H__
|
| 27 | +
|
| 28 | +
|
| 29 | +//#define NAND_DEBUG
|
| 30 | +//#define NAND_TRACE
|
| 31 | +//#define VFL_DEBUG
|
| 32 | +//#define VFL_TRACE
|
| 33 | +//#define FTL_DEBUG
|
| 34 | +//#define FTL_TRACE
|
| 35 | +
|
| 36 | +
|
| 37 | +//#define DEBUG_CONSOLES 2
|
| 38 | +//#define DEBUG_PRINT_SOURCE_LINE
|
| 39 | +
|
| 40 | +
|
| 41 | +#endif
|
Index: emcore/trunk/target/ipodtouch2g/target.h |
— | — | @@ -0,0 +1,64 @@ |
| 2 | +//
|
| 3 | +//
|
| 4 | +// Copyright 2010 TheSeven
|
| 5 | +//
|
| 6 | +//
|
| 7 | +// This file is part of emCORE.
|
| 8 | +//
|
| 9 | +// emCORE is free software: you can redistribute it and/or
|
| 10 | +// modify it under the terms of the GNU General Public License as
|
| 11 | +// published by the Free Software Foundation, either version 2 of the
|
| 12 | +// License, or (at your option) any later version.
|
| 13 | +//
|
| 14 | +// emCORE is distributed in the hope that it will be useful,
|
| 15 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
| 17 | +// See the GNU General Public License for more details.
|
| 18 | +//
|
| 19 | +// You should have received a copy of the GNU General Public License along
|
| 20 | +// with emCORE. If not, see <http://www.gnu.org/licenses/>.
|
| 21 | +//
|
| 22 | +//
|
| 23 | +
|
| 24 | +
|
| 25 | +#ifndef __TARGET_H__
|
| 26 | +#define __TARGET_H__
|
| 27 | +
|
| 28 | +
|
| 29 | +#define PLATFORM_ID 0x47325449
|
| 30 | +
|
| 31 | +
|
| 32 | +#define ARM_ARCH 6
|
| 33 | +#define LITTLE_ENDIAN
|
| 34 | +#define CACHEALIGN_BITS 4
|
| 35 | +#define CPU_FREQ 532000000
|
| 36 | +
|
| 37 | +
|
| 38 | +#define CONSOLE_BOOT 3
|
| 39 | +#define CONSOLE_PANIC 3
|
| 40 | +#define CONSOLE_PANICDUMP 0
|
| 41 | +
|
| 42 | +
|
| 43 | +#define HAVE_USB
|
| 44 | +#define USB_NUM_ENDPOINTS 5
|
| 45 | +
|
| 46 | +#define HAVE_LCD
|
| 47 | +#define LCD_WIDTH 320
|
| 48 | +#define LCD_HEIGHT 480
|
| 49 | +#define LCD_FORMAT 0x00721d07 // rgb888
|
| 50 | +#define LCD_BYTESPERPIXEL 4
|
| 51 | +#define LCDCONSOLE_FGCOLOR 0
|
| 52 | +#define LCDCONSOLE_BGCOLOR -1
|
| 53 | +
|
| 54 | +#define HAVE_BACKLIGHT
|
| 55 | +
|
| 56 | +#define HAVE_I2C
|
| 57 | +
|
| 58 | +//#define HAVE_STORAGE
|
| 59 | +//#define HAVE_FLASH_STORAGE
|
| 60 | +//#define HAVE_STORAGE_FLUSH
|
| 61 | +//#define CONFIG_STORAGE STORAGE_NAND
|
| 62 | +//#define SECTOR_SIZE 4096
|
| 63 | +
|
| 64 | +
|
| 65 | +#endif
|
Index: emcore/trunk/target/ipodtouch2g/target.mk |
— | — | @@ -0,0 +1 @@ |
| 2 | +CFLAGS_ipodtouch2g += -mcpu=arm1136j-s
|
Index: emcore/trunk/SOURCES |
— | — | @@ -59,6 +59,19 @@ |
60 | 60 | target/ipodclassic/usbtarget.c
|
61 | 61 | #endif
|
62 | 62 |
|
| 63 | +#ifdef TARGET_ipodtouch2g
|
| 64 | +target/ipodnano4g/mmu.c
|
| 65 | +target/ipodnano4g/timer.c
|
| 66 | +target/ipodnano4g/i2c.S
|
| 67 | +target/ipodnano4g/interrupt.c
|
| 68 | +target/ipodnano4g/power.c
|
| 69 | +target/ipodnano4g/accel.c
|
| 70 | +target/ipodnano4g/backlight.c
|
| 71 | +target/ipodnano4g/clockgates.c
|
| 72 | +target/ipodtouch2g/lcd.c
|
| 73 | +usb/synopsysotg.c
|
| 74 | +#endif
|
| 75 | +
|
63 | 76 | #ifdef ARM_ARCH
|
64 | 77 | arm/arm-support.S
|
65 | 78 | arm/contextswitch.S
|
Index: emcore/trunk/usb/synopsysotg.h |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | #if defined(TARGET_ipodnano3g) || defined(TARGET_ipodclassic)
|
36 | 36 | #include "target/ipodnano3g/s5l8702.h"
|
37 | 37 | #endif
|
38 | | -#ifdef TARGET_ipodnano4g
|
| 38 | +#if defined(TARGET_ipodnano4g) || defined(TARGET_ipodtouch2g)
|
39 | 39 | #include "target/ipodnano4g/s5l8720.h"
|
40 | 40 | #endif
|
41 | 41 |
|