1 /***************************************************************************//**
2 * \file cy_syspm_ppu.h
3 * \version 5.150
4 *
5 * This file provides header for ARM PPU Power Domain Platform Dependant
6 * specific driver.
7 *
8 ********************************************************************************
9 * \copyright
10 * Copyright 2016-2021 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 /**
27 * \addtogroup group_syspm_ppu              PPU (Power Policy Unit)
28 * \{
29 * Power Domain PPU driver is a platform dependent driver on top of ARM PPU Driver
30 *
31 * The functions and other declarations used in this driver are in cy_syspm_ppu.h.
32 *
33 * \note  PD PPU API's are used by the Syspm driver and BTSS API's, there is no
34 * need to call them directly in Application code.
35 *
36 * You can use this driver to implement the platform dependent code to
37 * control power domain using PPU.
38 *
39 * \section group_syspm_ppu_more_information More Information
40 *
41 * For more information on the PD PPU, refer to
42 * the technical reference manual (TRM).
43 *
44 * \section group_syspm_ppu_MISRA MISRA-C Compliance
45 * The PD PPU driver does not has any specific deviations.
46 *
47 * \section group_syspm_ppu_changelog Changelog
48 * <table class="doxtable">
49 *   <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr>
50 *   <tr>
51 *     <td>5.150</td>
52 *     <td>Version updated to match SYSPM driver.</td>
53 *     <td></td>
54 *   </tr>
55 *   <tr>
56 *     <td>1.0</td>
57 *     <td>Initial version</td>
58 *     <td></td>
59 *   </tr>
60 * </table>
61 *
62 * \defgroup group_syspm_ppu_macros Macros
63 * \defgroup group_syspm_ppu_functions Functions
64 * \defgroup group_syspm_ppu_data_structures Data Structures
65 * \defgroup group_syspm_ppu_enums Enumerated Types
66 */
67 
68 
69 #ifndef CY_PD_PPU_H
70 #define CY_PD_PPU_H
71 
72 #include "cy_device.h"
73 
74 #if defined (CY_IP_MXS28SRSS) || defined (CY_IP_MXS40SSRSS) || defined (CY_IP_MXS22SRSS)
75 
76 #include <stdint.h>
77 #include "ppu_v1.h"
78 #include "cy_syspm.h"
79 
80 
81 /**
82 * \addtogroup group_syspm_ppu_macros
83 * \{
84 */
85 
86 /** Driver major version */
87 #define CY_PD_PPU_DRV_VERSION_MAJOR       5
88 /** Driver minor version */
89 #define CY_PD_PPU_DRV_VERSION_MINOR       150
90 
91 /** PPU Device Sleep Deny Status Mask */
92 #define CY_PD_PPU_DEVDENY_STATUS_MASK    (0x00000001U)
93 
94 /** \} group_syspm_ppu_macros */
95 
96 /**
97 * \addtogroup group_syspm_ppu_enums
98 * \{
99 */
100 
101 /** Defines the Device interface channels for all the PPU's */
102 typedef enum
103 {
104     CY_PD_PPU_DEVICE_0            = (CY_PD_PPU_DEVDENY_STATUS_MASK),         /**< Device 0 */
105     CY_PD_PPU_DEVICE_1            = (CY_PD_PPU_DEVDENY_STATUS_MASK << 0x1),  /**< Device 1 */
106     CY_PD_PPU_DEVICE_2            = (CY_PD_PPU_DEVDENY_STATUS_MASK << 0x2),  /**< Device 2 */
107     CY_PD_PPU_DEVICE_3            = (CY_PD_PPU_DEVDENY_STATUS_MASK << 0x3),  /**< Device 3 */
108     CY_PD_PPU_DEVICE_4            = (CY_PD_PPU_DEVDENY_STATUS_MASK << 0x4),  /**< Device 4 */
109     CY_PD_PPU_DEVICE_5            = (CY_PD_PPU_DEVDENY_STATUS_MASK << 0x5),  /**< Device 5 */
110     CY_PD_PPU_DEVICE_6            = (CY_PD_PPU_DEVDENY_STATUS_MASK << 0x6),  /**< Device 6 */
111     CY_PD_PPU_DEVICE_7            = (CY_PD_PPU_DEVDENY_STATUS_MASK << 0x7),  /**< Device 7 */
112 } cy_pd_ppu_device_status_t;
113 
114 /** \} group_syspm_ppu_enums */
115 
116 /**
117 * \addtogroup group_syspm_ppu_functions
118 * \{
119 */
120 cy_en_syspm_status_t cy_pd_ppu_init(struct ppu_v1_reg *ppu);
121 enum ppu_v1_mode cy_pd_ppu_get_power_mode(struct ppu_v1_reg *ppu);
122 enum ppu_v1_mode cy_pd_ppu_get_programmed_power_mode(struct ppu_v1_reg *ppu);
123 cy_en_syspm_status_t cy_pd_ppu_set_power_mode(struct ppu_v1_reg *ppu, uint32_t mode);
124 cy_en_syspm_status_t cy_pd_ppu_set_static_power_mode(struct ppu_v1_reg *ppu, uint32_t mode);
125 cy_en_syspm_status_t cy_pd_ppu_reset(struct ppu_v1_reg *ppu);
126 cy_pd_ppu_device_status_t cy_pd_ppu_get_ds_fail_device(struct ppu_v1_reg *ppu);
127 void cy_pd_ppu_enable_dynamic_mode(struct ppu_v1_reg *ppu, bool enable);
128 
129 /** \} group_syspm_ppu_functions */
130 
131 #endif /* CY_IP_MXS28SRSS, CY_IP_MXS40SSRSS, CY_IP_MXS22SRSS */
132 
133 #endif /* CY_PD_PPU_H */
134 
135 /** \} group_syspm_ppu */
136 
137 
138 /* [] END OF FILE */
139