cabc797a2d
1. Update the copyright information - 2009 => 2011 2. Add external oscillator configuration routine in "rt_hw_board_init()" - Before, it is set by default frequency, 32MHz - Now it can be set by user specified frequency 3. Add ADC and ACMP (analog comparator) drivers 4. Clarify the MCU and target board define in "rtconfig.py" git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1296 bbd45198-f89e-11dd-88c7-29a3b14d5316
68 lines
2.6 KiB
C
68 lines
2.6 KiB
C
/******************************************************************//**
|
|
* @file drv_dma.c
|
|
* @brief USART driver of RT-Thread RTOS for EFM32
|
|
* COPYRIGHT (C) 2011, RT-Thread Development Team
|
|
* @author onelife
|
|
* @version 0.4 beta
|
|
**********************************************************************
|
|
* @section License
|
|
* The license and distribution terms for this file may be found in the file LICENSE in this
|
|
* distribution or at http://www.rt-thread.org/license/LICENSE
|
|
**********************************************************************
|
|
* @section Change Logs
|
|
* Date Author Notes
|
|
* 2010-12-23 onelife Initial creation for EFM32
|
|
*********************************************************************/
|
|
|
|
/******************************************************************//**
|
|
* @addtogroup efm32
|
|
* @{
|
|
*********************************************************************/
|
|
|
|
/* Includes -------------------------------------------------------------------*/
|
|
#include "board.h"
|
|
#include "drv_dma.h"
|
|
|
|
/* Private typedef -------------------------------------------------------------*/
|
|
/* Private define --------------------------------------------------------------*/
|
|
/* Private macro --------------------------------------------------------------*/
|
|
/* Private variables ------------------------------------------------------------*/
|
|
/** DMA control block, requires proper alignment. */
|
|
#if defined (__ICCARM__)
|
|
#pragma data_alignment=256
|
|
DMA_DESCRIPTOR_TypeDef dmaControlBlock[DMA_CHAN_COUNT * 2];
|
|
#elif defined (__CC_ARM)
|
|
DMA_DESCRIPTOR_TypeDef dmaControlBlock[DMA_CHAN_COUNT * 2] __attribute__ ((aligned(256)));
|
|
#elif defined (__GNUC__)
|
|
DMA_DESCRIPTOR_TypeDef dmaControlBlock[DMA_CHAN_COUNT * 2] __attribute__ ((aligned(256)));
|
|
#else
|
|
#error Undefined toolkit, need to define alignment
|
|
#endif
|
|
|
|
/* Private function prototypes ---------------------------------------------------*/
|
|
/* Private functions ------------------------------------------------------------*/
|
|
/******************************************************************//**
|
|
* @brief
|
|
* Initialize DMA hardware
|
|
*
|
|
* @details
|
|
*
|
|
* @note
|
|
*********************************************************************/
|
|
void rt_hw_dma_init(void)
|
|
{
|
|
DMA_Init_TypeDef dmaInit;
|
|
|
|
/* Reset */
|
|
DMA_Reset();
|
|
|
|
dmaInit.hprot = 0;
|
|
dmaInit.controlBlock = (DMA_DESCRIPTOR_TypeDef *)&dmaControlBlock;
|
|
DMA_Init(&dmaInit);
|
|
NVIC_SetPriority(DMA_IRQn, EFM32_IRQ_PRI_DEFAULT);
|
|
}
|
|
|
|
/******************************************************************//**
|
|
* @}
|
|
*********************************************************************/
|