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

📄 sdmmc_spi.lst

📁 Tried to make CAN logger on AT91sam7X-ek, but have no idea how to implement FATFs... -( I m just a
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   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   0010B0E1           MOVS     R1,R0
   \   00000024   0D00A001           MOVEQ    R0,SP
   \   00000028   ........           BLEQ     SD_SPI_R1
   \   0000002C                      REQUIRE ??Subroutine6_0
   \   0000002C                      ;; // Fall through to label ??Subroutine6_0
    470          
    471          //------------------------------------------------------------------------------
    472          /// Resets all cards to idle state
    473          /// Returns the command transfer result (see SendCommand).
    474          /// \param pSd  Pointer to a SdCard driver instance.
    475          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
    476          static unsigned char Cmd0(SdCard *pSd)
    477          {
   \                     Cmd0:
   \   00000000   38402DE9           PUSH     {R3-R5,LR}
   \   00000004   0040A0E1           MOV      R4,R0
    478              SdCmd *pCommand = &(pSd->command);
   \   00000008   045084E2           ADD      R5,R4,#+4
    479              unsigned int response;
    480              unsigned char error;
    481          
    482              TRACE_DEBUG("Cmd0()\n\r");
    483              memset(pCommand, 0, sizeof(SdCmd));
   \   0000000C   2820A0E3           MOV      R2,#+40
   \   00000010   0010A0E3           MOV      R1,#+0
   \   00000014   0500A0E1           MOV      R0,R5
   \   00000018   ........           BL       memset
    484              // Fill command information
    485              pCommand->cmd = AT91C_GO_IDLE_STATE_CMD;
   \   0000001C   0000A0E3           MOV      R0,#+0
   \   00000020   040085E5           STR      R0,[R5, #+4]
    486              pCommand->resType = 1;
   \   00000024   0100A0E3           MOV      R0,#+1
   \   00000028   1C00C5E5           STRB     R0,[R5, #+28]
    487              pCommand->pResp = &response;
   \   0000002C   0D00A0E1           MOV      R0,SP
   \   00000030   180085E5           STR      R0,[R5, #+24]
    488          
    489              // Set SD command state
    490              pSd->state = SD_STATE_STBY;
   \   00000034   0000A0E3           MOV      R0,#+0
   \   00000038   4400C4E5           STRB     R0,[R4, #+68]
    491          
    492              // send command
    493              error =  SendCommand(pSd);
   \   0000003C   0400A0E1           MOV      R0,R4
   \   00000040   ........           BL       SendCommand
    494              error = SD_SPI_R1((unsigned char *)&response);
    495              return error;
   \   00000044   0D00A0E1           MOV      R0,SP
   \   00000048   ........           BL       SD_SPI_R1
   \   0000004C   ........           B        ??Subroutine6_0
    496          }
    497          
    498          //------------------------------------------------------------------------------
    499          /// MMC send operation condition command.
    500          /// Sends host capacity support information and activates the card's
    501          /// initialization process.
    502          /// Returns the command transfer result (see SendCommand).
    503          /// \param pSd  Pointer to a SdCard driver instance.
    504          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
    505          static unsigned char Cmd1(SdCard *pSd)
    506          {
   \                     Cmd1:
   \   00000000   38402DE9           PUSH     {R3-R5,LR}
   \   00000004   0040A0E1           MOV      R4,R0
    507              SdCmd *pCommand = &(pSd->command);
   \   00000008   045084E2           ADD      R5,R4,#+4
    508              unsigned char error;
    509              unsigned int response;
    510          
    511              TRACE_DEBUG("Cmd1()\n\r");
    512              memset(pCommand, 0, sizeof(SdCmd));
   \   0000000C   2820A0E3           MOV      R2,#+40
   \   00000010   0010A0E3           MOV      R1,#+0
   \   00000014   0500A0E1           MOV      R0,R5
   \   00000018   ........           BL       memset
    513              // Fill command information
    514              pCommand->cmd = AT91C_MMC_SEND_OP_COND_CMD;
   \   0000001C   0100A0E3           MOV      R0,#+1
   \   00000020   040085E5           STR      R0,[R5, #+4]
    515              pCommand->arg = AT91C_MMC_HOST_VOLTAGE_RANGE;
   \   00000024   7E09A0E3           MOV      R0,#+2064384
   \   00000028   080085E5           STR      R0,[R5, #+8]
    516              pCommand->resType = 1;
   \   0000002C                      REQUIRE ?Subroutine0
   \   0000002C                      ;; // Fall through to label ?Subroutine0
    517              pCommand->pResp = &response;
    518          
    519              // Set SD command state
    520              pSd->state = SD_STATE_STBY;
    521          
    522              // send command
    523              error = SendCommand(pSd);
    524              if (error) {
    525                  return error;
    526              }
    527          
    528              error = SD_SPI_R1((unsigned char *)&response);
    529              return error;
    530          }
    531          
    532          //------------------------------------------------------------------------------
    533          /// Sends SD Memory Card interface
    534          /// condition, which includes host supply
    535          /// voltage information and asks the card
    536          /// whether card supports voltage.
    537          /// Returns 0 if successful; otherwise returns SD_ERROR_NORESPONSE if the card did
    538          /// not answer the command, or SD_ERROR_DRIVER.
    539          /// \param pSd  Pointer to a SD card driver instance.
    540          /// \param supplyVoltage  Expected supply voltage.
    541          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
    542          static unsigned char Cmd8(SdCard *pSd, unsigned char supplyVoltage)
    543          {
   \                     Cmd8:
   \   00000000   70402DE9           PUSH     {R4-R6,LR}
   \   00000004   10D04DE2           SUB      SP,SP,#+16
   \   00000008   0040A0E1           MOV      R4,R0
   \   0000000C   0160A0E1           MOV      R6,R1
    544              SdCmd *pCommand = &(pSd->command);
   \   00000010   045084E2           ADD      R5,R4,#+4
    545              unsigned int response[2];
    546              unsigned char error;
    547              unsigned char isSdhc;
    548          
    549              TRACE_DEBUG("Cmd8()\n\r");
    550              memset(pCommand, 0, sizeof(SdCmd));
   \   00000014   2820A0E3           MOV      R2,#+40
   \   00000018   0010A0E3           MOV      R1,#+0
   \   0000001C   0500A0E1           MOV      R0,R5
   \   00000020   ........           BL       memset
    551              // Fill command information
    552              pCommand->cmd = AT91C_SEND_IF_COND;
   \   00000024   0800A0E3           MOV      R0,#+8
   \   00000028   040085E5           STR      R0,[R5, #+4]
    553              pCommand->arg = (supplyVoltage << 8) | (0xAA);
   \   0000002C   AA00A0E3           MOV      R0,#+170
   \   00000030   060480E1           ORR      R0,R0,R6, LSL #+8
   \   00000034   080085E5           STR      R0,[R5, #+8]
    554              pCommand->resType = 7;
   \   00000038   0700A0E3           MOV      R0,#+7
   \   0000003C   1C00C5E5           STRB     R0,[R5, #+28]
    555              pCommand->pResp = &response[0];
   \   00000040   04008DE2           ADD      R0,SP,#+4
   \   00000044   180085E5           STR      R0,[R5, #+24]
    556              // Set SD command state
    557              pSd->state = SD_STATE_STBY;
   \   00000048   0000A0E3           MOV      R0,#+0
   \   0000004C   4400C4E5           STRB     R0,[R4, #+68]
    558          
    559              TRACE_DEBUG("supplyVoltage: 0x%x\n\r", supplyVoltage);
    560          
    561              // Send command
    562              error = SendCommand(pSd);
   \   00000050   0400A0E1           MOV      R0,R4
   \   00000054   ........           BL       SendCommand
    563          
    564          
    565              TRACE_DEBUG("SD_R7[0]: 0x%x\n\r", response[0]);
    566              TRACE_DEBUG("SD_R7[1]: 0x%x\n\r", response[1]);
    567              error = SD_SPI_R7((unsigned char *)&response, &isSdhc);
   \   00000058   0D10A0E1           MOV      R1,SP
   \   0000005C   04008DE2           ADD      R0,SP,#+4
   \   00000060   ........           BL       SD_SPI_R7
    568              if( error == SD_ERROR_NORESPONSE ) {
   \   00000064   020050E3           CMP      R0,#+2
   \   00000068   0200000A           BEQ      ??Cmd8_0
    569                  TRACE_DEBUG("Cmd8 R7 error:%d \n\r", error);
    570                  return error;
    571              }
    572              else {
    573                  if(isSdhc == 1) {
   \   0000006C   0010DDE5           LDRB     R1,[SP, #+0]
   \   00000070   010051E3           CMP      R1,#+1
    574                      TRACE_DEBUG("Cmd8 Ver 2.00 isSdhc:%d\n\r", isSdhc);
    575                      return 0;
   \   00000074   0000A003           MOVEQ    R0,#+0
    576                  }
    577                  else {
    578                      TRACE_DEBUG("Cmd8 Ver 1.X isSdhc:%d\n\r", isSdhc);
    579                      return error;
   \                     ??Cmd8_0:
   \   00000078   10D08DE2           ADD      SP,SP,#+16       ;; stack cleaning
   \   0000007C   7040BDE8           POP      {R4-R6,LR}
   \   00000080   1EFF2FE1           BX       LR               ;; return
    580                  }
    581              }
    582          }
    583          
    584          //------------------------------------------------------------------------------
    585          /// Addressed card sends its card-specific
    586          /// data (CSD) on the CMD line.
    587          /// Returns the command transfer result (see SendCommand).
    588          /// \param pSd  Pointer to a SD card driver instance.
    589          //------------------------------------------------------------------------------

   \                                 In section .text, align 4, keep-with-next
    590          static unsigned char Cmd9(SdCard *pSd)
    591          {
   \                     Cmd9:
   \   00000000   30402DE9           PUSH     {R4,R5,LR}
   \   00000004   14D04DE2           SUB      SP,SP,#+20
   \   00000008   0040A0E1           MOV      R4,R0
    592              SdCmd *pCommand = &(pSd->command);
   \   0000000C   045084E2           ADD      R5,R4,#+4
    593              unsigned char error;
    594              unsigned int response = 0;
   \   00000010   0010A0E3           MOV      R1,#+0
   \   00000014   00108DE5           STR      R1,[SP, #+0]
    595              unsigned char csdData[16];
    596              unsigned int i;
    597          
    598              TRACE_DEBUG("Cmd9()\n\r");
    599              memset(pCommand, 0, sizeof(SdCmd));
   \   00000018   2820A0E3           MOV      R2,#+40
   \   0000001C   0500A0E1           MOV      R0,R5
   \   00000020   ........           BL       memset
    600              // Fill command information
    601              pCommand->cmd = AT91C_SEND_CSD_CMD;
   \   00000024   0900A0E3           MOV      R0,#+9
   \   00000028   040085E5           STR      R0,[R5, #+4]
    602              pCommand->resType = 1;
   \   0000002C   0100A0E3           MOV      R0,#+1
   \   00000030   1C00C5E5           STRB     R0,[R5, #+28]
    603              pCommand->blockSize = 16;

⌨️ 快捷键说明

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