1 /***************************************************************************//**
2 * \file cy_syspm_pdcm.h
3 * \version 5.92
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>1.0</td>
47 *     <td>Initial version</td>
48 *     <td></td>
49 *   </tr>
50 * </table>
51 *
52 * \defgroup group_syspm_pdcm_macros Macros
53 * \defgroup group_syspm_pdcm_functions Functions
54 * \defgroup group_syspm_pdcm_data_structures Data Structures
55 * \defgroup group_syspm_pdcm_enums Enumerated Types
56 */
57 /** \} group_syspm_pdcm */
58 
59 #ifndef CY_PD_PDCM_H
60 #define CY_PD_PDCM_H
61 
62 #include "cy_device.h"
63 
64 #if defined (CY_IP_MXS40SSRSS) || defined (CY_IP_MXS22SRSS)
65 
66 #include <stdint.h>
67 #include "cy_syslib.h"
68 #include "cy_syspm.h"
69 
70 /*******************************************************************************
71 *       Enumerated Types
72 *******************************************************************************/
73 
74 /**
75 * \addtogroup group_syspm_pdcm_enums
76 * \{
77 */
78 
79 /** Defines ID's for each of the PDCM's */
80 #if defined (CY_IP_MXS22SRSS)
81 typedef enum
82 {
83     CY_PD_PDCM_MAIN      = 0x00UL, /**< For MAIN/PD0 Power domain */
84     CY_PD_PDCM_PD1       = 0x01UL, /**< For PD1 Power domain */
85     CY_PD_PDCM_SRAM0     = 0x02UL, /**< For SRAM0 Power domain */
86     CY_PD_PDCM_SRAM1     = 0x03UL, /**< For SRAM1 Power domain */
87     CY_PD_PDCM_SYSCPU    = 0x04UL, /**< For SYSCPU Power domain */
88     CY_PD_PDCM_APPSS     = 0x05UL, /**< For APPSS Power domain */
89     CY_PD_PDCM_APPCPU    = 0x06UL, /**< For APPCPU Power domain */
90     CY_PD_PDCM_SOCMEM    = 0x07UL, /**< For SOCMEM Power domain */
91     CY_PD_PDCM_U55       = 0x08UL, /**< For U55 Power domain */
92 } cy_pd_pdcm_id_t;
93 #else
94 typedef enum
95 {
96     CY_PD_PDCM_MAIN      = 0x00UL, /**< For MAIN Power domain */
97     CY_PD_PDCM_CPUSS     = 0x01UL, /**< For CPUSS Power domain */
98     CY_PD_PDCM_SRAM      = 0x02UL, /**< For SRAM Power domain */
99     CY_PD_PDCM_BTSS      = 0x03UL, /**< For BTSS Power domain */
100 } cy_pd_pdcm_id_t;
101 #endif
102 /** Defines Dependency Matrix for PD's */
103 typedef enum
104 {
105     CY_PD_PDCM_DEP_NONE         = 0x00UL, /**< No Direct Dependency */
106     CY_PD_PDCM_DEP_DIRECT       = 0x01UL, /**< Direct Dependency */
107     CY_PD_PDCM_DEP_CONFIG       = 0x02UL, /**< Configurable Dependency */
108 } cy_pd_pdcm_dep_t;
109 
110 /** \} group_syspm_pdcm_enums */
111 
112 /**
113 * \addtogroup group_syspm_pdcm_macros
114 * \{
115 */
116 
117 /** Driver major version */
118 #define CY_PD_PDCM_DRV_VERSION_MAJOR       5
119 /** Driver minor version */
120 #define CY_PD_PDCM_DRV_VERSION_MINOR       91
121 
122 /** 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 */
123 #if defined (CY_IP_MXS22SRSS)
124 #define CY_SYSPM_IS_PDCM_ID_VALID(id)    (((id) == CY_PD_PDCM_MAIN)     || \
125                                            ((id) == CY_PD_PDCM_PD1)   || \
126                                            ((id) == CY_PD_PDCM_SRAM0)   || \
127                                            ((id) == CY_PD_PDCM_SRAM1)   || \
128                                            ((id) == CY_PD_PDCM_SYSCPU)   || \
129                                            ((id) == CY_PD_PDCM_APPSS)   || \
130                                            ((id) == CY_PD_PDCM_APPCPU)   || \
131                                            ((id) == CY_PD_PDCM_SOCMEM)   || \
132                                            ((id) == CY_PD_PDCM_U55))
133 #else
134 #define CY_SYSPM_IS_PDCM_ID_VALID(id)    (((id) == CY_PD_PDCM_MAIN)     || \
135                                            ((id) == CY_PD_PDCM_SRAM)   || \
136                                            ((id) == CY_PD_PDCM_CPUSS)   || \
137                                            ((id) == CY_PD_PDCM_BTSS))
138 
139 #endif
140 /** \} group_syspm_pdcm_macros */
141 
142 /**
143 * \addtogroup group_syspm_pdcm_functions
144 * \{
145 */
146 cy_pd_pdcm_dep_t cy_pd_pdcm_get_dependency(cy_pd_pdcm_id_t host_pd,cy_pd_pdcm_id_t dest_pd);
147 cy_en_syspm_status_t cy_pd_pdcm_set_dependency(cy_pd_pdcm_id_t host_pd,cy_pd_pdcm_id_t dest_pd);
148 cy_en_syspm_status_t cy_pd_pdcm_clear_dependency(cy_pd_pdcm_id_t host_pd,cy_pd_pdcm_id_t dest_pd);
149 /** \} group_syspm_pdcm_functions */
150 
151 #endif /* CY_IP_MXS40SSRSS */
152 
153 #endif /* CY_PD_PDCM_H */
154