PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
Main Page
Modules
Data Structures
Files
File List
Globals
mft_ocu.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
/******************************************************************************/
53
#ifndef __MFT_OCU_H__
54
#define __MFT_OCU_H__
55
/******************************************************************************/
56
/* Include files */
57
/******************************************************************************/
58
#include "
pdl.h
"
59
60
#if (defined(PDL_PERIPHERAL_MFT_OCU_ACTIVE))
61
114
/******************************************************************************
115
* Global definitions
116
******************************************************************************/
117
#define stc_mftn_ocu_t FM4_MFT_OCU_TypeDef
118
119
#define MFT0_OCU (*((volatile stc_mftn_ocu_t *) FM4_MFT0_OCU_BASE))
120
#define MFT1_OCU (*((volatile stc_mftn_ocu_t *) FM4_MFT1_OCU_BASE))
121
#define MFT2_OCU (*((volatile stc_mftn_ocu_t *) FM4_MFT1_OCU_BASE))
122
123
#define MFT_OCU_CH0 0
124
#define MFT_OCU_CH1 1
125
#define MFT_OCU_CH2 2
126
#define MFT_OCU_CH3 3
127
#define MFT_OCU_CH4 4
128
#define MFT_OCU_CH5 5
129
#define MFT_OCU_MAXCH 6
130
131
#define MFT_OCU_CH10 0
132
#define MFT_OCU_CH32 1
133
#define MFT_OCU_CH54 2
134
139
typedef
enum
en_ocu_instance_index
140
{
141
OcuInstanceIndexOcu0
= 0,
142
OcuInstanceIndexOcu1
,
143
OcuInstanceIndexOcu2
,
144
145
}
en_ocu_instance_index_t
;
146
151
typedef
enum
en_mft_ocu_frt
152
{
153
Frt0ToOcu
,
154
Frt1ToOcu
,
155
Frt2ToOcu
,
156
OcuFrtToExt
,
157
}
en_mft_ocu_frt_t
;
158
163
typedef
enum
en_ocu_rt_out_state
164
{
165
RtLowLevel
= 0,
166
RtHighLevel
167
}
en_ocu_rt_out_state_t
;
168
173
typedef
enum
en_ocu_occp_buf
174
{
175
OccpBufDisable
= 0,
176
OccpBufTrsfByFrtZero
,
177
OccpBufTrsfByFrtPeak
,
178
OccpBufTrsfByFrtZeroPeak
,
179
}
en_ocu_occp_buf_t
;
180
181
186
typedef
enum
en_ocu_ocse_buf
187
{
188
OcseBufDisable
= 0,
189
OcseBufTrsfByFrtZero
,
190
OcseBufTrsfByFrtPeak
,
191
OcseBufTrsfByFrtZeroPeak
,
192
193
}
en_ocu_ocse_buf_t
;
194
199
typedef
struct
stc_mft_ocu_config
200
{
201
en_mft_ocu_frt_t
enFrtConnect
;
202
boolean_t
bFm4
;
203
boolean_t
bCmod
;
204
uint8_t
u8Mod
;
205
en_ocu_occp_buf_t
enOccpBufMode
;
206
en_ocu_ocse_buf_t
enOcseBufMode
;
207
en_ocu_rt_out_state_t
enStatePin
;
208
}
stc_mft_ocu_config_t
;
209
214
typedef
enum
en_rt_status
215
{
216
RtOutputHold
= 0,
217
RtOutputHigh
,
218
RtOutputLow
,
219
RtOutputReverse
,
220
221
}
en_rt_even_status_t
,
en_rt_odd_status_t
;
222
227
typedef
enum
en_iop_flag_set_condition
228
{
229
IopFlagHold
= 0,
230
IopFlagSet
,
231
232
}
en_iop_flag_even_t
,
en_iop_flag_odd_t
;
233
238
typedef
struct
stc_even_compare_config
239
{
240
en_rt_even_status_t
enFrtZeroEvenMatchEvenChRtStatus
;
241
en_rt_even_status_t
enFrtZeroEvenNotMatchEvenChRtStatus
;
242
243
en_rt_even_status_t
enFrtUpCntEvenMatchEvenChRtStatus
;
244
245
en_rt_even_status_t
enFrtPeakEvenMatchEvenChRtStatus
;
246
en_rt_even_status_t
enFrtPeakEvenNotMatchEvenChStatus
;
247
248
en_rt_even_status_t
enFrtDownCntEvenMatchEvenChRtStatus
;
249
250
en_iop_flag_even_t
enIopFlagWhenFrtZeroEvenMatch
;
251
en_iop_flag_even_t
enIopFlagWhenFrtUpCntEvenMatch
;
252
en_iop_flag_even_t
enIopFlagWhenFrtPeakEvenMatch
;
253
en_iop_flag_even_t
enIopFlagWhenFrtDownCntEvenMatch
;
254
255
}
stc_even_compare_config_t
;
256
261
typedef
struct
stc_odd_compare_config
262
{
263
en_rt_odd_status_t
enFrtZeroOddMatchEvenMatchOddChRtStatus
;
264
en_rt_odd_status_t
enFrtZeroOddMatchEvenNotMatchOddChRtStatus
;
265
en_rt_odd_status_t
enFrtZeroOddNotMatchEvenMatchOddChRtStatus
;
266
en_rt_odd_status_t
enFrtZeroOddNotMatchEvenNotMatchOddChRtStatus
;
267
268
en_rt_odd_status_t
enFrtUpCntOddMatchEvenMatchOddChRtStatus
;
269
en_rt_odd_status_t
enFrtUpCntOddMatchEvenNotMatchOddChRtStatus
;
270
en_rt_odd_status_t
enFrtUpCntOddNotMatchEvenMatchOddChRtStatus
;
271
272
en_rt_odd_status_t
enFrtPeakOddMatchEvenMatchOddChRtStatus
;
273
en_rt_odd_status_t
enFrtPeakOddMatchEvenNotMatchOddChRtStatus
;
274
en_rt_odd_status_t
enFrtPeakOddNotMatchEvenMatchOddChRtStatus
;
275
en_rt_odd_status_t
enFrtPeakOddNotMatchEvenNotMatchOddChRtStatus
;
276
277
en_rt_odd_status_t
enFrtDownOddMatchEvenMatchOddChRtStatus
;
278
en_rt_odd_status_t
enFrtDownOddMatchEvenNotMatchOddChRtStatus
;
279
en_rt_odd_status_t
enFrtDownOddNotMatchEvenMatchOddChRtStatus
;
280
281
en_iop_flag_odd_t
enIopFlagWhenFrtZeroOddMatch
;
282
en_iop_flag_odd_t
enIopFlagWhenFrtUpCntOddMatch
;
283
en_iop_flag_odd_t
enIopFlagWhenFrtPeakOddMatch
;
284
en_iop_flag_odd_t
enIopFlagWhenFrtDownCntOddMatch
;
285
286
}
stc_odd_compare_config_t
;
287
292
typedef
struct
stc_mft_ocu_intern_data
293
{
294
func_ptr_t
pfnOcu0Callback
;
295
func_ptr_t
pfnOcu1Callback
;
296
func_ptr_t
pfnOcu2Callback
;
297
func_ptr_t
pfnOcu3Callback
;
298
func_ptr_t
pfnOcu4Callback
;
299
func_ptr_t
pfnOcu5Callback
;
300
}
stc_mft_ocu_intern_data_t
;
301
306
typedef
struct
stc_mft_ocu_instance_data
307
{
308
volatile
stc_mftn_ocu_t
*
pstcInstance
;
309
stc_mft_ocu_intern_data_t
stcInternData
;
310
}
stc_mft_ocu_instance_data_t
;
311
312
/* C binding of definitions if building with C++ compiler */
313
#ifdef __cplusplus
314
extern
"C"
315
{
316
#endif
317
/******************************************************************************/
318
/* Global variable declarations ('extern', definition in C source) */
319
/******************************************************************************/
321
extern
stc_mft_ocu_instance_data_t
m_astcMftOcuInstanceDataLut
[];
322
323
/******************************************************************************/
324
/* Global function prototypes ('extern', definition in C source) */
325
/******************************************************************************/
326
/* Init */
327
en_result_t
Mft_Ocu_Init
(
volatile
stc_mftn_ocu_t
*pstcMft,
328
uint8_t u8Ch,
stc_mft_ocu_config_t
* pstcOcuConfig);
329
330
/* Compare congifuration */
331
en_result_t
Mft_Ocu_SetEvenChCompareMode
(
volatile
stc_mftn_ocu_t
*pstcMft,
332
uint8_t EvenCh,
333
stc_even_compare_config_t
* pstcConfig);
334
en_result_t
Mft_Ocu_SetOddChCompareMode
(
volatile
stc_mftn_ocu_t
*pstcMft,
335
uint8_t OddCh,
336
stc_odd_compare_config_t
* pstcConfig);
337
338
/* Func/Int enable/disable */
339
en_result_t
Mft_Ocu_EnableOperation
(
volatile
stc_mftn_ocu_t
*pstcMft, uint8_t u8Ch);
340
en_result_t
Mft_Ocu_DisableOperation
(
volatile
stc_mftn_ocu_t
*pstcMft, uint8_t u8Ch);
341
#if (PDL_INTERRUPT_ENABLE_MFT0_OCU == PDL_ON) || \
342
(PDL_INTERRUPT_ENABLE_MFT1_OCU == PDL_ON) || \
343
(PDL_INTERRUPT_ENABLE_MFT2_OCU == PDL_ON)
344
en_result_t
Mft_Ocu_EnableInt
(
volatile
stc_mftn_ocu_t
*pstcMft,
345
uint8_t u8Ch,
func_ptr_t
pfnCallback);
346
en_result_t
Mft_Ocu_DisableInt
(
volatile
stc_mftn_ocu_t
*pstcMft,uint8_t u8Ch);
347
#endif
348
349
/* Count write/read */
350
en_result_t
Mft_Ocu_WriteOccp
(
volatile
stc_mftn_ocu_t
*pstcMft,
351
uint8_t u8Ch, uint16_t u16Occp);
352
uint16_t
Mft_Ocu_ReadOccp
(
volatile
stc_mftn_ocu_t
*pstcMft, uint8_t u8Ch);
353
354
/* Status read/clear */
355
en_int_flag_t
Mft_Ocu_GetIntFlag
(
volatile
stc_mftn_ocu_t
*pstcMft, uint8_t u8Ch);
356
en_result_t
Mft_Ocu_ClrIntFlag
(
volatile
stc_mftn_ocu_t
*pstcMft, uint8_t u8Ch);
357
358
/* Get RT pin level */
359
en_ocu_rt_out_state_t
Mft_Ocu_GetRtPinLevel
(
volatile
stc_mftn_ocu_t
*pstcMft, uint8_t u8Ch);
360
361
/* IRQ handler */
362
void
Mft_Ocu_IrqHandler
(
volatile
stc_mftn_ocu_t
*pstcMft,
363
stc_mft_ocu_intern_data_t
* pstcMftOcuInternData) ;
364
365
366
#ifdef __cplusplus
367
}
368
#endif
369
371
372
#endif // #if (defined(PDL_PERIPHERAL_ADC_ACTIVE))
373
374
#endif
PDL_1_2
library
driver
mft
mft_ocu.h
Generated on Wed May 28 2014 09:28:11 for PDL for FM4 by
1.8.3.1