Newer
Older
mbed-os / targets / TARGET_Cypress / TARGET_PSOC6 / mtb-pdl-cat1 / personalities / platform / wco-1.0.cypersonality
@Dustin Crossman Dustin Crossman on 4 Jun 2021 8 KB Fix file modes.
<?xml version="1.0" encoding="utf-8"?>


<!--****************************************************************************
* \file wco.cypersonality
* \version 1.0
*
* \brief
* WCO personality description file.
*
********************************************************************************
* \copyright
* Copyright 2018-2019 Cypress Semiconductor Corporation
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************-->

<Personality id="mxs40wco" name="WCO" version="1.0" path="Clocks/Slow" xmlns="http://cypress.com/xsd/cyhwpersonality_v1">
  <Dependencies>
    <IpBlock name="mxs40srss" />
    <IpBlock name="mxs40ioss" />
    <Resource name="srss\.clock\.wco" used="true" />
  </Dependencies>
  <ExposedMembers>
    <ExposedMember key="frequency" paramId="frequency" />
    <ExposedMember key="accuracy"  paramId="accuracyPct" />
  </ExposedMembers>
  <Parameters>
    <!-- PDL documentation -->
    <ParamDoc id="pdlDoc" name="Configuration Help" group="Peripheral Documentation" 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" />

  
    <ParamRange id="frequency" name="Frequency (kHz)" group="General" default="32768" min="32768" max="32768" resolution="1" visible="false" editable="false" desc="" />

    <ParamChoice id="clockPort" name="Clock Port" group="General" default="CY_SYSCLK_WCO_NOT_BYPASSED" visible="true" editable="true" desc="Activates the WCO bypass mode">
      <Entry name="Normal (Crystal)" value="CY_SYSCLK_WCO_NOT_BYPASSED" visible="true" />
      <Entry name="Bypass (External sine wave)" value="CY_SYSCLK_WCO_BYPASSED" visible="true" />
    </ParamChoice>
    <ParamBool id="clockLostDetection" name="Enable Clock Loss Detection" group="General" default="false" visible="`${WCOCSV_PRESENT}`" editable="true" desc="" />
    <ParamChoice id="clockSupervisor" name="Supervisor" group="General" default="CY_SYSCLK_WCO_CSV_SUPERVISOR_ILO" visible="`${clockLostDetection}`" editable="true" desc="">
      <Entry name="ILO" value="CY_SYSCLK_WCO_CSV_SUPERVISOR_ILO" visible="true"/>
      <Entry name="ALTLF" value="CY_SYSCLK_WCO_CSV_SUPERVISOR_ALTLF" visible="`${ALTLF_PRESENT}`"/>
      <Entry name="PILO" value="CY_SYSCLK_WCO_CSV_SUPERVISOR_PILO" visible="`${PILO_PRESENT}`"/>
    </ParamChoice>
    <ParamChoice id="lossWindow" name="Loss Window" group="General" default="CY_SYSCLK_CSV_LOSS_4_CYCLES" visible="`${clockLostDetection}`" editable="true" desc="">
      <Entry name="4 cycle" value="CY_SYSCLK_CSV_LOSS_4_CYCLES" visible="true"/>
      <Entry name="8 cycle" value="CY_SYSCLK_CSV_LOSS_8_CYCLES" visible="true"/>
      <Entry name="16 cycle" value="CY_SYSCLK_CSV_LOSS_16_CYCLES" visible="true"/>
      <Entry name="32 cycle" value="CY_SYSCLK_CSV_LOSS_32_CYCLES" visible="true"/>
      <Entry name="64 cycle" value="CY_SYSCLK_CSV_LOSS_64_CYCLES" visible="true"/>
      <Entry name="128 cycle" value="CY_SYSCLK_CSV_LOSS_128_CYCLES" visible="true"/>
      <Entry name="256 cycle" value="CY_SYSCLK_CSV_LOSS_256_CYCLES" visible="true"/>
      <Entry name="512 cycle" value="CY_SYSCLK_CSV_LOSS_512_CYCLES" visible="true"/>
    </ParamChoice>
    <ParamChoice id="lossAction" name="Loss Action" group="General" default="CY_SYSCLK_CSV_ERROR_FAULT" visible="`${clockLostDetection}`" editable="true" desc="">
      <Entry name="None" value="CY_SYSCLK_CSV_ERROR_IGNORE" visible="true"/>
      <Entry name="Fault" value="CY_SYSCLK_CSV_ERROR_FAULT" visible="true"/>
      <Entry name="Reset" value="CY_SYSCLK_CSV_ERROR_RESET" visible="true"/>
      <Entry name="Fault-Reset" value="CY_SYSCLK_CSV_ERROR_FAULT_RESET" visible="true"/>
    </ParamChoice>
    <ParamString id="frequencyInfo" name="Frequency" group="General" default="`${frequency / 1000.0 . &quot; kHz&quot;}`" visible="true" editable="false" desc="The nominal output frequency" />
    <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" />
    <ParamString id="accuracyPct" name="Accuracy (&#177;%)" group="General" default="`${accuracyPpm/10000.0}`" visible="true" editable="false" desc="Clock accuracy in %" />

    <!-- Restrict WCO connections to pins -->
    <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">
      <Constraint type="REQUIRE" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" />
    </ParamSignal>
    <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">
      <Constraint type="REQUIRE" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" />
    </ParamSignal>

    <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="" />
    <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="" />
    <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="" />
    <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="" />
  </Parameters>

  <DRCs>
    <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" />
  </DRCs>

  <ConfigFirmware>
    <ConfigInclude value="cy_gpio.h" include="true" />
    <ConfigInclude value="cy_sysclk.h" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_WCO_ENABLED" value="1" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_WCO_IN_PRT" value="GPIO_PRT`${gpio_in_port}`" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_WCO_IN_PIN" value="`${gpio_in_pin}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_WCO_OUT_PRT" value="GPIO_PRT`${gpio_out_port}`" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_WCO_OUT_PIN" value="`${gpio_out_pin}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_WCO_BYPASS" value="`${clockPort}`" public="false" include="true" />
    <ConfigStruct name="`${INST_NAME . &quot;_wcoCsv&quot;}`" type="cy_stc_wco_csv_config_t" const="true" public="true" include="`${WCOCSV_PRESENT}`" >
      <Member name="SupervisorClock" value="`${clockSupervisor}`" />
      <Member name="enableLossDetection" value="`${clockLostDetection}`" />
      <Member name="LossWindow" value="`${lossWindow}`" />
      <Member name="LossAction" value="`${lossAction}`" />
    </ConfigStruct>
    <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;    }`${WCOCSV_PRESENT ? &quot;&#xA;    Cy_SysClk_WcoConfigureCsv(&amp;wcoCsv);&quot; : &quot;&quot;}`" public="false" include="true" guard="((!CY_CPU_CORTEX_M4) || (!defined(CY_DEVICE_SECURE)))" />
  </ConfigFirmware>
</Personality>