lpc177x_8x_mmcard_sdio.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #ifndef _LPC177x_8x_MMCARD_SDIO_H_
  2. #define _LPC177x_8x_MMCARD_SDIO_H_
  3. /*
  4. * Copyright (C) 2005 by egnite Software GmbH. All rights reserved.
  5. * Copyright (C) 2012 by Rob van Lieshout (info@pragmalab.nl)
  6. * Copyright (C) 2012 by Ole Reinhardt (ole.reinhardt@embedded-it.de)
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. Neither the name of the copyright holders nor the names of
  18. * contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  30. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  31. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * For additional information see http://www.ethernut.de/
  35. */
  36. /*!
  37. * \file arch/cm3/nxp/lpc177x_8x_mmcard_sdio.h
  38. * \brief Header file for multimedia card driver.
  39. *
  40. * \verbatim
  41. * $Id: $
  42. * \endverbatim
  43. */
  44. #include <cfg/mmci.h>
  45. #include <sys/device.h>
  46. #include <sys/file.h>
  47. /*
  48. * MCI power active level -> set to (0) or (1) depending your board HW
  49. */
  50. #ifndef BRD_MCI_POWERED_ACTIVE_LEVEL
  51. #define BRD_MCI_POWERED_ACTIVE_LEVEL (1) /* IAR LPC1788 devboared needs active HIGH level */
  52. #endif
  53. #ifndef MMC_BLOCK_SIZE
  54. #define MMC_BLOCK_SIZE 512
  55. #endif
  56. /*!
  57. * \addtogroup xgMmCard
  58. */
  59. /*@{*/
  60. /*!
  61. * \name Control Codes
  62. */
  63. /*@{*/
  64. /*! \brief Retrieve card status. */
  65. #define MMCARD_GETSTATUS 0x2001
  66. /*! \brief Retrieve operation condition register. */
  67. #define MMCARD_GETOCR 0x2002
  68. /*! \brief Retrieve card identification. */
  69. #define MMCARD_GETCID 0x2003
  70. /*! \brief Retrieve card specific data. */
  71. #define MMCARD_GETCSD 0x2004
  72. /*! \brief Retrieve extended card specific data. */
  73. #define MMCARD_GETEXTCSD 0x2005
  74. /*!
  75. * \brief Multimedia card identification register.
  76. */
  77. typedef struct NUT_PACKED_TYPE _MMC_CSD {
  78. /*! \brief Card specification. */
  79. u_char mmcsd_spec;
  80. /*! \brief Data read access time. */
  81. u_char mmcsd_taac;
  82. /*! \brief Data read access time 2. */
  83. u_char mmcsd_nsac;
  84. /*! \brief Maximum data transfer rate. */
  85. u_char mmcsd_speed;
  86. /*! \brief Card command classes and max. read block length. */
  87. u_char mmcsd_ccc_bl[2];
  88. /*! \brief Read-only fields.
  89. *
  90. * - [0] 0..1 Device size bits 10..11.
  91. * - [0] 2..3 Reserved.
  92. * - [0] 4 DSR implemented.
  93. * - [0] 5 Read block misalignment.
  94. * - [0] 6 Write block misalignment.
  95. * - [0] 7 Partial blocks for read allowed.
  96. * - [1] 0..7 Device size bits 2..9.
  97. * - [2] 0..2 Max. read current at VDD max.
  98. * - [2] 3..5 Max. read current at VDD min.
  99. * - [2] 6..7 Device size bits 0..1.
  100. * - [3] 0..1 Device size multiplier bits 1..2.
  101. * - [3] 2..4 Max. write current at VDD max.
  102. * - [3] 5..7 Max. write current at VDD min.
  103. * - [4] 0..1 Erase group size multiplier bits 3..4.
  104. * - [4] 2..6 Erase group size.
  105. * - [4] 7 Device size multiplier bit 0.
  106. * - [5] 0..4 Write protect group size.
  107. * - [5] 5..7 Erase group size multiplier bits 0..2.
  108. * - [6] 0..1 Max. write data block length bits 2..3.
  109. * - [6] 2..4 Read to write speed factor.
  110. * - [6] 5..6 Reserved.
  111. * - [6] 7 Write protect group enable.
  112. * - [7] 0 Content protection application.
  113. * - [7] 1..4 Reserved.
  114. * - [7] 5 Partial blocks for write allowed.
  115. * - [7] 6..7 Max. write data block length bits 0..1.
  116. */
  117. u_char mmcsd_rfld[8];
  118. /*! \brief Programmable field. */
  119. u_char mmcsd_pfld;
  120. /*! \brief Checksum. */
  121. u_char mmcsd_crc;
  122. } MMC_CSD;
  123. /*@}*/
  124. #endif