/*1Boot.S: boot loader for Siemens DVB-S card23Copyright (C) 2001 Convergence integrated media GmbH4Written by Ralph Metzler5<[email protected]>6Copyright (C) 2006 Matthieu CASTET <[email protected]>78This program is free software; you can redistribute it and/or9modify it under the terms of the GNU General Public License10as published by the Free Software Foundation; either version 211of the License, or (at your option) any later version.1213This program is distributed in the hope that it will be useful,14but WITHOUT ANY WARRANTY; without even the implied warranty of15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16GNU General Public License for more details.1718You should have received a copy of the GNU General Public License19along with this program; if not, write to the Free Software20Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.2122*/2324/*25check AV711x_3_1.pdf for some hardware infos26build it with :27$ cc -mbig-endian -c Boot.S28$ ld -Ttext 0x2c000000 -EB -o Boot Boot.o29$ objcopy -Obinary Boot30*/3132.text33.align34.globl _start35_start:36b reset // reset vector37movs pc, r14 // undefined38subs pc, r14, #4 // SWI39subs pc, r14, #4 // prefetch abort40subs pc, r14, #8 // data abort41subs pc, r14, #4 // reserved42subs pc, r14, #4 // IRQ43subs pc, r14, #4 // FIQ4445.word tbl // table needed by firmware ROM46tbl: .word (endtbl - tbl)47.word 048.word conf49endtbl: .word 050conf: .word 0xa5a55a5a51.word 0x001f155552.word 0x000000095354reset: ldr r13, buffer55ldr r4, flag56mov r0, #057str r0, [r4]58str r0, [r4, #4]5960ldr r1, wait_address61ldr r2, flag_address62ldr r3, sram6364copycode: // copy the code HW Sram65ldmia r1!, {r5-r12}66stmia r3!, {r5-r12}67cmp r1, r268ble copycode69ldr pc, sram // jump to the copied code7071wait: ldrh r1, [r4] // wait for flag!=072cmp r1, #073beq wait7475mov r1, r13 // buffer address76ldr r3, [r4,#4] // destaddr7778ldrh r2, [r4,#2] // get segment length79add r2, r2, #63 // round length to next 64 bytes80movs r2, r2, lsr #6 // and divide by 6481moveq r0, #2 // if 0, set flag to 2, else signal82strh r0, [r4] // that buffer is accepted by setting to 083beq wait8485copyloop:86ldmia r1!, {r5-r12}87stmia r3!, {r5-r12}88ldmia r1!, {r5-r12}89stmia r3!, {r5-r12}90subs r2, r2, #191bne copyloop9293eor r13, r13, #0x1400 // switch to other buffer94b wait9596// flag is stored at 0x2c0003f8, length at 0x2c0003fa,97// destaddr at 0x2c0003fc9899flag: .word 0x2c0003f8100101102// buffer 1 is at 0x2c000400, buffer 2 at 0x2c001000103104buffer: .word 0x2c000400105106sram: .word 0x9e000800107wait_address: .word wait108flag_address: .word flag109110111