sbi1mmc1.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright (C) 2006 by egnite Software GmbH
  3. * Copyright (C) 2008 by egnite GmbH
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the distribution.
  16. * 3. Neither the name of the copyright holders nor the names of
  17. * contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  23. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  24. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  25. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  26. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  27. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  28. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  29. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  30. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31. * SUCH DAMAGE.
  32. *
  33. * For additional information see http://www.ethernut.de/
  34. */
  35. /*!
  36. * \brief Low Level Multimedia Card Access.
  37. *
  38. * Low level MMC hardware routines for SPI emulation by software
  39. * (bit banging).
  40. *
  41. * These routines support SPI mode only and are required by the
  42. * basic MMC driver.
  43. *
  44. * \verbatim
  45. * $Id: sbi1mmc1.c 2349 2008-10-23 08:52:20Z haraldkipp $
  46. * \endverbatim
  47. */
  48. #include <cfg/arch.h>
  49. #include <cfg/arch/gpio.h>
  50. #include <sys/event.h>
  51. #include <dev/irqreg.h>
  52. #include <dev/mmcard.h>
  53. #include <dev/sbimmc.h>
  54. #if 0
  55. /* Use for local debugging. */
  56. #define NUTDEBUG
  57. #include <stdio.h>
  58. #endif
  59. /*!
  60. * \addtogroup xgSbiMmCard
  61. */
  62. /*@{*/
  63. #if defined(MMC1_CLK_PIO_BIT)
  64. #define MMC_CLK_PIO_BIT MMC1_CLK_PIO_BIT
  65. #endif
  66. #if defined(MMC1_CLK_PIO_ID)
  67. #define MMC_CLK_PIO_ID MMC1_CLK_PIO_ID
  68. #endif
  69. #if defined(MMC1_MOSI_PIO_BIT)
  70. #define MMC_MOSI_PIO_BIT MMC1_MOSI_PIO_BIT
  71. #endif
  72. #if defined(MMC1_MOSI_PIO_ID)
  73. #define MMC_MOSI_PIO_ID MMC1_MOSI_PIO_ID
  74. #endif
  75. #if defined(MMC1_MISO_PIO_BIT)
  76. #define MMC_MISO_PIO_BIT MMC1_MISO_PIO_BIT
  77. #endif
  78. #if defined(MMC1_MISO_PIO_ID)
  79. #define MMC_MISO_PIO_ID MMC1_MISO_PIO_ID
  80. #endif
  81. #if defined(MMC1_CS1_PIO_BIT)
  82. #define MMC_CS_PIO_BIT MMC1_CS1_PIO_BIT
  83. #endif
  84. #if defined(MMC1_CS1_PIO_ID)
  85. #define MMC_CS_PIO_ID MMC1_CS1_PIO_ID
  86. #endif
  87. #if defined(MMC1_CD1_PIO_BIT)
  88. #define MMC_CD_PIO_BIT MMC1_CD1_PIO_BIT
  89. #endif
  90. #if defined(MMC1_CD1_PIO_ID)
  91. #define MMC_CD_PIO_ID MMC1_CD1_PIO_ID
  92. #endif
  93. #if defined(MMC1_WP1_PIO_BIT)
  94. #define MMC_WP_PIO_BIT MMC1_WP1_PIO_BIT
  95. #endif
  96. #if defined(MMC1_WP1_PIO_ID)
  97. #define MMC_WP_PIO_ID MMC1_WP1_PIO_ID
  98. #endif
  99. #define MMC_DEV_NAME {'M', 'M', 'C', '3', 0, 0, 0, 0, 0}
  100. /*@}*/
  101. #define devSbiMmCard devSbi1MmCard1
  102. #include "sbi_mmc.c"