summaryrefslogtreecommitdiff
path: root/nuttx/configs/sam3u-ek/src/up_mmcsd.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-04-11 18:08:52 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-04-11 18:08:52 +0000
commit43f791fab83155249f86ed7432a60d420b8b9851 (patch)
tree40ef0f96cebc9308369d6d72d0d70ad75907b717 /nuttx/configs/sam3u-ek/src/up_mmcsd.c
parent43a9fea627eecbc4294079e80be611c2f4f7d7e3 (diff)
downloadpx4-nuttx-43f791fab83155249f86ed7432a60d420b8b9851.tar.gz
px4-nuttx-43f791fab83155249f86ed7432a60d420b8b9851.tar.bz2
px4-nuttx-43f791fab83155249f86ed7432a60d420b8b9851.zip
Early debug of SAM3U MCI
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2587 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/sam3u-ek/src/up_mmcsd.c')
-rwxr-xr-xnuttx/configs/sam3u-ek/src/up_mmcsd.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/nuttx/configs/sam3u-ek/src/up_mmcsd.c b/nuttx/configs/sam3u-ek/src/up_mmcsd.c
index 45762ee28..2f19c9ced 100755
--- a/nuttx/configs/sam3u-ek/src/up_mmcsd.c
+++ b/nuttx/configs/sam3u-ek/src/up_mmcsd.c
@@ -70,39 +70,42 @@
* Public Functions
************************************************************************************/
-/****************************************************************************
+/************************************************************************************
* Name: sam3u_hsmciinit
*
* Description:
- * Initialize HSMCI support
+ * Initialize HSMCI support. This function is called very early in board
+ * initialization.
*
- ****************************************************************************/
+ ************************************************************************************/
int sam3u_hsmciinit(void)
{
-#if GPIO_MCI_CD
+#ifdef GPIO_MCI_CD
sam3u_configgpio(GPIO_MCI_CD);
#endif
-#if GPIO_MCI_WP
+#ifdef GPIO_MCI_WP
sam3u_configgpio(GPIO_MCI_WP);
#endif
return OK;
}
-/****************************************************************************
+/************************************************************************************
* Name: sam3u_cardinserted
*
* Description:
* Check if a card is inserted into the selected HSMCI slot
*
- ****************************************************************************/
+ ************************************************************************************/
bool sam3u_cardinserted(unsigned char slot)
{
if (slot == 0)
{
#ifdef GPIO_MCI_CD
- return !sam3u_gpioread(GPIO_MCI_CD);
+ bool inserted = sam3u_gpioread(GPIO_MCI_CD);
+ fvdbg("inserted: %s\n", inserted ? "NO" : "YES");
+ return !inserted;
#else
return true;
#endif
@@ -110,20 +113,22 @@ bool sam3u_cardinserted(unsigned char slot)
return false;
}
-/****************************************************************************
+/************************************************************************************
* Name: sam3u_writeprotected
*
* Description:
* Check if a card is inserted into the selected HSMCI slot
*
- ****************************************************************************/
+ ************************************************************************************/
bool sam3u_writeprotected(unsigned char slot)
{
if (slot == 0)
{
#ifdef GPIO_MCI_WP
- return sam3u_gpioread(GPIO_MCI_WP);
+ bool protected = sam3u_gpioread(GPIO_MCI_WP);
+ fvdbg("protected: %s\n", inserted ? "YES" : "NO");
+ return protected;
#else
return false;
#endif