1<?xml version="1.0" encoding="utf-8"?>
2
3
4<!--****************************************************************************
5* \file fastclk.cypersonality
6* \version 2.0
7*
8* \brief
9* CLK_FAST personality description file. It supports CAT1A, CAT1B, CAT1C and
10* CAT1D devices.
11*
12********************************************************************************
13* \copyright
14* Copyright 2018-2022 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="fastclk" name="CLK_FAST" version="2.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v7">
31  <Dependencies>
32    <IpBlock name="mxs40srss,mxs40srss_ver2,mxs40srss_ver3" />
33    <Resource name="srss\.clock\.fastclk" />
34  </Dependencies>
35  <ExposedMembers>
36    <ExposedMember key="frequency" paramId="frequency" />
37    <ExposedMember key="accuracy"  paramId="accuracy" />
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__fast.html" linkText="Open Fast Clock Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />
42    <ParamBool
43      id="is40srss_ver2or3Available" name="is40srss_ver2or3Available" group=""
44      default="`${((&quot;mxs40srss_ver2&quot; eq getIpBlockName()) || (&quot;mxs40srss_ver3&quot; eq getIpBlockName()))}`"
45      visible="false" editable="false" desc="" />
46
47  <!-- Source clock -->
48    <ParamString
49      id="sourceClockRscMxs40srss" name="Source Clock" group="Internal"
50      default="srss[0].clock[0].hfclk[0]"
51      visible="false" editable="false" desc="" />
52    <ParamString
53      id="sourceClockRscMxs40srss_ver2or3" name="Source Clock" group="Internal"
54      default="`${
55        hasBlock(&quot;srss[0].clock[0].memclk[0]&quot;) ?
56          &quot;srss[0].clock[0].hfclk[1]&quot;:
57          &quot;srss[0].clock[0].hfclk[0]&quot;}`"
58      visible="false" editable="false" desc="" />
59    <ParamString
60      id="sourceClockRsc" name="Source Clock" group="Internal"
61      default="`${
62        (is40srss_ver2or3Available) ?
63        (sourceClockRscMxs40srss_ver2or3) :
64        (sourceClockRscMxs40srss)}`"
65      visible="false" editable="false" desc="" />
66
67    <!-- Set an error if the source clock is not enabled or contains an error -->
68    <ParamBool id="srcNotUsed" name="Clock Source Enabled" group="Internal" default="`${!isBlockUsed(sourceClockRsc)}`" visible="false" editable="false" desc="" />
69    <ParamBool id="error" name="Clock Error" group="Internal" default="`${srcNotUsed || getExposedMember(sourceClockRsc, &quot;error&quot;)}`" visible="false" editable="false" desc="" />
70    <!-- Use default values in case of error -->
71    <ParamRange  id="sourceFreq"  name="Source Frequency" group="Internal" default="`${!error ? getExposedMember(sourceClockRsc, &quot;frequency&quot;) : 0}`" min="0" max="400000000" resolution="1" visible="false" editable="false" desc="" />
72    <ParamString id="accuracy"  name="Accuracy"  group="Internal" default="`${!error ? getExposedMember(sourceClockRsc, &quot;accuracy&quot;) : 0}`" visible="false" editable="false" desc="" />
73    <ParamString
74      id="sourceFrequencyInfoMxs40srss" name="Source Clock" group="General"
75      default="CLK_HF0 (`${formatFrequency(sourceFreq,accuracy)}`)"
76      visible="false" editable="false" desc="Source clock frequency" />
77    <ParamString
78      id="sourceFrequencyInfoMxs40srss_ver2or3" name="Source Clock" group="General"
79      default="`${hasBlock(&quot;srss[0].clock[0].memclk[0]&quot;) ? &quot;CLK_HF1&quot;:&quot;CLK_HF0&quot;}` (`${formatFrequency(sourceFreq,accuracy)}`)"
80      visible="false" editable="false" desc="Source clock frequency" />
81    <ParamString
82      id="sourceFrequencyInfo" name="Source Clock" group="General"
83      default="`${
84        (is40srss_ver2or3Available) ?
85          (sourceFrequencyInfoMxs40srss_ver2or3) :
86          (sourceFrequencyInfoMxs40srss)}`"
87      visible="true" editable="false" desc="Source clock frequency" />
88    <ParamBool
89      id="is40srss_ver2or3withCM4" name="is40srss_ver2or3withCM4" group=""
90      default="`${(is40srss_ver2or3Available) &amp;&amp;
91                  !hasBlock(&quot;srss[0].clock[0].memclk[0]&quot;)
92                 }`"
93      visible="false" editable="false" desc="" />
94    <ParamChoice id="accuracyUnit" name="Accuracy Unit" group="Internal" default="1" visible="false" editable="false" desc="">
95      <Entry name="%" value="1" visible="true" />
96    </ParamChoice>
97    <ParamRange id="divider" name="Divider" group="General" default="1" min="1" max="256" resolution="1" visible="`${(&quot;mxs40srss&quot; eq getIpBlockName())}`" editable="true" desc="" />
98    <ParamRange id="intDivider" name="Integer Divider" group="General" default="1" min="1" max="256" resolution="1" visible="`${(is40srss_ver2or3Available)}`"  editable="true" desc="" />
99    <ParamRange id="fracDivider" name="Fractional Divider" group="General" default="0" min="0" max="31" resolution="1" visible="`${(is40srss_ver2or3Available)}`" editable="true" desc="" />
100    <ParamRange id="frequencyMxs40srss" name="Frequency" group="Internal" default="`${sourceFreq / divider}`" min="0" max="400000000" resolution="1" visible="false" editable="false" desc="" />
101    <ParamRange id="frequencyMxs40srss_ver2or3" name="Frequency" group="Internal" default="`${sourceFreq / (intDivider + fracDivider / 32.0)}`" min="0" max="400000000" resolution="1" visible="false" editable="false" desc="" />
102    <ParamRange id="frequency" name="Frequency" group="Internal" default="`${(is40srss_ver2or3Available) ? (frequencyMxs40srss_ver2or3) : (frequencyMxs40srss)}`" min="0" max="400000000" resolution="1" visible="false" editable="false" desc="" />
103    <!-- If the frequency is less than one MHz, display its value in kHz -->
104    <ParamString id="frequencyInfo" name="Frequency" group="General" default="`${formatFrequency(frequency,accuracy)}`" visible="true" editable="false" desc="The resulting CLK_FAST output clock frequency" />
105  </Parameters>
106  <DRCs>
107    <DRC type="ERROR" text="Source clock for CLK_FAST is not enabled" condition="`${srcNotUsed}`" >
108      <FixIt action="ENABLE_BLOCK" target="`${sourceClockRsc}`" value="" valid="true" />
109    </DRC>
110  </DRCs>
111  <ConfigFirmware>
112    <ConfigInclude value="cy_sysclk.h" include="true" />
113    <ConfigDefine name="CY_CFG_SYSCLK_CLKFAST_ENABLED" value="1" public="false"
114      include="`${(&quot;mxs40srss&quot; eq getIpBlockName()) || is40srss_ver2or3withCM4}`" />
115    <ConfigDefine name="CY_CFG_SYSCLK_CLKFAST_DIVIDER" value="`${divider - 1}`"  public="false"
116      include="`${(&quot;mxs40srss&quot; eq getIpBlockName()) || is40srss_ver2or3withCM4}`" />
117    <ConfigDefine name="CY_CFG_SYSCLK_CLKFAST_`${getInstNumber(&quot;fastclk&quot;)}`_ENABLED" value="1" public="false"
118      include="`${(is40srss_ver2or3Available) &amp;&amp; !is40srss_ver2or3withCM4}`" />
119    <ConfigDefine name="CY_CFG_SYSCLK_CLKFAST_`${getInstNumber(&quot;fastclk&quot;)}`_INT_DIVIDER" value="`${intDivider - 1}`"  public="false"
120      include="`${(is40srss_ver2or3Available) &amp;&amp; !is40srss_ver2or3withCM4}`" />
121    <ConfigDefine name="CY_CFG_SYSCLK_CLKFAST_`${getInstNumber(&quot;fastclk&quot;)}`_FRAC_DIVIDER" value="`${fracDivider}`"  public="false"
122      include="`${(is40srss_ver2or3Available) &amp;&amp; !is40srss_ver2or3withCM4}`" />
123    <ConfigFunction
124      signature="__STATIC_INLINE void Cy_SysClk_ClkFast_`${getInstNumber(&quot;fastclk&quot;)}`_Init()"
125      body="    Cy_SysClk_ClkFastSrcSetDivider(`${getInstNumber(&quot;fastclk&quot;)}`, CY_CFG_SYSCLK_CLKFAST_`${getInstNumber(&quot;fastclk&quot;)}`_INT_DIVIDER, CY_CFG_SYSCLK_CLKFAST_`${getInstNumber(&quot;fastclk&quot;)}`_FRAC_DIVIDER);"
126      public="false"
127      include="`${((&quot;mxs40srss_ver3&quot; eq getIpBlockName()) ) &amp;&amp;
128                   !is40srss_ver2or3withCM4}`" />
129    <ConfigFunction
130      signature="__STATIC_INLINE void Cy_SysClk_ClkFastInit()"
131      body="    Cy_SysClk_ClkFastSetDivider(`${divider - 1}`U);"
132      public="false"
133      include="`${(&quot;mxs40srss&quot; eq getIpBlockName()) || is40srss_ver2or3withCM4 }`"
134      guard="(!defined(CY_DEVICE_SECURE))" />
135  </ConfigFirmware>
136</Personality>
137