libuav original

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers wwdt_11xx.c Source File

wwdt_11xx.c

00001 /*
00002  * @brief LPC11xx WWDT chip driver
00003  *
00004  * @note
00005  * Copyright(C) NXP Semiconductors, 2012
00006  * All rights reserved.
00007  *
00008  * @par
00009  * Software that is described herein is for illustrative purposes only
00010  * which provides customers with programming information regarding the
00011  * LPC products.  This software is supplied "AS IS" without any warranties of
00012  * any kind, and NXP Semiconductors and its licensor disclaim any and
00013  * all warranties, express or implied, including all implied warranties of
00014  * merchantability, fitness for a particular purpose and non-infringement of
00015  * intellectual property rights.  NXP Semiconductors assumes no responsibility
00016  * or liability for the use of the software, conveys no license or rights under any
00017  * patent, copyright, mask work right, or any other intellectual property rights in
00018  * or to any products. NXP Semiconductors reserves the right to make changes
00019  * in the software without notification. NXP Semiconductors also makes no
00020  * representation or warranty that such application will be suitable for the
00021  * specified use without further testing or modification.
00022  *
00023  * @par
00024  * Permission to use, copy, modify, and distribute this software and its
00025  * documentation is hereby granted, under NXP Semiconductors' and its
00026  * licensor's relevant copyrights in the software, without fee, provided that it
00027  * is used in conjunction with NXP Semiconductors microcontrollers.  This
00028  * copyright, permission, and disclaimer notice must appear in all copies of
00029  * this code.
00030  */
00031 
00032 /*
00033  * Compiler warning fixes
00034  * Pavel Kirienko, 2014 <pavel.kirienko@gmail.com>
00035  */
00036 
00037 #include "chip.h"
00038 
00039 /*****************************************************************************
00040  * Private types/enumerations/variables
00041  ****************************************************************************/
00042 
00043 /*****************************************************************************
00044  * Public types/enumerations/variables
00045  ****************************************************************************/
00046 
00047 /*****************************************************************************
00048  * Private functions
00049  ****************************************************************************/
00050 
00051 /*****************************************************************************
00052  * Public functions
00053  ****************************************************************************/
00054 
00055 /* Initialize the Watchdog timer */
00056 void Chip_WWDT_Init(LPC_WWDT_T *pWWDT)
00057 {
00058     Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_WDT );
00059 
00060     /* Disable watchdog */
00061     pWWDT->MOD        = 0;
00062     pWWDT->TC         = 0xFF;
00063 #if defined(WATCHDOG_WINDOW_SUPPORT)
00064     pWWDT->WARNINT    = 0xFFFF;
00065     pWWDT->WINDOW     = 0xFFFFFF;
00066 #endif
00067 }
00068 
00069 /* Shutdown the Watchdog timer */
00070 void Chip_WWDT_DeInit(LPC_WWDT_T *pWWDT)
00071 {
00072     (void)pWWDT;
00073     Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_WDT );
00074 }
00075 
00076 /* Clear WWDT interrupt status flags */
00077 void Chip_WWDT_ClearStatusFlag(LPC_WWDT_T *pWWDT, uint32_t status)
00078 {
00079     if (status & WWDT_WDMOD_WDTOF) {
00080         pWWDT->MOD  &= (~WWDT_WDMOD_WDTOF) & WWDT_WDMOD_BITMASK;
00081     }
00082 
00083     if (status & WWDT_WDMOD_WDINT) {
00084         pWWDT->MOD  |= WWDT_WDMOD_WDINT;
00085     }
00086 }