1<?xml version="1.0" encoding="utf-8"?>
2
3
4<!--****************************************************************************
5* \file eco.cypersonality
6* \version 3.0
7*
8* \brief
9* ECO personality description file. It supports CAT1A, CAT1B and CAT1C devices.
10*
11********************************************************************************
12* \copyright
13* Copyright (c) 2022, Cypress Semiconductor Corporation (an Infineon company) or
14* an affiliate of Cypress Semiconductor Corporation.
15* SPDX-License-Identifier: Apache-2.0
16*
17* Licensed under the Apache License, Version 2.0 (the "License");
18* you may not use this file except in compliance with the License.
19* You may obtain a copy of the License at
20*
21*     http://www.apache.org/licenses/LICENSE-2.0
22*
23* Unless required by applicable law or agreed to in writing, software
24* distributed under the License is distributed on an "AS IS" BASIS,
25* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26* See the License for the specific language governing permissions and
27* limitations under the License.
28*****************************************************************************-->
29
30<Personality id="eco" name="ECO" version="3.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v7">
31  <Dependencies>
32    <IpBlock name="mxs40srss,mxs40srss_ver2,mxs40srss_ver3,mxs40ssrss" />
33    <IpBlock name="mxs40ioss,mxs40sioss" />
34    <Resource name="srss\.clock\.eco" />
35  </Dependencies>
36  <ExposedMembers>
37    <ExposedMember key="frequency" paramId="frequency" />
38    <ExposedMember key="accuracy"  paramId="accuracyPct" />
39    <ExposedMember key="suppressCodeGen" paramId="suppressWcoCodeGen" />
40  </ExposedMembers>
41  <Parameters>
42    <!-- PDL documentation -->
43    <ParamDoc id="pdlDoc" name="Configuration Help" group="Overview" default="file:///`${cy_libs_path()}`/docs/pdl_api_reference_manual/html/group__group__sysclk__eco.html" linkText="Open ECO Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />
44
45    <ParamBool
46      id="is40srss_ver2or3Available" name="is40srss_ver2or3Available" group=""
47      default="`${((&quot;mxs40srss_ver2&quot; eq getIpBlockName()) || (&quot;mxs40srss_ver3&quot; eq getIpBlockName()))}`"
48      visible="false" editable="false" desc="" />
49
50    <ParamRange id="ecoFrequency" name="Frequency (MHz)" group="General" default="24.0000" visible="true" editable="true" min="`${((is40srss_ver2or3Available) ? 8 : 16)}`" max="`${((is40srss_ver2or3Available) ? 33.34 : 35)}`" resolution="0.0001" desc="" />
51    <ParamRange id="frequency" name="Frequency (Hz)" group="Internal" default="`${ecoFrequency * 1000000}`" visible="false" editable="false" min="16000000" max="35000000" resolution="1" desc="" />
52
53    <ParamRange id="accuracyPpm" name="Accuracy (&#177;ppm)" group="General" default="0" min="0" max="1000000" resolution="1" visible="true" editable="true" desc="Clock accuracy in ppm" />
54    <ParamString id="accuracyPct" name="Accuracy (&#177;%)" group="General" default="`${accuracyPpm/10000.0}`" visible="true" editable="false" desc="Clock accuracy in %" />
55
56    <ParamRange id="driveLevel" name="Drive Level (uW)" group="General" default="100" min="1" max="1000" resolution="1" visible="true" editable="true" desc="" />
57    <ParamRange id="esr" name="Equivalent Series Resistance ESR (ohm)" group="General" default="50" min="1" max="1000" resolution="1" visible="true" editable="true" desc="" />
58    <ParamRange id="c0" name="Crystal Shunt Capacitance C0 (pF)" group="General" default="0" min="0" max="100" resolution="1" visible="true" editable="true" desc="" />
59    <ParamRange id="cLoad" name="Parallel Load Capacitance Cload (pF)" group="General" default="18" min="1" max="100" resolution="1" visible="true" editable="true" desc="" />
60    <ParamRange id="csum" name="summary capacitance" group="General" default="`${c0 + cLoad}`" min="1" max="200" resolution="1" visible="false" editable="false" desc="" />
61
62    <ParamBool id="debug" name="debug" group="General" default="false" visible="false" editable="false" desc="" />
63
64    <ParamRange id="maxAmpl" name="Max Ampl" group="General" default="`${sqrt(driveLevel / (2.0 * esr)) * 1000 / (3.14 * ecoFrequency * csum)}`" min="0" max="100000" resolution="0.001" visible="`${debug}`" editable="false" desc="" />
65    <ParamRange id="maxAmplpp" name="Max Ampl Vpp" group="General" default="`${2 * maxAmpl}`" min="0" max="100000" resolution="0.001" visible="`${debug}`" editable="false" desc="" />
66    <ParamRange id="gmMin" name="GM Min" group="General" default="`${(5 * 4 * 3.14 * 3.14 * ecoFrequency * ecoFrequency * csum * csum * 4 * esr) / 1000000000}`" min="0" max="100000" resolution="0.001" visible="`${debug}`" editable="false" desc="" />
67    <ParamRange id="amplSect" name="ampl sections" group="General" default="`${floor(gmMin / 9)}`" visible="`${debug}`" editable="false" min="0" max="100000" resolution="1" desc="" />
68
69    <ParamBool id="errorMxs40srss" name="error" group="General" default="`${maxAmplpp &lt; 1.3 || amplSect &gt; 3}`" visible="false" editable="false" desc="" />
70    <ParamBool id="errorMxs40srss_ver2or3Mxs22srss" name="error" group="General" default="`${maxAmplpp &lt; 0.3 || amplSect &gt; 3}`" visible="false" editable="false" desc="" />
71    <ParamBool id="error" name="error" group="General" default="`${((&quot;mxs40srss&quot; eq getIpBlockName()) ? (errorMxs40srss) : (errorMxs40srss_ver2or3Mxs22srss))}`" visible="`${debug}`" editable="false" desc="" />
72
73    <ParamRange id="agcEnMxs40srss" name="AGC EN" group="General" default="1" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
74    <ParamRange id="agcEnMxs40srss_ver2or3Mxs22srss" name="AGC EN" group="General" default="`${maxAmpl &lt; 0.50 ? -1 :
75                                                                     maxAmpl &gt;= 0.50 &amp;&amp; maxAmpl &lt; 1.10 ? 1 : 0}`" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
76    <ParamRange id="agcEn" name="AGC EN" group="General" default="`${((&quot;mxs40srss&quot; eq getIpBlockName()) ? (agcEnMxs40srss) : (agcEnMxs40srss_ver2or3Mxs22srss))}`" min="0" max="100000" resolution="1" visible="`${debug}`" editable="false" desc="" />
77
78    <ParamRange id="wdTrimMxs40srss" name="WD Trim" group="General" default="7" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
79    <ParamRange id="wdTrimMxs40srss_ver2or3Mxs22srss" name="WD Trim" group="General" default="`${maxAmpl &lt; 0.50 ? -1 :
80                                                                       maxAmpl &gt;= 0.50 &amp;&amp; maxAmpl &lt; 0.60 ? 2 :
81                                                                       maxAmpl &gt;= 0.60 &amp;&amp; maxAmpl &lt; 0.70 ? 3 :
82                                                                       maxAmpl &gt;= 0.70 &amp;&amp; maxAmpl &lt; 0.80 ? 4 :
83                                                                       maxAmpl &gt;= 0.80 &amp;&amp; maxAmpl &lt; 0.90 ? 5 :
84                                                                       maxAmpl &gt;= 0.90 &amp;&amp; maxAmpl &lt; 1.0 ? 6 :
85                                                                       maxAmpl &gt;= 1.0 &amp;&amp; maxAmpl &lt; 1.10 ? 7 : 7}`" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
86    <ParamRange id="wdTrimMxs40ssrss" name="WD Trim" group="General" default="`${maxAmpl &lt; 0.05 ? -1 :
87                                                                       maxAmpl eq 0.05  ? 0 :
88                                                                       maxAmpl eq 0.75  ? 1 :
89                                                                       maxAmpl eq 0.10  ? 2 :
90                                                                       maxAmpl eq 0.125 ? 3 :
91                                                                       maxAmpl eq 0.15  ? 4 :
92                                                                       maxAmpl eq 0.175 ? 5 :
93                                                                       maxAmpl eq 0.20  ? 6 : 7}`" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
94    <ParamRange id="wdTrim" name="WD Trim" group="General" default="`${((&quot;mxs40srss&quot; eq getIpBlockName()) ? (wdTrimMxs40srss) :
95                                                                        (&quot;mxs40ssrss&quot; eq getIpBlockName()) ? (wdTrimMxs40ssrss) : (wdTrimMxs40srss_ver2or3Mxs22srss))}`" min="0" max="100000" resolution="1" visible="`${debug}`" editable="false" desc="" />
96
97    <ParamRange id="aTrimMxs40srss" name="A Trim" group="General" default="15" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
98    <ParamRange id="aTrimMxs40srss_ver2or3Mxs22srss" name="A Trim" group="General" default="`${maxAmpl &lt; 0.50 ? -1 :
99                                                                     maxAmpl &gt;= 0.50 &amp;&amp; maxAmpl &lt; 0.55 ? 4 :
100                                                                     maxAmpl &gt;= 0.55 &amp;&amp; maxAmpl &lt; 0.60 ? 5 :
101                                                                     maxAmpl &gt;= 0.60 &amp;&amp; maxAmpl &lt; 0.65 ? 6 :
102                                                                     maxAmpl &gt;= 0.65 &amp;&amp; maxAmpl &lt; 0.70 ? 7 :
103                                                                     maxAmpl &gt;= 0.70 &amp;&amp; maxAmpl &lt; 0.75 ? 8 :
104                                                                     maxAmpl &gt;= 0.75 &amp;&amp; maxAmpl &lt; 0.80 ? 9 :
105                                                                     maxAmpl &gt;= 0.80 &amp;&amp; maxAmpl &lt; 0.85 ? 10 :
106                                                                     maxAmpl &gt;= 0.85 &amp;&amp; maxAmpl &lt; 0.90 ? 11 :
107                                                                     maxAmpl &gt;= 0.90 &amp;&amp; maxAmpl &lt; 0.95 ? 12 :
108                                                                     maxAmpl &gt;= 0.95 &amp;&amp; maxAmpl &lt; 1.0 ? 13 :
109                                                                     maxAmpl &gt;= 1.0 &amp;&amp; maxAmpl &lt; 1.05 ? 14 :
110                                                                     maxAmpl &gt;= 1.05 &amp;&amp; maxAmpl &lt; 1.10 ? 15 : 0}`" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
111    <ParamRange id="aTrimMxs40ssrss" name="A Trim" group="General" default="`${maxAmpl &lt; 0.150 ? -1 :
112                                                                       maxAmpl eq 0.150 ? 0 :
113                                                                       maxAmpl eq 0.175 ? 1 :
114                                                                       maxAmpl eq 0.200 ? 2 :
115                                                                       maxAmpl eq 0.225 ? 3 :
116                                                                       maxAmpl eq 0.250 ? 4 :
117                                                                       maxAmpl eq 0.275 ? 5 :
118                                                                       maxAmpl eq 0.300 ? 6 :
119                                                                       maxAmpl eq 0.325 ? 7 :
120                                                                       maxAmpl eq 0.350 ? 8 :
121                                                                       maxAmpl eq 0.375 ? 9 :
122                                                                       maxAmpl eq 0.400 ? A :
123                                                                       maxAmpl eq 0.425 ? B :
124                                                                       maxAmpl eq 0.450 ? C :
125                                                                       maxAmpl eq 0.475 ? D :
126                                                                       maxAmpl eq 0.500 ? E : F}`" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
127    <ParamRange id="aTrim" name="A Trim" group="General" default="`${((&quot;mxs40srss&quot; eq getIpBlockName()) ? (aTrimMxs40srss) :
128                                                                      (&quot;mxs40srss&quot; eq getIpBlockName()) ? (aTrimMxs40ssrss) :(aTrimMxs40srss_ver2or3Mxs22srss))}`" min="0" max="100000" resolution="1" visible="`${debug}`" editable="false" desc="" />
129
130    <ParamRange id="fTrim" name="F Trim" group="General" default="`${((&quot;mxs40srss&quot; eq getIpBlockName()) ? (3) : (0))}`" min="0" max="100000" resolution="1" visible="`${debug}`" editable="false" desc="" />
131
132    <ParamRange id="rTrimMxs40srss" name="R Trim" group="General" default="0" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
133    <ParamRange id="rTrimMxs40srss_ver2or3Mxs22srss" name="R Trim" group="General" default="`${maxAmpl &lt;= 0 ? -1 :
134                                                                     maxAmpl &gt; 0 &amp;&amp; maxAmpl &lt;= 16.5 ? 3 :
135                                                                     maxAmpl &gt; 16.5 &amp;&amp; maxAmpl &lt;= 23.33 ? 2 :
136                                                                     maxAmpl &gt; 23.33 &amp;&amp; maxAmpl &lt;= 28.6 ? 1 : 0}`" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
137    <ParamRange id="rTrim" name="R Trim" group="General" default="`${((&quot;mxs40srss&quot; eq getIpBlockName()) ? (rTrimMxs40srss) : (rTrimMxs40srss_ver2or3Mxs22srss))}`" min="0" max="100000" resolution="1" visible="`${debug}`" editable="false" desc="" />
138
139    <ParamRange id="gTrimMxs40srss" name="G Trim" group="General" default="`${amplSect > 1 ? amplSect : amplSect == 1 ? 0 : 1}`" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
140    <ParamRange id="gTrimMxs40srss_ver2or3Mxs22srss" name="G Trim" group="General" default="`${maxAmpl &gt; 15.40 ? -1 :
141                                                                     maxAmpl &gt;= 0 &amp;&amp; maxAmpl &lt; 2.2 ? 1 :
142                                                                     maxAmpl &gt;= 2.2 &amp;&amp; maxAmpl &lt; 4.4 ? 2 :
143                                                                     maxAmpl &gt;= 4.4 &amp;&amp; maxAmpl &lt; 6.6 ? 3 :
144                                                                     maxAmpl &gt;= 6.6 &amp;&amp; maxAmpl &lt; 8.8 ? 4 :
145                                                                     maxAmpl &gt;= 8.8 &amp;&amp; maxAmpl &lt; 11.0 ? 5 :
146                                                                     maxAmpl &gt;= 11.0 &amp;&amp; maxAmpl &lt; 13.2 ? 6 : 7}`" min="0" max="100000" resolution="1" visible="false" editable="false" desc="" />
147    <ParamRange id="gTrim" name="G Trim" group="General" default="`${((&quot;mxs40srss&quot; eq getIpBlockName()) ? (gTrimMxs40srss) : (gTrimMxs40srss_ver2or3Mxs22srss))}`" min="0" max="100000" resolution="1" visible="`${debug}`" editable="false" desc="" />
148
149    <!-- Restrict ECO connections to pins -->
150    <ParamSignal port="eco_in[0]" name="Input" group="Connections" visible="true" desc="The input/passive terminal of the internal ECO circuitry" canBeEmpty="false" requirePreferred="true" isDependency="true">
151      <Constraint type="REQUIRE" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" />
152    </ParamSignal>
153    <ParamSignal port="eco_out[0]" name="Output" group="Connections" visible="true" desc="The output/active terminal of the internal ECO circuitry" canBeEmpty="false" requirePreferred="true" isDependency="true">
154      <Constraint type="REQUIRE" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" />
155    </ParamSignal>
156
157    <ParamString id="gpio_in_port" name="gpio_in_port" group="General" default="`${getInstFromLocation(getParamValue(&quot;eco_in[0]&quot;), &quot;port&quot;)}`" visible="false" editable="false" desc="" />
158    <ParamString id="gpio_in_pin" name="gpio_in_pin" group="General" default="`${getInstFromLocation(getParamValue(&quot;eco_in[0]&quot;), &quot;pin&quot;)}`" visible="false" editable="false" desc="" />
159    <ParamString id="gpio_out_port" name="gpio_out_port" group="General" default="`${getInstFromLocation(getParamValue(&quot;eco_out[0]&quot;), &quot;port&quot;)}`" visible="false" editable="false" desc="" />
160    <ParamString id="gpio_out_pin" name="gpio_out_pin" group="General" default="`${getInstFromLocation(getParamValue(&quot;eco_out[0]&quot;), &quot;pin&quot;)}`" visible="false" editable="false" desc="" />
161    <ParamBool id="suppressWcoCodeGen" name="Suppress WCO PIN Configuration Code Generation" group="Internal" default="true"
162            visible="false" editable="false" desc="Prevents pins connected to this personality to generate configuration code" />
163  </Parameters>
164  <DRCs>
165    <DRC type="ERROR" text="Parameters provided cause the maximum trans-conductance and amplitude control range to exceed the legal design limits." condition="`${error}`" />
166    <DRC type="ERROR" text="The sum of C0 and Cload should not exceed 100 pF." condition="`${csum &gt; 100}`" />
167  </DRCs>
168  <ConfigFirmware>
169    <ConfigInclude value="cy_gpio.h" include="true" />
170    <ConfigInclude value="cy_sysclk.h" include="true" />
171    <ConfigDefine name="CY_CFG_SYSCLK_ECO_ENABLED" value="1" public="false" include="true" />
172    <ConfigDefine name="CY_CFG_SYSCLK_ECO_FREQ" value="`${frequency}`UL" public="false" include="true" />
173    <ConfigDefine name="CY_CFG_SYSCLK_ECO_GPIO_IN_PRT" value="GPIO_PRT`${gpio_in_port}`" public="false" include="true" />
174    <ConfigDefine name="CY_CFG_SYSCLK_ECO_GPIO_IN_PIN" value="`${gpio_in_pin}`" public="false" include="true" />
175    <ConfigDefine name="CY_CFG_SYSCLK_ECO_GPIO_OUT_PRT" value="GPIO_PRT`${gpio_out_port}`" public="false" include="true" />
176    <ConfigDefine name="CY_CFG_SYSCLK_ECO_GPIO_OUT_PIN" value="`${gpio_out_pin}`" public="false" include="true" />
177    <ConfigDefine name="CY_CFG_SYSCLK_ECO_CLOAD" value="`${cLoad}`UL" public="false" include="true" />
178    <ConfigDefine name="CY_CFG_SYSCLK_ECO_ESR" value="`${esr}`UL" public="false" include="true" />
179    <ConfigDefine name="CY_CFG_SYSCLK_ECO_DRIVE_LEVEL" value="`${driveLevel}`UL" public="false" include="true" />
180    <ConfigFunction signature="__STATIC_INLINE void Cy_SysClk_EcoInit()" body="    (void)Cy_GPIO_Pin_FastInit(GPIO_PRT`${gpio_in_port}`, `${gpio_in_pin}`, CY_GPIO_DM_ANALOG, 0UL, HSIOM_SEL_GPIO);&#xA;    (void)Cy_GPIO_Pin_FastInit(GPIO_PRT`${gpio_out_port}`, `${gpio_out_pin}`, CY_GPIO_DM_ANALOG, 0UL, HSIOM_SEL_GPIO);&#xA;    if (CY_SYSCLK_BAD_PARAM == Cy_SysClk_EcoConfigure(CY_CFG_SYSCLK_ECO_FREQ, `${csum}`UL, `${esr}`UL, `${driveLevel}`UL))&#xA;    {&#xA;        cycfg_ClockStartupError(CY_CFG_SYSCLK_ECO_ERROR);&#xA;    }&#xA;    if (CY_SYSCLK_TIMEOUT == Cy_SysClk_EcoEnable(3000UL))&#xA;    {&#xA;        cycfg_ClockStartupError(CY_CFG_SYSCLK_ECO_ERROR);&#xA;    }" public="false" include="`${!error}`" guard="(!defined(CY_DEVICE_SECURE))" />
181    <ConfigInstruction value="Cy_SysClk_EcoSetFrequency(CY_CFG_SYSCLK_ECO_FREQ);" purpose="RESERVE" include="`${(&quot;mxs40srss&quot; eq getIpBlockName()) || (&quot;mxs40srss_ver3&quot; eq getIpBlockName())}`" />
182    <ConfigInstruction value="SystemCoreClockUpdate();" purpose="RESERVE" include="`${(&quot;mxs40srss&quot; eq getIpBlockName()) || (&quot;mxs40srss_ver3&quot; eq getIpBlockName())}`" />
183  </ConfigFirmware>
184</Personality>
185