Fix mount problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1835 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
45456750bf
commit
9f478308f7
@ -749,5 +749,7 @@
|
|||||||
* configs/mcu123-lpc214x/src: Corrected some logic in the LPC2148 SPI receive block
|
* configs/mcu123-lpc214x/src: Corrected some logic in the LPC2148 SPI receive block
|
||||||
logic. Re-verified SDC ver1.x support with 1Gb Toshiba SDC, 1Gb PNY SDC, 2Gb SanDisk SDC,
|
logic. Re-verified SDC ver1.x support with 1Gb Toshiba SDC, 1Gb PNY SDC, 2Gb SanDisk SDC,
|
||||||
and 4Gb Kingston SDHC.
|
and 4Gb Kingston SDHC.
|
||||||
|
* fs/fs_mount.c: Corrected error handling that could cause a deadlock on certain
|
||||||
|
mount() failures.
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<tr align="center" bgcolor="#e4e4e4">
|
<tr align="center" bgcolor="#e4e4e4">
|
||||||
<td>
|
<td>
|
||||||
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
||||||
<p>Last Updated: May 28, 2009</p>
|
<p>Last Updated: May 29, 2009</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -1439,6 +1439,8 @@ nuttx-0.4.7 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
|||||||
* configs/mcu123-lpc214x/src: Corrected some logic in the LPC2148 SPI receive block
|
* configs/mcu123-lpc214x/src: Corrected some logic in the LPC2148 SPI receive block
|
||||||
logic. Re-verified SDC ver1.x support with 1Gb Toshiba SDC, 1Gb PNY SDC, 2Gb SanDisk SDC,
|
logic. Re-verified SDC ver1.x support with 1Gb Toshiba SDC, 1Gb PNY SDC, 2Gb SanDisk SDC,
|
||||||
and 4Gb Kingston SDHC.
|
and 4Gb Kingston SDHC.
|
||||||
|
* fs/fs_mount.c: Corrected error handling that could cause a deadlock on certain
|
||||||
|
mount() failures.
|
||||||
|
|
||||||
pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
pascal-0.1.3 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
|
||||||
|
@ -431,8 +431,17 @@ static uint32 mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot,
|
|||||||
FAR struct spi_dev_s *spi = slot->spi;
|
FAR struct spi_dev_s *spi = slot->spi;
|
||||||
uint32 result;
|
uint32 result;
|
||||||
ubyte response = 0xff;
|
ubyte response = 0xff;
|
||||||
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* Wait until the card is not busy */
|
||||||
|
|
||||||
|
ret = mmcsd_waitready(slot);
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* Send command code */
|
/* Send command code */
|
||||||
|
|
||||||
SPI_SEND(spi, cmd->cmd);
|
SPI_SEND(spi, cmd->cmd);
|
||||||
@ -1012,15 +1021,34 @@ static int mmcsd_open(FAR struct inode *inode)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Select the slave */
|
/* Verify that an MMC/SD card has been inserted */
|
||||||
|
|
||||||
|
ret = -ENODEV;
|
||||||
mmcsd_semtake(&slot->sem);
|
mmcsd_semtake(&slot->sem);
|
||||||
|
if ((SPI_STATUS(spi, SPIDEV_MMCSD) & SPI_STATUS_PRESENT) != 0)
|
||||||
|
{
|
||||||
|
/* Yes.. a card is present. Has it been initialized? */
|
||||||
|
|
||||||
|
if (slot->type == MMCSD_CARDTYPE_UNKNOWN)
|
||||||
|
{
|
||||||
|
/* Ininitialize for the media in the slot */
|
||||||
|
|
||||||
|
ret = mmcsd_mediainitialize(slot);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
fvdbg("Failed to initialize card\n");
|
||||||
|
goto errout_with_sem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure that the card is ready */
|
||||||
|
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, TRUE);
|
SPI_SELECT(spi, SPIDEV_MMCSD, TRUE);
|
||||||
|
|
||||||
/* Verify that the MMC/SD card is alive and ready for business */
|
|
||||||
|
|
||||||
ret = mmcsd_waitready(slot);
|
ret = mmcsd_waitready(slot);
|
||||||
SPI_SELECT(spi, SPIDEV_MMCSD, FALSE);
|
SPI_SELECT(spi, SPIDEV_MMCSD, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
errout_with_sem:
|
||||||
mmcsd_semgive(&slot->sem);
|
mmcsd_semgive(&slot->sem);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1084,7 +1112,7 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Verify that card is availabled */
|
/* Verify that card is available */
|
||||||
|
|
||||||
if (slot->state & MMCSD_SLOTSTATUS_NOTREADY)
|
if (slot->state & MMCSD_SLOTSTATUS_NOTREADY)
|
||||||
{
|
{
|
||||||
@ -1237,7 +1265,7 @@ static ssize_t mmcsd_write(FAR struct inode *inode, const unsigned char *buffer,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Verify that card is availabled */
|
/* Verify that card is available */
|
||||||
|
|
||||||
if (slot->state & MMCSD_SLOTSTATUS_NOTREADY)
|
if (slot->state & MMCSD_SLOTSTATUS_NOTREADY)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/nsh/nsh_fscmds.c
|
* examples/nsh/nsh_fscmds.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* fs_fat32.c
|
* fs_fat32.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* References:
|
* References:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* fs/fs_mount.c
|
* fs/fs_mount.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -231,7 +231,7 @@ int mount(const char *source, const char *target,
|
|||||||
|
|
||||||
fdbg("Bind method failed: %d\n", status);
|
fdbg("Bind method failed: %d\n", status);
|
||||||
errcode = -status;
|
errcode = -status;
|
||||||
goto errout_with_blkdrvr;
|
goto errout_with_mountpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We have it, now populate it with driver specific information. */
|
/* We have it, now populate it with driver specific information. */
|
||||||
@ -256,13 +256,16 @@ int mount(const char *source, const char *target,
|
|||||||
|
|
||||||
/* A lot of goto's! But they make the error handling much simpler */
|
/* A lot of goto's! But they make the error handling much simpler */
|
||||||
|
|
||||||
errout_with_blkdrvr:
|
|
||||||
inode_release(blkdrvr_inode);
|
|
||||||
errout_with_mountpt:
|
errout_with_mountpt:
|
||||||
|
inode_semgive();
|
||||||
|
inode_release(blkdrvr_inode);
|
||||||
inode_release(mountpt_inode);
|
inode_release(mountpt_inode);
|
||||||
|
goto errout;
|
||||||
|
|
||||||
errout_with_semaphore:
|
errout_with_semaphore:
|
||||||
inode_semgive();
|
inode_semgive();
|
||||||
inode_release(blkdrvr_inode);
|
inode_release(blkdrvr_inode);
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
errno = errcode;
|
errno = errcode;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
|
Loading…
Reference in New Issue
Block a user