Advertisement
Guest User

Untitled

a guest
Jan 13th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.68 KB | None | 0 0
  1. diff --git a/litesdcard/firmware/sdcard.c b/litesdcard/firmware/sdcard.c
  2. index f819953..4e44d39 100644
  3. --- a/litesdcard/firmware/sdcard.c
  4. +++ b/litesdcard/firmware/sdcard.c
  5. @@ -204,45 +204,13 @@ int sdcard_wait_data_done(void) {
  6.  }
  7.  
  8.  int sdcard_wait_response(void) {
  9. -       int i;
  10. -       int status;
  11. +       int status = sdcard_wait_cmd_done();
  12.  
  13. -#if CSR_DATA_WIDTH == 8
  14. -       unsigned int r;
  15. -
  16. -       status = sdcard_wait_cmd_done();
  17. -
  18. -       // LSB is located at RESPONSE_ADDR + (RESPONSE_SIZE - 1) * 4
  19. -       int offset;
  20. -       for(i=0; i<4; i++) {
  21. -         r = 0;
  22. -         for( j = 0; j < 4; j++ ) {
  23. -           offset = ((CSR_SDCORE_RESPONSE_SIZE - 1) * 4) - j * 4 - i * 16;
  24. -           if( offset >= 0 ) {
  25. -             r |= ((csr_readl(CSR_SDCORE_RESPONSE_ADDR + offset) & 0xFF) << (j
  26. * 8));
  27. -           }
  28. -         }
  29. -#ifdef SDCARD_DEBUG
  30. -         printf("%08x ", r);
  31. -#endif
  32. -         sdcard_response[3 - i] = r;  // NOTE: this is "backwards" but sticking with this because it's compatible with CSR32
  33. -       }
  34. -#ifdef SDCARD_DEBUG
  35. -       printf( "\n" );
  36. -#endif
  37. -
  38. -
  39. -#else
  40. -       volatile unsigned int *buffer = (unsigned int *)CSR_SDCORE_RESPONSE_ADDR;
  41. -
  42. -       status = sdcard_wait_cmd_done();
  43. -
  44. -       for(i=0; i<4; i++) {
  45. +       csr_rd_buf_uint32(CSR_SDCORE_RESPONSE_ADDR, sdcard_response, 4);
  46.  #ifdef SDCARD_DEBUG
  47. -               printf("%08x\n", buffer[i]);
  48. -#endif
  49. -               sdcard_response[i] = buffer[i];
  50. -       }
  51. +       printf("sdcard_response = [%08x, %08x, %08x, %08x];\n",
  52. +               sdcard_response[0], sdcard_response[1],
  53. +               sdcard_response[2], sdcard_response[3]);
  54.  #endif
  55.  
  56.         return status;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement