Skip to content
Snippets Groups Projects
Commit fe3d0004 authored by patacongo's avatar patacongo
Browse files

fragments of MCI driver

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2551 42af7a65-404d-4744-a932-0658087f49c3
parent ac6f9752
No related branches found
No related tags found
No related merge requests found
/************************************************************************************
* 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
......
This diff is collapsed.
......@@ -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 */
......
......@@ -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)
}
......
......@@ -2,7 +2,7 @@
* configs/sam3u-ek/include/board.h
* include/arch/board/board.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
......
......@@ -2,7 +2,7 @@
* configs/sam3uek_eval/src/sam3uek_internal.h
* arch/arm/src/board/sam3uek_internal.n
*
* 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
......@@ -65,14 +65,13 @@
#define GPIO_BUTTON1 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN18)
#define GPIO_BUTTON2 (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_CFG_DEGLITCH|GPIO_PORT_PIOA|GPIO_PIN19)
#define IRQ_BUTTON1 SAM3U_IRQ_PA18
#define IRQ_BUTTON2 SAM3U_IRQ_PA19
/* SD Card Detect */
#define GPIO_MCI_CD (GPIO_INPUT|GPIO_CFG_PULLUP|GPIO_PORT_PIOA|GPIO_PIN25)
#define IRQ_BUTTON1 SAM3U_IRQ_PA18
#define IRQ_BUTTON2 SAM3U_IRQ_PA19
/* SPI Chip Selects */
/************************************************************************************
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment