![]() |
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 /******************************************************************************/ 00051 #ifndef __MFT_ADCMP_H__ 00052 #define __MFT_ADCMP_H__ 00053 00054 /******************************************************************************/ 00055 /* Include files */ 00056 /******************************************************************************/ 00057 #include "mcu.h" 00058 #include "pdl_user.h" 00059 00060 #if (defined(PDL_PERIPHERAL_MFT_ADCMP_ACTIVE)) 00061 00126 /******************************************************************************/ 00127 /* Global pre-processor symbols/macros ('#define') */ 00128 /******************************************************************************/ 00129 00130 #define MFT_ADCMP_CH0 0 00131 #define MFT_ADCMP_CH1 1 00132 #define MFT_ADCMP_CH2 2 00133 #define MFT_ADCMP_CH3 3 00134 #define MFT_ADCMP_CH4 4 00135 #define MFT_ADCMP_CH5 5 00136 00137 #define MFT_ADCMP_CH10 0 00138 #define MFT_ADCMP_CH32 1 00139 #define MFT_ADCMP_CH54 2 00140 00141 #define MFT_ADCMP_CH_MAX 5 00142 #define MFT_ADCMP_CPCH_MAX 2 00143 /****************************************************************************** 00144 * Global type definitions 00145 ******************************************************************************/ 00146 #define stc_mftn_adcmp_t FM0P_MFT_ADCMP_TypeDef 00147 00148 #define MFT0_ADCMP (*(volatile stc_mftn_adcmp_t *) FM0P_MFT0_ADCMP_BASE) 00149 #define MFT1_ADCMP (*(volatile stc_mftn_adcmp_t *) FM0P_MFT1_ADCMP_BASE) 00150 #define MFT2_ADCMP (*(volatile stc_mftn_adcmp_t *) FM0P_MFT2_ADCMP_BASE) 00151 00156 typedef enum en_adcmp_frt 00157 { 00158 Frt0ToAdcmp = 0, 00159 Frt1ToAdcmp = 1, 00160 Frt2ToAdcmp = 2, 00161 AdcmpFrtToExt0 = 3, 00162 AdcmpFrtToExt1 = 4, 00163 00164 }en_adcmp_frt_t; 00165 00170 typedef enum en_adcmp_fm3_frt 00171 { 00172 Frt1ToAdcmpFm3 = 1, 00173 Frt2ToAdcmpFm3 = 2, 00174 00175 }en_adcmp_fm3_frt_t; 00176 00181 typedef enum en_adcmp_buf 00182 { 00183 AdcmpBufDisable = 0, 00184 AdcmpBufFrtZero = 1, 00185 AdcmpBufFrtPeak = 2, 00186 AdcmpBufFrtZeroPeak = 3, 00187 00188 }en_adcmp_buf_t; 00189 00194 typedef enum en_adcmp_trig_channel 00195 { 00196 AdcmpStartTrig0 = 0, 00197 AdcmpStartTrig1 = 1, 00198 AdcmpStartTrig2 = 2, 00199 AdcmpStartTrig3 = 3, 00200 AdcmpStartTrig4 = 4, 00201 AdcmpStartTrig5 = 5, 00202 AdcmpStartTrig6 = 6, 00203 AdcmpStartTrig7 = 7, 00204 00205 }en_adcmp_start_trig_t; 00210 typedef enum en_adcmp_trig_sel 00211 { 00212 AdcmpTrigAdc0Scan = 0, 00213 AdcmpTrigAdc0Prio = 1, 00214 AdcmpTrigAdc1Scan = 2, 00215 AdcmpTrigAdc1Prio = 3, 00216 AdcmpTrigAdc2Scan = 4, 00217 AdcmpTrigAdc2Prio = 5, 00218 00219 }en_adcmp_trig_sel_t; 00224 typedef enum en_adcmp_mode 00225 { 00226 AdcmpNormalMode = 0, 00227 AdcmpOffsetMode = 1, 00228 00229 }en_adcmp_mode_t; 00234 typedef enum en_adcmp_occp_sel 00235 { 00236 AdcmpSelOccp0 = 0, 00237 AdcmpSelOccp1 = 1, 00238 00239 }en_adcmp_occp_sel_t; 00244 typedef struct stc_mft_adcmp_config 00245 { 00246 en_adcmp_frt_t enFrt; 00247 en_adcmp_buf_t enBuf; 00248 en_adcmp_trig_sel_t enTrigSel; 00249 en_adcmp_mode_t enMode; 00250 en_adcmp_occp_sel_t enOccpSel; 00251 00252 }stc_mft_adcmp_config_t; 00257 typedef struct stc_mft_adcmp_func 00258 { 00259 boolean_t bDownEn; 00260 boolean_t bPeakEn; 00261 boolean_t bUpEn; 00262 boolean_t bZeroEn; 00263 00264 }stc_mft_adcmp_func_t; 00269 typedef enum en_adcmp_fm3_mode 00270 { 00271 AdcmpFm3AccpUpAccpDown = 0, 00272 AdcmpFm3AccpUp = 1, 00273 AdcmpFm3AccpDown = 2, 00274 AdcmpFm3AccpUpAccpdnDown = 3, 00275 00276 }en_adcmp_fm3_mode_t; 00281 typedef struct stc_mft_adcmp_fm3_config 00282 { 00283 en_adcmp_fm3_frt_t enFrt; 00284 en_adcmp_fm3_mode_t enMode; 00285 en_adcmp_buf_t enBuf; 00286 en_adcmp_trig_sel_t enTrigSel; 00287 00288 }stc_mft_adcmp_fm3_config_t; 00293 /* C binding of definitions if building with C++ compiler */ 00294 #ifdef __cplusplus 00295 extern "C" 00296 { 00297 #endif 00298 00299 /* 1. FM0P */ 00300 /* Init */ 00301 en_result_t Mft_Adcmp_Init (volatile stc_mftn_adcmp_t *pstcMftAdcmp, 00302 uint8_t u8Ch, 00303 stc_mft_adcmp_config_t *pstcConfig); 00304 /* Func enable/disable */ 00305 en_result_t Mft_Adcmp_EnableOperation(volatile stc_mftn_adcmp_t *pstcMftAdcmp, 00306 uint8_t u8Ch, 00307 stc_mft_adcmp_func_t* pstcFunc); 00308 en_result_t Mft_Adcmp_DisableOperation(volatile stc_mftn_adcmp_t *pstcMftAdcmp, 00309 uint8_t u8Ch, 00310 stc_mft_adcmp_func_t* pstcFunc); 00311 /* Count write/read */ 00312 en_result_t Mft_Adcmp_WriteAcmp(volatile stc_mftn_adcmp_t *pstcMftAdcmp, uint8_t u8Ch, 00313 uint16_t u16AcmpVal); 00314 uint16_t Mft_Adcmp_ReadAcmp(volatile stc_mftn_adcmp_t *pstcMftAdcmp, uint8_t u8Ch); 00315 00316 /* 2. FM3 compatible */ 00317 /* Init */ 00318 en_result_t Mft_Adcmp_Fm3_Init(volatile stc_mftn_adcmp_t *pstcMftAdcmp, 00319 uint8_t u8CoupleCh, 00320 stc_mft_adcmp_fm3_config_t *pstcConfig); 00321 /* Mode configuration */ 00322 en_result_t Mft_Adcmp_Fm3_EnableOperation(volatile stc_mftn_adcmp_t *pstcMftAdcmp, uint8_t u8CoupleCh); 00323 en_result_t Mft_Adcmp_Fm3_DisableOperation(volatile stc_mftn_adcmp_t *pstcMftAdcmp, uint8_t u8CoupleCh); 00324 /* Count write/read */ 00325 en_result_t Mft_Adcmp_Fm3_WriteAccp(volatile stc_mftn_adcmp_t *pstcMftAdcmp, uint8_t u8CoupleCh, uint16_t u16AccpVal); 00326 uint16_t Mft_Adcmp_Fm3_ReadAccp(volatile stc_mftn_adcmp_t *pstcMftAdcmp, uint8_t u8CoupleCh); 00327 en_result_t Mft_Adcmp_Fm3_WriteAccpdn(volatile stc_mftn_adcmp_t *pstcMftAdcmp, uint8_t u8CoupleCh, uint16_t u16AccpdnVal); 00328 uint16_t Mft_Adcmp_Fm3_ReadAccpdn(volatile stc_mftn_adcmp_t *pstcMftAdcmp, uint8_t u8CoupleCh); 00329 00331 #ifdef __cplusplus 00332 } 00333 #endif 00334 00335 #endif 00336 00337 #endif 00338 00339 00340 00341 00342 /******************************************************************************/ 00343 /* EOF (not truncated) */ 00344 /******************************************************************************/