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


<!--****************************************************************************
* \file comp.cypersonality
* \version 1.0
*
* \brief
* Comparator 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="mxs40comparator" name="Comparator" version="1.0" path="Analog/Comparators" xmlns="http://cypress.com/xsd/cyhwpersonality_v1">
  <Dependencies>
    <IpBlock name="mxs40pass,mxs40pass_ver2" />
    <Resource name="pass\.ctb\.oa" used="true" />
  </Dependencies>
  <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__ctb.html" linkText="Open CTB Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />

    <ParamChoice id="power" name="Power" group="General" default="CY_CTB_POWER_HIGH" visible="true" editable="true" desc="This parameter provides a way to optimize speed versus power consumption." >      
      <Entry name="Low" value="CY_CTB_POWER_LOW" visible="true" />
      <Entry name="Medium" value="CY_CTB_POWER_MEDIUM" visible="true" />
      <Entry name="High" value="CY_CTB_POWER_HIGH" visible="true" />
    </ParamChoice>
    <ParamChoice id="interrupt" name="Interrupt Edge" group="General" default="CY_CTB_COMP_EDGE_RISING" visible="true" editable="true" desc="This parameter defines the event that will cause a pulse to be generated on the comparator interrupt output and configures the Interrupt Mask. You can select the interrupt mode: Disable edge detect, Rising edge, Falling edge, or Both edges." >
      <Entry name="Rising edge" value="CY_CTB_COMP_EDGE_RISING" visible="true" />
      <Entry name="Falling edge" value="CY_CTB_COMP_EDGE_FALLING" visible="true" />
      <Entry name="Either edge" value="CY_CTB_COMP_EDGE_BOTH" visible="true" />
      <Entry name="Disable" value="CY_CTB_COMP_EDGE_DISABLE" visible="true" />
    </ParamChoice>
    <ParamChoice id="level" name="Comparator Output" group="General" default="CY_CTB_COMP_DSI_TRIGGER_OUT_LEVEL" visible="true" editable="true" desc="Configure whether the comparator output is pulse or level." >
      <Entry name="Pulse" value="CY_CTB_COMP_DSI_TRIGGER_OUT_PULSE" visible="true" />
      <Entry name="Level" value="CY_CTB_COMP_DSI_TRIGGER_OUT_LEVEL" visible="true" />      
    </ParamChoice>

    <!-- Internal Parameters -->
    <ParamBool id="debug" name="debug" group="Internal" default="false" visible="false" editable="false" desc="" />
    <ParamString id="version" name="version" group="Internal" default="`${getVersion()}`" visible="`${debug}`" editable="false" desc="" />
    <ParamBool id="verGt1" name="verGt1" desc="" group="Internal" default="`${version &gt; 1}`" visible="`${debug}`" editable="false" />
    <ParamString id="opampId" name="Opamp Used" group="Internal" default="`${getInstNumber(&quot;oa&quot;) ? &quot;CY_CTB_OPAMP_1&quot; : &quot;CY_CTB_OPAMP_0&quot;}`" visible="`${debug}`" editable="false" desc="Selected Opamp" />
    <ParamString id="instNum" name="CTB Instance" group="Internal" default="`${getInstNumber(&quot;ctb&quot;)}`" visible="`${debug}`" editable="false" desc="Selected CTBM" />    
    <ParamBool id="isArefEnabled" name="Is Aref Enabled" group="Internal" default="`${isBlockUsed(&quot;pass[0].aref[0]&quot;)}`" visible="`${debug}`" editable="false" desc="" />
    <ParamBool id="isSysAnalogEnabled" name="Is SysAnalog Enabled" group="Internal" default="`${isBlockUsed(&quot;pass[0]&quot;)}`" visible="`${debug}`" editable="false" desc="" />
    <ParamBool id="isCTBmClockEnabled" name="isCTBmClockEnabled" group="Internal" default="`${verGt1 ? isBlockUsed(&quot;pass[0].ctbmclk[0]&quot;) : false}`" visible="`${debug}`" editable="false" desc="" />
    <ParamBool id="isPumpClkEnabled" name="isPumpClkEnabled" group="Internal" default="`${verGt1 ? isCTBmClockEnabled : isSysAnalogEnabled}`" visible="`${debug}`" editable="false" desc="" />
    <ParamString id="clockRsc" name="clockRsc" group="Internal" default="`${verGt1 ? &quot;pass[0].ctbmclk[0]&quot; : &quot;pass[0]&quot;}`" visible="`${debug}`" editable="false" desc="" />
    <ParamString id="pumpClkHz" name="Opamp Pump Clock Freq" group="Internal" default="`${isPumpClkEnabled ? getExposedMember(clockRsc, &quot;frequency&quot;) : 0}`" visible="`${debug}`" editable="false" desc="Frequency of the Opamp Pump Clock in Hertz" />
    <ParamBool id="highPwr" name="Is Power High" group="Internal" default="`${power eq &quot;CY_CTB_POWER_HIGH&quot;}`" visible="`${debug}`" editable="false" desc="High power selected" /> 
    <!-- Internal Parameters -->

    <ParamBool id="hysteresis" name="Enable 10 mV Hysteresis" group="General" default="false" visible="true" editable="true" desc="This parameter gives you the ability to add approximately 10 mV of hysteresis to the comparator. This helps to ensure that slowly moving voltages or slightly noisy voltages do not cause the output to oscillate when the two input voltages are nearly equal." />    
    <ParamBool id="deepSleep" name="Deep Sleep Enable" group="General" default="`${isSysAnalogEnabled ? (getExposedMember(&quot;pass[0]&quot;, &quot;ctb&quot; . getInstNumber(&quot;ctb&quot;) . &quot;_deep_sleep&quot;)) : false}`" visible="true" editable="false" desc="Deep Sleep is configured in the Programmable Analog resource. When Deep Sleep is enabled, the input range of the comparator is reduced." />
    <ParamBool id="deepSleepClk" name="deepSleepClk" group="Internal" default="`${(deepSleep &amp;&amp; verGt1) ? (&quot;CY_CTB_CLK_PUMP_DEEPSLEEP&quot; eq getExposedMember(&quot;pass[0].ctbmclk[0]&quot;, &quot;clock&quot;)) : false}`" visible="`${debug}`" editable="false" desc="" />
    <ParamBool id="interruptEnable" name="Interrupt Enable" group="General" default="false" visible="true" editable="true" desc="Enable the comparator interrupt." />    
    <!-- Signals -->
    <ParamSignal port="vplus[0]" name="Vplus Input" group="Connections" visible="true" desc="Positive Comparator Input" canBeEmpty="false" />
    <ParamSignal port="vminus[0]" name="Vminus Input" group="Connections" visible="true" desc="Negative Comparator Input" canBeEmpty="false" />
    <ParamSignal port="dsi_ctb_cmp[0]" name="Output" group="Connections" visible="true" desc="Comparator Output" canBeEmpty="true" >
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="DEFAULT" reason="">
          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected.">
          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    
    <!--Config-->
    <ParamBool id="inFlash" name="Store Config in Flash" group="Advanced" default="true" visible="true" editable="true" desc="Controls whether the configuration structure is stored in flash (const, true) or SRAM (not const, false)." />
    <ParamChoice id="sync" name="Output Synchronization" group="Advanced" default="CY_CTB_COMP_BYPASS_SYNC" visible="true" editable="true" desc="Configure whether the comparator output is synchronized or not for triggering." >
      <Entry name="Sync" value="CY_CTB_COMP_BYPASS_SYNC" visible="true" />
      <Entry name="Async" value="CY_CTB_COMP_BYPASS_NO_SYNC" visible="true" />      
    </ParamChoice>
  </Parameters>
  
  <!--DRCs-->
  <DRCs>
    <DRC type="ERROR" text="The AREF resource must be enabled for `${INST_NAME}` to work." condition="`${!isArefEnabled}`" >
        <FixIt action="ENABLE_BLOCK" target="pass[0].aref[0]" value="mxs40aref-1.0" valid="true" />
    </DRC>
    <DRC type="ERROR" text="The Programmable Analog resource must be enabled for `${INST_NAME}` to work." condition="`${!isSysAnalogEnabled}`" >
        <FixIt action="ENABLE_BLOCK" target="pass[0]" value="mxs40sysanalog-1.0" valid="true" />
    </DRC>
    <DRC type="ERROR" text="The CTBM Clock resource must be enabled for `${INST_NAME}` to work." condition="`${verGt1 &amp;&amp; !isPumpClkEnabled}`" >
        <FixIt action="ENABLE_BLOCK" target="pass[0].ctbmclk[0]" value="mxs40ctbmclk-1.0" valid="true" />
    </DRC>
    <DRC type="ERROR" text="The charge pump clock must be within a range from 8 MHz - 10% to 24 MHz + 10%." condition="`${isPumpClkEnabled &amp;&amp; !deepSleepClk &amp;&amp; !highPwr &amp;&amp; ((pumpClkHz &lt; 7200000) || (pumpClkHz &gt; 26400000))}`" />
    <DRC type="ERROR" text="The charge pump clock must be within a range 24 MHz &#177; 10%." condition="`${isPumpClkEnabled &amp;&amp; !deepSleepClk &amp;&amp; highPwr &amp;&amp; ((pumpClkHz &lt; 21600000) || (pumpClkHz &gt; 26400000))}`" />
  </DRCs>
  
  <ConfigFirmware>
    <ConfigInclude value="cy_ctb.h" include="true" />
    <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" />
    
    <ConfigDefine name="`${INST_NAME}`_HW" value="CTBM`${instNum}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_IRQ" value="pass_interrupt_ctbs_IRQn" public="true" include="`${interruptEnable eq true}`" />
    <ConfigStruct name="`${INST_NAME . &quot;_config&quot;}`" type="cy_stc_ctb_opamp_config_t" const="`${inFlash}`" public="true" include="true">      
      <Member name="deepSleep" value="`${deepSleep ? &quot;CY_CTB_DEEPSLEEP_ENABLE&quot; : &quot;CY_CTB_DEEPSLEEP_DISABLE&quot;}`" />
      <Member name="oaPower" value="`${power}`" />
      <Member name="oaMode" value="CY_CTB_MODE_COMP" />
      <Member name="oaPump" value="`${(deepSleep &amp;&amp; !deepSleepClk) ? &quot;CY_CTB_PUMP_DISABLE&quot; : &quot;CY_CTB_PUMP_ENABLE&quot;}`" />
      <Member name="oaCompEdge" value="`${interrupt}`" />
      <Member name="oaCompLevel" value="`${level}`"/>
      <Member name="oaCompBypass" value="`${sync}`"/>
      <Member name="oaCompHyst" value="`${hysteresis ? &quot;CY_CTB_COMP_HYST_10MV&quot; : &quot;CY_CTB_COMP_HYST_DISABLE&quot;}`"/>
      <Member name="oaCompIntrEn" value="`${interruptEnable}`"/>       
    </ConfigStruct>

    <ConfigStruct name="`${INST_NAME}`_obj" type="cyhal_resource_inst_t" const="true" public="true" include="true" guard="defined (CY_USING_HAL)">
      <Member name="type" value="CYHAL_RSC_OPAMP" />
      <Member name="block_num" value="`${getInstNumber(&quot;ctb&quot;)}`U" />
      <Member name="channel_num" value="`${getInstNumber(&quot;oa&quot;)}`U" />
    </ConfigStruct>
    
    <ConfigInstruction value="cyhal_hwmgr_reserve(&amp;`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" />
  </ConfigFirmware>
</Personality>