1<?xml version="1.0" encoding="utf-8"?>
2
3
4<!--****************************************************************************
5* \file wco.cypersonality
6* \version 3.0
7*
8* \brief
9* WCO personality description file.
10* This supports CAT1A, CAT1B, CAT1C and CAT1D devices.
11*
12********************************************************************************
13* \copyright
14* Copyright (c) 2022, Cypress Semiconductor Corporation (an Infineon company) or
15* an affiliate of Cypress Semiconductor Corporation.
16* SPDX-License-Identifier: Apache-2.0
17*
18* Licensed under the Apache License, Version 2.0 (the "License");
19* you may not use this file except in compliance with the License.
20* You may obtain a copy of the License at
21*
22*     http://www.apache.org/licenses/LICENSE-2.0
23*
24* Unless required by applicable law or agreed to in writing, software
25* distributed under the License is distributed on an "AS IS" BASIS,
26* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27* See the License for the specific language governing permissions and
28* limitations under the License.
29*****************************************************************************-->
30
31<Personality id="wco" name="WCO" version="3.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v7">
32  <Dependencies>
33    <IpBlock name="mxs40srss,mxs40ssrss,mxs40srss_ver2,mxs40srss_ver3,mxs22srss" />
34    <IpBlock name="mxs40ioss,mxs40sioss,mxs22ioss" />
35    <Resource name="srss\.clock\.wco" />
36  </Dependencies>
37  <ExposedMembers>
38    <ExposedMember key="frequency" paramId="frequency" />
39    <ExposedMember key="accuracy"  paramId="accuracyPct" />
40    <ExposedMember key="suppressCodeGen" paramId="suppressWcoCodeGen" />
41  </ExposedMembers>
42  <Parameters>
43    <!-- PDL documentation -->
44    <ParamDoc id="pdlDoc" name="Configuration Help" group="Overview" default="file:///`${cy_libs_path()}`/docs/pdl_api_reference_manual/html/group__group__sysclk__wco.html" linkText="Open WCO Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />
45    <ParamBool id="isS40sPiloPresent" name="S40S_PILO Present" group="Internal" default="`${lookupExpression(&quot;S40S_PILO_PRESENT&quot;, 0)}`" visible="false" editable="false" desc="S40S_PILO Present" />
46    <ParamBool id="isPiloPresent" name="Pilo Present" group="Internal" default="`${lookupExpression(&quot;PILO_PRESENT&quot;, 0)}`" visible="false" editable="false" desc="PILO Present" />
47    <ParamString id="isWCOCSVPresent" name="WCOCSV Present" group="Internal" default="`${lookupExpression(&quot;WCO_CSV_PRESENT&quot;, 0)}`" visible="false" editable="false" desc="WCOCSV Present" />
48    <ParamString id="isCSVBAKPresent" name="CSVBAK Present" group="Internal" default="`${lookupExpression(&quot;CSV_BAK_PRESENT&quot;, 0)}`" visible="false" editable="false" desc="CSVBAK Present" />
49
50    <ParamRange id="frequency" name="Frequency (kHz)" group="General" default="32768" min="32768" max="32768" resolution="1" visible="false" editable="false" desc="" />
51
52    <ParamChoice id="clockPort" name="Clock Port" group="General" default="CY_SYSCLK_WCO_NOT_BYPASSED" visible="true" editable="true" desc="Activates the WCO bypass mode">
53      <Entry name="Normal (Crystal)" value="CY_SYSCLK_WCO_NOT_BYPASSED" visible="true" />
54      <Entry name="Bypass (External sine wave)" value="CY_SYSCLK_WCO_BYPASSED" visible="true" />
55    </ParamChoice>
56    <ParamBool id="clockLostDetection" name="Enable Clock Loss Detection" group="General" default="false" visible="`${isCSVBAKPresent || isWCOCSVPresent}`" editable="true" desc="" />
57    <ParamChoice id="clockSupervisor" name="Supervisor" group="General" default="CY_SYSCLK_WCO_CSV_SUPERVISOR_ILO" visible="`${clockLostDetection}`" editable="true" desc="">
58      <Entry name="ILO" value="CY_SYSCLK_WCO_CSV_SUPERVISOR_ILO" visible="true"/>
59      <Entry name="ALTLF" value="CY_SYSCLK_WCO_CSV_SUPERVISOR_ALTLF" visible="`${ALTLF_PRESENT}`"/>
60      <Entry name="PILO" value="CY_SYSCLK_WCO_CSV_SUPERVISOR_PILO" visible="`${(isS40sPiloPresent) || (isPiloPresent)}`"/>
61    </ParamChoice>
62    <ParamChoice id="lossWindow" name="Loss Window" group="General" default="CY_SYSCLK_CSV_LOSS_4_CYCLES" visible="`${clockLostDetection}`" editable="true" desc="">
63      <Entry name="4 cycle" value="CY_SYSCLK_CSV_LOSS_4_CYCLES" visible="true"/>
64      <Entry name="8 cycle" value="CY_SYSCLK_CSV_LOSS_8_CYCLES" visible="true"/>
65      <Entry name="16 cycle" value="CY_SYSCLK_CSV_LOSS_16_CYCLES" visible="true"/>
66      <Entry name="32 cycle" value="CY_SYSCLK_CSV_LOSS_32_CYCLES" visible="true"/>
67      <Entry name="64 cycle" value="CY_SYSCLK_CSV_LOSS_64_CYCLES" visible="true"/>
68      <Entry name="128 cycle" value="CY_SYSCLK_CSV_LOSS_128_CYCLES" visible="true"/>
69      <Entry name="256 cycle" value="CY_SYSCLK_CSV_LOSS_256_CYCLES" visible="true"/>
70      <Entry name="512 cycle" value="CY_SYSCLK_CSV_LOSS_512_CYCLES" visible="true"/>
71    </ParamChoice>
72    <ParamChoice id="lossAction" name="Loss Action" group="General" default="CY_SYSCLK_CSV_ERROR_FAULT" visible="`${clockLostDetection}`" editable="true" desc="">
73      <Entry name="None" value="CY_SYSCLK_CSV_ERROR_IGNORE" visible="true"/>
74      <Entry name="Fault" value="CY_SYSCLK_CSV_ERROR_FAULT" visible="true"/>
75      <Entry name="Reset" value="CY_SYSCLK_CSV_ERROR_RESET" visible="true"/>
76      <Entry name="Fault-Reset" value="CY_SYSCLK_CSV_ERROR_FAULT_RESET" visible="true"/>
77    </ParamChoice>
78    <ParamString id="frequencyInfo" name="Frequency" group="General" default="`${frequency / 1000.0 . &quot; kHz&quot;}`" visible="true" editable="false" desc="The nominal output frequency" />
79    <ParamRange id="accuracyPpm" name="Accuracy (&#177;ppm)" group="General" default="150" min="0" max="1000000" resolution="1" visible="true" editable="true" desc="Clock accuracy in ppm" />
80    <ParamString id="accuracyPct" name="Accuracy (&#177;%)" group="General" default="`${accuracyPpm/10000.0}`" visible="true" editable="false" desc="Clock accuracy in %" />
81
82    <!-- Restrict WCO connections to pins -->
83    <ParamSignal port="wco_in[0]" name="Input" group="Connections" visible="true" desc="The input/passive terminal of the internal WCO circuitry" canBeEmpty="false" requirePreferred="true">
84      <Constraint type="REQUIRE" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" />
85    </ParamSignal>
86    <ParamSignal port="wco_out[0]" name="Output" group="Connections" visible="true" desc="The output/active terminal of the internal WCO circuitry" canBeEmpty="false" requirePreferred="true">
87      <Constraint type="REQUIRE" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" />
88    </ParamSignal>
89
90    <ParamString id="gpio_in_port" name="gpio_in_port" group="General" default="`${getInstFromLocation(getParamValue(&quot;wco_in[0]&quot;), &quot;port&quot;)}`" visible="false" editable="false" desc="" />
91    <ParamString id="gpio_in_pin" name="gpio_in_pin" group="General" default="`${getInstFromLocation(getParamValue(&quot;wco_in[0]&quot;), &quot;pin&quot;)}`" visible="false" editable="false" desc="" />
92    <ParamString id="gpio_out_port" name="gpio_out_port" group="General" default="`${getInstFromLocation(getParamValue(&quot;wco_out[0]&quot;), &quot;port&quot;)}`" visible="false" editable="false" desc="" />
93    <ParamString id="gpio_out_pin" name="gpio_out_pin" group="General" default="`${getInstFromLocation(getParamValue(&quot;wco_out[0]&quot;), &quot;pin&quot;)}`" visible="false" editable="false" desc="" />
94    <!-- ExposedMember -->
95    <ParamBool id="suppressWcoCodeGen" name="Suppress WCO PIN Configuration Code Generation" group="Internal" default="true"
96            visible="false" editable="false" desc="Prevents pins connected to this personality to generate configuration code" />
97  </Parameters>
98
99  <DRCs>
100    <DRC type="INFO" text="The WCO is enabled. Chip startup will be slower because clock configuration cannot continue until the WCO is ready. See the device datasheet for WCO startup timing. If WCO is not required during startup, consider starting it in main() for faster chip startup." condition="true" />
101  </DRCs>
102
103  <ConfigFirmware>
104    <ConfigInclude value="cy_gpio.h" include="true" />
105    <ConfigInclude value="cy_sysclk.h" include="true" />
106    <ConfigDefine name="CY_CFG_SYSCLK_WCO_ENABLED" value="1" public="false" include="true" />
107    <ConfigDefine name="CY_CFG_SYSCLK_WCO_IN_PRT" value="GPIO_PRT`${gpio_in_port}`" public="false" include="true" />
108    <ConfigDefine name="CY_CFG_SYSCLK_WCO_IN_PIN" value="`${gpio_in_pin}`U" public="false" include="true" />
109    <ConfigDefine name="CY_CFG_SYSCLK_WCO_OUT_PRT" value="GPIO_PRT`${gpio_out_port}`" public="false" include="true" />
110    <ConfigDefine name="CY_CFG_SYSCLK_WCO_OUT_PIN" value="`${gpio_out_pin}`U" public="false" include="true" />
111    <ConfigDefine name="CY_CFG_SYSCLK_WCO_BYPASS" value="`${clockPort}`" public="false" include="true" />
112    <ConfigStruct name="`${INST_NAME . &quot;_wcoCsv&quot;}`" type="cy_stc_wco_csv_config_t" const="true" public="true" include="`${isCSVBAKPresent || isWCOCSVPresent}`" >
113      <Member name="supervisorClock" value="`${clockSupervisor}`" />
114      <Member name="enableLossDetection" value="`${clockLostDetection}`" />
115      <Member name="lossWindow" value="`${lossWindow}`" />
116      <Member name="lossAction" value="`${lossAction}`" />
117    </ConfigStruct>
118    <ConfigFunction signature="__STATIC_INLINE void Cy_SysClk_WcoInit()" body="    (void)Cy_GPIO_Pin_FastInit(GPIO_PRT`${gpio_in_port}`, `${gpio_in_pin}`U, 0x00U, 0x00U, HSIOM_SEL_GPIO);&#xA;    (void)Cy_GPIO_Pin_FastInit(GPIO_PRT`${gpio_out_port}`, `${gpio_out_pin}`U, 0x00U, 0x00U, HSIOM_SEL_GPIO);&#xA;`${clockPort eq CY_SYSCLK_WCO_BYPASSED ? &quot;    Cy_SysClk_WcoBypass(CY_SYSCLK_WCO_BYPASSED);&#xA;&quot; : &quot;&quot;}`    if (CY_SYSCLK_SUCCESS != Cy_SysClk_WcoEnable(1000000UL))&#xA;    {&#xA;        cycfg_ClockStartupError(CY_CFG_SYSCLK_WCO_ERROR);&#xA;    }`${(isCSVBAKPresent || isWCOCSVPresent) ? &quot;&#xA;    Cy_SysClk_WcoConfigureCsv(&amp;wcoCsv);&quot; : &quot;&quot;}`" public="false" include="`${(&quot;mxs22srss&quot; eq getIpBlockName())}`"  guard="defined(CORE_NAME_CM33_0)"/>
119    <ConfigFunction signature="__STATIC_INLINE void Cy_SysClk_WcoInit()" body="    (void)Cy_GPIO_Pin_FastInit(GPIO_PRT`${gpio_in_port}`, `${gpio_in_pin}`U, 0x00U, 0x00U, HSIOM_SEL_GPIO);&#xA;    (void)Cy_GPIO_Pin_FastInit(GPIO_PRT`${gpio_out_port}`, `${gpio_out_pin}`U, 0x00U, 0x00U, HSIOM_SEL_GPIO);&#xA;`${clockPort eq CY_SYSCLK_WCO_BYPASSED ? &quot;    Cy_SysClk_WcoBypass(CY_SYSCLK_WCO_BYPASSED);&#xA;&quot; : &quot;&quot;}`    if (CY_SYSCLK_SUCCESS != Cy_SysClk_WcoEnable(1000000UL))&#xA;    {&#xA;        cycfg_ClockStartupError(CY_CFG_SYSCLK_WCO_ERROR);&#xA;    }" public="false" include="`${(&quot;mxs22srss&quot; ne getIpBlockName())}`"  guard="(!defined(CY_DEVICE_SECURE))"/>
120  </ConfigFirmware>
121</Personality>
122