1 /***************************************************************************//**
2 * \file cy_syspm_pdcm.h
3 * \version 5.150
4 *
5 * This file provides the header for PDCM driver, where the APIs are used
6 * by Syspm driver and BTSS driver.
7 *
8 ********************************************************************************
9 * \copyright
10 * Copyright 2016-2020 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_pdcm             PDCM (Power Dependency Control Matrix)
28 * \{
29 * PDCM driver provides APIs for controlling the Power Dependency Control Matrix
30 * across Power Domains
31 *
32 * The functions and other declarations used in this driver are in cy_syspm_pdcm.h.
33 *
34 * \section group_syspm_pdcm_more_information More Information
35 *
36 * For more information on the PDCM, refer to
37 * the technical reference manual (TRM).
38 *
39 * \section group_syspm_pdcm_MISRA MISRA-C Compliance
40 * The PDCM driver does not have any specific deviations.
41 *
42 * \section group_syspm_pdcm_changelog Changelog
43 * <table class="doxtable">
44 *   <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr>
45 *   <tr>
46 *     <td>5.150</td>
47 *     <td>Version updated to match SYSPM driver.</td>
48 *     <td></td>
49 *   </tr>
50 *   <tr>
51 *     <td>1.0</td>
52 *     <td>Initial version</td>
53 *     <td></td>
54 *   </tr>
55 * </table>
56 *
57 * \defgroup group_syspm_pdcm_macros Macros
58 * \defgroup group_syspm_pdcm_functions Functions
59 * \defgroup group_syspm_pdcm_data_structures Data Structures
60 * \defgroup group_syspm_pdcm_enums Enumerated Types
61 */
62 /** \} group_syspm_pdcm */
63 
64 #ifndef CY_PD_PDCM_H
65 #define CY_PD_PDCM_H
66 
67 #include "cy_device.h"
68 
69 #if defined (CY_IP_MXS40SSRSS) || defined (CY_IP_MXS22SRSS)
70 
71 #include <stdint.h>
72 #include "cy_syslib.h"
73 #include "cy_syspm.h"
74 
75 /*******************************************************************************
76 *       Enumerated Types
77 *******************************************************************************/
78 
79 /**
80 * \addtogroup group_syspm_pdcm_enums
81 * \{
82 */
83 
84 /** Defines ID's for each of the PDCM's */
85 #if defined (CY_IP_MXS22SRSS)
86 typedef enum
87 {
88     CY_PD_PDCM_MAIN      = 0x00UL, /**< For MAIN/PD0 Power domain */
89     CY_PD_PDCM_PD1       = 0x01UL, /**< For PD1 Power domain */
90     CY_PD_PDCM_SRAM0     = 0x02UL, /**< For SRAM0 Power domain */
91     CY_PD_PDCM_SRAM1     = 0x03UL, /**< For SRAM1 Power domain */
92     CY_PD_PDCM_SYSCPU    = 0x04UL, /**< For SYSCPU Power domain */
93     CY_PD_PDCM_APPCPUSS  = 0x05UL, /**< For APPCPUSS Power domain */
94     CY_PD_PDCM_APPCPU    = 0x06UL, /**< For APPCPU Power domain */
95     CY_PD_PDCM_SOCMEM    = 0x07UL, /**< For SOCMEM Power domain */
96     CY_PD_PDCM_U55       = 0x08UL, /**< For U55 Power domain */
97 } cy_pd_pdcm_id_t;
98 #else
99 typedef enum
100 {
101     CY_PD_PDCM_MAIN      = 0x00UL, /**< For MAIN Power domain */
102     CY_PD_PDCM_CPUSS     = 0x01UL, /**< For CPUSS Power domain */
103     CY_PD_PDCM_SRAM      = 0x02UL, /**< For SRAM Power domain */
104     CY_PD_PDCM_BTSS      = 0x03UL, /**< For BTSS Power domain */
105 } cy_pd_pdcm_id_t;
106 #endif
107 /** Defines Dependency Matrix for PD's */
108 typedef enum
109 {
110     CY_PD_PDCM_DEP_NONE         = 0x00UL, /**< No Direct Dependency */
111     CY_PD_PDCM_DEP_DIRECT       = 0x01UL, /**< Direct Dependency */
112     CY_PD_PDCM_DEP_CONFIG       = 0x02UL, /**< Configurable Dependency */
113 } cy_pd_pdcm_dep_t;
114 
115 /** \} group_syspm_pdcm_enums */
116 
117 /**
118 * \addtogroup group_syspm_pdcm_macros
119 * \{
120 */
121 
122 /** Driver major version */
123 #define CY_PD_PDCM_DRV_VERSION_MAJOR       5
124 /** Driver minor version */
125 #define CY_PD_PDCM_DRV_VERSION_MINOR       150
126 
127 /** Macro to validate the PDCM PPU ID in API's : /ref cy_pd_pdcm_get_dependency, /ref cy_pd_pdcm_set_dependency() and /ref cy_pd_pdcm_clear_dependency */
128 #if defined (CY_IP_MXS22SRSS)
129 #define CY_SYSPM_IS_PDCM_ID_VALID(id)    (((id) == CY_PD_PDCM_MAIN)      || \
130                                            ((id) == CY_PD_PDCM_PD1)      || \
131                                            ((id) == CY_PD_PDCM_SRAM0)    || \
132                                            ((id) == CY_PD_PDCM_SRAM1)    || \
133                                            ((id) == CY_PD_PDCM_SYSCPU)   || \
134                                            ((id) == CY_PD_PDCM_APPCPUSS) || \
135                                            ((id) == CY_PD_PDCM_APPCPU)   || \
136                                            ((id) == CY_PD_PDCM_SOCMEM)   || \
137                                            ((id) == CY_PD_PDCM_U55))
138 #else
139 #define CY_SYSPM_IS_PDCM_ID_VALID(id)    (((id) == CY_PD_PDCM_MAIN)      || \
140                                            ((id) == CY_PD_PDCM_SRAM)     || \
141                                            ((id) == CY_PD_PDCM_CPUSS)    || \
142                                            ((id) == CY_PD_PDCM_BTSS))
143 
144 #endif
145 /** \} group_syspm_pdcm_macros */
146 
147 /**
148 * \addtogroup group_syspm_pdcm_functions
149 * \{
150 */
151 cy_pd_pdcm_dep_t cy_pd_pdcm_get_dependency(cy_pd_pdcm_id_t host_pd,cy_pd_pdcm_id_t dest_pd);
152 cy_en_syspm_status_t cy_pd_pdcm_set_dependency(cy_pd_pdcm_id_t host_pd,cy_pd_pdcm_id_t dest_pd);
153 cy_en_syspm_status_t cy_pd_pdcm_clear_dependency(cy_pd_pdcm_id_t host_pd,cy_pd_pdcm_id_t dest_pd);
154 /** \} group_syspm_pdcm_functions */
155 
156 #endif /* CY_IP_MXS40SSRSS */
157 
158 #endif /* CY_PD_PDCM_H */
159