stm32_ota/SYSTEM/DMA/dma.h

75 lines
2.1 KiB
C
Raw Normal View History

2023-12-15 06:28:06 +00:00
#ifndef __DMA_H
#define __DMA_H
#include "stm32f10x_dma.h"
#include "stm32f10x.h"
#include "usart.h"
#include "misc.h"
#include "sysTick.h"
#include "Led.h"
/****************************************************************************
* <EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
****************************************************************************/
typedef enum
{
DMA1_CH1 = 0 ,
DMA1_CH2 = 1 ,
DMA1_CH3 = 2 ,
DMA1_CH4 = 3 ,
DMA1_CH5 = 4 ,
DMA1_CH6 = 5 ,
DMA1_CH7 = 6 , //<2F><><EFBFBD><EFBFBD>ΪDMA1<41><31>7<EFBFBD><37>ͨ<EFBFBD><CDA8>
DMA2_CH1 = 7 ,
DMA2_CH2 = 8 ,
DMA2_CH3 = 9 ,
DMA2_CH4 = 10 ,
DMA2_CH5 = 11 , //<2F><><EFBFBD><EFBFBD>ΪDMA2<41><32>5<EFBFBD><35>ͨ<EFBFBD><CDA8>
DMA_CHSUM= 12
}DMACH_e ;
/*DMA<4D>жϻص<CFBB><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
typedef void (*DMAFP)(void) ; //<2F><><EFBFBD><EFBFBD><E5BAAF>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD>
typedef enum
{
DMATC = 0 , //DMA<4D><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
DMATE = 1 //DMA<4D><41><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
// DMAHT = 2 , //DMA<4D><41><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ж<EFBFBD>
// DMAGL = 3 //DMA1ȫ<31><C8AB><EFBFBD>ж<EFBFBD>
}DMAIRQTYPE_e ;
typedef enum
{
DMA_DIR_MTP = ((uint32_t)0x00000010) , //<2F>ڴ浽<DAB4><E6B5BD><EFBFBD><EFBFBD>
DMA_DIR_PTM = ((uint32_t)0x00000000) //<2F><><EFBFBD><EFBFBD>ڴ<EFBFBD>
}DMADIR_e ; //DMA<4D><41><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><E4B7BD>
typedef enum
{
CIRCULAR = ((uint32_t)0x00000020) , //ѭ<><D1AD>ģʽ
NORMAL = ((uint32_t)0x00000000) //<2F><>ѭ<EFBFBD><D1AD>
}DMAMODE_e ; //DMA<4D><41><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD>Ƿ<EFBFBD>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/********************************************************************************
*<EFBFBD><EFBFBD><EFBFBD>ⲿʹ<EFBFBD>õij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*********************************************************************************/
extern DMA_Channel_TypeDef* dmaChx[DMA_CHSUM] ;
/********************************************************************************
*<EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*********************************************************************************/
void Dma_Hook(uint32_t DMAy_FLAG) ;
/********************************************************************************
*<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿں<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*********************************************************************************/
extern DMAFP Dma_RegHookCallback(DMACH_e DMA_CHx, DMAIRQTYPE_e eIrqType, DMAFP pCallback) ;
extern void DMA_Config(DMACH_e DMA_CHx, u32 periAddr, u32 memAddr, DMADIR_e tranDire, DMAMODE_e CircMode, IntPriority_e ePriority);//<2F><><EFBFBD><EFBFBD>DMA1_CHx
extern void DMA1_Channel4_IRQHandler(void) ;
#endif