1<?xml version="1.0" encoding="utf-8"?>
2
3
4<!--****************************************************************************
5* \file hfclk.cypersonality
6* \version 3.0
7*
8* \brief
9* CLK_HF personality description file. It Supports CAT1A, CAT1B and CAT1C family of devices.
10*
11********************************************************************************
12* \copyright
13* Copyright 2022 Cypress Semiconductor Corporation
14* SPDX-License-Identifier: Apache-2.0
15*
16* Licensed under the Apache License, Version 2.0 (the "License");
17* you may not use this file except in compliance with the License.
18* You may obtain a copy of the License at
19*
20*     http://www.apache.org/licenses/LICENSE-2.0
21*
22* Unless required by applicable law or agreed to in writing, software
23* distributed under the License is distributed on an "AS IS" BASIS,
24* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25* See the License for the specific language governing permissions and
26* limitations under the License.
27*****************************************************************************-->
28
29<Personality id="hfclk" name="CLK_HF" version="3.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v7">
30  <Dependencies>
31    <IpBlock name="mxs40srss,mxs40ssrss,mxs40srss_ver3" />
32    <Resource name="srss\.clock\.hfclk" />
33  </Dependencies>
34  <ExposedMembers>
35    <ExposedMember key="frequency" paramId="frequency" />
36    <ExposedMember key="accuracy"  paramId="accuracy" />
37    <ExposedMember key="error"     paramId="error" />
38  </ExposedMembers>
39  <Parameters>
40    <!-- PDL documentation -->
41    <ParamDoc id="pdlDoc" name="Configuration Help" group="Overview" default="file:///`${cy_libs_path()}`/docs/pdl_api_reference_manual/html/group__group__sysclk__clk__hf.html" linkText="Open High-Frequency Clocks Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />
42
43    <ParamRange id="clockInst" name="clockInst" group="Internal" default="`${getInstNumber(&quot;hfclk&quot;)}`" min="0" max="`${NUM_HFROOT-1}`" resolution="1" visible="false" editable="false" desc="" />
44    <ParamChoice id="sourceClockNumber" name="Source Clock" group="General" default="0" visible="true" editable="true" desc="The clock source for CLK_HF`${clockInst}`">
45      <Entry name="CLK_PATH0"  value="0"  visible="`${NUM_CLKPATH >= 1}`"/>
46      <Entry name="CLK_PATH1"  value="1"  visible="`${NUM_CLKPATH >= 2}`"/>
47      <Entry name="CLK_PATH2"  value="2"  visible="`${NUM_CLKPATH >= 3}`"/>
48      <Entry name="CLK_PATH3"  value="3"  visible="`${NUM_CLKPATH >= 4}`"/>
49      <Entry name="CLK_PATH4"  value="4"  visible="`${NUM_CLKPATH >= 5}`"/>
50      <Entry name="CLK_PATH5"  value="5"  visible="`${NUM_CLKPATH >= 6}`"/>
51      <Entry name="CLK_PATH6"  value="6"  visible="`${NUM_CLKPATH >= 7}`"/>
52      <Entry name="CLK_PATH7"  value="7"  visible="`${NUM_CLKPATH >= 8}`"/>
53      <Entry name="CLK_PATH8"  value="8"  visible="`${NUM_CLKPATH >= 9}`"/>
54      <Entry name="CLK_PATH9"  value="9"  visible="`${NUM_CLKPATH >= 10}`"/>
55      <Entry name="CLK_PATH10" value="10" visible="`${NUM_CLKPATH >= 11}`"/>
56      <Entry name="CLK_PATH11" value="11" visible="`${NUM_CLKPATH >= 12}`"/>
57      <Entry name="CLK_PATH12" value="12" visible="`${NUM_CLKPATH >= 13}`"/>
58      <Entry name="CLK_PATH13" value="13" visible="`${NUM_CLKPATH >= 14}`"/>
59      <Entry name="CLK_PATH14" value="14" visible="`${NUM_CLKPATH >= 15}`"/>
60      <Entry name="CLK_PATH15" value="15" visible="`${NUM_CLKPATH >= 16}`"/>
61    </ParamChoice>
62
63    <!-- If the FLL/PLL are enabled, their output drive the corresponding clock path -->
64
65    <ParamBool id="isFllUsed" name="Is FLL Used" group="Internal" default="`${(sourceClockNumber eq 0) &amp;&amp; isBlockUsed(&quot;srss[0].clock[0].fll[0]&quot;)}`" visible="false" editable="false" desc="" />
66
67    <ParamBool id="isPll400mUsed" name="Is PLL-400MHz Used" group="Internal" default="`${((&quot;mxs40srss_ver3&quot; eq getIpBlockName())) &amp;&amp; ((sourceClockNumber &gt; 0) &amp;&amp; (sourceClockNumber &lt;= NUM_PLL400M) &amp;&amp; isBlockUsed(&quot;srss[0].clock[0].pll400m[&quot; . (sourceClockNumber-1) . &quot;]&quot;))}`" visible="false" editable="false" desc="" />
68
69    <ParamBool id="isPllUsed" name="Is PLL Used" group="Internal" default="`${ (&quot;mxs40ssrss&quot; eq getIpBlockName()) ? 0 : ((&quot;mxs40srss&quot; eq getIpBlockName()) ? (sourceClockNumber &gt; 0) &amp;&amp; (sourceClockNumber &lt;= NUM_PLL) &amp;&amp; isBlockUsed(&quot;srss[0].clock[0].pll[&quot; . (sourceClockNumber-1) . &quot;]&quot;) : (sourceClockNumber &gt; NUM_PLL) &amp;&amp; (sourceClockNumber &lt;= (NUM_PLL + NUM_PLL400M)) &amp;&amp; isBlockUsed(&quot;srss[0].clock[0].pll[&quot; . (sourceClockNumber-3) . &quot;]&quot;)) }`" visible="false" editable="false" desc="" />
70
71    <ParamBool id="isPll250mUsed" name="Is PLL-250MHz Used" group="Internal" default="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? ((sourceClockNumber ne 0 &amp;&amp; sourceClockNumber &lt;= NUM_DPLL250) &amp;&amp; isBlockUsed(&quot;srss[0].clock[0].pll250m[&quot; . (sourceClockNumber - 1 ) . &quot;]&quot;)) : false) : false}`" visible="false" editable="false" desc="" />
72
73    <ParamString id="sourceClock" name="Source clock resource" group="Internal" default="`${isFllUsed ? &quot;fll[0]&quot; :
74                                                                                            isPll400mUsed ? &quot;pll400m[&quot; . (sourceClockNumber-1) . &quot;]&quot; :
75                                                                                            isPllUsed &amp;&amp; (&quot;mxs40srss&quot; eq getIpBlockName()) ? &quot;pll[&quot; . (sourceClockNumber-1) . &quot;]&quot; :
76                                                                                            isPll250mUsed &amp;&amp; (&quot;mxs40ssrss&quot; eq getIpBlockName()) ? &quot;pll[&quot; . (sourceClockNumber-1) . &quot;]&quot; :
77                                                                                            isPllUsed &amp;&amp; (&quot;mxs40srss_ver3&quot; eq getIpBlockName()) ? &quot;pll[&quot; . (sourceClockNumber-(NUM_PLL+1)) . &quot;]&quot; :
78                                                                                                        &quot;pathmux[&quot; . sourceClockNumber . &quot;]&quot;}`" visible="false" editable="false" desc="" />
79
80    <ParamString id="sourceClockRsc" name="Source Clock" group="Internal" default="srss[0].clock[0].`${sourceClock}`" visible="false" editable="false" desc="" />
81
82    <!-- Set an error if the source clock is not enabled or contains an error -->
83    <ParamBool id="srcNotUsed" name="Clock Source Enabled" group="Internal" default="`${!isBlockUsed(sourceClockRsc)}`" visible="false" editable="false" desc="" />
84    <ParamBool id="error" name="Clock Error" group="Internal" default="`${srcNotUsed || getExposedMember(sourceClockRsc, &quot;error&quot;)}`" visible="false" editable="false" desc="" />
85    <ParamRange id="sourceFreq" name="sourceFrequency" group="Internal" default="`${!error ? getExposedMember(sourceClockRsc, &quot;frequency&quot;) : 0}`" min="0" max="400000000" resolution="0.001" visible="false" editable="false" desc="" />
86    <ParamString id="accuracy" name="accuracy" group="Internal" default="`${!error ? getExposedMember(sourceClockRsc, &quot;accuracy&quot;) : 0}`" visible="false" editable="false" desc="" />
87    <ParamString id="sourceFrequencyInfo" name="Source Frequency" group="General" default="`${formatFrequency(sourceFreq,accuracy)}`" visible="true" editable="false" desc="Source clock frequency" />
88
89
90    <ParamChoice id="divider" name="Divider" group="General" default="1" visible="true" editable="true" desc="The source clock frequency divider">
91      <Entry name="1" value="1" visible="true"/>
92      <Entry name="2" value="2" visible="true"/>
93      <Entry name="3" value="3" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
94      <Entry name="4" value="4" visible="true"/>
95      <Entry name="5" value="5" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
96      <Entry name="6" value="6" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
97      <Entry name="7" value="7" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
98      <Entry name="8" value="8" visible="true"/>
99      <Entry name="9" value="9" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
100      <Entry name="10" value="10" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
101      <Entry name="11" value="11" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
102      <Entry name="12" value="12" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
103      <Entry name="13" value="13" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
104      <Entry name="14" value="14" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
105      <Entry name="15" value="15" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
106      <Entry name="16" value="16" visible="`${(&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (NUM_TOTAL_PLL ne 0 ? true : false) : false}`"/>
107    </ParamChoice>
108    <ParamRange id="frequency" name="Frequency" group="Internal" default="`${sourceFreq / divider}`" min="0" max="400000000" resolution="1" visible="false" editable="false" desc="" />
109    <!-- If the frequency is less than one MHz, display its value in kHz -->
110    <ParamString id="frequencyInfo" name="Frequency" group="General" default="`${formatFrequency(frequency,accuracy)}`" visible="true" editable="false" desc="The resulting CLK_HF`${clockInst}` output clock frequency" />
111    <ParamSignal port="root_clk[0]" name="Clock Output" group="General" visible="`${hasVisibleOption(&quot;root_clk[0]&quot;)}`" desc="A high-frequency clock output driving specific peripherals" canBeEmpty="true" >
112      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
113        <Parameter id="DriveModes" severity="DEFAULT" reason="">
114          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
115        </Parameter>
116      </Constraint>
117      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
118        <Parameter id="DriveModes" severity="WARNING" reason="">
119          <Choice>
120            <Option value="CY_GPIO_DM_STRONG_IN_OFF"/>
121            <Option value="CY_GPIO_DM_STRONG"/>
122            <Option value="CY_GPIO_DM_OD_DRIVESLOW_IN_OFF"/>
123            <Option value="CY_GPIO_DM_OD_DRIVESHIGH_IN_OFF"/>
124            <Option value="CY_GPIO_DM_OD_DRIVESLOW"/>
125            <Option value="CY_GPIO_DM_OD_DRIVESHIGH"/>
126            <Option value="CY_GPIO_DM_PULLUP_IN_OFF"/>
127            <Option value="CY_GPIO_DM_PULLDOWN_IN_OFF"/>
128            <Option value="CY_GPIO_DM_PULLUP_DOWN_IN_OFF"/>
129            <Option value="CY_GPIO_DM_PULLUP"/>
130            <Option value="CY_GPIO_DM_PULLDOWN"/>
131            <Option value="CY_GPIO_DM_PULLUP_DOWN"/>
132          </Choice>
133        </Parameter>
134      </Constraint>
135      <!--Constraint type="REQUIRE" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
136        <Parameter id="DriveModes" severity="ERROR" reason="">
137          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
138        </Parameter>
139      </Constraint-->
140      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
141    </ParamSignal>
142  </Parameters>
143  <DRCs>
144    <DRC type="ERROR" text="Source clock for CLK_HF`${clockInst}` is not enabled" condition="`${srcNotUsed}`" >
145      <FixIt action="ENABLE_BLOCK" target="`${sourceClockRsc}`" value="" valid="true" />
146    </DRC>
147    <DRC type="ERROR" text="CLK_HF0 is slower than legal min 200 kHz." condition="`${!error &amp;&amp; ((clockInst == 0) &amp;&amp; (sourceFreq &lt; 200000))}`" />
148    <DRC type="INFO" text="The top-level System Clocks must be enabled to generate the clock initialization code" condition="`${!isBlockUsed(&quot;srss[0].clock[0]&quot;) &amp;&amp; clockInst == 0}`" location="srss[0].clock[0]" >
149      <FixIt action="ENABLE_BLOCK" target="srss[0].clock[0]" value="" valid="true" />
150    </DRC>
151    <!-- Generate a DRC from HFCLK0 that prevents IMO from being disabled -->
152    <DRC type="ERROR" text="The IMO cannot be disabled." condition="`${(clockInst eq 0) &amp;&amp; !isBlockUsed(&quot;srss[0].clock[0].imo[0]&quot;)}`" location="srss[0].clock[0]">
153      <FixIt action="ENABLE_BLOCK" target="srss[0].clock[0].imo[0]" value="" valid="true" />
154    </DRC>
155	<DRC type="ERROR" text="CLK_HF2 should be equal to 48MHz." condition="`${((clockInst == 2) &amp;&amp; (frequency ne 48000000) &amp;&amp; (&quot;mxs40ssrss&quot; eq getIpBlockName()) &amp;&amp; NUM_TOTAL_PLL eq 0)}`" />
156	<DRC type="ERROR" text="CLK_HF3 should be less than 24MHz." condition="`${((clockInst == 3) &amp;&amp; (frequency &gt; 24000000) &amp;&amp; (&quot;mxs40ssrss&quot; eq getIpBlockName()))}`" />
157    <!--DRC type="ERROR" text="Only one connection between the clock system and GPIO pins is possible, either EXTCLK or CLK_HF4." condition="`${hasConnection(&quot;root_clk&quot;, 0) &amp;&amp; isBlockUsed(&quot;srss[0].clock[0].ext[0]&quot;)}`" /-->
158  </DRCs>
159  <ConfigFirmware>
160    <ConfigInclude value="cy_sysclk.h" include="true" />
161    <ConfigDefine name="CY_CFG_SYSCLK_CLKHF`${clockInst}`_ENABLED" public="false" value="1" include="true" />
162    <ConfigDefine name="CY_CFG_SYSCLK_CLKHF`${clockInst}`_DIVIDER" public="false" value="CY_SYSCLK_CLKHF_`${divider == 1 ? &quot;NO_DIVIDE&quot; : ((&quot;DIVIDE_BY_&quot;) . divider)}`" include="true" />
163    <ConfigDefine name="CY_CFG_SYSCLK_CLKHF`${clockInst}`" public="true" value="`${clockInst}`UL" include="true" />
164    <ConfigDefine name="CY_CFG_SYSCLK_CLKHF`${clockInst}`_FREQ_MHZ" public="false" value="`${frequency / 1000000}`UL" include="true" />
165    <ConfigDefine name="CY_CFG_SYSCLK_CLKHF`${clockInst}`_CLKPATH" public="false" value="CY_SYSCLK_CLKHF_IN_CLKPATH`${sourceClockNumber}`" include="true" />
166    <ConfigDefine name="CY_CFG_SYSCLK_CLKHF`${clockInst}`_CLKPATH_NUM" public="true" value="`${sourceClockNumber}`UL" include="true" />
167
168    <ConfigFunction signature="__STATIC_INLINE void Cy_SysClk_ClkHf`${clockInst}`Init()" body="    Cy_SysClk_ClkHfSetSource(`${clockInst}`U, CY_CFG_SYSCLK_CLKHF`${clockInst}`_CLKPATH);&#xA;    Cy_SysClk_ClkHfSetDivider(`${clockInst}`U, CY_SYSCLK_CLKHF_`${divider == 1 ? &quot;NO_DIVIDE&quot; : ((&quot;DIVIDE_BY_&quot;) . divider)}`);&#xA;    Cy_SysClk_ClkHfDirectSel(CY_CFG_SYSCLK_CLKHF`${clockInst}`, false);" public="false" include="`${(&quot;mxs40srss_ver3&quot; eq getIpBlockName()) &amp;&amp; (clockInst eq 0)}`"  />
169
170    <ConfigFunction signature="__STATIC_INLINE void Cy_SysClk_ClkHf`${clockInst}`Init()" body="    Cy_SysClk_ClkHfSetSource(CY_CFG_SYSCLK_CLKHF`${clockInst}`, CY_CFG_SYSCLK_CLKHF`${clockInst}`_CLKPATH);&#xA;    Cy_SysClk_ClkHfSetDivider(CY_CFG_SYSCLK_CLKHF`${clockInst}`, CY_SYSCLK_CLKHF_`${divider == 1 ? &quot;NO_DIVIDE&quot; : ((&quot;DIVIDE_BY_&quot;) . divider)}`);&#xA;    Cy_SysClk_ClkHfDirectSel(CY_CFG_SYSCLK_CLKHF`${clockInst}`, false);&#xA;    Cy_SysClk_ClkHfEnable(CY_CFG_SYSCLK_CLKHF`${clockInst}`);" public="false" include="`${(&quot;mxs40srss_ver3&quot; eq getIpBlockName()) &amp;&amp; (clockInst gt 0)}`"  />
171
172    <ConfigFunction signature="__STATIC_INLINE void Cy_SysClk_ClkHf`${clockInst}`Init()" body="    Cy_SysClk_ClkHfSetSource(`${clockInst}`U, CY_CFG_SYSCLK_CLKHF`${clockInst}`_CLKPATH);&#xA;    Cy_SysClk_ClkHfSetDivider(`${clockInst}`U, CY_SYSCLK_CLKHF_`${divider == 1 ? &quot;NO_DIVIDE&quot; : ((&quot;DIVIDE_BY_&quot;) . divider)}`);" public="false" include="`${(&quot;mxs40srss_ver3&quot; ne getIpBlockName()) &amp;&amp; (clockInst eq 0)}`" guard="(!defined(CY_DEVICE_SECURE))"/>
173
174    <ConfigFunction signature="__STATIC_INLINE void Cy_SysClk_ClkHf`${clockInst}`Init()" body="    Cy_SysClk_ClkHfSetSource(CY_CFG_SYSCLK_CLKHF`${clockInst}`, CY_CFG_SYSCLK_CLKHF`${clockInst}`_CLKPATH);&#xA;    Cy_SysClk_ClkHfSetDivider(CY_CFG_SYSCLK_CLKHF`${clockInst}`, CY_SYSCLK_CLKHF_`${divider == 1 ? &quot;NO_DIVIDE&quot; : ((&quot;DIVIDE_BY_&quot;) . divider)}`);&#xA;    Cy_SysClk_ClkHfEnable(CY_CFG_SYSCLK_CLKHF`${clockInst}`);" public="false" include="`${(&quot;mxs40srss_ver3&quot; ne getIpBlockName()) &amp;&amp; (clockInst gt 0)}`" guard="(!defined(CY_DEVICE_SECURE))"/>
175
176  </ConfigFirmware>
177</Personality>
178