Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

fat_t3.cpp 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Optimized SD Library for Teensy 3.X
  2. * Copyright (c) 2015, Paul Stoffregen, paul@pjrc.com
  3. *
  4. * Development of this SD library was funded by PJRC.COM, LLC by sales of
  5. * Teensy and Audio Adaptor boards. Please support PJRC's efforts to develop
  6. * open source software by purchasing genuine Teensy or other PJRC products.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documentation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice, development funding notice, and this permission
  16. * notice shall be included in all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. */
  26. #if defined(__arm__)
  27. #include "SD_t3.h"
  28. #ifdef USE_TEENSY3_OPTIMIZED_CODE
  29. bool File::next_cluster()
  30. {
  31. SDCache fat;
  32. uint32_t lba, cluster;
  33. lba = SDClass::fat1_begin_lba;
  34. cluster = current_cluster;
  35. //Serial.println();
  36. //Serial.println("****************************************");
  37. //Serial.println();
  38. //Serial.printf(" current_cluster = %d\n", cluster);
  39. if (SDClass::fat_type == 16) {
  40. SDClass::sector_t *s = fat.read(lba + (cluster >> 8), true);
  41. if (!s) return false;
  42. cluster = s->u16[cluster & 255];
  43. } else {
  44. SDClass::sector_t *s = fat.read(lba + (cluster >> 7), true);
  45. if (!s) return false;
  46. cluster = s->u32[cluster & 127];
  47. }
  48. //Serial.printf(" new_cluster = %d\n", cluster);
  49. //Serial.println();
  50. //Serial.println("****************************************");
  51. //Serial.println();
  52. current_cluster = cluster;
  53. if (cluster > SDClass::max_cluster) return false;
  54. return true;
  55. }
  56. #endif
  57. #endif