2018-11-29 17:00:22 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
2019-01-08 11:58:57 +08:00
|
|
|
* 2018-11-10 SummerGift first version
|
2018-11-29 17:00:22 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRV_DMA_H_
|
|
|
|
#define __DRV_DMA_H_
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include "rtdevice.h"
|
|
|
|
#include <rthw.h>
|
|
|
|
#include <drv_common.h>
|
|
|
|
|
2019-01-09 10:10:39 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-01-08 11:58:57 +08:00
|
|
|
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4)
|
2018-11-29 17:00:22 +08:00
|
|
|
#define DMA_INSTANCE_TYPE DMA_Channel_TypeDef
|
2018-12-10 21:39:28 +08:00
|
|
|
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
|
2018-11-29 17:00:22 +08:00
|
|
|
#define DMA_INSTANCE_TYPE DMA_Stream_TypeDef
|
|
|
|
#endif /* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) */
|
|
|
|
|
|
|
|
struct dma_config {
|
|
|
|
DMA_INSTANCE_TYPE *Instance;
|
|
|
|
rt_uint32_t dma_rcc;
|
|
|
|
IRQn_Type dma_irq;
|
|
|
|
|
2018-12-10 21:39:28 +08:00
|
|
|
#if defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
|
2018-11-29 17:00:22 +08:00
|
|
|
rt_uint32_t channel;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SOC_SERIES_STM32L4)
|
|
|
|
rt_uint32_t request;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2019-01-09 10:10:39 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-11-29 17:00:22 +08:00
|
|
|
#endif /*__DRV_DMA_H_ */
|