![]() |
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 /******************************************************************************/ 00053 /* Include files */ 00054 /******************************************************************************/ 00055 #include "cr.h" 00056 00057 #if (defined(PDL_PERIPHERAL_CR_ACTIVE)) 00058 00064 00065 /******************************************************************************/ 00066 /* Local pre-processor symbols/macros ('#define') */ 00067 /******************************************************************************/ 00068 #define CR_REG_UNLOCK_CODE 0x1ACCE554 00069 #define CR_REG_LOCK_CODE 0 00070 00071 /******************************************************************************/ 00072 /* Global variable definitions (declared in header file with 'extern') */ 00073 /******************************************************************************/ 00074 00075 /******************************************************************************/ 00076 /* Local type definitions ('typedef') */ 00077 /******************************************************************************/ 00078 00079 /******************************************************************************/ 00080 /* Local function prototypes ('static') */ 00081 /******************************************************************************/ 00082 00083 /******************************************************************************/ 00084 /* Local variable definitions ('static') */ 00085 /******************************************************************************/ 00086 00105 en_result_t Cr_SetFreqDiv(en_cr_freq_div_t enCrDiv) 00106 { 00107 if(enCrDiv > CrFreqDivBy512) 00108 { 00109 return ErrorInvalidParameter; 00110 } 00111 00112 FM0P_CRTRIM->MCR_PSR = enCrDiv; 00113 00114 return Ok; 00115 } 00116 00128 en_result_t Cr_SetTempTrimmingData(uint8_t u8Data) 00129 { 00130 FM0P_CRTRIM->MCR_RLR = CR_REG_UNLOCK_CODE; 00131 FM0P_CRTRIM->MCR_TTRM = u8Data & 0x1F; 00132 FM0P_CRTRIM->MCR_RLR = CR_REG_LOCK_CODE; 00133 return Ok; 00134 } 00135 00143 uint8_t Cr_GetTempTrimmingData(void) 00144 { 00145 uint8_t u8CrTempData; 00146 u8CrTempData = FM0P_CRTRIM->MCR_TTRM & 0x1F; 00147 return u8CrTempData; 00148 } 00149 00160 en_result_t Cr_SetFreqTrimmingData(uint16_t u16Data) 00161 { 00162 FM0P_CRTRIM->MCR_RLR = CR_REG_UNLOCK_CODE; 00163 FM0P_CRTRIM->MCR_FTRM = u16Data & 0x3FF; 00164 FM0P_CRTRIM->MCR_RLR = CR_REG_LOCK_CODE; 00165 return Ok; 00166 } 00167 00176 uint16_t Cr_GetFreqTrimmingData(void) 00177 { 00178 uint16_t u16CrFreqData; 00179 u16CrFreqData = FM0P_CRTRIM->MCR_FTRM & 0x3FF; 00180 return u16CrFreqData; 00181 } 00182 00184 00185 #endif /* #if (defined(PDL_PERIPHERAL_CR_ACTIVE)) */ 00186 /******************************************************************************/ 00187 /* EOF (not truncated) */ 00188 /******************************************************************************/