![]() |
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 __WC_H__ 00052 #define __WC_H__ 00053 00054 /******************************************************************************/ 00055 /* Include files */ 00056 /******************************************************************************/ 00057 #include "mcu.h" 00058 #include "pdl_user.h" 00059 00060 #if (defined(PDL_PERIPHERAL_WC_ACTIVE)) 00061 00121 /*****************************************************************************/ 00122 /* Global pre-processor symbols/macros ('#define') */ 00123 /*****************************************************************************/ 00124 00129 typedef enum en_input_clk 00130 { 00131 WcPresInClkSubOsc = 0, 00132 WcPresInClkMainOsc, 00133 WcPresInClkHighCr, 00134 WcPresInClkLowCr, 00135 00136 }en_input_clk_t; 00137 00142 typedef enum en_output_clk 00143 { 00144 WcPresOutClkArray0 = 0, 00145 WcPresOutClkArray1, 00146 WcPresOutClkArray2, 00147 WcPresOutClkArray3, 00148 WcPresOutClkArray4, 00149 WcPresOutClkArray5, 00150 WcPresOutClkArray6, 00151 00152 }en_output_clk_t; 00153 00158 typedef struct stc_wc_pres_clk 00159 { 00160 en_input_clk_t enInputClk; 00161 en_output_clk_t enOutputClk; 00162 00163 }stc_wc_pres_clk_t; 00164 00165 00170 typedef enum en_wc_cnt_clk 00171 { 00172 WcCntClkWcck0 = 0, 00173 WcCntClkWcck1, 00174 WcCntClkWcck2, 00175 WcCntClkWcck3, 00176 00177 }en_wc_cnt_clk_t; 00178 00183 typedef struct stc_wc_config 00184 { 00185 en_wc_cnt_clk_t enCntClk; 00186 uint8_t u8ReloadValue; 00187 00188 }stc_wc_config_t; 00189 00190 00191 /******************************************************************************/ 00192 /* Global variable definitions ('extern') */ 00193 /******************************************************************************/ 00194 00195 /******************************************************************************/ 00196 /* Global function prototypes (definition in C source) */ 00197 /******************************************************************************/ 00198 /* C binding of definitions if building with C++ compiler */ 00199 #ifdef __cplusplus 00200 extern "C" 00201 { 00202 #endif 00203 00204 /* 1. WC prescaler setting */ 00205 en_result_t Wc_Pres_SelClk(stc_wc_pres_clk_t* pstcWcPresClk); 00206 en_result_t Wc_Pres_EnableDiv(void); 00207 en_result_t Wc_Pres_DisableDiv(void); 00208 en_stat_flag_t Wc_GetDivStat(void); 00209 /* 2. WC setting */ 00210 /* Init */ 00211 en_result_t Wc_Init(stc_wc_config_t* pstcWcConfig); 00212 /* Func/Int enable/disable */ 00213 en_result_t Wc_EnableCount(void); 00214 en_result_t Wc_DisableCount(void); 00215 #if (PDL_INTERRUPT_ENABLE_WC == PDL_ON) 00216 en_result_t Wc_EnableInt(func_ptr_t pfnIntCallback); 00217 en_result_t Wc_DisableInt(void); 00218 #endif 00219 /* Count write/read */ 00220 en_result_t Wc_WriteReloadVal(uint8_t u8Val); 00221 uint8_t Wc_ReadCurCnt(void); 00222 /* Status clear */ 00223 en_result_t Wc_ClearIntFlag(void); 00224 /* Status read */ 00225 en_int_flag_t Wc_GetIntFlag(void); 00226 en_stat_flag_t Wc_GetOperationFlag(void); 00227 /* 3. IRQ handler */ 00228 void Wc_IrqHandler(void) ; 00229 00231 00232 #ifdef __cplusplus 00233 } 00234 #endif 00235 00236 #endif // #if (defined(L3_PERIPHERAL_WC_ACTIVE)) 00237 00238 #endif /* __WC_H__ */ 00239 /******************************************************************************/ 00240 /* EOF (not truncated) */ 00241 /******************************************************************************/