| Index: embios/trunk/SOURCES | 
| — | — | @@ -6,6 +6,12 @@ | 
| 7 | 7 | target/ipodnano2g/i2c.S | 
| 8 | 8 | #endif | 
| 9 | 9 |  | 
|  | 10 | +#ifdef TARGET_ipodnano4g | 
|  | 11 | +target/ipodnano4g/mmu.c | 
|  | 12 | +target/ipodnano4g/lcd.c | 
|  | 13 | +target/ipodnano4g/storage.c | 
|  | 14 | +#endif | 
|  | 15 | + | 
| 10 | 16 | init.c | 
| 11 | 17 | main.c | 
| 12 | 18 | util.c | 
| — | — | @@ -19,3 +25,4 @@ | 
| 20 | 26 | strlen.c | 
| 21 | 27 | fat32.c | 
| 22 | 28 | ucl.S | 
|  | 29 | + | 
| Index: embios/trunk/target/ipodnano4g/mmu.c | 
| — | — | @@ -0,0 +1,34 @@ | 
|  | 2 | +// | 
|  | 3 | +// | 
|  | 4 | +//    Copyright 2010 TheSeven | 
|  | 5 | +// | 
|  | 6 | +// | 
|  | 7 | +//    This file is part of emBIOS. | 
|  | 8 | +// | 
|  | 9 | +//    emBIOS 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 | +//    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 21 | +// | 
|  | 22 | +// | 
|  | 23 | + | 
|  | 24 | + | 
|  | 25 | +#include "global.h" | 
|  | 26 | +#include "mmu.h" | 
|  | 27 | + | 
|  | 28 | + | 
|  | 29 | +void clean_dcache() | 
|  | 30 | +{ | 
|  | 31 | +} | 
|  | 32 | + | 
|  | 33 | +void invalidate_dcache() | 
|  | 34 | +{ | 
|  | 35 | +} | 
| Index: embios/trunk/target/ipodnano4g/lcd.S | 
| — | — | @@ -0,0 +1,92 @@ | 
|  | 2 | +@ | 
|  | 3 | +@ | 
|  | 4 | +@    Copyright 2010 TheSeven | 
|  | 5 | +@ | 
|  | 6 | +@ | 
|  | 7 | +@    This file is part of emBIOS. | 
|  | 8 | +@ | 
|  | 9 | +@    emBIOS 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 | +@    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 21 | +@ | 
|  | 22 | +@ | 
|  | 23 | + | 
|  | 24 | + | 
|  | 25 | +.section .icode.displaylcd, "ax", %progbits | 
|  | 26 | +.align 2 | 
|  | 27 | +.global displaylcd | 
|  | 28 | +.type displaylcd, %function | 
|  | 29 | +displaylcd: | 
|  | 30 | +	stmfd	sp!, {r0,r1,r4,lr} | 
|  | 31 | +	mov	r12, #0x38000000 | 
|  | 32 | +	orr	r12, r12, #0x300000 | 
|  | 33 | +	mov	r0, #0x2a | 
|  | 34 | +	bl	displaylcd_sendlcdc | 
|  | 35 | +	ldr	r0, [sp] | 
|  | 36 | +	bl	displaylcd_sendlcdd | 
|  | 37 | +	ldr	r0, [sp,#0x04] | 
|  | 38 | +	bl	displaylcd_sendlcdd | 
|  | 39 | +	mov	r0, #0x2b | 
|  | 40 | +	bl	displaylcd_sendlcdc | 
|  | 41 | +	mov	r0, r2 | 
|  | 42 | +	tst	r0, #0x100 | 
|  | 43 | +	eorne	r0, #0x300 | 
|  | 44 | +	bl	displaylcd_sendlcdd | 
|  | 45 | +	mov	r0, r3 | 
|  | 46 | +	tst	r0, #0x100 | 
|  | 47 | +	eorne	r0, #0x300 | 
|  | 48 | +	bl	displaylcd_sendlcdd | 
|  | 49 | +	mov	r0, #0x2c | 
|  | 50 | +	bl	displaylcd_sendlcdc | 
|  | 51 | +	ldmia	sp, {r0,r1} | 
|  | 52 | +	sub	r1, r0 | 
|  | 53 | +	add	r1, r1, #1 | 
|  | 54 | +	sub	r3, r2 | 
|  | 55 | +	add	r3, r3, #1 | 
|  | 56 | +	mul	r2, r1, r3 | 
|  | 57 | +	ldr	r1, [sp,#0x10] | 
|  | 58 | +	cmp	r1, #0x40000000 | 
|  | 59 | +	bne	displaylcd_framebuf | 
|  | 60 | +displaylcd_color: | 
|  | 61 | +	ldr	r0, [sp,#0x14] | 
|  | 62 | +	bl	displaylcd_sendlcdd | 
|  | 63 | +	subs	r2, r2, #1 | 
|  | 64 | +	bne	displaylcd_color | 
|  | 65 | +	ldmfd	sp!, {r4-r6,pc} | 
|  | 66 | +displaylcd_framebuf: | 
|  | 67 | +	ldrh	r0, [r1], #2 | 
|  | 68 | +	bl	displaylcd_sendlcdd | 
|  | 69 | +	subs	r2, r2, #1 | 
|  | 70 | +	bne	displaylcd_framebuf | 
|  | 71 | +	ldmfd	sp!, {r0,r1,r4,pc} | 
|  | 72 | + | 
|  | 73 | +displaylcd_sendlcdc: | 
|  | 74 | +	ldrh	r4, [r12,#0x1c] | 
|  | 75 | +	tst	r4, #0x10 | 
|  | 76 | +	bne	displaylcd_sendlcdc | 
|  | 77 | +	strh	r0, [r12,#0x04] | 
|  | 78 | +	mov	pc, lr | 
|  | 79 | +displaylcd_sendlcdd: | 
|  | 80 | +	ldrh	r4, [r12,#0x1c] | 
|  | 81 | +	tst	r4, #0x10 | 
|  | 82 | +	bne	displaylcd_sendlcdd | 
|  | 83 | +	strh	r0, [r12,#0x40] | 
|  | 84 | +	mov	pc, lr | 
|  | 85 | +.size displaylcd, .-displaylcd | 
|  | 86 | + | 
|  | 87 | +.section .icode.displaylcd_sync, "ax", %progbits | 
|  | 88 | +.align 2 | 
|  | 89 | +.global displaylcd_sync | 
|  | 90 | +.type displaylcd_sync, %function | 
|  | 91 | +displaylcd_sync: | 
|  | 92 | +	mov	pc, lr | 
|  | 93 | +.size displaylcd_sync, .-displaylcd_sync | 
| Index: embios/trunk/target/ipodnano4g/ls.x | 
| — | — | @@ -0,0 +1,101 @@ | 
|  | 2 | +ENTRY(_start) | 
|  | 3 | +OUTPUT_FORMAT(elf32-littlearm) | 
|  | 4 | +OUTPUT_ARCH(arm) | 
|  | 5 | +STARTUP(build/ipodnano4g/target/ipodnano4g/crt0.o) | 
|  | 6 | + | 
|  | 7 | +MEMORY | 
|  | 8 | +{ | 
|  | 9 | +    INIT : ORIGIN = 0x08000000, LENGTH = 0x01f00000 | 
|  | 10 | +    SRAM : ORIGIN = 0x22000000, LENGTH = 0x00030000 | 
|  | 11 | +    SDRAM : ORIGIN = 0x09f00000, LENGTH = 0x00100000 | 
|  | 12 | +} | 
|  | 13 | + | 
|  | 14 | +SECTIONS | 
|  | 15 | +{ | 
|  | 16 | +    .init : { | 
|  | 17 | +        *(.initcode*) | 
|  | 18 | +        *(.initrodata*) | 
|  | 19 | +        *(.initdata*) | 
|  | 20 | +        . = ALIGN(0x4); | 
|  | 21 | +    } > INIT | 
|  | 22 | + | 
|  | 23 | +    .intvect : { | 
|  | 24 | +        _sramstart = .; | 
|  | 25 | +        KEEP(*(.intvect)) | 
|  | 26 | +        *(.intvect) | 
|  | 27 | +    } > SRAM AT> INIT | 
|  | 28 | +    _sramsource = LOADADDR(.intvect); | 
|  | 29 | + | 
|  | 30 | +    .iram : | 
|  | 31 | +    { | 
|  | 32 | +        *(.icode*) | 
|  | 33 | +        *(.irodata*) | 
|  | 34 | +        *(.idata*) | 
|  | 35 | +        . = ALIGN(0x4); | 
|  | 36 | +        _sramend = .; | 
|  | 37 | +    } > SRAM AT> INIT | 
|  | 38 | + | 
|  | 39 | +    .text : | 
|  | 40 | +    { | 
|  | 41 | +        _sdramstart = .; | 
|  | 42 | +        *(.text*) | 
|  | 43 | +        *(.glue_7) | 
|  | 44 | +        *(.glue_7t) | 
|  | 45 | +        . = ALIGN(0x4); | 
|  | 46 | +    } > SDRAM AT> INIT | 
|  | 47 | +    _sdramsource = LOADADDR(.text); | 
|  | 48 | + | 
|  | 49 | +    .rodata : | 
|  | 50 | +    { | 
|  | 51 | +        *(.rodata*) | 
|  | 52 | +        . = ALIGN(0x4); | 
|  | 53 | +    } > SDRAM AT> INIT | 
|  | 54 | + | 
|  | 55 | +    .data : | 
|  | 56 | +    { | 
|  | 57 | +        *(.data*) | 
|  | 58 | +        . = ALIGN(0x4); | 
|  | 59 | +        _sdramend = .; | 
|  | 60 | +    } > SDRAM AT> INIT | 
|  | 61 | + | 
|  | 62 | +    .initbss (NOLOAD) : | 
|  | 63 | +    { | 
|  | 64 | +        _initbssstart = .; | 
|  | 65 | +        *(.initbss*) | 
|  | 66 | +        . = ALIGN(0x4); | 
|  | 67 | +        _initstackstart = .; | 
|  | 68 | +        . += 0x4000; | 
|  | 69 | +        _initstackend = .; | 
|  | 70 | +        _initbssend = .; | 
|  | 71 | +    } > INIT | 
|  | 72 | + | 
|  | 73 | +    .ibss (NOLOAD) : | 
|  | 74 | +    { | 
|  | 75 | +        _ibssstart = .; | 
|  | 76 | +        *(.ibss*) | 
|  | 77 | +        . = ALIGN(0x4); | 
|  | 78 | +        _irqstackstart = .; | 
|  | 79 | +        . += 0x400; | 
|  | 80 | +        _irqstackend = .; | 
|  | 81 | +        _abortstackstart = .; | 
|  | 82 | +        . += 0x400; | 
|  | 83 | +        _abortstackend = .; | 
|  | 84 | +        *(.stack) | 
|  | 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: embios/trunk/target/ipodnano4g/mmu.h | 
| — | — | @@ -0,0 +1,35 @@ | 
|  | 2 | +// | 
|  | 3 | +// | 
|  | 4 | +//    Copyright 2010 TheSeven | 
|  | 5 | +// | 
|  | 6 | +// | 
|  | 7 | +//    This file is part of emBIOS. | 
|  | 8 | +// | 
|  | 9 | +//    emBIOS 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 | +//    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 21 | +// | 
|  | 22 | +// | 
|  | 23 | + | 
|  | 24 | + | 
|  | 25 | +#ifndef __MMU_H__ | 
|  | 26 | +#define __MMU_H__ | 
|  | 27 | + | 
|  | 28 | + | 
|  | 29 | +#include "global.h" | 
|  | 30 | + | 
|  | 31 | + | 
|  | 32 | +void clean_dcache() __attribute__((naked, noinline)) ICODE_ATTR; | 
|  | 33 | +void invalidate_dcache() __attribute__((naked, noinline)) ICODE_ATTR; | 
|  | 34 | + | 
|  | 35 | + | 
|  | 36 | +#endif | 
| Index: embios/trunk/target/ipodnano4g/storage.c | 
| — | — | @@ -0,0 +1,51 @@ | 
|  | 2 | +// | 
|  | 3 | +// | 
|  | 4 | +//    Copyright 2010 TheSeven | 
|  | 5 | +// | 
|  | 6 | +// | 
|  | 7 | +//    This file is part of emBIOS. | 
|  | 8 | +// | 
|  | 9 | +//    emBIOS 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 | +//    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 21 | +// | 
|  | 22 | +// | 
|  | 23 | + | 
|  | 24 | + | 
|  | 25 | + | 
|  | 26 | +#include "global.h" | 
|  | 27 | +#include "storage.h" | 
|  | 28 | + | 
|  | 29 | +uint32_t storage_init() | 
|  | 30 | +{ | 
|  | 31 | +    return -1; | 
|  | 32 | +} | 
|  | 33 | + | 
|  | 34 | +uint32_t storage_read(uint32_t sector, uint32_t count, void* buffer) | 
|  | 35 | +{ | 
|  | 36 | +    return -1; | 
|  | 37 | +} | 
|  | 38 | + | 
|  | 39 | +uint32_t storage_write(uint32_t sector, uint32_t count, const void* buffer) | 
|  | 40 | +{ | 
|  | 41 | +    return -1; | 
|  | 42 | +} | 
|  | 43 | + | 
|  | 44 | +uint32_t storage_sync() | 
|  | 45 | +{ | 
|  | 46 | +    return -1; | 
|  | 47 | +} | 
|  | 48 | + | 
|  | 49 | +uint32_t storage_get_sector_count() | 
|  | 50 | +{ | 
|  | 51 | +    return -1; | 
|  | 52 | +} | 
| Index: embios/trunk/target/ipodnano4g/timer.h | 
| — | — | @@ -0,0 +1,42 @@ | 
|  | 2 | +// | 
|  | 3 | +// | 
|  | 4 | +//    Copyright 2010 TheSeven | 
|  | 5 | +// | 
|  | 6 | +// | 
|  | 7 | +//    This file is part of emBIOS. | 
|  | 8 | +// | 
|  | 9 | +//    emBIOS 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 | +//    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 21 | +// | 
|  | 22 | +// | 
|  | 23 | + | 
|  | 24 | + | 
|  | 25 | +#ifndef __TIMER_H__ | 
|  | 26 | +#define __TIMER_H__ | 
|  | 27 | + | 
|  | 28 | +#include "global.h" | 
|  | 29 | + | 
|  | 30 | + | 
|  | 31 | +#define TIME_AFTER(a,b)         ((long)(b) - (long)(a) < 0) | 
|  | 32 | +#define TIME_BEFORE(a,b)        TIME_AFTER(b,a) | 
|  | 33 | +#define TIMEOUT_EXPIRED(a,b)    TIME_AFTER(USEC_TIMER,a + b) | 
|  | 34 | + | 
|  | 35 | + | 
|  | 36 | +static inline void sleep(long duration)  /* in usec steps */ | 
|  | 37 | +{ | 
|  | 38 | +    long timestamp = USEC_TIMER; | 
|  | 39 | +    while (!TIMEOUT_EXPIRED(timestamp, duration)); | 
|  | 40 | +} | 
|  | 41 | + | 
|  | 42 | + | 
|  | 43 | +#endif | 
| Index: embios/trunk/target/ipodnano4g/lcd.h | 
| — | — | @@ -0,0 +1,43 @@ | 
|  | 2 | +// | 
|  | 3 | +// | 
|  | 4 | +//    Copyright 2010 TheSeven | 
|  | 5 | +// | 
|  | 6 | +// | 
|  | 7 | +//    This file is part of emBIOS. | 
|  | 8 | +// | 
|  | 9 | +//    emBIOS 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 | +//    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 21 | +// | 
|  | 22 | +// | 
|  | 23 | + | 
|  | 24 | + | 
|  | 25 | +#ifndef __LCD_H__ | 
|  | 26 | +#define __LCD_H__ | 
|  | 27 | + | 
|  | 28 | + | 
|  | 29 | +#include "global.h" | 
|  | 30 | + | 
|  | 31 | + | 
|  | 32 | +#define LCD_WIDTH 240 | 
|  | 33 | +#define LCD_HEIGHT 320 | 
|  | 34 | +#define LCD_FORMAT rgb565 | 
|  | 35 | +#define LCD_BYTESPERPIXEL 2 | 
|  | 36 | +#define LCD_FRAMEBUFSIZE (LCD_WIDTH * LCD_HEIGHT * LCD_BYTESPERPIXEL) | 
|  | 37 | + | 
|  | 38 | + | 
|  | 39 | +void displaylcd(unsigned int startx, unsigned int endx, | 
|  | 40 | +                unsigned int starty, unsigned int endy, void* data, int color); | 
|  | 41 | +void displaylcd_sync(); | 
|  | 42 | + | 
|  | 43 | + | 
|  | 44 | +#endif | 
| Index: embios/trunk/target/ipodnano4g/crt0.S | 
| — | — | @@ -0,0 +1,182 @@ | 
|  | 2 | +@ | 
|  | 3 | +@ | 
|  | 4 | +@    Copyright 2010 TheSeven | 
|  | 5 | +@ | 
|  | 6 | +@ | 
|  | 7 | +@    This file is part of emBIOS. | 
|  | 8 | +@ | 
|  | 9 | +@    emBIOS 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 | +@    emBIOS 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 emBIOS.  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 .initcode,"ax",%progbits | 
|  | 38 | +.global _start | 
|  | 39 | +_start: | 
|  | 40 | +	ldr	r0, =_sramsource | 
|  | 41 | +	ldr	r1, =_sramstart | 
|  | 42 | +	ldr	r2, =_sramend | 
|  | 43 | +.copysram: | 
|  | 44 | +	cmp	r2, r1 | 
|  | 45 | +	ldrhi	r3, [r0], #4 | 
|  | 46 | +	strhi	r3, [r1], #4 | 
|  | 47 | +	bhi	.copysram | 
|  | 48 | +	ldr	r0, =_sdramsource | 
|  | 49 | +	ldr	r1, =_sdramstart | 
|  | 50 | +	ldr	r2, =_sdramend | 
|  | 51 | +.copysdram: | 
|  | 52 | +	cmp	r2, r1 | 
|  | 53 | +	ldrhi	r3, [r0], #4 | 
|  | 54 | +	strhi	r3, [r1], #4 | 
|  | 55 | +	bhi	.copysdram | 
|  | 56 | +	ldr	r0, =_initbssstart | 
|  | 57 | +	ldr	r1, =_initbssend | 
|  | 58 | +	mov	r2, #0 | 
|  | 59 | +.clearinitbss: | 
|  | 60 | +	cmp	r1, r0 | 
|  | 61 | +	strhi	r2, [r0], #4 | 
|  | 62 | +	bhi	.clearinitbss | 
|  | 63 | +	ldr	r0, =_ibssstart | 
|  | 64 | +	ldr	r1, =_ibssend | 
|  | 65 | +.clearibss: | 
|  | 66 | +	cmp	r1, r0 | 
|  | 67 | +	strhi	r2, [r0], #4 | 
|  | 68 | +	bhi	.clearibss | 
|  | 69 | +	ldr	r0, =_bssstart | 
|  | 70 | +	ldr	r1, =_bssend | 
|  | 71 | +.clearbss: | 
|  | 72 | +	cmp	r1, r0 | 
|  | 73 | +	strhi	r2, [r0], #4 | 
|  | 74 | +	bhi	.clearbss | 
|  | 75 | +	ldr	r1, =0x38200000 | 
|  | 76 | +	ldr	r0, [r1] | 
|  | 77 | +	orr	r0, r0, #1 | 
|  | 78 | +	bic	r0, r0, #0x10000 | 
|  | 79 | +	str	r0, [r1] | 
|  | 80 | +	mov	r0, #0 | 
|  | 81 | +	mcr	p15, 0, r0,c7,c5,0 | 
|  | 82 | +	msr	cpsr_c, #0xd2 | 
|  | 83 | +	ldr	sp, =_irqstackend | 
|  | 84 | +	msr	cpsr_c, #0xd7 | 
|  | 85 | +	ldr	sp, =_abortstackend | 
|  | 86 | +	msr	cpsr_c, #0xdb | 
|  | 87 | +	ldr	sp, =_abortstackend | 
|  | 88 | +	msr	cpsr_c, #0xd3 | 
|  | 89 | +	ldr	sp, =_initstackend | 
|  | 90 | +	bl	init | 
|  | 91 | +	b	main | 
|  | 92 | +.ltorg | 
|  | 93 | + | 
|  | 94 | + | 
|  | 95 | +.section .icode, "ax", %progbits | 
|  | 96 | +.align 2 | 
|  | 97 | +.global reset | 
|  | 98 | +.global hang | 
|  | 99 | +.type reset, %function | 
|  | 100 | +.type hang, %function | 
|  | 101 | +reset: | 
|  | 102 | +	msr	cpsr_c, #0xd3 | 
|  | 103 | +	mov	r0, #0x100000 | 
|  | 104 | +	mov	r1, #0x3c800000 | 
|  | 105 | +	str	r0, [r1] | 
|  | 106 | +hang: | 
|  | 107 | +	b	hang | 
|  | 108 | +.size reset, .-reset | 
|  | 109 | +.size hang, .-hang | 
|  | 110 | + | 
|  | 111 | +.type reset_handler, %function | 
|  | 112 | +reset_handler: | 
|  | 113 | +	adr	r0, reset_text | 
|  | 114 | +	b	panic | 
|  | 115 | +reset_text: | 
|  | 116 | +	.ascii	"Hit reset vector!\0" | 
|  | 117 | +.size reset_handler, .-reset_handler | 
|  | 118 | + | 
|  | 119 | +.type undef_instr_handler, %function | 
|  | 120 | +undef_instr_handler: | 
|  | 121 | +	adr	r0, undef_instr_text | 
|  | 122 | +	sub	r0, lr, #4 | 
|  | 123 | +	b	panicf | 
|  | 124 | +.size undef_instr_handler, .-undef_instr_handler | 
|  | 125 | + | 
|  | 126 | +.type prefetch_abort_handler, %function | 
|  | 127 | +prefetch_abort_handler: | 
|  | 128 | +	adr	r0, prefetch_abort_text | 
|  | 129 | +	sub	r0, lr, #4 | 
|  | 130 | +	b	panicf | 
|  | 131 | +.size prefetch_abort_handler, .-prefetch_abort_handler | 
|  | 132 | + | 
|  | 133 | +.type data_abort_handler, %function | 
|  | 134 | +data_abort_handler: | 
|  | 135 | +	adr	r0, data_abort_text | 
|  | 136 | +	sub	r0, lr, #4 | 
|  | 137 | +	b	panicf | 
|  | 138 | +.size data_abort_handler, .-data_abort_handler | 
|  | 139 | + | 
|  | 140 | +.type reserved_handler, %function | 
|  | 141 | +reserved_handler: | 
|  | 142 | +	adr	r0, reserved_text | 
|  | 143 | +	b	panic | 
|  | 144 | +.size reserved_handler, .-reserved_handler | 
|  | 145 | + | 
|  | 146 | +.type fiq_handler, %function | 
|  | 147 | +fiq_handler: | 
|  | 148 | +	adr	r0, fiq_text | 
|  | 149 | +	b	panic | 
|  | 150 | +.size fiq_handler, .-fiq_handler | 
|  | 151 | + | 
|  | 152 | +.type irq_handler, %function | 
|  | 153 | +irq_handler: | 
|  | 154 | +	adr	r0, irq_text | 
|  | 155 | +	b	panic | 
|  | 156 | +.size irq_handler, .-irq_handler | 
|  | 157 | + | 
|  | 158 | +.type syscall_handler, %function | 
|  | 159 | +syscall_handler: | 
|  | 160 | +	adr	r0, syscall_text | 
|  | 161 | +	b	panic | 
|  | 162 | +.size syscall_handler, .-syscall_handler | 
|  | 163 | + | 
|  | 164 | +undef_instr_text: | 
|  | 165 | +	.ascii	"Undefined instruction at %08X!\0" | 
|  | 166 | + | 
|  | 167 | +prefetch_abort_text: | 
|  | 168 | +	.ascii	"Prefetch abort at %08X!\0" | 
|  | 169 | + | 
|  | 170 | +data_abort_text: | 
|  | 171 | +	.ascii	"Data abort at %08X!\0" | 
|  | 172 | + | 
|  | 173 | +reserved_text: | 
|  | 174 | +	.ascii	"Hit reserved exception handler!\0" | 
|  | 175 | + | 
|  | 176 | +fiq_text: | 
|  | 177 | +	.ascii	"Unhandled FIQ!\0" | 
|  | 178 | + | 
|  | 179 | +irq_text: | 
|  | 180 | +	.ascii	"Unhandled IRQ!\0" | 
|  | 181 | + | 
|  | 182 | +syscall_text: | 
|  | 183 | +	.ascii	"Unhandled syscall!\0" | 
| Index: embios/trunk/target/ipodnano4g/storage.h | 
| — | — | @@ -0,0 +1,36 @@ | 
|  | 2 | +// | 
|  | 3 | +// | 
|  | 4 | +//    Copyright 2010 TheSeven | 
|  | 5 | +// | 
|  | 6 | +// | 
|  | 7 | +//    This file is part of emBIOS. | 
|  | 8 | +// | 
|  | 9 | +//    emBIOS 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 | +//    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 21 | +// | 
|  | 22 | +// | 
|  | 23 | + | 
|  | 24 | + | 
|  | 25 | +#ifndef __FTL_H__ | 
|  | 26 | +#define __FTL_H__ | 
|  | 27 | + | 
|  | 28 | +#include "global.h" | 
|  | 29 | + | 
|  | 30 | +uint32_t storage_init(); | 
|  | 31 | +uint32_t storage_read(uint32_t sector, uint32_t count, void* buffer); | 
|  | 32 | +uint32_t storage_write(uint32_t sector, uint32_t count, const void* buffer); | 
|  | 33 | +uint32_t storage_sync(); | 
|  | 34 | +uint32_t storage_get_sector_count(); | 
|  | 35 | + | 
|  | 36 | + | 
|  | 37 | +#endif | 
| Index: embios/trunk/target/ipodnano4g/config.h | 
| — | — | @@ -0,0 +1,28 @@ | 
|  | 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 | +//#define NAND_DEBUG | 
|  | 26 | +//#define NAND_TRACE | 
|  | 27 | +//#define VFL_TRACE | 
|  | 28 | +//#define FTL_TRACE | 
|  | 29 | + | 
| Index: embios/trunk/target/ipodnano4g/target.h | 
| — | — | @@ -0,0 +1,31 @@ | 
|  | 2 | +// | 
|  | 3 | +// | 
|  | 4 | +//    Copyright 2010 TheSeven | 
|  | 5 | +// | 
|  | 6 | +// | 
|  | 7 | +//    This file is part of emBIOS. | 
|  | 8 | +// | 
|  | 9 | +//    emBIOS 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 | +//    emBIOS 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 emBIOS.  If not, see <http://www.gnu.org/licenses/>. | 
|  | 21 | +// | 
|  | 22 | +// | 
|  | 23 | + | 
|  | 24 | + | 
|  | 25 | +#ifndef __TARGET_H__ | 
|  | 26 | +#define __TARGET_H__ | 
|  | 27 | + | 
|  | 28 | + | 
|  | 29 | +#define ARM_ARCH 6 | 
|  | 30 | + | 
|  | 31 | + | 
|  | 32 | +#endif | 
| Index: embios/trunk/Makefile | 
| — | — | @@ -1,5 +1,5 @@ | 
| 2 | 2 | NAME := embios | 
| 3 |  | -TARGETS := ipodnano2g
 | 
|  | 3 | +TARGETS := ipodnano2g ipodnano4g | 
| 4 | 4 |  | 
| 5 | 5 | CROSS   := arm-none-eabi- | 
| 6 | 6 | CC      := $(CROSS)gcc |