PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
mft_frt.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 /******************************************************************************/
52 #ifndef __MFT_FRT_H__
53 #define __MFT_FRT_H__
54 
55 /******************************************************************************/
56 /* Include files */
57 /******************************************************************************/
58 #include "pdl.h"
59 
60 #if (defined(PDL_PERIPHERAL_MFT_FRT_ACTIVE))
61 
120 
121 /******************************************************************************
122  * Global definitions
123  ******************************************************************************/
124 #define stc_mftn_frt_t FM4_MFT_FRT_TypeDef
125 #define MFT0_FRT (*((volatile stc_mftn_frt_t *) FM4_MFT0_FRT_BASE))
126 #define MFT1_FRT (*((volatile stc_mftn_frt_t *) FM4_MFT1_FRT_BASE))
127 #define MFT2_FRT (*((volatile stc_mftn_frt_t *) FM4_MFT2_FRT_BASE))
128 
133 #define MFT_FRT_CH0 0
134 #define MFT_FRT_CH1 1
135 #define MFT_FRT_CH2 2
136 
137 #define MFT_FRT_MAX_CH 3
138 
144 {
148 
150 
155 typedef enum en_mft_frt_clock
156 {
169 
174 typedef enum en_mft_frt_mode
175 {
179 
184 typedef struct stc_mft_frt_config
185 {
190 
192 
197 typedef struct stc_frt_int_sel
198 {
201 
203 
208 typedef enum en_mft_frt_int
209 {
212 
214 
219 typedef struct stc_frt_int_cb
220 {
223 
225 
232 {
240 
246 {
250 
251 /******************************************************************************/
252 /* Global variable declarations ('extern', definition in C source) */
253 /******************************************************************************/
256 
257 /* C binding of definitions if building with C++ compiler */
258 #ifdef __cplusplus
259 extern "C"
260 {
261 #endif
262 /******************************************************************************/
263 /* Global function prototypes ('extern', definition in C source) */
264 /******************************************************************************/
265 /* Init */
266 en_result_t Mft_Frt_Init(volatile stc_mftn_frt_t*pstcMft,
267  uint8_t u8Ch, stc_mft_frt_config_t* pstcFrtConfig);
268 
269 /* Mask zero/peak write/read */
270 en_result_t Mft_Frt_SetMaskZeroTimes(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch,
271  uint8_t u8Times);
272 uint8_t Mft_Frt_GetMaskZeroTimes(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch);
273 en_result_t Mft_Frt_SetMaskPeakTimes(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch, uint8_t u8Times);
274 uint8_t Mft_Frt_GetMaskPeakTimes(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch);
275 
276 /* Func/Int enable/disable */
277 en_result_t Mft_Frt_Start(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch);
278 en_result_t Mft_Frt_Stop(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch);
279 #if (PDL_INTERRUPT_ENABLE_MFT0_FRT == PDL_ON) || \
280  (PDL_INTERRUPT_ENABLE_MFT1_FRT == PDL_ON) || \
281  (PDL_INTERRUPT_ENABLE_MFT2_FRT == PDL_ON)
283  uint8_t u8Ch,
284  stc_frt_int_sel_t* pstcIntSel,
285  stc_frt_int_cb_t* pstcFrtIntCallback);
286 en_result_t Mft_Frt_DisableInt(volatile stc_mftn_frt_t*pstcMft,uint8_t u8Ch,
287  stc_frt_int_sel_t* pstcIntSel);
288 #endif
289 
290 /* Status get/clear */
292  uint8_t u8Ch,
293  en_mft_frt_int_t enIntType);
295  uint8_t u8Ch,
296  en_mft_frt_int_t enIntType);
297 
298 /* Count write/read */
299 en_result_t Mft_Frt_SetCountCycle(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch, uint16_t u16Cycle);
300 en_result_t Mft_Frt_SetCountVal(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch,uint16_t u16Count);
301 uint16_t Mft_Frt_GetCurCount(volatile stc_mftn_frt_t*pstcMft, uint8_t u8Ch);
302 
303 /* IRQ handler */
304 void Mft_Frt_IrqHandler(volatile stc_mftn_frt_t*pstcMft, stc_mft_frt_intern_data_t* pstcMftFrtInternData) ;
305 
306 #ifdef __cplusplus
307 }
308 #endif
309 
311 
312 #endif // #if (defined(PDL_PERIPHERAL_ADC_ACTIVE))
313 
314 #endif /* __MFT_H__ */
315 
316 
317 
318 
319 
320 
321 
322 
323