0% found this document useful (0 votes)
13 views

XMC WDT C

wdt

Uploaded by

Roberto Dias
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

XMC WDT C

wdt

Uploaded by

Roberto Dias
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1 /**

2 * @file xmc_wdt.c
3 * @date 2015-06-20
4 *
5 * @cond
6 *****************************************************************************
7 * XMClib v2.2.0 - XMC Peripheral Driver Library
8 *
9 * Copyright (c) 2015-2020, Infineon Technologies AG
10 * All rights reserved.
11 *
12 * Boost Software License - Version 1.0 - August 17th, 2003
13 *
14 * Permission is hereby granted, free of charge, to any person or organization
15 * obtaining a copy of the software and accompanying documentation covered by
16 * this license (the "Software") to use, reproduce, display, distribute,
17 * execute, and transmit the Software, and to prepare derivative works of the
18 * Software, and to permit third-parties to whom the Software is furnished to
19 * do so, all subject to the following:
20 *
21 * The copyright notices in the Software and this entire statement, including
22 * the above license grant, this restriction and the following disclaimer,
23 * must be included in all copies of the Software, in whole or in part, and
24 * all derivative works of the Software, unless such copies or derivative
25 * works are solely in the form of machine-executable object code generated by
26 * a source language processor.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
31 * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
32 * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
33 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
34 * DEALINGS IN THE SOFTWARE.
35 *
36 * To improve the quality of the software, users are encouraged to share
37 * modifications, enhancements or bug fixes with Infineon Technologies AG
38 * at [email protected].
39 *****************************************************************************
40 *
41 * Change History
42 * --------------
43 *
44 * 2015-02-20:
45 * - Initial <br>
46 *
47 * 2015-06-20:
48 * - Removed definition of GetDriverVersion API <br>
49 *
50 * @endcond
51 */
52
53 /*************************************************************************************
********************************
54 * HEADER FILES
55
*************************************************************************************
*******************************/
56 #include "xmc_wdt.h"
57 #include "xmc_scu.h"
58
59 /*************************************************************************************
********************************
60 * API IMPLEMENTATION
61
************************************************************************************
********************************/
62
63 /* Enables watchdog clock and releases watchdog reset. */
64 void XMC_WDT_Enable(void)
65 {
66 #if UC_FAMILY == XMC4
67 XMC_SCU_CLOCK_EnableClock(XMC_SCU_CLOCK_WDT);
68 #endif
69
70 #if defined(CLOCK_GATING_SUPPORTED)
71 XMC_SCU_CLOCK_UngatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT);
72 #endif
73 #if defined(PERIPHERAL_RESET_SUPPORTED)
74 XMC_SCU_RESET_DeassertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_WDT);
75 #endif
76 }
77
78 /* Disables watchdog clock and resets watchdog. */
79 void XMC_WDT_Disable(void)
80 {
81 #if defined(PERIPHERAL_RESET_SUPPORTED)
82 XMC_SCU_RESET_AssertPeripheralReset(XMC_SCU_PERIPHERAL_RESET_WDT);
83 #endif
84 #if defined(CLOCK_GATING_SUPPORTED)
85 XMC_SCU_CLOCK_GatePeripheralClock(XMC_SCU_PERIPHERAL_CLOCK_WDT);
86 #endif
87
88 #if UC_FAMILY == XMC4
89 XMC_SCU_CLOCK_DisableClock(XMC_SCU_CLOCK_WDT);
90 #endif
91 }
92 /* Initializes and configures watchdog with configuration data pointed by \a config.
*/
93 void XMC_WDT_Init(const XMC_WDT_CONFIG_t *const config)
94 {
95 XMC_WDT_Enable();
96 WDT->CTR = config->wdt_ctr;
97 WDT->WLB = config->window_lower_bound;
98 WDT->WUB = config->window_upper_bound;
99 }
100

You might also like