Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Unnamed
Saturday, May 19th, 2007 at 2:12:01pm UTC 

  1. @@ -467,21 +511,37 @@
  2.      unsigned int dummy;
  3.      unsigned int response;
  4.      unsigned int i;
  5. -    tSDCardInfo *card = &card_info[current_card];
  6. -
  7. +    tSDCardInfo *card;
  8. +   
  9.      /* TODO: Add DMA support. */
  10.  
  11. -#ifdef HAVE_MULTIVOLUME
  12. -    (void)drive; /* unused for now */
  13. -#endif
  14.      mutex_lock(&sd_mtx);
  15.  
  16. +    ata_enable(true);
  17. +    ata_led(true);
  18. +
  19. +    if(drive && (GPIOA_INPUT_VAL & 0x80)) /* no external sd-card inserted */
  20. +    {
  21. +        ret = -9;
  22. +        goto error;
  23. +    }
  24. +
  25. +    if((drive != current_card) || !card_info[drive].initialized)
  26. +    {
  27. +        current_card = drive;
  28. +        sd_init_device(drive);
  29. +    }
  30. +
  31. +    card = &card_info[current_card];
  32. +    if (!card->initialized)
  33. +    {
  34. +        ret = -9;
  35. +        goto error;
  36. +    }
  37. +   
  38.      last_disk_activity = current_tick;
  39.      spinup_start = current_tick;
  40.  
  41. -    ata_enable(true);
  42. -    ata_led(true);
  43. -
  44.      timeout = current_tick + READ_TIMEOUT;
  45.  
  46.      /* TODO: Select device */
  47. @@ -529,6 +589,9 @@
  48.          sd_wait_for_state(card, TRAN);
  49.          break;
  50.      }
  51. +
  52. +  error:
  53. +
  54.      ata_led(false);
  55.      ata_enable(false);
  56.  
  57. @@ -551,11 +614,35 @@
  58.      int ret = 0;
  59.      unsigned int i;
  60.      long timeout;
  61. -    tSDCardInfo *card = &card_info[current_card];
  62. +    tSDCardInfo *card;
  63.  
  64.      mutex_lock(&sd_mtx);
  65. +
  66.      ata_enable(true);
  67.      ata_led(true);
  68. +
  69. +    if(drive && (GPIOA_INPUT_VAL & 0x80)) /* no external sd-card inserted */
  70. +    {
  71. +        ret = -9;
  72. +        goto error;
  73. +    }
  74. +
  75. +    if((drive != current_card) || !card_info[drive].initialized)
  76. +    {
  77. +        current_card = drive;
  78. +        sd_init_device(drive);
  79. +    }
  80. +
  81. +    card = &card_info[current_card];
  82. +    if (!card->initialized)
  83. +    {
  84. +        ret = -9;
  85. +        goto error;
  86. +    }
  87. +   
  88. +
  89. +    card = &card_info[current_card];
  90. +
  91.      if(current_card == 0)
  92.      {
  93.          if(start < BLOCKS_PER_BANK)

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right