Remove some STM32-isms and SPI support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2536 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
ae4a408774
commit
31dd459a90
@ -2,7 +2,7 @@
|
||||
* config/sam3u-ek/src/up_nsh.c
|
||||
* arch/arm/src/board/up_nsh.c
|
||||
*
|
||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -45,18 +45,13 @@
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef CONFIG_SAM3U_SPI1
|
||||
# include <nuttx/spi.h>
|
||||
# include <nuttx/mtd.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAM3U_SDIO
|
||||
# include <nuttx/sdio.h>
|
||||
# include <nuttx/mmcsd.h>
|
||||
#endif
|
||||
#include <nuttx/sdio.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
#include "sam3u_internal.h"
|
||||
|
||||
#ifdef CONFIG_SAM3U_HSMCI
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
@ -65,7 +60,7 @@
|
||||
|
||||
/* PORT and SLOT number probably depend on the board configuration */
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_SAM3U_EK
|
||||
#ifdef CONFIG_ARCH_BOARD_SAM3UEK
|
||||
# define CONFIG_EXAMPLES_NSH_HAVEUSBDEV 1
|
||||
# define CONFIG_EXAMPLES_NSH_HAVEMMCSD 1
|
||||
# if defined(CONFIG_EXAMPLES_NSH_MMCSDSLOTNO) && CONFIG_EXAMPLES_NSH_MMCSDSLOTNO != 0
|
||||
@ -92,7 +87,7 @@
|
||||
* is not enabled.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM3U_SDIO)
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM3U_HSMCI)
|
||||
# undef CONFIG_EXAMPLES_NSH_HAVEMMCSD
|
||||
#endif
|
||||
|
||||
@ -130,50 +125,11 @@
|
||||
|
||||
int nsh_archinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_SAM3U_SPI1
|
||||
FAR struct spi_dev_s *spi;
|
||||
FAR struct mtd_dev_s *mtd;
|
||||
#endif
|
||||
#ifdef CONFIG_EXAMPLES_NSH_HAVEMMCSD
|
||||
FAR struct sdio_dev_s *sdio;
|
||||
int ret;
|
||||
#endif
|
||||
|
||||
/* Configure SPI-based devices */
|
||||
|
||||
#ifdef CONFIG_SAM3U_SPI1
|
||||
/* Get the SPI port */
|
||||
|
||||
message("nsh_archinitialize: Initializing SPI port 0\n");
|
||||
spi = up_spiinitialize(0);
|
||||
if (!spi)
|
||||
{
|
||||
message("nsh_archinitialize: Failed to initialize SPI port 0\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
message("nsh_archinitialize: Successfully initialized SPI port 0\n");
|
||||
|
||||
/* Now bind the SPI interface to the M25P64/128 SPI FLASH driver */
|
||||
|
||||
message("nsh_archinitialize: Bind SPI to the SPI flash driver\n");
|
||||
mtd = m25p_initialize(spi);
|
||||
if (!mtd)
|
||||
{
|
||||
message("nsh_archinitialize: Failed to bind SPI port 0 to the SPI FLASH driver\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
message("nsh_archinitialize: Successfully bound SPI port 0 to the SPI FLASH driver\n");
|
||||
#warning "Now what are we going to do with this SPI FLASH driver?"
|
||||
#endif
|
||||
|
||||
/* Create the SPI FLASH MTD instance */
|
||||
/* The M25Pxx is not a give media to implement a file system..
|
||||
* its block sizes are too large
|
||||
*/
|
||||
|
||||
/* Mount the SDIO-based MMC/SD block driver */
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NSH_HAVEMMCSD
|
||||
/* First, get an instance of the SDIO interface */
|
||||
|
||||
message("nsh_archinitialize: Initializing SDIO slot %d\n",
|
||||
@ -186,7 +142,7 @@ int nsh_archinitialize(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Now bind the SPI interface to the MMC/SD driver */
|
||||
/* Now bind the SDIO interface to the MMC/SD driver */
|
||||
|
||||
message("nsh_archinitialize: Bind SDIO to the MMC/SD driver, minor=%d\n",
|
||||
CONFIG_EXAMPLES_NSH_MMCSDMINOR);
|
||||
@ -199,7 +155,7 @@ int nsh_archinitialize(void)
|
||||
message("nsh_archinitialize: Successfully bound SDIO to the MMC/SD driver\n");
|
||||
|
||||
/* Then let's guess and say that there is a card in the slot. I need to check to
|
||||
* see if the SAM3U10E-EVAL board supports a GPIO to detect if there is a card in
|
||||
* see if the SAM3U-EK board supports a GPIO to detect if there is a card in
|
||||
* the slot.
|
||||
*/
|
||||
|
||||
@ -207,3 +163,4 @@ int nsh_archinitialize(void)
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user