PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
Main Page
Modules
Data Structures
Files
File List
Globals
dma.h
Go to the documentation of this file.
1
/*******************************************************************************
2
* Copyright (C) 2013 Spansion LLC. All Rights Reserved.
3
*
4
* This software is owned and published by:
5
* Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion").
6
*
7
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
8
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
9
*
10
* This software contains source code for use with Spansion
11
* components. This software is licensed by Spansion to be adapted only
12
* for use in systems utilizing Spansion components. Spansion shall not be
13
* responsible for misuse or illegal use of this software for devices not
14
* supported herein. Spansion is providing this software "AS IS" and will
15
* not be responsible for issues arising from incorrect user implementation
16
* of the software.
17
*
18
* SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
19
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
20
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
21
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
22
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
23
* WARRANTY OF NONINFRINGEMENT.
24
* SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
25
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
26
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
27
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
28
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
29
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
30
* SAVINGS OR PROFITS,
31
* EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
33
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
34
* FROM, THE SOFTWARE.
35
*
36
* This software may be replicated in part or whole for the licensed use,
37
* with the restriction that this Disclaimer and Copyright notice must be
38
* included with each copy of this software, whether used in part or whole,
39
* at all times.
40
*/
41
/******************************************************************************/
51
#ifndef __DMA_H__
52
#define __DMA_H__
53
54
/******************************************************************************/
55
/* Include files */
56
/******************************************************************************/
57
#include "
pdl.h
"
58
59
#if (defined(PDL_PERIPHERAL_DMA_ACTIVE))
60
61
/* C binding of definitions if building with C++ compiler */
62
#ifdef __cplusplus
63
extern
"C"
64
{
65
#endif
66
101
102
/******************************************************************************/
103
/* Global pre-processor symbols/macros ('#define') */
104
/******************************************************************************/
105
106
// register address offset
107
#define DMA_DMACA_OFFSET 0x00ul
108
#define DMA_DMACB_OFFSET 0x04ul
109
#define DMA_DMASA_OFFSET 0x08ul
110
#define DMA_DMADA_OFFSET 0x0Cul
111
112
// DMA channel active markers for internal data:
113
// au8DmaChannelActive[DMA_MAX_CHANNELS]
114
#define DMA_CHANNEL_ACTIVE 1u
115
#define DMA_CHANNEL_INACTIVE 0u
116
117
/******************************************************************************/
118
/* Local type definitions ('typedef') */
119
/******************************************************************************/
120
125
typedef
enum
en_dma_transfermode
126
{
127
DmaBlockTransfer
= 0,
128
DmaBurstTransfer
= 1,
129
DmaDemandTransfer
= 2
130
}
en_dma_transfermode_t
;
131
136
typedef
enum
en_dma_transferwidth
137
{
138
Dma8Bit
= 0,
139
Dma16Bit
= 1,
140
Dma32Bit
= 2
141
}
en_dma_transferwidth_t
;
142
147
typedef
enum
en_dma_idreq
148
{
149
Ep1DrqUsb0
= 0,
150
Ep2DrqUsb0
= 1,
151
Ep3DrqUsb0
= 2,
152
Ep4DrqUsb0
= 3,
153
Ep5DrqUsb0
= 4,
154
Adc0
= 5,
155
Adc1
= 6,
156
Adc2
= 7,
157
Bt0Irq0
= 8,
158
Bt2Irq0
= 9,
159
Bt4Irq0
= 10,
160
Bt6Irq0
= 11,
161
MfsRx0
= 12,
162
MfsTx0
= 13,
163
MfsRx1
= 14,
164
MfsTx1
= 15,
165
MfsRx2
= 16,
166
MfsTx2
= 17,
167
MfsRx3
= 18,
168
MfsTx3
= 19,
169
MfsRx4
= 20,
170
MfsTx4
= 21,
171
MfsRx5
= 22,
172
MfsTx5
= 23,
173
MfsRx6
= 24,
174
MfsTx6
= 25,
175
MfsRx7
= 26,
176
MfsTx7
= 27,
177
ExtIrq0
= 28,
178
ExtIrq1
= 29,
179
ExtIrq2
= 30,
180
ExtIrq3
= 31,
181
Software
= 1234
182
}
en_dma_idreq_t
;
183
188
typedef
struct
stc_dma_intern_data
189
{
190
uint8_t
au8DmaChannelActive
[
PDL_DMA_CHANNELS
];
191
func_ptr_t
apfnDmaCallback
[
PDL_DMA_CHANNELS
];
192
func_ptr_arg1_t
apfnDmaErrorCallback
[
PDL_DMA_CHANNELS
];
193
194
}
stc_dma_intern_data_t
;
195
200
typedef
struct
stc_dma_instance_data
201
{
202
stc_dma_intern_data_t
stcInternData
;
203
}
stc_dma_instance_data_t
;
204
209
typedef
struct
stc_dma_config
210
{
211
boolean_t
bEnable
;
212
boolean_t
bPause
;
213
boolean_t
bSoftwareTrigger
;
214
uint8_t
u8DmaChannel
;
215
en_dma_idreq_t
enDmaIdrq
;
216
uint8_t
u8BlockCount
;
217
uint16_t
u16TransferCount
;
218
en_dma_transfermode_t
enTransferMode
;
219
en_dma_transferwidth_t
enTransferWdith
;
220
uint32_t
u32SourceAddress
;
221
uint32_t
u32DestinationAddress
;
222
boolean_t
bFixedSource
;
223
boolean_t
bFixedDestination
;
224
boolean_t
bReloadCount
;
225
boolean_t
bReloadSource
;
226
boolean_t
bReloadDestination
;
227
boolean_t
bErrorInterruptEnable
;
228
boolean_t
bCompletionInterruptEnable
;
229
boolean_t
bEnableBitMask
;
230
func_ptr_t
pfnCallback
;
231
func_ptr_arg1_t
pfnErrorCallback
;
232
uint8_t
u8ErrorStopStatus
;
233
}
stc_dma_config_t
;
234
235
/******************************************************************************/
236
/* Global variable definitions ('extern') */
237
/******************************************************************************/
238
extern
stc_dma_intern_data_t
stcDmaInternData
;
239
240
/******************************************************************************/
241
/* Global function prototypes (definition in C source) */
242
/******************************************************************************/
243
244
extern
void
DmaIrqHandler
(uint8_t u8DmaChannel) ;
245
246
en_result_t
Dma_Init_Channel
(
volatile
stc_dma_config_t
* pstcConfig) ;
247
248
en_result_t
Dma_Set_Channel
(
volatile
stc_dma_config_t
* pstcConfig) ;
249
250
en_result_t
Dma_Enable
(
void
) ;
251
252
en_result_t
Dma_Disable
(
void
) ;
253
254
en_result_t
Dma_DeInit_Channel
(
volatile
stc_dma_config_t
* pstcConfig) ;
255
256
en_result_t
Dma_Set_ChannelParam
( uint8_t u8DmaChannel,
257
boolean_t
bEnable,
258
boolean_t
bPause,
259
boolean_t
bSoftwareTrigger
260
) ;
261
262
en_result_t
Dma_DeInit_ChannelParam
(uint8_t u8DmaChannel) ;
263
265
266
#ifdef __cplusplus
267
}
268
#endif
269
270
#endif // #if (defined(PDL_PERIPHERAL_DMA_ACTIVE))
271
272
#endif
/* __DMA_H__ */
273
/******************************************************************************/
274
/* EOF (not truncated) */
275
/******************************************************************************/
PDL_1_2
library
driver
dma
dma.h
Generated on Wed May 28 2014 09:28:10 for PDL for FM4 by
1.8.3.1