Guest User

nointernal

a guest
Oct 18th, 2017
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- a/firmware/target/arm/as3525/sd-as3525v2.c
  2. +++ b/firmware/target/arm/as3525/sd-as3525v2.c
  3. @@ -53,9 +53,14 @@
  4. #define INTERNAL_AS3525 0 /* embedded SD card */
  5. #define SD_SLOT_AS3525 1 /* SD slot if present */
  6.  
  7. +#define SD_BLOCKED_DRIVE INTERNAL_AS3525
  8. +#define SD_REDIRECT_DRIVE SD_SLOT_AS3525
  9. /* Clipv2 Clip+ and Fuzev2 OF all occupy the same size */
  10. +#if SD_BLOCKED_DRIVE == INTERNAL_AS3525
  11. +#define AMS_OF_SIZE 0x0
  12. +#else
  13. #define AMS_OF_SIZE 0xf000
  14. -
  15. +#endif
  16. /* command flags */
  17. #define MCI_NO_RESP (0<<0)
  18. #define MCI_RESP (1<<0)
  19. @@ -449,12 +454,15 @@
  20. return true;
  21. }
  22.  
  23. -static int sd_wait_for_tran_state(const int drive)
  24. +static int sd_wait_for_tran_state(int drive)
  25. {
  26. unsigned long response;
  27. unsigned int timeout = current_tick + 5*HZ;
  28. int cmd_retry = 10;
  29. -
  30. +#ifdef SD_BLOCKED_DRIVE
  31. +if (drive == SD_BLOCKED_DRIVE)
  32. + drive = SD_REDIRECT_DRIVE;
  33. +#endif
  34. while (1)
  35. {
  36. while (!send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca, MCI_RESP,
  37. @@ -477,7 +485,7 @@
  38. }
  39.  
  40.  
  41. -static int sd_init_card(const int drive)
  42. +static int sd_init_card(int drive)
  43. {
  44. unsigned long response;
  45. long init_timeout;
  46. @@ -485,7 +493,10 @@
  47.  
  48. card_info[drive].initialized = 0;
  49. card_info[drive].rca = 0;
  50. -
  51. +#ifdef SD_BLOCKED_DRIVE
  52. +if (drive == SD_BLOCKED_DRIVE)
  53. + drive = SD_REDIRECT_DRIVE;
  54. +#endif
  55. /* assume 24 MHz clock / 60 = 400 kHz */
  56. MCI_CLKDIV = (MCI_CLKDIV & ~(0xFF)) | 0x3C; /* CLK_DIV_0 : bits 7:0 */
  57.  
  58. @@ -756,6 +767,10 @@
  59. {
  60. unsigned long response;
  61. int ret = 0;
  62. +#ifdef SD_BLOCKED_DRIVE
  63. +if (drive == SD_BLOCKED_DRIVE)
  64. + drive = SD_REDIRECT_DRIVE;
  65. +#endif
  66. #ifndef HAVE_MULTIDRIVE
  67. const int drive = 0;
  68. #endif
  69. @@ -978,6 +993,10 @@
  70.  
  71. bool sd_present(IF_MD_NONVOID(int drive))
  72. {
  73. +#ifdef SD_BLOCKED_DRIVE
  74. +if (drive == SD_BLOCKED_DRIVE)
  75. + drive = SD_REDIRECT_DRIVE;
  76. +#endif
  77. return (drive == INTERNAL_AS3525) ? true : card_detect_target();
  78. }
RAW Paste Data