mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 09:16:49 +02:00
Perform more optimization in supercard platform (#107)
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
@ void sc_change_mode(uint16_t mode);
|
||||
BEGIN_THUMB_FUNCTION sccmn_changeMode
|
||||
push {r0-r3,lr}
|
||||
ldr r2,= 0x09FFFFFE
|
||||
ldr r3,= 0xA55A
|
||||
strh r3, [r2]
|
||||
@@ -19,24 +20,26 @@ BEGIN_THUMB_FUNCTION sccmn_changeMode
|
||||
@ if mode is 3 (sd enable), reset the sd card
|
||||
@ SDResetCard
|
||||
@ write 0
|
||||
ldr r2,= sd_resetaddr
|
||||
ldr r2, =sd_resetaddr
|
||||
strh r2, [r2]
|
||||
1:
|
||||
mov pc, lr
|
||||
pop {r0-r3,pc}
|
||||
|
||||
.section "scsd_common", "ax"
|
||||
@ this function will trash r4 but leave r0 and r1 untouched
|
||||
@ void SDSendClock10(void)
|
||||
BEGIN_THUMB_FUNCTION sccmn_sdSendClock10
|
||||
@ here we get lr from the caller
|
||||
push {r0-r3}
|
||||
movs r3, #0x10
|
||||
@ loads reg_scsd_cmd
|
||||
movs r2, #0x98
|
||||
lsls r2, r2, #20
|
||||
1:
|
||||
ldrh r4, [r2]
|
||||
ldrh r0, [r2]
|
||||
subs r3, r3, #1
|
||||
bne 1b
|
||||
mov pc, lr
|
||||
pop {r0-r3,pc}
|
||||
|
||||
.section "scsd_common", "ax"
|
||||
|
||||
@ static uint64_t inline calSingleCRC16(uint64_t crc, uint32_t data_in){
|
||||
@ // Shift out 8 bits for each line
|
||||
@@ -73,8 +76,10 @@ BEGIN_THUMB_FUNCTION sccmn_sdSendClock10
|
||||
|
||||
@ uint64_t sdio_crc16_4bit_checksum(void*)
|
||||
@ r0 and r1 are left untouched, the result is returned in r2-r3 instead
|
||||
@ a "continuation function" is provided in r5, and we have to jump to it
|
||||
BEGIN_THUMB_FUNCTION sccmn_sdio4BitCrc16
|
||||
push {r0,r1,r4-r5,lr}
|
||||
push {r5,lr}
|
||||
push {r0,r1,r4-r5}
|
||||
movs r4, #0 @ r4 = crc_lo
|
||||
movs r5, #0 @ r5 = crc_hi
|
||||
movs r1, #128
|
||||
@@ -116,7 +121,7 @@ byteSwap32:
|
||||
push {r0,r1,r4-r5,lr}
|
||||
byteSwap32_nopush:
|
||||
movs r5, #16
|
||||
ldr r4,= 0xFF00FF
|
||||
ldr r4, =0xFF00FF
|
||||
rors r2, r5 // ror 16
|
||||
ands r4, r2
|
||||
bics r2, r4
|
||||
|
||||
Reference in New Issue
Block a user