fragments of MCI driver

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2551 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2010-03-23 02:00:38 +00:00
parent c823a47276
commit 9cffc07595
4 changed files with 2725 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/sam3u/chip.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
@ -52,7 +52,7 @@
# define CONFIG_SAM3U_SRAM0_SIZE 0x00008000 /* 32Kb */
# define CONFIG_SAM3U_SRAM1_SIZE 0x00004000 /* 16Kb */
# define CONFIG_SAM3U_NFCSRAM_SIZE 0x00001000 /* 4Kb */
# define CONFIG_SAM3U_MCI2 1
#else
# error "Unknown SAM3U chip type"
#endif

2638
arch/arm/src/sam3u/sam3u_hsmci.c Executable file

File diff suppressed because it is too large Load Diff

View File

@ -132,6 +132,7 @@
#define HSMCI_DTOR_DTOCYC_SHIFT (0) /* Bits 0-3: Data Timeout Cycle Number */
#define HSMCI_DTOR_DTOCYC_MASK (15 << HSMCI_DTOR_DTOCYC_SHIFT)
# define HSMCI_DTOR_DTOCYC_MAX (15 << HSMCI_DTOR_DTOCYC_SHIFT)
#define HSMCI_DTOR_DTOMUL_SHIFT (4) /* Bits 4-6: Data Timeout Multiplier */
#define HSMCI_DTOR_DTOMUL_MASK (7 << HSMCI_DTOR_DTOMUL_SHIFT)
# define HSMCI_DTOR_DTOMUL_1 (0 << HSMCI_DTOR_DTOMUL_SHIFT)
@ -142,6 +143,7 @@
# define HSMCI_DTOR_DTOMUL_4096 (5 << HSMCI_DTOR_DTOMUL_SHIFT)
# define HSMCI_DTOR_DTOMUL_65536 (6 << HSMCI_DTOR_DTOMUL_SHIFT)
# define HSMCI_DTOR_DTOMUL_1048576 (7 << HSMCI_DTOR_DTOMUL_SHIFT)
# define HSMCI_DTOR_DTOMUL_MAX (7 << HSMCI_DTOR_DTOMUL_SHIFT)
/* HSMCI SDCard/SDIO Register */

View File

@ -231,6 +231,7 @@
#define GPIO_MCI_DAT7 (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOB|GPIO_PIN31)
#define GPIO_MCI_CK (GPIO_PERIPHA|GPIO_CFG_DEFAULT|GPIO_PORT_PIOA|GPIO_PIN3)
#define GPIO_MCI_DA (GPIO_PERIPHA|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN4)
#define GPIO_MCI_DAT0IN (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN5)
#define GPIO_PWMC_PWMH0 (GPIO_PERIPHA|GPIO_CFG_DEFAULT|GPIO_PORT_PIOB|GPIO_PIN0)
#define GPIO_PWMC_PWML0 (GPIO_PERIPHB|GPIO_CFG_DEFAULT|GPIO_PORT_PIOA|GPIO_PIN7)
@ -293,6 +294,9 @@
* Public Types
************************************************************************************/
typedef FAR void *DMA_HANDLE;
typedef void (*dma_callback_t)(DMA_HANDLE handle, uint8_t isr, void *arg);
/************************************************************************************
* Inline Functions
************************************************************************************/
@ -428,6 +432,85 @@ EXTERN void sam3u_gpioirqdisable(int irq);
# define sam3u_gpioirqdisable(irq)
#endif
/****************************************************************************
* Name: sam3u_dmachannel
*
* Description:
* Allocate a DMA channel. This function sets aside a DMA channel and
* gives the caller mutually exclusive access to the DMA channel.
*
* Returned Value:
* One success, this function ALWAYS will return a non-NULL, DMA channel
* handle.
*
****************************************************************************/
EXTERN DMA_HANDLE sam3u_dmachannel(void);
/****************************************************************************
* Name: sam3u_dmafree
*
* Description:
* Release a DMA channel. NOTE: The 'handle' used in this argument must
* NEVER be used again until sam3u_dmachannel() is called again to
* re-allocate the channel.
*
* Returned Value:
* None
*
* Assumptions:
* - The caller holds the DMA channel.
* - There is no DMA in progress
*
****************************************************************************/
EXTERN void sam3u_dmafree(DMA_HANDLE handle);
/****************************************************************************
* Name: sam3u_dmasetup
*
* Description:
* Configure DMA before using
*
* Assumptions:
* - DMA handle allocated by sam3u_dmachannel()
* - No DMA in progress
*
****************************************************************************/
EXTERN void sam3u_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr,
size_t ntransfers, uint32_t ccr);
/****************************************************************************
* Name: sam3u_dmastart
*
* Description:
* Start the DMA transfer
*
* Assumptions:
* - DMA handle allocated by sam3u_dmachannel()
* - No DMA in progress
*
****************************************************************************/
EXTERN void sam3u_dmastart(DMA_HANDLE handle, dma_callback_t callback,
void *arg, bool half);
/****************************************************************************
* Name: sam3u_dmastop
*
* Description:
* Cancel the DMA. After sam3u_dmastop() is called, the DMA channel is
* reset and sam3u_dmasetup() must be called before sam3u_dmastart() can be
* called again
*
* Assumptions:
* - DMA handle allocated by sam3u_dmachannel()
*
****************************************************************************/
EXTERN void sam3u_dmastop(DMA_HANDLE handle);
#undef EXTERN
#if defined(__cplusplus)
}