rk27load - fix indentation

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30460 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Marcin Bukat 2011-09-06 12:39:58 +00:00
parent 6d5671a8d8
commit 77a82ad56a
4 changed files with 209 additions and 206 deletions

View file

@ -1,7 +1,7 @@
// /*
// startup code * startup code
// *
// */
#define PSR_MODE 0x0000001f #define PSR_MODE 0x0000001f
#define PSR_USR_MODE 0x00000010 #define PSR_USR_MODE 0x00000010
@ -16,32 +16,33 @@
.global start .global start
.extern _interrupt_disable .extern _interrupt_disable
// ----------------------------------------------------- /* -----------------------------------------------------
// startup code (setup stacks, branch to main) * startup code (setup stacks, branch to main)
// ----------------------------------------------------- * -----------------------------------------------------
*/
start: start:
// setup IRQ stack /* setup IRQ stack */
mov r0,#(PSR_IRQ_MODE|PSR_FIQ_DIS|PSR_IRQ_DIS) mov r0,#(PSR_IRQ_MODE|PSR_FIQ_DIS|PSR_IRQ_DIS)
msr cpsr,r0 msr cpsr,r0
ldr sp,=irqstackend ldr sp,=irqstackend
// setup SVC stack /* setup SVC stack */
mov r0,#(PSR_SVC_MODE|PSR_FIQ_DIS|PSR_IRQ_DIS) mov r0,#(PSR_SVC_MODE|PSR_FIQ_DIS|PSR_IRQ_DIS)
msr cpsr,r0 msr cpsr,r0
ldr sp,=stackend ldr sp,=stackend
// disbale interrupts /* disbale interrupts */
mrs r0,cpsr mrs r0,cpsr
orr r0,r0,#0xc0 orr r0,r0,#0xc0
msr cpsr_c, r0 msr cpsr_c, r0
// remap /* remap */
mov r0,#0x18000000 mov r0,#0x18000000
add r0,r0,#0x1C000 add r0,r0,#0x1C000
ldr r1,=0xdeadbeef ldr r1,=0xdeadbeef
str r1,[r0,#4] str r1,[r0,#4]
// relocate itself /* relocate itself */
ldr r0,=_relocstart ldr r0,=_relocstart
ldr r1,=_relocend ldr r1,=_relocend
ldr r2,=0x0 ldr r2,=0x0
@ -51,5 +52,5 @@ start:
strhi r3,[r2],#4 strhi r3,[r2],#4
bhi 1b bhi 1b
// continue running in SVC (supervisor mode) /* continue running in SVC (supervisor mode) */
ldr pc,=0x0 ldr pc,=0x0

View file

@ -7,16 +7,16 @@
irq_handler: irq_handler:
stmfd sp!,{r0-r7,ip,lr} stmfd sp!,{r0-r7,ip,lr}
// get interrupt number /* get interrupt number */
mov r4,#0x18000000 mov r4,#0x18000000
add r4,r4,#0x80000 add r4,r4,#0x80000
ldr r5,[r4,#0x104] ldr r5,[r4,#0x104]
and r5,r5,#0x1f and r5,r5,#0x1f
cmp r5, #0x10 // UDC interrupt cmp r5,#0x10 /* UDC interrupt */
bleq udc_irq bleq udc_irq
// clear pending interrupt /* clear pending interrupt */
mov r3,#1 mov r3,#1
mov r2,r3,LSL r5 mov r2,r3,LSL r5
str r2,[r4,#0x118] str r2,[r4,#0x118]
@ -27,77 +27,76 @@ irq_handler:
udc_irq: udc_irq:
stmfd sp!,{r4-r8,lr} stmfd sp!,{r4-r8,lr}
// handle usb interrupt /* handle usb interrupt */
ldr r4,=0x180A0000 ldr r4,=0x180A0000
ldr r5, [r4, #0x18] // UDC_INTFLAG ldr r5,[r4,#0x18] /* UDC_INTFLAG */
// ep0 in intr /* ep0 in intr */
tst r5,#0x04 tst r5,#0x04
beq bulk_recv_intr beq bulk_recv_intr
ep0:
// write_reg32(UDC_TX0STAT, read_reg32(UDC_TX0STAT) & ~0x7FF);
ldr r5,[r4,#0x40] ldr r5,[r4,#0x40]
mov r5,r5,lsr #10 mov r5,r5,lsr #10
mov r5, r5, lsl #10 // clear clower 10 bits mov r5,r5,lsl #10 /* clear lower 10 bits in TX0STAT */
str r5,[r4,#0x40] str r5,[r4,#0x40]
// write_reg32(UDC_DMA0LM_OADDR, (uint32_t)(state.ctrlep_data)); /* set buffer addres in UDC_DMA0LM_OADDR */
mov r5,#0x60000000 mov r5,#0x60000000
str r5,[r4, #0x3c] str r5,[r4, #0x3c]
// write_reg32(UDC_DMA0CTLO, read_reg32(UDC_DMA0CTLO) | ENP_DMA_START); /* write DMA_START in UDC_DMA0CTLO */
mov r5,#1 mov r5,#1
str r5,[r4,#0x38] str r5,[r4,#0x38]
ldmfd sp!,{r4-r8,pc} ldmfd sp!,{r4-r8,pc}
// bulk out interrupt /* bulk out interrupt */
bulk_recv_intr: bulk_recv_intr:
tst r5,#0x100 tst r5,#0x100
ldmeqfd sp!,{r4-r8,pc} ldmeqfd sp!,{r4-r8,pc}
// read UDC_RX1STAT /* read UDC_RX1STAT */
ldr r5,[r4,#0x54] ldr r5,[r4,#0x54]
mov r5,r5,lsl #21 mov r5,r5,lsl #21
mov r5, r5, lsr #21 // r5 = length mov r5,r5,lsr #21 /* r5 = length */
ldr r6,=usb_sz ldr r6,=usb_sz
ldr r6,[r6] ldr r6,[r6]
ldr r7, [r6] // r7 = total_code_length expected ldr r7,[r6] /* r7 = total_code_length expected */
subs r7,r7,r5 subs r7,r7,r5
bne usb_bulk_out1_recv bne usb_bulk_out1_recv
// copy from buff to the begining of the ram /* copy from buff to the begining of the ram */
ldr r0,=BUFF_ADDR ldr r0,=BUFF_ADDR
ldr r1,[r0,#-4] // size ldr r1,[r0,#-4] /* size */
ldr r1,=0x800000 // buffer size ldr r1,=0x800000 /* buffer size */
add r1,r1,r0 // end address add r1,r1,r0 /* end address */
ldr r2,=0x60000000 // destination ldr r2,=0x60000000 /* destination */
1: 1:
cmp r1,r0 cmp r1,r0
ldrhi r3,[r0],#4 ldrhi r3,[r0],#4
strhi r3,[r2],#4 strhi r3,[r2],#4
bhi 1b bhi 1b
// execute user code /* execute user code */
ldr r0,=0x60000000 ldr r0,=0x60000000
bx r0 // jump to 0x60000000 bx r0 /* jump to 0x60000000 */
usb_bulk_out1_recv: usb_bulk_out1_recv:
str r7, [r6] // size = size - received str r7,[r6] /* size = size - received */
ldr r6,=usb_write_addr ldr r6,=usb_write_addr
ldr r7,[r6] ldr r7,[r6]
add r7,r7,r5 add r7,r7,r5
str r7, [r6] // usb_write_addr += length str r7,[r6] /* usb_write_addr += length */
str r7, [r4, #0x60] // DMA1LM_OADDR = usb_write_addr str r7,[r4,#0x60] /* DMA1LM_OADDR = usb_write_addr */
mov r5,#1 mov r5,#1
str r5, [r4, #0x5c] // DMA1_CTL0 = ENP_DMA_START str r5,[r4,#0x5c] /* DMA1_CTL0 = ENP_DMA_START */
ldmfd sp!,{r4-r8,pc} ldmfd sp!,{r4-r8,pc}

View file

@ -1,4 +1,3 @@
.section .text .section .text
.align 4 .align 4
@ -13,9 +12,10 @@
#define BUFF_ADDR 0x60800000 #define BUFF_ADDR 0x60800000
// ----------------------------------------------------- /* -----------------------------------------------------
// vector table * vector table
// ----------------------------------------------------- * -----------------------------------------------------
*/
ldr pc,=main ldr pc,=main
ldr pc,=main ldr pc,=main
ldr pc,=main ldr pc,=main
@ -25,55 +25,58 @@
ldr pc,=irq_handler ldr pc,=irq_handler
ldr pc,=main ldr pc,=main
// ----------------------------------------------------- /* -----------------------------------------------------
// main * main
// ----------------------------------------------------- * -----------------------------------------------------
*/
main: main:
// turn on usb interrupts /* turn on usb interrupts */
mov r0,#0x18000000 mov r0,#0x18000000
add r0,r0,#0x80000 add r0,r0,#0x80000
ldr r1,[r0,#0x10c] ldr r1,[r0,#0x10c]
orr r1,r1,#0x10000 orr r1,r1,#0x10000
str r1,[r0,#0x10c] str r1,[r0,#0x10c]
// enable usb-bulk /* enable usb-bulk */
add r0, r0, #0x20000 // R0 = 0x180A0000 (UDC_BASE) add r0,r0,#0x20000 /* R0 = 0x180A0000 (UDC_BASE) */
// enable EP1, write_reg32(UDC_RX1CON, (0x1 << 8) | RxACKINTEN | RxEPEN); /* enable EP1 */
mov r1, #0x190 // bits 8,7,4 -> 0x190 mov r1,#0x190 /* bits 8,7,4 -> 0x190 */
str r1,[r0,#0x58] str r1,[r0,#0x58]
// setup receive buffer (must be aligned on dword boundary) /* setup receive buffer (must be aligned on dword boundary) */
ldr r1,=usb_write_addr // write_reg32(UDC_DMA1LM_OADDR, (uint32_t)rx_buff); ldr r1,=usb_write_addr
ldr r1,[r1] ldr r1,[r1]
str r1, [r0, #0x60] // UDC_DMA1LM_OADDR = usb_write_addr str r1,[r0, #0x60] /* UDC_DMA1LM_OADDR = usb_write_addr */
// write_reg32(UDC_DMA1CTRLO, read_reg32(UDC_DMA1CTRLO) | ENP_DMA_START); /* write DMA_START in UDC_DMA1CTRLO */
ldr r1,[r0,#0x5c] ldr r1,[r0,#0x5c]
orr r1,r1,#2 orr r1,r1,#2
str r1,[r0,#0x5c] str r1,[r0,#0x5c]
// enable bulk_out1 interrupt /* enable bulk_out1 interrupt */
ldr r1, [r0, #0x14] // UDC_ENINT ldr r1,[r0,#0x14] /* UDC_ENINT */
orr r1, r1, #0x100 // EN_BOUT1_INTR orr r1,r1,#0x100 /* EN_BOUT1_INTR */
str r1,[r0,#0x14] str r1,[r0,#0x14]
bl _interrupt_enable bl _interrupt_enable
idle: idle:
b idle b idle
// ----------------------------------------------------- /* -----------------------------------------------------
// _interrupt_enable - enables interrupts * _interrupt_enable - enables interrupts
// ----------------------------------------------------- * -----------------------------------------------------
*/
_interrupt_enable: _interrupt_enable:
mrs r0,cpsr mrs r0,cpsr
bic r0,r0,#0x80 bic r0,r0,#0x80
msr cpsr_c,r0 msr cpsr_c,r0
mov pc,lr mov pc,lr
// ----------------------------------------------------- /* -----------------------------------------------------
// _interrupt_disable - disables interrupts * _interrupt_disable - disables interrupts
// ----------------------------------------------------- * -----------------------------------------------------
*/
_interrupt_disable: _interrupt_disable:
mrs r0,cpsr mrs r0,cpsr
orr r0,r0,#0xc0 orr r0,r0,#0xc0