PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
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 
140 {
144 
146 
151 typedef enum en_mft_ocu_frt
152 {
158 
164 {
168 
173 typedef enum en_ocu_occp_buf
174 {
180 
181 
186 typedef enum en_ocu_ocse_buf
187 {
192 
194 
199 typedef struct stc_mft_ocu_config
200 {
204  uint8_t u8Mod;
209 
214 typedef enum en_rt_status
215 {
220 
222 
228 {
231 
233 
239 {
242 
244 
247 
249 
254 
256 
262 {
267 
271 
276 
280 
285 
287 
293 {
301 
307 {
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 /******************************************************************************/
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 */
332  uint8_t EvenCh,
333  stc_even_compare_config_t* pstcConfig);
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)
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 */
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