1 |
577 |
jeremybenn |
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
|
2 |
|
|
* File Name : 75x_dma.h
|
3 |
|
|
* Author : MCD Application Team
|
4 |
|
|
* Date First Issued : 03/10/2006
|
5 |
|
|
* Description : This file contains all the functions prototypes for the
|
6 |
|
|
* DMA software library.
|
7 |
|
|
********************************************************************************
|
8 |
|
|
* History:
|
9 |
|
|
* 07/17/2006 : V1.0
|
10 |
|
|
* 03/10/2006 : V0.1
|
11 |
|
|
********************************************************************************
|
12 |
|
|
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
13 |
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
14 |
|
|
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
15 |
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
16 |
|
|
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
17 |
|
|
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
18 |
|
|
*******************************************************************************/
|
19 |
|
|
|
20 |
|
|
/* Define to prevent recursive inclusion ------------------------------------ */
|
21 |
|
|
#ifndef __75x_DMA_H
|
22 |
|
|
#define __75x_DMA_H
|
23 |
|
|
|
24 |
|
|
/* Includes ------------------------------------------------------------------*/
|
25 |
|
|
#include "75x_map.h"
|
26 |
|
|
|
27 |
|
|
/* Exported types ------------------------------------------------------------*/
|
28 |
|
|
/* DMA Init structure definition */
|
29 |
|
|
typedef struct
|
30 |
|
|
{
|
31 |
|
|
u32 DMA_SRCBaseAddr;
|
32 |
|
|
u32 DMA_DSTBaseAddr;
|
33 |
|
|
u16 DMA_BufferSize;
|
34 |
|
|
u16 DMA_SRC;
|
35 |
|
|
u16 DMA_DST;
|
36 |
|
|
u16 DMA_SRCSize;
|
37 |
|
|
u16 DMA_SRCBurst;
|
38 |
|
|
u16 DMA_DSTSize;
|
39 |
|
|
u16 DMA_Mode;
|
40 |
|
|
u16 DMA_M2M;
|
41 |
|
|
u16 DMA_DIR;
|
42 |
|
|
}DMA_InitTypeDef;
|
43 |
|
|
|
44 |
|
|
/* Exported constants --------------------------------------------------------*/
|
45 |
|
|
/* DMA interrupt Mask */
|
46 |
|
|
#define DMA_IT_SI0 0x0001
|
47 |
|
|
#define DMA_IT_SI1 0x0002
|
48 |
|
|
#define DMA_IT_SI2 0x0004
|
49 |
|
|
#define DMA_IT_SI3 0x0008
|
50 |
|
|
#define DMA_IT_SE0 0x0010
|
51 |
|
|
#define DMA_IT_SE1 0x0020
|
52 |
|
|
#define DMA_IT_SE2 0x0040
|
53 |
|
|
#define DMA_IT_SE3 0x0080
|
54 |
|
|
#define DMA_IT_ALL 0x00FF
|
55 |
|
|
|
56 |
|
|
/* DMA Flags */
|
57 |
|
|
#define DMA_FLAG_SI0 0x0001
|
58 |
|
|
#define DMA_FLAG_SI1 0x0002
|
59 |
|
|
#define DMA_FLAG_SI2 0x0004
|
60 |
|
|
#define DMA_FLAG_SI3 0x0008
|
61 |
|
|
#define DMA_FLAG_SE0 0x0010
|
62 |
|
|
#define DMA_FLAG_SE1 0x0020
|
63 |
|
|
#define DMA_FLAG_SE2 0x0040
|
64 |
|
|
#define DMA_FLAG_SE3 0x0080
|
65 |
|
|
#define DMA_FLAG_ACT0 0x0100
|
66 |
|
|
#define DMA_FLAG_ACT1 0x0200
|
67 |
|
|
#define DMA_FLAG_ACT2 0x0400
|
68 |
|
|
#define DMA_FLAG_ACT3 0x0800
|
69 |
|
|
|
70 |
|
|
/* DMA Increment Current Source Register */
|
71 |
|
|
#define DMA_SRC_INCR 0x0002
|
72 |
|
|
#define DMA_SRC_NOT_INCR 0xFFFD
|
73 |
|
|
|
74 |
|
|
/* DMA Increment Current Destination Register */
|
75 |
|
|
#define DMA_DST_INCR 0x0004
|
76 |
|
|
#define DMA_DST_NOT_INCR 0xFFFB
|
77 |
|
|
|
78 |
|
|
/* Source to DMA data width */
|
79 |
|
|
#define DMA_SRCSize_Byte 0x0000
|
80 |
|
|
#define DMA_SRCSize_HalfWord 0x0008
|
81 |
|
|
#define DMA_SRCSize_Word 0x0010
|
82 |
|
|
|
83 |
|
|
/* DMA source burst size */
|
84 |
|
|
#define DMA_SRCBurst_1Data 0x0000
|
85 |
|
|
#define DMA_SRCBurst_4Data 0x0020
|
86 |
|
|
#define DMA_SRCBurst_8Data 0x0040
|
87 |
|
|
#define DMA_SRCBurst_16Data 0x0060
|
88 |
|
|
|
89 |
|
|
/* DMA destination data width */
|
90 |
|
|
#define DMA_DSTSize_Byte 0x0000
|
91 |
|
|
#define DMA_DSTSize_HalfWord 0x0080
|
92 |
|
|
#define DMA_DSTSize_Word 0x0100
|
93 |
|
|
|
94 |
|
|
/* DMA mode */
|
95 |
|
|
#define DMA_Mode_Circular 0x0200
|
96 |
|
|
#define DMA_Mode_Normal 0xFDFF
|
97 |
|
|
|
98 |
|
|
/* Memory to Memory Transfer */
|
99 |
|
|
#define DMA_M2M_Enable 0x0800
|
100 |
|
|
#define DMA_M2M_Disable 0xF7FF
|
101 |
|
|
|
102 |
|
|
/* Direction Transfer */
|
103 |
|
|
#define DMA_DIR_PeriphDST 0x2000
|
104 |
|
|
#define DMA_DIR_PeriphSRC 0xDFFF
|
105 |
|
|
|
106 |
|
|
/* DMA streamx Registers */
|
107 |
|
|
#define DMA_SOURCEL 0x00000000 /* source base address low register */
|
108 |
|
|
#define DMA_SOURCEH 0x00000004 /* source base address high register */
|
109 |
|
|
#define DMA_DESTL 0x00000008 /* destination base address low register */
|
110 |
|
|
#define DMA_DESTH 0x0000000C /* destination base address high register */
|
111 |
|
|
#define DMA_MAX 0x00000010 /* Maximum count register */
|
112 |
|
|
#define DMA_CTRL 0x00000014 /* Control register */
|
113 |
|
|
#define DMA_SOCURRH 0x00000018 /* Current Source address high register */
|
114 |
|
|
#define DMA_SOCURRL 0x0000001C /* Current Source address low register */
|
115 |
|
|
#define DMA_DECURRH 0x00000020 /* Current Destination address high register */
|
116 |
|
|
#define DMA_DECURRL 0x00000024 /* Current Destination address low register */
|
117 |
|
|
#define DMA_TCNT 0x00000028 /* Terminal Counter Register */
|
118 |
|
|
#define DMA_LUBUFF 0x0000002C /* Last Used Buffer location */
|
119 |
|
|
|
120 |
|
|
/* Exported macro ------------------------------------------------------------*/
|
121 |
|
|
/* Exported functions ------------------------------------------------------- */
|
122 |
|
|
|
123 |
|
|
void DMA_DeInit(DMA_Stream_TypeDef* DMA_Streamx);
|
124 |
|
|
void DMA_Init(DMA_Stream_TypeDef* DMA_Streamx, DMA_InitTypeDef* DMA_InitStruct);
|
125 |
|
|
void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct);
|
126 |
|
|
void DMA_Cmd(DMA_Stream_TypeDef* DMA_Streamx, FunctionalState NewState);
|
127 |
|
|
void DMA_ITConfig(u16 DMA_IT, FunctionalState NewState);
|
128 |
|
|
u32 DMA_GetCurrDSTAddr(DMA_Stream_TypeDef* DMA_Streamx);
|
129 |
|
|
u32 DMA_GetCurrSRCAddr(DMA_Stream_TypeDef* DMA_Streamx);
|
130 |
|
|
u16 DMA_GetTerminalCounter(DMA_Stream_TypeDef* DMA_Streamx);
|
131 |
|
|
void DMA_LastBufferSweepConfig(DMA_Stream_TypeDef* DMA_Streamx, FunctionalState NewState);
|
132 |
|
|
void DMA_LastBufferAddrConfig(DMA_Stream_TypeDef* DMA_Streamx, u16 DMA_LastBufferAddr);
|
133 |
|
|
FlagStatus DMA_GetFlagStatus(u16 DMA_FLAG);
|
134 |
|
|
void DMA_ClearFlag(u16 DMA_FLAG);
|
135 |
|
|
ITStatus DMA_GetITStatus(u16 DMA_IT);
|
136 |
|
|
void DMA_ClearITPendingBit(u16 DMA_IT);
|
137 |
|
|
|
138 |
|
|
#endif /* __75x_DMA_H */
|
139 |
|
|
|
140 |
|
|
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
|