1 /***************************************************************************//**
2 * \file cyhal_wdt_impl.h
3 *
4 * \brief
5 * CAT1 specific implementation for WDT API.
6 *
7 ********************************************************************************
8 * \copyright
9 * Copyright 2019-2021 Cypress Semiconductor Corporation (an Infineon company) or
10 * an affiliate of Cypress Semiconductor Corporation
11 *
12 * SPDX-License-Identifier: Apache-2.0
13 *
14 * Licensed under the Apache License, Version 2.0 (the "License");
15 * you may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at
17 *
18 *     http://www.apache.org/licenses/LICENSE-2.0
19 *
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
25 *******************************************************************************/
26 
27 #pragma once
28 
29 /**
30 * \addtogroup group_hal_impl_wdt WDT (Watchdog Timer)
31 * \ingroup group_hal_impl
32 * \{
33 * The CAT1 WDT is only capable of supporting certain timeout ranges below its maximum timeout.
34 * As a result, any unsupported timeouts given to the HAL WDT are rounded up to the nearest supported value.
35 * The following table describes the unsupported ranges and the timeout values they are rounded to.
36 *
37 * <table class="doxtable">
38 *   <tr><th>Range (ms)</th><th>Rounded Timeout (ms)</th></tr>
39 *   <tr>
40 *     <td>3001 - 3999</td>
41 *     <td>4000</td>
42 *   </tr>
43 *   <tr>
44 *     <td>1501 - 1999</td>
45 *     <td>2000</td>
46 *   </tr>
47 *   <tr>
48 *     <td>751 - 999</td>
49 *     <td>1000</td>
50 *   </tr>
51 *   <tr>
52 *     <td>376 - 499</td>
53 *     <td>500</td>
54 *   </tr>
55 *   <tr>
56 *     <td>188 - 249</td>
57 *     <td>250</td>
58 *   </tr>
59 *   <tr>
60 *     <td>94 - 124</td>
61 *     <td>125</td>
62 *   </tr>
63 *   <tr>
64 *     <td>47 - 62</td>
65 *     <td>63</td>
66 *   </tr>
67 *   <tr>
68 *     <td>24 - 31</td>
69 *     <td>32</td>
70 *   </tr>
71 *   <tr>
72 *     <td>12 - 15</td>
73 *     <td>16</td>
74 *   </tr>
75 *   <tr>
76 *     <td>6 - 7</td>
77 *     <td>8</td>
78 *   </tr>
79 *   <tr>
80 *     <td>3 - 3</td>
81 *     <td>4</td>
82 *   </tr>
83 * </table>
84 * \} group_hal_impl_wdt
85 */
86 
87 #include "cyhal_wdt_impl_common.h"
88 
89 #if (defined(CY_IP_MXS40SRSS) && (CY_IP_MXS40SRSS_VERSION < 3)) || defined(CY_IP_MXS40SSRSS)
90 
91 #if defined(__cplusplus)
92 extern "C" {
93 #endif /* __cplusplus */
94 
95 /**
96 * \cond INTERNAL
97 */
98 
99 // (2^16 * 3) * .030518 ms
100 /** Maximum WDT timeout in milliseconds */
101 #define _CYHAL_WDT_MAX_TIMEOUT_MS 6000
102 
103 /** Maximum number of ignore bits */
104 #define _CYHAL_WDT_MAX_IGNORE_BITS 12
105 
106 /** \endcond */
107 
108 #if defined(__cplusplus)
109 }
110 #endif /* __cplusplus */
111 
112 #endif // defined(CY_IP_MXS40SRSS) || defined(CY_IP_MXS40SSRSS)
113