![]() |
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 __LPM_H__ 00052 #define __LPM_H__ 00053 00054 /******************************************************************************/ 00055 /* Include files */ 00056 /******************************************************************************/ 00057 #include "mcu.h" 00058 #include "pdl_user.h" 00059 00060 #if (defined(PDL_PERIPHERAL_LPM_ACTIVE)) 00061 00062 /* C binding of definitions if building with C++ compiler */ 00063 #ifdef __cplusplus 00064 extern "C" 00065 { 00066 #endif 00067 00115 00116 /******************************************************************************/ 00117 /* Global pre-processor symbols/macros ('#define') 00118 ******************************************************************************/ 00119 #define WIFSR_WRTCI (1ul<<0) 00120 #define WIFSR_WLVDI (1ul<<1) 00121 #define WIFSR_WUI0 (1ul<<2) 00122 #define WIFSR_WUI1 (1ul<<3) 00123 #define WIFSR_WUI2 (1ul<<4) 00124 #define WIFSR_WUI3 (1ul<<5) 00125 #define WIFSR_WUI4 (1ul<<6) 00126 #define WIFSR_WUI5 (1ul<<7) 00127 #define WIFSR_WCEC0I (1ul<<8) 00128 #define WIFSR_WCEC1I (1ul<<9) 00129 00130 #define WRFSR_WINITX (1ul<<0) 00131 #define WRFSR_WLVDH (1ul<<1) 00132 00138 typedef enum en_lpm_mode 00139 { 00140 StbSleepMode = 0u, 00141 StbTimerMode = 1u, 00142 StbStopMode = 2u, 00143 StbRtcMode = 3u, 00144 DeepStbRtcMode = 4u, 00145 DeepStbStopMode = 5u, 00146 00147 } en_lpm_mode_t; 00148 00154 typedef struct stc_ret_cause 00155 { 00156 boolean_t bRtcEn; 00157 boolean_t bLvdEn; 00158 boolean_t bWakeup1En; 00159 boolean_t bWakeup2En; 00160 boolean_t bWakeup3En; 00161 boolean_t bWakeup4En; 00162 boolean_t bWakeup5En; 00163 boolean_t bCec0En; 00164 boolean_t bCec1En; 00165 00166 }stc_dstb_ret_cause_t; 00167 00168 00174 typedef enum en_ret_cause_flag 00175 { 00176 DeepStbNoFlag = 0u, 00177 DeepStbInitx = 1u, 00178 DeepStbLvdReset = 2u, 00179 DeepStbRtcInt = 3u, 00180 DeepStbLvdInt = 4u, 00181 DeepStbWkupPin0 = 5u, 00182 DeepStbWkupPin1 = 6u, 00183 DeepStbWkupPin2 = 7u, 00184 DeepStbWkupPin3 = 8u, 00185 DeepStbWkupPin4 = 9u, 00186 DeepStbWkupPin5 = 10u, 00187 DeepStbCec0 = 11u, 00188 DeepStbCec1 = 12u, 00189 } en_dstb_ret_cause_t; 00190 00196 typedef enum en_dstb_wkup_pin 00197 { 00198 WkupPin1 = 0u, 00199 WkupPin2 = 1u, 00200 WkupPin3 = 2u, 00201 WkupPin4 = 3u, 00202 WkupPin5 = 4u, 00203 00204 } en_dstb_wkup_pin_t; 00205 00211 typedef enum en_wkup_valid_level 00212 { 00213 WkupLowLevelValid = 0u, 00214 WkupHighLevelValid = 1u, 00215 00216 }en_wkup_valid_level_t; 00217 00223 typedef enum en_dstb_bakup_reg 00224 { 00225 BackupReg1 = 1u, 00226 BackupReg2 = 2u, 00227 BackupReg3 = 3u, 00228 BackupReg4 = 4u, 00229 BackupReg5 = 5u, 00230 BackupReg6 = 6u, 00231 BackupReg7 = 7u, 00232 BackupReg8 = 8u, 00233 BackupReg9 = 9u, 00234 BackupReg10 = 10u, 00235 BackupReg11 = 11u, 00236 BackupReg12 = 12u, 00237 BackupReg13 = 13u, 00238 BackupReg14 = 14u, 00239 BackupReg15 = 15u, 00240 BackupReg16 = 16u, 00241 00242 } en_dstb_bakup_reg_t; 00243 00244 /******************************************************************************/ 00245 /* Global variable definitions ('extern') */ 00246 /******************************************************************************/ 00247 00248 /******************************************************************************/ 00249 /* Global function prototypes (definition in C source) */ 00250 /******************************************************************************/ 00251 void Lpm_GoToStandByMode(en_lpm_mode_t enMode, boolean_t bIoRemain); 00252 en_result_t Lpm_ConfigDeepStbRetCause(stc_dstb_ret_cause_t* pstcCause); 00253 en_dstb_ret_cause_t Lpm_ReadDeepStbRetCause(void); 00254 en_result_t Lpm_SetWkupPinLevel(en_dstb_wkup_pin_t enPinIndex, en_wkup_valid_level_t enLevel); 00255 en_result_t Lpm_ConfigSubClk(boolean_t bSupplyCec, boolean_t bSupplyRtc); 00256 en_result_t Lpm_ConfigDeepStbRAMRetention(boolean_t bRamRetain); 00257 en_result_t Lpm_WriteBackupReg(en_dstb_bakup_reg_t enRegIndex, uint8_t u8Data); 00258 uint8_t Lpm_ReadBackupReg(en_dstb_bakup_reg_t enRegIndex); 00259 00261 00262 #ifdef __cplusplus 00263 } 00264 #endif 00265 00266 #endif // #if (defined(PDL_PERIPHERAL_LPM_ACTIVE)) 00267 00268 #endif /* __LPM_H__ */ 00269 /******************************************************************************/ 00270 /* EOF (not truncated) */ 00271 /******************************************************************************/