⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmcsupp.s

📁 基于EP7312的MP3播放器源代码,包括MCU和PC端代码.
💻 S
📖 第 1 页 / 共 2 页
字号:
    ldr     r4, [r3, _CONST_ MMC_CMD_DIR]#if MMC_CMD_SHIFT >= 24    orr     r4, r4, _CONST_ MMC_CMD_BIT#else    bic     r4, r4, _CONST_ MMC_CMD_BIT#endif    str     r4, [r3, _CONST_ MMC_CMD_DIR]    //    // Clock the MMC bus up to 8192 times waiting for the device to be ready.    //    mov     r14, _CONST_ 0x00002000    //    // Clock the MMC bus.    //WaitTilReady _LABEL_    ldrb    r4, [r2]    //    // Read the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Stop clocking if the command line is low.    //    cmp     r4, _CONST_ 0x00000000    beq     ReadNextByte    //    // Decrement the count of clocks.    //    subs     r14, r14, _CONST_ 1    //    // Loop back if the count is non-zero.    //    bne      WaitTilReady    //    // We did not receive a response within 8192 MMC bus clocks, so return a    // failure.    //    mov      r0, _CONST_ 0x00000000    ldmia    r13!, {r4, pc}    //    // Read the GPIO data register.    //ReadNextByte _LABEL_    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Shift the command bit to the MSB.    //#if MMC_CMD_SHIFT != 7    mov     r14, r4, ror _CONST_ ((MMC_CMD_SHIFT + 25) _MOD_ 32)#else    mov     r14, r4#endif    //    // Clock the MMC bus.    //    ldrb    r4, [r2]    //    // Read the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Shift the command bit to the second MSB.    //#if MMC_CMD_SHIFT != 6    orr     r14, r14, r4, ror _CONST_ ((MMC_CMD_SHIFT + 26) _MOD_ 32)#else    orr     r14, r14, r4#endif    //    // Clock the MMC bus.    //    ldrb    r4, [r2]    //    // Read the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Shift the command bit to the third MSB.    //#if MMC_CMD_SHIFT != 5    orr     r14, r14, r4, ror _CONST_ ((MMC_CMD_SHIFT + 27) _MOD_ 32)#else    orr     r14, r14, r4#endif    //    // Clock the MMC bus.    //    ldrb    r4, [r2]    //    // Read the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Shift the command bit to the fourth MSB.    //#if MMC_CMD_SHIFT != 4    orr     r14, r14, r4, ror _CONST_ ((MMC_CMD_SHIFT + 28) _MOD_ 32)#else    orr     r14, r14, r4#endif    //    // Clock the MMC bus.    //    ldrb    r4, [r2]    //    // Read the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Shift the command bit to the fifth MSB.    //#if MMC_CMD_SHIFT != 3    orr     r14, r14, r4, ror _CONST_ ((MMC_CMD_SHIFT + 29) _MOD_ 32)#else    orr     r14, r14, r4#endif    //    // Clock the MMC bus.    //    ldrb    r4, [r2]    //    // Read the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Shift the command bit to the sixth MSB.    //#if MMC_CMD_SHIFT != 2    orr     r14, r14, r4, ror _CONST_ ((MMC_CMD_SHIFT + 30) _MOD_ 32)#else    orr     r14, r14, r4#endif    //    // Clock the MMC bus.    //    ldrb    r4, [r2]    //    // Read the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Shift the command bit to the seventh MSB.    //#if MMC_CMD_SHIFT != 1    orr     r14, r14, r4, ror _CONST_ ((MMC_CMD_SHIFT + 31) _MOD_ 32)#else    orr     r14, r14, r4#endif    //    // Clock the MMC bus.    //    ldrb    r4, [r2]    //    // Read the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Mask off the command bit.    //    and     r4, r4, _CONST_ MMC_CMD_BIT    //    // Shift the command bit to the LSB.    //#if MMC_CMD_SHIFT != 0    orr     r14, r14, r4, lsr _CONST_ MMC_CMD_SHIFT#else    orr     r14, r14, r4#endif    //    // Clock the MMC bus.    //    ldrb    r4, [r2]    //    // Save this byte.    //    strb    r14, [r0], _CONST_ 1    //    // Decrement the count of bytes to read.    //    subs    r1, r1, _CONST_ 1    //    // Loop back if there are more bytes to read.    //    bne     ReadNextByte    //    // Restore r4 from the stack and return to the caller.    //    mov     r0, _CONST_ 0x00000001    ldmia   r13!, {r4, pc}//****************************************************************************//// MMCWriteCommand writes a command to the MMC card via the command line.////****************************************************************************    _EXPORT_ MMCWriteCommandMMCWriteCommand _LABEL_    //    // Save r4, r5, and lr to the stack.    //    stmdb   r13!, {r4, r5, lr}    //    // Get a pointer to the MMC data space so that we can toggle the MMC clock.    //    ldr     r2, =HwMMCAddress    //    // Get a pointer to the internal registers.    //    ldr     r3, =HwBaseAddress    //    // Make the command line an output.    //    ldr     r4, [r3, _CONST_ MMC_CMD_DIR]#if MMC_CMD_SHIFT >= 24    bic     r4, r4, _CONST_ MMC_CMD_BIT#else    orr     r4, r4, _CONST_ MMC_CMD_BIT#endif    str     r4, [r3, _CONST_ MMC_CMD_DIR]    //    // Load the current value of the GPIO data register.    //    ldr     r4, [r3, _CONST_ MMC_CMD_PORT]    //    // Clear the command bit.    //    bic     r4, r4, _CONST_ MMC_CMD_BIT    //    // Send six bytes to the MMC card.    //    mov     r14, _CONST_ 0x00000006    //    // Get the next byte to be sent.    //WriteNextByte _LABEL_    ldrb    r5, [r0], _CONST_ 1    //    // Get the MSB of the byte to be written.    //#if MMC_CMD_SHIFT != 7    mov     r1, r5, ror _CONST_ ((39 - MMC_CMD_SHIFT) _MOD_ 32)    and     r1, r1, _CONST_ MMC_CMD_BIT#else    and     r1, r5, _CONST_ MMC_CMD_BIT#endif    //    // Set the command line to the next bit.    //    orr     r1, r1, r4    str     r1, [r3, _CONST_ MMC_CMD_PORT]    //    // Clock the MMC bus.    //    ldrb    r1, [r2]    //    // Get the second MSB of the byte to be written.    //#if MMC_CMD_SHIFT != 6    mov     r1, r5, ror _CONST_ ((38 - MMC_CMD_SHIFT) _MOD_ 32)    and     r1, r1, _CONST_ MMC_CMD_BIT#else    and     r1, r5, _CONST_ MMC_CMD_BIT#endif    //    // Set the command line to the next bit.    //    orr     r1, r1, r4    str     r1, [r3, _CONST_ MMC_CMD_PORT]    //    // Clock the MMC bus.    //    ldrb    r1, [r2]    //    // Get the third MSB of the byte to be written.    //#if MMC_CMD_SHIFT != 5    mov     r1, r5, ror _CONST_ ((37 - MMC_CMD_SHIFT) _MOD_ 32)    and     r1, r1, _CONST_ MMC_CMD_BIT#else    and     r1, r5, _CONST_ MMC_CMD_BIT#endif    //    // Set the command line to the next bit.    //    orr     r1, r1, r4    str     r1, [r3, _CONST_ MMC_CMD_PORT]    //    // Clock the MMC bus.    //    ldrb    r1, [r2]    //    // Get the fourth MSB of the byte to be written.    //#if MMC_CMD_SHIFT != 4    mov     r1, r5, ror _CONST_ ((36 - MMC_CMD_SHIFT) _MOD_ 32)    and     r1, r1, _CONST_ MMC_CMD_BIT#else    and     r1, r5, _CONST_ MMC_CMD_BIT#endif    //    // Set the command line to the next bit.    //    orr     r1, r1, r4    str     r1, [r3, _CONST_ MMC_CMD_PORT]    //    // Clock the MMC bus.    //    ldrb    r1, [r2]    //    // Get the fifth MSB of the byte to be written.    //#if MMC_CMD_SHIFT != 3    mov     r1, r5, ror _CONST_ ((35 - MMC_CMD_SHIFT) _MOD_ 32)    and     r1, r1, _CONST_ MMC_CMD_BIT#else    and     r1, r5, _CONST_ MMC_CMD_BIT#endif    //    // Set the command line to the next bit.    //    orr     r1, r1, r4    str     r1, [r3, _CONST_ MMC_CMD_PORT]    //    // Clock the MMC bus.    //    ldrb    r1, [r2]    //    // Get the sixth MSB of the byte to be written.    //#if MMC_CMD_SHIFT != 2    mov     r1, r5, ror _CONST_ ((34 - MMC_CMD_SHIFT) _MOD_ 32)    and     r1, r1, _CONST_ MMC_CMD_BIT#else    and     r1, r5, _CONST_ MMC_CMD_BIT#endif    //    // Set the command line to the next bit.    //    orr     r1, r1, r4    str     r1, [r3, _CONST_ MMC_CMD_PORT]    //    // Clock the MMC bus.    //    ldrb    r1, [r2]    //    // Get the seventh MSB of the byte to be written.    //#if MMC_CMD_SHIFT != 1    mov     r1, r5, ror _CONST_ ((33 - MMC_CMD_SHIFT) _MOD_ 32)    and     r1, r1, _CONST_ MMC_CMD_BIT#else    and     r1, r5, _CONST_ MMC_CMD_BIT#endif    //    // Set the command line to the next bit.    //    orr     r1, r1, r4    str     r1, [r3, _CONST_ MMC_CMD_PORT]    //    // Clock the MMC bus.    //    ldrb    r1, [r2]    //    // Get the LSB of the byte to be written.    //#if MMC_CMD_SHIFT != 0    mov     r1, r5, ror _CONST_ ((32 - MMC_CMD_SHIFT) _MOD_ 32)    and     r1, r1, _CONST_ MMC_CMD_BIT#else    and     r1, r5, _CONST_ MMC_CMD_BIT#endif    //    // Set the command line to the next bit.    //    orr     r1, r1, r4    str     r1, [r3, _CONST_ MMC_CMD_PORT]    //    // Clock the MMC bus.    //    ldrb    r1, [r2]    //    // Decrement the count of bytes to send.    //    subs    r14, r14, _CONST_ 1    //    // Loop back if there are more bytes to send.    //    bne     WriteNextByte    //    // Restore r4 and r5 from the stack, and return to the caller.    //    ldmia   r13!, {r4, r5, pc}#endif    _END_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -