📄 sdmmc_spi.lst
字号:
\ 00000034 1000A0E3 MOV R0,#+16
\ 00000038 B001C5E1 STRH R0,[R5, #+16]
604 pCommand->pData = csdData;
\ 0000003C 04008DE2 ADD R0,SP,#+4
\ 00000040 0C0085E5 STR R0,[R5, #+12]
605 pCommand->isRead = 1;
\ 00000044 0100A0E3 MOV R0,#+1
\ 00000048 1500C5E5 STRB R0,[R5, #+21]
606 pCommand->pResp = &response;
\ 0000004C 0D00A0E1 MOV R0,SP
\ 00000050 180085E5 STR R0,[R5, #+24]
607
608 // Set SD command state
609 pSd->state = SD_STATE_STBY;
\ 00000054 0000A0E3 MOV R0,#+0
\ 00000058 4400C4E5 STRB R0,[R4, #+68]
610
611 // Send command
612 error = SendCommand(pSd);
\ 0000005C 0400A0E1 MOV R0,R4
\ 00000060 ........ BL SendCommand
613
614 // In SPI mode, reading CSD is the same as reading data.
615 for (i = 0; i < 4; i++) {
\ 00000064 301084E2 ADD R1,R4,#+48
\ 00000068 04208DE2 ADD R2,SP,#+4
\ 0000006C 0430A0E3 MOV R3,#+4
616 pSd->csd[i] = csdData[i*4] << 24 |
617 csdData[i*4+1] << 16 |
618 csdData[i*4+2] << 8 |
619 csdData[i*4+3];
\ ??Cmd9_0:
\ 00000070 0000D2E5 LDRB R0,[R2, #+0]
\ 00000074 01C0D2E5 LDRB R12,[R2, #+1]
\ 00000078 0CC8A0E1 LSL R12,R12,#+16
\ 0000007C 000C8CE1 ORR R0,R12,R0, LSL #+24
\ 00000080 02C0D2E5 LDRB R12,[R2, #+2]
\ 00000084 0C0480E1 ORR R0,R0,R12, LSL #+8
\ 00000088 03C0D2E5 LDRB R12,[R2, #+3]
\ 0000008C 00008CE1 ORR R0,R12,R0
\ 00000090 040081E4 STR R0,[R1], #+4
620 }
\ 00000094 042082E2 ADD R2,R2,#+4
\ 00000098 013053E2 SUBS R3,R3,#+1
\ 0000009C F3FFFF1A BNE ??Cmd9_0
621 error = SD_SPI_R1((unsigned char *)&response);
622 return error;
\ 000000A0 0D00A0E1 MOV R0,SP
\ 000000A4 ........ BL SD_SPI_R1
\ 000000A8 14D08DE2 ADD SP,SP,#+20 ;; stack cleaning
\ 000000AC 3040BDE8 POP {R4,R5,LR}
\ 000000B0 1EFF2FE1 BX LR ;; return
623 }
624
625 //------------------------------------------------------------------------------
626 /// Forces the card to stop transmission
627 /// \param pSd Pointer to a SD card driver instance.
628 /// \param pStatus Pointer to a status variable.
629 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
630 static unsigned char Cmd12(SdCard *pSd)
631 {
\ Cmd12:
\ 00000000 38402DE9 PUSH {R3-R5,LR}
\ 00000004 0040A0E1 MOV R4,R0
632 SdCmd *pCommand = &(pSd->command);
\ 00000008 045084E2 ADD R5,R4,#+4
633 unsigned char error;
634 unsigned int response;
635
636 TRACE_DEBUG("Cmd12()\n\r");
637 memset(pCommand, 0, sizeof(SdCmd));
\ 0000000C 2820A0E3 MOV R2,#+40
\ 00000010 0010A0E3 MOV R1,#+0
\ 00000014 0500A0E1 MOV R0,R5
\ 00000018 ........ BL memset
638 // Fill command information
639 pCommand->cmd = AT91C_STOP_TRANSMISSION_CMD;
\ 0000001C 0C00A0E3 MOV R0,#+12
\ 00000020 040085E5 STR R0,[R5, #+4]
640 pCommand->conTrans = SPI_NEW_TRANSFER;
\ 00000024 0000A0E3 MOV R0,#+0
\ 00000028 1400C5E5 STRB R0,[R5, #+20]
641 pCommand->resType = 1;
\ 0000002C 0100A0E3 MOV R0,#+1
\ 00000030 1C00C5E5 STRB R0,[R5, #+28]
642 pCommand->pResp = &response;
\ 00000034 0D00A0E1 MOV R0,SP
\ 00000038 180085E5 STR R0,[R5, #+24]
643 // Set SD command state
644 pSd->state = SD_STATE_STBY;
\ 0000003C 0000A0E3 MOV R0,#+0
\ 00000040 4400C4E5 STRB R0,[R4, #+68]
645
646 // Send command
647 error = SendCommand(pSd);
\ 00000044 0400A0E1 MOV R0,R4
\ 00000048 ........ BL SendCommand
648
649 //TRACE_DEBUG("cmd12 resp 0x%X\n\r",response);
650 error = SD_SPI_R1b((unsigned char *)&response);
651 return error;
\ 0000004C 0D00A0E1 MOV R0,SP
\ 00000050 ........ BL SD_SPI_R1b
\ 00000054 ........ B ??Subroutine6_0
652 }
653
654 //------------------------------------------------------------------------------
655 /// Addressed card sends its status register.
656 /// Returns the command transfer result (see SendCommand).
657 /// \param pSd Pointer to a SD card driver instance.
658 /// \param pStatus Pointer to a status variable.
659 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
660 static unsigned char Cmd13(SdCard *pSd, unsigned int *pStatus)
661 {
\ Cmd13:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 0040A0E1 MOV R4,R0
\ 00000008 0150A0E1 MOV R5,R1
662 SdCmd *pCommand = &(pSd->command);
\ 0000000C 046084E2 ADD R6,R4,#+4
663 unsigned char error;
664
665 TRACE_DEBUG("Cmd13()\n\r");
666 memset(pCommand, 0, sizeof(SdCmd));
\ 00000010 2820A0E3 MOV R2,#+40
\ 00000014 0010A0E3 MOV R1,#+0
\ 00000018 0600A0E1 MOV R0,R6
\ 0000001C ........ BL memset
667 // Fill command information
668 pCommand->cmd = AT91C_SEND_STATUS_CMD;
\ 00000020 0D00A0E3 MOV R0,#+13
\ 00000024 040086E5 STR R0,[R6, #+4]
669 pCommand->resType = 2;
\ 00000028 0200A0E3 MOV R0,#+2
\ 0000002C 1C00C6E5 STRB R0,[R6, #+28]
670 pCommand->pResp = pStatus;
\ 00000030 185086E5 STR R5,[R6, #+24]
671 // Set SD command state
672 pSd->state = SD_STATE_STBY;
\ 00000034 0000A0E3 MOV R0,#+0
\ 00000038 4400C4E5 STRB R0,[R4, #+68]
673
674 // Send command
675 error = SendCommand(pSd);
\ 0000003C 0400A0E1 MOV R0,R4
\ 00000040 ........ BL SendCommand
676 error = SD_SPI_R2((unsigned char *)pStatus);
677 return error;
\ 00000044 0500A0E1 MOV R0,R5
\ 00000048 7040BDE8 POP {R4-R6,LR}
\ 0000004C ........ B SD_SPI_R2 ;; tailcall
678 }
679
680 //------------------------------------------------------------------------------
681 /// In the case of a Standard Capacity SD Memory Card, this command sets the
682 /// block length (in bytes) for all following block commands (read, write, lock).
683 /// Default block length is fixed to 512 Bytes.
684 /// Set length is valid for memory access commands only if partial block read
685 /// operation are allowed in CSD.
686 /// In the case of a High Capacity SD Memory Card, block length set by CMD16
687 /// command does not affect the memory read and write commands. Always 512
688 /// Bytes fixed block length is used. This command is effective for LOCK_UNLOCK command.
689 /// In both cases, if block length is set larger than 512Bytes, the card sets the
690 /// BLOCK_LEN_ERROR bit.
691 /// \param pSd Pointer to a SD card driver instance.
692 /// \param blockLength Block length in bytes.
693 //------------------------------------------------------------------------------
\ In section .text, align 4, keep-with-next
694 static unsigned char Cmd16(SdCard *pSd, unsigned short blockLength)
695 {
\ Cmd16:
\ 00000000 70402DE9 PUSH {R4-R6,LR}
\ 00000004 08D04DE2 SUB SP,SP,#+8
\ 00000008 0040A0E1 MOV R4,R0
\ 0000000C 0160A0E1 MOV R6,R1
696 SdCmd *pCommand = &(pSd->command);
\ 00000010 045084E2 ADD R5,R4,#+4
697 unsigned char error;
698 unsigned int response;
699
700 TRACE_DEBUG("Cmd16()\n\r");
701 memset(pCommand, 0, sizeof(SdCmd));
\ 00000014 2820A0E3 MOV R2,#+40
\ 00000018 0010A0E3 MOV R1,#+0
\ 0000001C 0500A0E1 MOV R0,R5
\ 00000020 ........ BL memset
702 // Fill command information
703 pCommand->cmd = AT91C_SET_BLOCKLEN_CMD;
\ 00000024 1000A0E3 MOV R0,#+16
\ 00000028 040085E5 STR R0,[R5, #+4]
704 pCommand->arg = blockLength;
\ 0000002C 086085E5 STR R6,[R5, #+8]
705 pCommand->resType = 1;
\ 00000030 ........ B ?Subroutine1
706 pCommand->pResp = &response;
707 // Set SD command state
708 pSd->state = SD_STATE_STBY;
709
710 // Send command
711 //return SendCommand(pSd);
712 error = SendCommand(pSd);
713 error = SD_SPI_R1((unsigned char *)&response);
714 return error;
715 }
\ In section .text, align 4, keep-with-next
\ ?Subroutine1:
\ 00000000 0100A0E3 MOV R0,#+1
\ 00000004 1C00C5E5 STRB R0,[R5, #+28]
\ 00000008 0D00A0E1 MOV R0,SP
\ 0000000C 180085E5 STR R0,[R5, #+24]
\ 00000010 0000A0E3 MOV R0,#+0
\ 00000014 4400C4E5 STRB R0,[R4, #+68]
\ 00000018 0400A0E1 MOV R0,R4
\ 0000001C ........ BL SendCommand
\ 00000020 0D00A0E1 MOV R0,SP
\ 00000024 ........ BL SD_SPI_R1
\ 00000028 REQUIRE ??Subroutine7_0
\ 00000028 ;; // Fall through to label ??Subroutine7_0
\ In section .text, align 4, keep-with-next
\ ??Subroutine7_0:
\ 00000000 7640BDE8 POP {R1,R2,R4-R6,LR}
\ 00000004 1EFF2FE1 BX LR ;; return
716
717 //------------------------------------------------------------------------------
718 /// Continously transfers datablocks from card to host until interrupted by a
719 /// STOP_TRANSMISSION command.
720 /// \param pSd Pointer to a SD card driver instance.
721 /// \param blockSize Block size (shall be set to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -