Add support for multiplexed SDIO pins from Uros

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3898 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-08-19 16:51:04 +00:00
parent de0f788a05
commit a87259ebc6
18 changed files with 698 additions and 218 deletions
+29 -3
View File
@@ -148,7 +148,10 @@ struct mmcsd_state_s
/* Misc Helpers *************************************************************/
static void mmcsd_takesem(FAR struct mmcsd_state_s *priv);
#define mmcsd_givesem(p) sem_post(&priv->sem);
#ifndef CONFIG_SDIO_MUXBUS
# define mmcsd_givesem(p) sem_post(&priv->sem);
#endif
/* Command/response helpers *************************************************/
@@ -261,18 +264,41 @@ static const struct block_operations g_bops =
static void mmcsd_takesem(FAR struct mmcsd_state_s *priv)
{
/* Take the semaphore (perhaps waiting) */
/* Take the semaphore, giving exclusive access to the driver (perhaps
* waiting)
*/
while (sem_wait(&priv->sem) != 0)
{
/* The only case that an error should occr here is if the wait was
/* The only case that an error should occur here is if the wait was
* awakened by a signal.
*/
ASSERT(errno == EINTR);
}
/* Lock the bus if mutually exclusive access to the SDIO bus is required
* on this platform.
*/
#ifdef CONFIG_SDIO_MUXBUS
SDIO_LOCK(priv->dev, TRUE);
#endif
}
#ifdef CONFIG_SDIO_MUXBUS
static void mmcsd_givesem(FAR struct mmcsd_state_s *priv)
{
/* Release the SDIO bus lock, then the MMC/SD driver semaphore in the
* opposite order that they were taken to assure that no deadlock
* conditions will arise.
*/
SDIO_LOCK(priv->dev, FALSE);
sem_post(&priv->sem);
}
#endif
/****************************************************************************
* Command/Response Helpers
****************************************************************************/