| PDL for FM0+ Version1.0 Peripheral Driverl Library for FM0+

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

C:/pdl_v10/library/driver/wdg/swwdg.h
Go to the documentation of this file.

    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 __SWWDG_H__
    00052 #define __SWWDG_H__
    00053
    00054 /******************************************************************************/
    00055 /* Include files                                                              */
    00056 /******************************************************************************/
    00057 #include "mcu.h"
    00058 #include "pdl_user.h"
    00059
    00060 #if (defined(PDL_PERIPHERAL_WDG_ACTIVE))
    00061
    00062 /* C binding of definitions if building with C++ compiler */
    00063 #ifdef __cplusplus
    00064 extern "C"
    00065 {
    00066 #endif
    00067
    00119
    00120 /*****************************************************************************/
    00121 /* Global pre-processor symbols/macros ('#define')                           */
    00122 /*****************************************************************************/
    00123 /* for WDOGLOCK */
    00124 #define SWWDG_REG_UNLOCK    (0x1ACCE551u)
    00125
    00126 /******************************************************************************
    00127  * Global type definitions
    00128  ******************************************************************************/
    00129
    00134 typedef enum en_swwdg_timing_window
    00135 {
    00136     en_swwdg_timing_window_100 = 0x00,
    00137     en_swwdg_timing_window_75  = 0x01,
    00138     en_swwdg_timing_window_50  = 0x02,
    00139     en_swwdg_timing_window_25  = 0x03
    00140 } en_swwdg_timing_window_t;
    00141
    00146 typedef struct stc_swwdg_config
    00147 {
    00148   uint32_t   u32LoadValue;
    00149   boolean_t  bResetEnable;
    00150   boolean_t  bWinWdgEnable;
    00151   boolean_t  bWinWdgResetEnable;
    00152
    00153   uint8_t    u8TimingWindow;
    00154 } stc_swwdg_config_t;
    00155
    00156 /******************************************************************************/
    00157 /* Local type definitions ('typedef')                                         */
    00158 /******************************************************************************/
    00159
    00160 /******************************************************************************/
    00161 /* Global variable definitions ('extern')                                     */
    00162 /******************************************************************************/
    00163
    00164 /******************************************************************************/
    00165 /* Global function prototypes (definition in C source)                        */
    00166 /******************************************************************************/
    00167 /* Interrupt */
    00168 void SwwdgIrqHandler(void);
    00169
    00170 /* Setup(Initialize)/Disable(Un-initialize) */
    00171 en_result_t Swwdg_Init(stc_swwdg_config_t* pstcConfig);
    00172 void Swwdg_DeInit(void);
    00173
    00174 /* Start/Stop */
    00175 en_result_t Swwdg_Start(func_ptr_t pfnSwwdgCb);
    00176 void Swwdg_Stop(void);
    00177
    00178 /* Write/Read for counter */
    00179 void Swwdg_WriteWdgLoad(uint32_t u32LoadValue);
    00180 uint32_t Swwdg_ReadWdgValue(void);
    00181
    00182 /* Feed watchdog */
    00183 void Swwdg_Feed(void) ;
    00184 static void Swwdg_QuickFeed(void);
    00185
    00186 /* Setting Debug Break Watchdog Timer Control */
    00187 void Swwdg_EnableDbgBrkWdgCtl(void);
    00188 void Swwdg_DisableDbgBrkWdgCtl(void);
    00189
    00190 /******************************************************************************/
    00191 /* Static inline functions                                                    */
    00192 /******************************************************************************/
    00193
    00201 static __INLINE void Swwdg_QuickFeed(void)
    00202 {
    00203     FM0P_SWWDT->WDOGLOCK   = SWWDG_REG_UNLOCK;   /* Release Lock */
    00204     FM0P_SWWDT->WDOGINTCLR = 1;                  /* Clear possible interrupt and reload value */
    00205     FM0P_SWWDT->WDOGLOCK   = 0;                  /* Lock again it! */
    00206 } /* Swwdg_QuickFeed */
    00207
    00209
    00210 #ifdef __cplusplus
    00211 }
    00212 #endif
    00213
    00214 #endif /* #if (defined(PDL_PERIPHERAL_WDG_ACTIVE)) */
    00215
    00216 #endif /* __SWWDG_H__ */
    00217 /******************************************************************************/
    00218 /* EOF (not truncated)                                                        */
    00219 /******************************************************************************/