![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
00001 /******************************************************************************* 00002 * Copyright (C) 2013 Spansion LLC. All Rights Reserved. 00003 * 00004 * This software is owned and published by: 00005 * Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion"). 00006 * 00007 * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND 00008 * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT. 00009 * 00010 * This software contains source code for use with Spansion 00011 * components. This software is licensed by Spansion to be adapted only 00012 * for use in systems utilizing Spansion components. Spansion shall not be 00013 * responsible for misuse or illegal use of this software for devices not 00014 * supported herein. Spansion is providing this software "AS IS" and will 00015 * not be responsible for issues arising from incorrect user implementation 00016 * of the software. 00017 * 00018 * SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE, 00019 * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS), 00020 * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING, 00021 * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED 00022 * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED 00023 * WARRANTY OF NONINFRINGEMENT. 00024 * SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT, 00025 * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT 00026 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, 00027 * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR 00028 * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT, 00029 * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA, 00030 * SAVINGS OR PROFITS, 00031 * EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00032 * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR 00033 * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED 00034 * FROM, THE SOFTWARE. 00035 * 00036 * This software may be replicated in part or whole for the licensed use, 00037 * with the restriction that this Disclaimer and Copyright notice must be 00038 * included with each copy of this software, whether used in part or whole, 00039 * at all times. 00040 */ 00041 /******************************************************************************/ 00052 #ifndef __MFT_ICU_H__ 00053 #define __MFT_ICU_H__ 00054 00055 #include "mcu.h" 00056 #include "pdl_user.h" 00057 00058 #if (defined(PDL_PERIPHERAL_MFT_ICU_ACTIVE)) 00059 00111 /****************************************************************************** 00112 * Global type definitions 00113 ******************************************************************************/ 00114 #define stc_mftn_icu_t FM0P_MFT_ICU_TypeDef 00115 #define MFT0_ICU (*((volatile stc_mftn_icu_t *) FM0P_MFT0_ICU_BASE)) 00116 #define MFT1_ICU (*((volatile stc_mftn_icu_t *) FM0P_MFT1_ICU_BASE)) 00117 #define MFT2_ICU (*((volatile stc_mftn_icu_t *) FM0P_MFT2_ICU_BASE)) 00118 00119 #define MFT_ICU_CH0 0u 00120 #define MFT_ICU_CH1 1u 00121 #define MFT_ICU_CH2 2u 00122 #define MFT_ICU_CH3 3u 00123 00124 #define MFT_ICU_CHx_MAX 3u 00125 00126 #define MFT_ICU_INSTANCE_COUNT \ 00127 (uint8_t)(PDL_PERIPHERAL_ENABLE_MFT0_ICU == PDL_ON) + \ 00128 (uint8_t)(PDL_PERIPHERAL_ENABLE_MFT1_ICU == PDL_ON) + \ 00129 (uint8_t)(PDL_PERIPHERAL_ENABLE_MFT2_ICU == PDL_ON) 00130 00135 typedef enum en_icu_instance_index 00136 { 00137 #if (PDL_PERIPHERAL_ENABLE_MFT0_ICU == PDL_ON) 00138 IcuInstanceIndexIcu0, 00139 #endif 00140 #if (PDL_PERIPHERAL_ENABLE_MFT1_ICU == PDL_ON) 00141 IcuInstanceIndexIcu1, 00142 #endif 00143 #if (PDL_PERIPHERAL_ENABLE_MFT2_ICU == PDL_ON) 00144 IcuInstanceIndexIcu2, 00145 #endif 00146 } en_icu_instance_index_t; 00147 00154 typedef enum en_mft_icu_frt 00155 { 00156 Frt0ToIcu = 0u, 00157 Frt1ToIcu = 1u, 00158 Frt2ToIcu = 2u, 00159 IcuFrtToExt0 = 3u, 00160 IcuFrtToExt1 = 4u, 00161 00162 }en_mft_icu_frt_t; 00169 typedef enum en_mft_icu_mode 00170 { 00171 IcuDisable = 0u, 00172 IcuRisingDetect = 1u, 00173 IcuFallingDetect = 2u, 00174 IcuBothDetect = 3u, 00175 00176 }en_mft_icu_mode_t; 00183 typedef enum en_icu_edge 00184 { 00185 IcuFallingEdge = 0u, 00186 IcuRisingEdge = 1u, 00187 00188 }en_mft_icu_edge_t; 00193 typedef struct stc_mft_icu_config 00194 { 00195 en_mft_icu_frt_t enFrt; 00196 en_mft_icu_mode_t enMode; 00197 en_mft_icu_edge_t enEdge; 00198 00199 }stc_mft_icu_config_t; 00205 typedef struct stc_mft_icu_intern_data 00206 { 00207 func_ptr_t pfnIcu0Callback; 00208 func_ptr_t pfnIcu1Callback; 00209 func_ptr_t pfnIcu2Callback; 00210 func_ptr_t pfnIcu3Callback; 00211 00212 }stc_mft_icu_intern_data_t; 00217 typedef struct stc_mft_icu_instance_data 00218 { 00219 volatile stc_mftn_icu_t* pstcInstance; 00220 stc_mft_icu_intern_data_t stcInternData; 00221 00222 }stc_mft_icu_instance_data_t; 00223 /******************************************************************************/ 00224 /* Global variable definitions ('extern') */ 00225 /******************************************************************************/ 00226 00228 extern stc_mft_icu_instance_data_t m_astcMftIcuInstanceDataLut[MFT_ICU_INSTANCE_COUNT]; 00229 00231 #ifdef __cplusplus 00232 extern "C" 00233 { 00234 #endif 00235 00236 en_result_t Mft_Icu_SelFrt(volatile stc_mftn_icu_t*pstcMft, uint8_t u8Ch, en_mft_icu_frt_t enFrt); 00238 en_result_t Mft_Icu_ConfigDetectMode(volatile stc_mftn_icu_t*pstcMft, uint8_t u8Ch, en_mft_icu_mode_t enMode); 00240 #if (PDL_INTERRUPT_ENABLE_MFT0_ICU == PDL_ON) || \ 00241 (PDL_INTERRUPT_ENABLE_MFT1_ICU == PDL_ON) || \ 00242 (PDL_INTERRUPT_ENABLE_MFT2_ICU == PDL_ON) 00243 en_result_t Mft_Icu_EnableInt(volatile stc_mftn_icu_t*pstcMft, uint8_t u8Ch, func_ptr_t pfnCallback); 00244 en_result_t Mft_Icu_DisableInt(volatile stc_mftn_icu_t*pstcMft, uint8_t u8Ch); 00245 #endif 00246 en_int_flag_t Mft_Icu_GetIntFlag(volatile stc_mftn_icu_t*pstcMft, uint8_t u8Ch); 00247 en_result_t Mft_Icu_ClrIntFlag(volatile stc_mftn_icu_t*pstcMft, uint8_t u8Ch); 00249 en_mft_icu_edge_t Mft_Icu_GetLastEdge(volatile stc_mftn_icu_t*pstcMft, uint8_t u8Ch); 00251 uint16_t Mft_Icu_GetCaptureData(volatile stc_mftn_icu_t*pstcMft, uint8_t u8Ch); 00253 void Mft_Icu_IrqHandler(volatile stc_mftn_icu_t*pstcMft, stc_mft_icu_intern_data_t* pstcMftIcuInternData) ; 00254 00255 #ifdef __cplusplus 00256 } 00257 #endif 00258 00260 00261 #endif 00262 00263 #endif