From dcde5e36393f0899914d3876a27da09b5f08a93c Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 11 Apr 2010 18:08:52 +0000 Subject: [PATCH] Early debug of SAM3U MCI git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2587 42af7a65-404d-4744-a932-0658087f49c3 --- configs/sam3u-ek/src/sam3uek_internal.h | 2 +- configs/sam3u-ek/src/up_mmcsd.c | 27 +++++++++++++++---------- configs/sam3u-ek/src/up_nsh.c | 4 ++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/configs/sam3u-ek/src/sam3uek_internal.h b/configs/sam3u-ek/src/sam3uek_internal.h index f092cbb02f7..52fd3dd550b 100755 --- a/configs/sam3u-ek/src/sam3uek_internal.h +++ b/configs/sam3u-ek/src/sam3uek_internal.h @@ -119,7 +119,7 @@ extern void weak_function sam3u_usbinitialize(void); #ifdef CONFIG_SAM3U_HSMCI extern int weak_function sam3u_hsmciinit(void); #else -# define sam3u_boardmciinit() +# define sam3u_hsmciinit() #endif /**************************************************************************** diff --git a/configs/sam3u-ek/src/up_mmcsd.c b/configs/sam3u-ek/src/up_mmcsd.c index 45762ee2816..2f19c9cede3 100755 --- a/configs/sam3u-ek/src/up_mmcsd.c +++ b/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 diff --git a/configs/sam3u-ek/src/up_nsh.c b/configs/sam3u-ek/src/up_nsh.c index ae1ecb673e6..cb3665f904d 100755 --- a/configs/sam3u-ek/src/up_nsh.c +++ b/configs/sam3u-ek/src/up_nsh.c @@ -100,13 +100,13 @@ #ifdef CONFIG_CPP_HAVE_VARARGS # ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) +# define message(...) lib_rawprintf(__VA_ARGS__) # else # define message(...) printf(__VA_ARGS__) # endif #else # ifdef CONFIG_DEBUG -# define message lib_lowprintf +# define message lib_rawprintf # else # define message printf # endif