1 /***************************************************************************//**
2 * \file cy_lvd.c
3 * \version 1.60
4 *
5 * The source code file for the LVD driver.
6 *
7 ********************************************************************************
8 * \copyright
9 * Copyright (c) (2017-2022), Cypress Semiconductor Corporation (an Infineon company) or
10 * an affiliate of Cypress Semiconductor Corporation.
11 * SPDX-License-Identifier: Apache-2.0
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 *     http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *******************************************************************************/
25 
26 #include "cy_device.h"
27 
28 #if defined (CY_IP_MXS40SSRSS) || (defined (CY_IP_MXS40SRSS) && (CY_IP_MXS40SRSS_VERSION < 3)) || defined (CY_IP_MXS22SRSS)
29 
30 #include "cy_lvd.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 
37 /*******************************************************************************
38 * Function Name: Cy_LVD_DeepSleepCallback
39 ****************************************************************************//**
40 *
41 * When this function is registered by \ref Cy_SysPm_RegisterCallback - it
42 * automatically enables the LVD after wake up from Deep-Sleep mode.
43 *
44 * \param callbackParams The pointer to the callback parameters structure,
45 * see \ref cy_stc_syspm_callback_params_t.
46 *
47 * \param mode
48 * Callback mode, see \ref cy_en_syspm_callback_mode_t
49 *
50 * \return the SysPm callback status \ref cy_en_syspm_status_t.
51 *
52 *******************************************************************************/
Cy_LVD_DeepSleepCallback(cy_stc_syspm_callback_params_t * callbackParams,cy_en_syspm_callback_mode_t mode)53 cy_en_syspm_status_t Cy_LVD_DeepSleepCallback(cy_stc_syspm_callback_params_t * callbackParams, cy_en_syspm_callback_mode_t mode)
54 {
55     cy_en_syspm_status_t ret = CY_SYSPM_SUCCESS;
56 
57     if (callbackParams != NULL)
58     {
59         switch(mode)
60         {
61             case CY_SYSPM_CHECK_READY:
62             case CY_SYSPM_CHECK_FAIL:
63             case CY_SYSPM_BEFORE_TRANSITION:
64                 break;
65 
66             case CY_SYSPM_AFTER_TRANSITION:
67                 Cy_LVD_Enable();
68                 break;
69 
70             default:
71                 ret = CY_SYSPM_FAIL;
72                 break;
73         }
74     }
75     return (ret);
76 }
77 
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif
84 /* [] END OF FILE */
85