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


<!--****************************************************************************
* \file fll.cypersonality
* \version 2.0
*
* \brief
* FLL personality description file.
*
********************************************************************************
* \copyright
* Copyright 2018-2020 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="mxs40fll" name="FLL" version="2.0" path="Clocks/Fast" xmlns="http://cypress.com/xsd/cyhwpersonality_v1">
  <Dependencies>
    <IpBlock name="mxs40srss" />
    <Resource name="srss\.clock\.fll" used="true" />
  </Dependencies>
  <ExposedMembers>
    <ExposedMember key="frequency" paramId="frequency" />
    <ExposedMember key="accuracy"  paramId="solvedAccuracy" />
    <ExposedMember key="error"     paramId="srcError" />
  </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__fll.html" linkText="Open FLL Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />

  
    <!-- For ULP mode, Ffll_max = 50 MHz. For LP mode, Ffll_max = 100 MHz or Fcpu_max (if Fcpu_max < 100 MHz) -->
    <ParamBool id="usingUlp" name="usingUlp" group="Internal" default="`${isBlockUsed(&quot;srss[0].power[0]&quot;) &amp;&amp; getExposedMember(&quot;srss[0].power[0]&quot;, &quot;usingUlp&quot;)}`" visible="false" editable="false" desc="" />
    <ParamString id="maxFrequency" name="Max Frequency (MHz)" group="Internal" default="`${getDeviceAttr(&quot;CPU_MAX_MHZ&quot;) &gt; 100 ? 100 : getDeviceAttr(&quot;CPU_MAX_MHZ&quot;)}`" visible="false" editable="false" desc="The maximum FLL frequency" />
    <ParamString id="maxFreqHz" name="Max Frequency (Hz)" group="Internal" default="`${1000000 * maxFrequency}`" visible="false" editable="false" desc="The maximum FLL frequency" />

    <!-- FLL is on clock path 0 -->
    <ParamString id="sourceClockRsc" name="Source Clock" group="Internal" default="srss[0].clock[0].pathmux[0]" visible="false" editable="false" desc="" />
    <ParamBool id="srcNotUsed" name="Clock Source Enabled" group="Internal" default="`${!isBlockUsed(sourceClockRsc)}`" visible="false" editable="false" desc="" />
    <!-- Set an error if the source clock is not enabled or contains an error -->
    <ParamBool id="srcError" name="Source Error" group="Internal" default="`${srcNotUsed || getExposedMember(sourceClockRsc, &quot;error&quot;)}`" visible="false" editable="false" desc="" />
    <ParamRange id="sourceFrequency" name="Source Frequency" group="Internal" default="`${!srcError ? getExposedMember(sourceClockRsc, &quot;frequency&quot;) : 0}`" min="0" max="100000000" resolution="1" visible="false" editable="false" desc="" />
    <ParamString id="sourceAccuracy" name="Source Accuracy" group="Internal" default="`${!srcError ? getExposedMember(sourceClockRsc, &quot;accuracy&quot;) : 0}`" visible="false" editable="false" desc="" />
    <ParamString id="sourceFrequencyInfo" name="Source Frequency" group="General" default="`${formatFrequency(sourceFrequency,sourceAccuracy)}`" visible="true" editable="false" desc="Source clock frequency" />
    <ParamChoice id="configuration" name="Configuration" group="General" default="auto" visible="true" editable="true" desc="Choose the automatic or manual FLL tuning">
      <Entry name="Automatic" value="auto"   visible="true"/>
      <Entry name="Manual"    value="manual" visible="true"/>
    </ParamChoice>

    <ParamBool id="manConfig" name="Manual FLL Configuration" group="Internal" default="`${configuration eq manual}`" visible="false" editable="false" desc="" />
    
    <ParamRange id="desiredFrequency" name="Desired Frequency (MHz)" group="General" default="`${maxFrequency}`" min="24" max="`${maxFrequency}`" resolution="0.001" visible="`${!manConfig}`" editable="true" desc="" />
    
    <!-- Use default values in case of error -->
    
    <!-- The FLL calculator takes into account whether the WCO is used as the reference clock for the FLL. The FLL resides on clock path 0. -->
    <ParamString id="path0ClkSource" name="Source Clock for Clock Path 0" group="Internal" default="`${!srcError ? getExposedMember(sourceClockRsc, &quot;sourceClock&quot;) : false}`" visible="false" editable="false" desc="" />

    <ParamString id="callSolverAuto" name="callSolver" group="Internal" default="`${manConfig ? &quot;&quot; : runTcl(&quot;fll_solver-2.0.tcl&quot;, &quot;auto&quot;, sourceFrequency / 1000000.0, desiredFrequency, path0ClkSource eq &quot;wco&quot;, sourceAccuracy)}`" visible="false" editable="false" desc="FLL clock solver" />

    <!-- Use min value in case of error -->
    <ParamRange id="multiplier" name="Multiplier (1-262143)" group="General" default="`${getTclVar(&quot;fllMult&quot;, callSolverAuto)}`" min="`${srcNotUsed ? 0 : 1}`" max="262143" resolution="1" visible="true" editable="`${manConfig}`" desc="The feedback clock divider" />
    <ParamRange id="reference" name="Reference (1-8191)" group="General" default="`${getTclVar(&quot;refDiv&quot;, callSolverAuto)}`" min="`${srcNotUsed ? 0 : 1}`" max="8191" resolution="1" visible="true" editable="`${manConfig}`" desc="The reference clock divider" />
    <ParamRange id="tolerance" name="Lock Tolerance (0-511)" group="General" default="`${getTclVar(&quot;lockTolerance&quot;, callSolverAuto)}`" min="0" max="511" resolution="1" visible="true" editable="`${manConfig}`" desc="Lock tolerance sets the error threshold for when the FLL output is considered locked to the reference input. A high tolerance can be used to lock more quickly or to track a less accurate source.  The tolerance should be set so that the FLL does not unlock under normal conditions. The tolerance is the allowed difference between the count value for the ideal formula and the measured value" />
    
    <ParamString id="callSolver" name="callSolver" group="Internal" default="`${manConfig ? runTcl(&quot;fll_solver-2.0.tcl&quot; , &quot;manual&quot;, sourceFrequency / 1000000.0, multiplier, reference, tolerance, path0ClkSource eq &quot;wco&quot;, sourceAccuracy) : callSolverAuto}`" visible="false" editable="false" desc="FLL clock solver" />

    <ParamRange id="frequency" name="Frequency" group="Internal" default="`${sourceFrequency * multiplier / (srcNotUsed ? 1 : reference) / (getTclVar(&quot;enableOutputDiv&quot;, callSolver) ? 2 : 1)}`" min="`${srcNotUsed ? 0 : 24000000}`" max="`${maxFreqHz}`" resolution="200000" visible="false" editable="false" desc="" />
    <ParamString id="solvedAccuracy" name="accuracy" group="Internal" default="`${getTclVar(&quot;accuracy&quot;, callSolver)}`" visible="false" editable="false" desc="" />
    <ParamString id="frequencyInfo" name="Actual Frequency" group="General" default="`${srcError ? formatFrequency(0,0) : formatFrequency(frequency,solvedAccuracy)}`" visible="true" editable="false" desc="The calculated resulting FLL output frequency" />
  </Parameters>
  <DRCs>
    <DRC type="ERROR" text="Source clock for FLL is not enabled" condition="`${srcNotUsed}`" >
      <FixIt action="ENABLE_BLOCK" target="`${sourceClockRsc}`" value="" valid="true" />
    </DRC>
    <DRC type="ERROR" text="Source clock for FLL is outside the valid range of 1 kHz - 100 MHz" condition="`${!srcError &amp;&amp; (sourceFrequency &lt; 1000) || (sourceFrequency &gt; 100000000)}`" />
    <DRC type="ERROR" text="The desired FLL frequency `${desiredFrequency}` MHz is higher than the maximum operating frequency `${maxFrequency}` MHz of the device" condition="`${!usingUlp &amp;&amp; desiredFrequency &gt; maxFrequency}`" paramId="desiredFrequency" />
    <DRC type="ERROR" text="The desired FLL frequency `${desiredFrequency}` MHz exceeds the maximum of 50 MHz when the ULP mode is used" condition="`${usingUlp &amp;&amp; desiredFrequency &gt; 50}`" paramId="desiredFrequency" />
  </DRCs>
  <ConfigFirmware>
    <ConfigInclude value="cy_sysclk.h" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_ENABLED" value="1" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_MULT" value="`${multiplier}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_REFDIV" value="`${reference}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_CCO_RANGE" value="`${getTclVar(&quot;ccoRange&quot;, callSolver)}`" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_ENABLE_OUTDIV" value="`${getTclVar(&quot;enableOutputDiv&quot;, callSolver)}`" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_LOCK_TOLERANCE" value="`${tolerance}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_IGAIN" value="`${getTclVar(&quot;igain&quot;, callSolver)}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_PGAIN" value="`${getTclVar(&quot;pgain&quot;, callSolver)}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_SETTLING_COUNT" value="`${getTclVar(&quot;settlingCount&quot;, callSolver)}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_OUTPUT_MODE" value="`${getTclVar(&quot;outputMode&quot;, callSolver)}`" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_CCO_FREQ" value="`${getTclVar(&quot;cco_Freq&quot;, callSolver)}`U" public="false" include="true" />
    <ConfigDefine name="CY_CFG_SYSCLK_FLL_OUT_FREQ" value="`${frequency}`" public="false" include="true" />
    <ConfigStruct name="`${INST_NAME . &quot;_fllConfig&quot;}`" type="cy_stc_fll_manual_config_t" const="true" public="false" include="true" guard="((!CY_CPU_CORTEX_M4) || (!defined(CY_DEVICE_SECURE)))" >
      <Member name="fllMult" value="`${multiplier}`U" />
      <Member name="refDiv" value="`${reference}`U" />
      <Member name="ccoRange" value="`${getTclVar(&quot;ccoRange&quot;, callSolver)}`" />
      <Member name="enableOutputDiv" value="`${getTclVar(&quot;enableOutputDiv&quot;, callSolver)}`" />
      <Member name="lockTolerance" value="`${tolerance}`U" />
      <Member name="igain" value="`${getTclVar(&quot;igain&quot;, callSolver)}`U" />
      <Member name="pgain" value="`${getTclVar(&quot;pgain&quot;, callSolver)}`U" />
      <Member name="settlingCount" value="`${getTclVar(&quot;settlingCount&quot;, callSolver)}`U" />
      <Member name="outputMode" value="`${getTclVar(&quot;outputMode&quot;, callSolver)}`" />
      <Member name="cco_Freq" value="`${getTclVar(&quot;cco_Freq&quot;, callSolver)}`U" />
    </ConfigStruct>
    <ConfigFunction signature="__STATIC_INLINE void Cy_SysClk_FllInit()" body="    if (CY_SYSCLK_SUCCESS != Cy_SysClk_FllManualConfigure(&amp;`${INST_NAME}`_fllConfig))&#xA;    {&#xA;        cycfg_ClockStartupError(CY_CFG_SYSCLK_FLL_ERROR);&#xA;    }&#xA;    if (CY_SYSCLK_SUCCESS != Cy_SysClk_FllEnable(200000UL))&#xA;    {&#xA;        cycfg_ClockStartupError(CY_CFG_SYSCLK_FLL_ERROR);&#xA;    }" public="false" include="true" guard="((!CY_CPU_CORTEX_M4) || (!defined(CY_DEVICE_SECURE)))" />
  </ConfigFirmware>
</Personality>