Early debug of SAM3U MCI
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2587 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
4ee22ed85c
commit
4262f27582
5 changed files with 41 additions and 21 deletions
|
|
@ -890,6 +890,10 @@ static void sam3u_endtransfer(struct sam3u_dev_s *priv, sdio_eventset_t wkupeven
|
|||
|
||||
sam3u_dmastop(priv->dma);
|
||||
|
||||
/* Disable the DMA handshaking */
|
||||
|
||||
putreg32(0, SAM3U_HSMCI_DMA);
|
||||
|
||||
/* Is a thread wait for these data transfer complete events? */
|
||||
|
||||
if ((priv->waitevents & wkupevent) != 0)
|
||||
|
|
@ -1114,10 +1118,6 @@ static void sam3u_reset(FAR struct sdio_dev_s *dev)
|
|||
|
||||
sam3u_notransfer(priv);
|
||||
|
||||
/* Disable the MCI peripheral clock */
|
||||
|
||||
putreg32((1 << SAM3U_PID_HSMCI), SAM3U_PMC_PCDR);
|
||||
|
||||
/* Reset data */
|
||||
|
||||
priv->waitevents = 0; /* Set of events to be waited for */
|
||||
|
|
@ -1508,6 +1508,11 @@ static int sam3u_cancel(FAR struct sdio_dev_s *dev)
|
|||
*/
|
||||
|
||||
sam3u_dmastop(priv->dma);
|
||||
|
||||
/* Disable the DMA handshaking */
|
||||
|
||||
putreg32(0, SAM3U_HSMCI_DMA);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
@ -2052,10 +2057,14 @@ static int sam3u_dmarecvsetup(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
|
|||
|
||||
sam3u_enablexfrints(priv, HSMCI_DMARECV_INTS);
|
||||
sam3u_dmarxsetup(priv->dma, SAM3U_HSMCI_FIFO, (uint32_t)buffer, buflen);
|
||||
|
||||
|
||||
/* Enable DMA handshaking */
|
||||
|
||||
putreg32(HSMCI_DMA_DMAEN, SAM3U_HSMCI_DMA);
|
||||
sam3u_sample(priv, SAMPLENDX_BEFORE_ENABLE);
|
||||
|
||||
/* Start the DMA */
|
||||
|
||||
sam3u_sample(priv, SAMPLENDX_BEFORE_ENABLE);
|
||||
sam3u_dmastart(priv->dma, sam3u_dmacallback, priv);
|
||||
sam3u_sample(priv, SAMPLENDX_AFTER_SETUP);
|
||||
return OK;
|
||||
|
|
@ -2096,6 +2105,10 @@ static int sam3u_dmasendsetup(FAR struct sdio_dev_s *dev,
|
|||
/* Configure the TX DMA */
|
||||
|
||||
sam3u_dmatxsetup(priv->dma, SAM3U_HSMCI_FIFO, (uint32_t)buffer, buflen);
|
||||
|
||||
/* Enable DMA handshaking */
|
||||
|
||||
putreg32(HSMCI_DMA_DMAEN, SAM3U_HSMCI_DMA);
|
||||
sam3u_sample(priv, SAMPLENDX_BEFORE_ENABLE);
|
||||
|
||||
/* Start the DMA */
|
||||
|
|
@ -2214,6 +2227,8 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
|
|||
|
||||
struct sam3u_dev_s *priv = &g_sdiodev;
|
||||
|
||||
fdbg("slotno: %d\n", slotno);
|
||||
|
||||
/* Initialize the HSMCI slot structure */
|
||||
|
||||
sem_init(&priv->waitsem, 0, 0);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/************************************************************************************************
|
||||
* arch/arm/src/sam3u/sam3u_memorymap.h
|
||||
*
|
||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue