2014-08-30 00:19:16 +08:00
|
|
|
/**
|
2023-04-05 11:26:18 +08:00
|
|
|
*****************************************************************************
|
|
|
|
* @file cmem7_dma.h
|
|
|
|
*
|
|
|
|
* @brief CMEM7 DMA header file
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @version V1.0
|
|
|
|
* @date 3. September 2013
|
|
|
|
*
|
|
|
|
* @note
|
|
|
|
*
|
|
|
|
*****************************************************************************
|
|
|
|
* @attention
|
|
|
|
*
|
|
|
|
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
|
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
|
|
|
* TIME. AS A RESULT, CAPITAL-MICRO SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
|
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
|
|
|
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
|
|
|
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
|
|
|
*
|
|
|
|
* <h2><center>© COPYRIGHT 2013 Capital-micro </center></h2>
|
|
|
|
*****************************************************************************
|
|
|
|
*/
|
|
|
|
|
2014-08-30 00:19:16 +08:00
|
|
|
#ifndef __CMEM7_DMA_H
|
|
|
|
#define __CMEM7_DMA_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "cmem7.h"
|
|
|
|
#include "cmem7_conf.h"
|
|
|
|
|
|
|
|
/** @defgroup DMA_Int
|
|
|
|
* @{
|
|
|
|
*/
|
2023-04-05 11:26:18 +08:00
|
|
|
#define DMA_Int_TfrComplete 0x00000001
|
2014-08-30 00:19:16 +08:00
|
|
|
#define DMA_Int_Err 0x00000002
|
|
|
|
#define DMA_Int_All 0x00000003
|
|
|
|
|
|
|
|
#define IS_DMA_INT(INT) (((INT) != 0) && (((INT) & ~DMA_Int_All) == 0))
|
|
|
|
/**
|
|
|
|
* @}
|
2023-04-05 11:26:18 +08:00
|
|
|
*/
|
2014-08-30 00:19:16 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Descriptor structure
|
2023-04-05 11:26:18 +08:00
|
|
|
* @note DMA requires users provides a list of descriptors to operation.
|
|
|
|
* Meanwhile, memory occupied by descriptors should be in physical
|
|
|
|
* memory and keep valid during DMA transfer.
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
uint32_t srcAddr; /*!< source address */
|
|
|
|
uint32_t dstAddr; /*!< destination address */
|
|
|
|
uint32_t number; /*!< block byte number, no more than 2K Bytes */
|
|
|
|
uint32_t nextBlock; /*!< next block descriptor */
|
|
|
|
uint32_t padding; /*!< Nonsense, only used to fill */
|
2014-08-30 00:19:16 +08:00
|
|
|
} BLOCK_DESC;
|
2023-04-05 11:26:18 +08:00
|
|
|
|
2014-08-30 00:19:16 +08:00
|
|
|
/**
|
|
|
|
* @brief DMA initialization
|
|
|
|
* @note This function should be called at first before any other interfaces.
|
2023-04-05 11:26:18 +08:00
|
|
|
* @param None
|
|
|
|
* @retval None
|
|
|
|
*/
|
2014-08-30 00:19:16 +08:00
|
|
|
void DMA_Init(void);
|
|
|
|
|
|
|
|
/**
|
2023-04-05 11:26:18 +08:00
|
|
|
* @brief Enable or disable DMA interrupt.
|
|
|
|
* @param[in] Int interrupt mask bits, which can be the combination of @ref DMA_Int
|
|
|
|
* @param[in] Enable The bit indicates if specific interrupts are enable or not
|
2014-08-30 00:19:16 +08:00
|
|
|
* @retval None
|
2023-04-05 11:26:18 +08:00
|
|
|
*/
|
2014-08-30 00:19:16 +08:00
|
|
|
void DMA_EnableInt(uint32_t Int, BOOL enable);
|
|
|
|
|
|
|
|
/**
|
2023-04-05 11:26:18 +08:00
|
|
|
* @brief Check specific interrupts are set or not
|
|
|
|
* @param[in] Int interrupt mask bits, which can be the combination of @ref DMA_Int
|
2014-08-30 00:19:16 +08:00
|
|
|
* @retval BOOL The bit indicates if specific interrupts are set or not
|
2023-04-05 11:26:18 +08:00
|
|
|
*/
|
2014-08-30 00:19:16 +08:00
|
|
|
BOOL DMA_GetIntStatus(uint32_t Int);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Clear specific interrupts
|
2023-04-05 11:26:18 +08:00
|
|
|
* @param[in] Int interrupt mask bits, which can be the combination of @ref DMA_Int
|
2014-08-30 00:19:16 +08:00
|
|
|
* @retval None
|
2023-04-05 11:26:18 +08:00
|
|
|
*/
|
2014-08-30 00:19:16 +08:00
|
|
|
void DMA_ClearInt(uint32_t Int);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief DMA transfer
|
2023-04-05 11:26:18 +08:00
|
|
|
* @note Make sure that memory occupied by descriptors should be in physical
|
|
|
|
* memory and keep valid before DMA transfer is finished (Return false by
|
|
|
|
* calling DMA_IsBusy after DMA transfer started).
|
|
|
|
* @param[in] blockList A pointer to header of list of BLOCK_DESC
|
2014-08-30 00:19:16 +08:00
|
|
|
* @retval BOOL The bit indicates if DMA begins to transfer
|
2023-04-05 11:26:18 +08:00
|
|
|
* @see DMA_IsBusy
|
|
|
|
*/
|
2014-08-30 00:19:16 +08:00
|
|
|
BOOL DMA_Transfer(BLOCK_DESC *blockList);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief DMA is busy or not
|
|
|
|
* @param None
|
2023-04-05 11:26:18 +08:00
|
|
|
* @retval BOOL The bit indicates if DMA is busy or not
|
|
|
|
*/
|
2014-08-30 00:19:16 +08:00
|
|
|
BOOL DMA_IsBusy(void);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __CMEM7_DMA_H */
|
|
|
|
|