From 43f791fab83155249f86ed7432a60d420b8b9851 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 11 Apr 2010 18:08:52 +0000 Subject: Early debug of SAM3U MCI git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2587 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/configs/sam3u-ek/src/up_mmcsd.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'nuttx/configs/sam3u-ek/src/up_mmcsd.c') 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 -- cgit v1.2.3