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


<!--****************************************************************************
* \file opamp.cypersonality
* \version 1.0
*
* \brief
* OpAmp 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="mxs40opamp" name="OpAmp" version="1.0" path="Analog/Amplifiers" xmlns="http://cypress.com/xsd/cyhwpersonality_v1">
  <Dependencies>
    <IpBlock name="mxs40pass,mxs40pass_ver2" />
    <Resource name="pass\.ctb\.oa" used="true" />
  </Dependencies>
  <ExposedMembers />
  <Parameters>
      <!--
    <ParamChoice id="mode" name="Mode" group="General" default="CY_CTB_MODE_OPAMP" visible="true" editable="true" desc="This parameter defines feedback routing of the Opamp." >
        <Entry name="Opamp" value="CY_CTB_MODE_OPAMP" visible="true" />
        <Entry name="Follower" value="CY_CTB_MODE_FOLLOWER" visible="true" />
    </ParamChoice>
    -->
    <!-- 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="The Power parameter allows you to select the power level. Higher operating current increases the Opamp bandwidth." >
      <Entry name="Off" value="CY_CTB_POWER_OFF" visible="false" />
      <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="outputCurrent" name="Output Drive" group="General" default="CY_CTB_MODE_OPAMP1X" visible="true" editable="true" desc="This parameter selects an output drive mode. Selecting Output to pin allows for connections to device pins with 10x more drive current." >
        <Entry name="Output to pin" value="CY_CTB_MODE_OPAMP10X" visible="true" />
        <Entry name="Internal only" value="CY_CTB_MODE_OPAMP1X" 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="ctbNum" name="CTB instance" group="Internal" default="`${getInstNumber(&quot;ctb&quot;)}`" visible="`${debug}`" editable="false" desc="Selected CTBM" />
    <ParamString id="opampNum" name="Opamp instance" group="Internal" default="`${getInstNumber(&quot;oa&quot;)}`" visible="`${debug}`" editable="false" desc="Selected Opamp within 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="isSysAnalogEnabled" 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" />
    <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 opamp 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="" />

    <!-- Signals -->
    <ParamSignal port="vplus[0]" name="Vplus Input" group="Connections" visible="true" desc="Positive Opamp Input" canBeEmpty="false" />
    <ParamSignal port="vminus[0]" name="Vminus Input" group="Connections" visible="true" desc="Negative Opamp Input" canBeEmpty="false" >
    </ParamSignal>
    <ParamSignal port="out_10x[0]" name="Output (to pin)" group="Connections" visible="`${outputCurrent eq &quot;CY_CTB_MODE_OPAMP10X&quot;}`" desc="Opamp Output to pin" canBeEmpty="`${outputCurrent ne &quot;CY_CTB_MODE_OPAMP10X&quot;}`" />
    <ParamSignal port="out_1x[0]" name="Output (internal only)" group="Connections" visible="`${outputCurrent eq &quot;CY_CTB_MODE_OPAMP1X&quot;}`" desc="Opamp Output to internal" canBeEmpty="`${outputCurrent ne &quot;CY_CTB_MODE_OPAMP1X&quot;}`" >
        <Constraint type="DENY" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="`${outputCurrent eq &quot;CY_CTB_MODE_OPAMP1X&quot;}`" >        
        </Constraint>
    </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)." />    
  </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`${ctbNum}`" public="true" include="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="`${outputCurrent}`" />
      <Member name="oaPump" value="`${(deepSleep &amp;&amp; !deepSleepClk) ? &quot;CY_CTB_PUMP_DISABLE&quot; : &quot;CY_CTB_PUMP_ENABLE&quot;}`" />
      <Member name="oaCompEdge" value="CY_CTB_COMP_EDGE_BOTH" />
      <Member name="oaCompLevel" value="CY_CTB_COMP_DSI_TRIGGER_OUT_PULSE"/>
      <Member name="oaCompBypass" value="CY_CTB_COMP_BYPASS_SYNC"/>
      <Member name="oaCompHyst" value="CY_CTB_COMP_HYST_DISABLE"/>
      <Member name="oaCompIntrEn" value="false"/>
    </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>