sdp.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All rights reserved.
  3. Module Name:
  4. sdp.h
  5. Abstract:
  6. This header contains internal definitions for the SD library. This file
  7. should only be included by the driver and library itself, not by external
  8. consumers of the library.
  9. Author:
  10. Evan Green 27-Feb-2014
  11. --*/
  12. //
  13. // ------------------------------------------------------------------- Includes
  14. //
  15. #define SD_API __DLLEXPORT
  16. #include <minoca/sd/sd.h>
  17. //
  18. // --------------------------------------------------------------------- Macros
  19. //
  20. //
  21. // ---------------------------------------------------------------- Definitions
  22. //
  23. //
  24. // Define the amount of time to wait in milliseconds for the controller to
  25. // respond.
  26. //
  27. #define SD_CONTROLLER_TIMEOUT_MS 300
  28. //
  29. // Define the amount of time to wait in seconds for the status to go green.
  30. //
  31. #define SD_CONTROLLER_STATUS_TIMEOUT 60
  32. //
  33. // Defien the amount of time to wait for an MMC card to initialize.
  34. //
  35. #define SD_CMD1_TIMEOUT 5
  36. //
  37. // Define the amount of time to wait for the card to initialize, in
  38. // microseconds.
  39. //
  40. #define SD_CARD_DELAY 1000
  41. #define SD_POST_RESET_DELAY 2000
  42. //
  43. // Define the number of attempts to try certain commands.
  44. //
  45. #define SD_CARD_INITIALIZE_RETRY_COUNT 3
  46. #define SD_CARD_OPERATING_CONDITION_RETRY_COUNT 1000
  47. #define SD_CONFIGURATION_REGISTER_RETRY_COUNT 3
  48. #define SD_SWITCH_RETRY_COUNT 4
  49. #define SD_INTERFACE_CONDITION_RETRY_COUNT 3
  50. #define SD_SET_BLOCK_LENGTH_RETRY_COUNT 10
  51. //
  52. // Define the block sized used by the SD library.
  53. //
  54. #define SD_BLOCK_SIZE 512
  55. #define SD_MMC_MAX_BLOCK_SIZE 512
  56. //
  57. // Define the maximum number of blocks that can be sent in a single command.
  58. //
  59. #define SD_MAX_BLOCK_COUNT 0xFFFF
  60. //
  61. // Define the size of the ADMA2 descriptor table, which is an entry for the
  62. // transfer and an entry for the terminator.
  63. //
  64. #define SD_ADMA2_DESCRIPTOR_COUNT 0x100
  65. #define SD_ADMA2_DESCRIPTOR_TABLE_SIZE \
  66. (SD_ADMA2_DESCRIPTOR_COUNT * sizeof(SD_ADMA2_DESCRIPTOR))
  67. //
  68. // ------------------------------------------------------ Data Type Definitions
  69. //
  70. //
  71. // -------------------------------------------------------------------- Globals
  72. //
  73. extern SD_FUNCTION_TABLE SdStdFunctionTable;
  74. //
  75. // -------------------------------------------------------- Function Prototypes
  76. //