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


<!--****************************************************************************
* \file uart.cypersonality
* \version 1.0
*
* \brief
* UART 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="mxs40uart" name="UART" version="1.0" path="Communications" xmlns="http://cypress.com/xsd/cyhwpersonality_v1">
  <Dependencies>
    <IpBlock name="mxscb">
      <Param name="UART" value="1" />
    </IpBlock>
    <Resource name="scb" 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__scb__uart.html" linkText="Open UART (SCB) Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />

    <!-- General -->
    <ParamChoice id="ComMode" name="Com Mode" group="General" default="CY_SCB_UART_STANDARD" visible="true" editable="true" desc="This parameter defines the sub-mode of UART as: Standard, SmartCard or IrDA.">
      <Entry name="Standard"  value="CY_SCB_UART_STANDARD"  visible="true" />
      <Entry name="SmartCard" value="CY_SCB_UART_SMARTCARD" visible="true" />
      <Entry name="IrDA"      value="CY_SCB_UART_IRDA"      visible="true" />
    </ParamChoice>
    <ParamBool id="Standard" name="Standard" group="Internal" default="`${ComMode eq CY_SCB_UART_STANDARD}`" visible="false" editable="false" desc="This parameter defines SmartCard." />
    <ParamBool id="SmartCard" name="SmartCard" group="Internal" default="`${ComMode eq CY_SCB_UART_SMARTCARD}`" visible="false" editable="false" desc="This parameter defines SmartCard." />
    <ParamBool id="IrDA" name="IrDA" group="Internal" default="`${ComMode eq CY_SCB_UART_IRDA}`" visible="false" editable="false" desc="This parameter defines SmartCard." />

    <ParamBool id="IrdaLowPower" name="Low Power Receiving" group="General" default="false" visible="`${IrDA}`" editable="true" desc="This parameter enables the low-power receiver option. Only applicable when Com Mode is IrDA."/>

    <ParamRange id="BaudRate" name="Baud Rate (bps)" group="General" default="115200" min="1" max="8000000" resolution="1" visible="true" editable="true" desc="Baud rate that UART operates. Maximum baud rate is 8 Mbps in LP mode and 3 Mbps in ULP mode." />

    <!--Oversample-->
    <ParamChoice id="Oversample" name="Oversample" group="General" default="8" visible="`${!IrDA}`" editable="true" desc="This parameter defines how many SCB clocks oversample the selected baud rate.">
      <Entry name="8"  value="8"  visible="true" />
      <Entry name="9"  value="9"  visible="true" />
      <Entry name="10" value="10" visible="true" />
      <Entry name="11" value="11" visible="true" />
      <Entry name="12" value="12" visible="true" />
      <Entry name="13" value="13" visible="true" />
      <Entry name="14" value="14" visible="true" />
      <Entry name="15" value="15" visible="true" />
      <Entry name="16" value="16" visible="true" />
    </ParamChoice>

    <ParamRange id="IrDAOversample" name="Oversample" group="General" default="16" min="16" max="16" resolution="1" visible="`${IrDA &amp;&amp; !IrdaLowPower}`" editable="false" desc="This parameter defines how many SCB clocks oversample the selected baud rate."/>

    <ParamRange id="IrDALpOversample" name="Oversample" group="General" default="`${(BaudRate eq 1200) ? 1536 : (BaudRate eq 2400) ? 768 : (BaudRate eq 9600) ? 192 : (BaudRate eq 19200) ? 96 : (BaudRate eq 38400) ? 48 : (BaudRate eq 57600) ? 32 : 16}`" min="16" max="1536" resolution="1" visible="`${IrDA &amp;&amp; IrdaLowPower}`" editable="false" desc="This parameter defines how many SCB clocks oversample the selected baud rate."/>

    <ParamString id="IrDAOversampleDefine" name="IrDAOversampleDefine" group="General" default="`${(BaudRate eq 1200) ? &quot;CY_SCB_UART_IRDA_LP_OVS1536&quot; : (BaudRate eq 2400) ?  &quot;CY_SCB_UART_IRDA_LP_OVS768&quot; : (BaudRate eq 9600) ?  &quot;CY_SCB_UART_IRDA_LP_OVS192&quot; : (BaudRate eq 19200) ? &quot;CY_SCB_UART_IRDA_LP_OVS96&quot; : (BaudRate eq 38400) ? &quot;CY_SCB_UART_IRDA_LP_OVS48&quot; : (BaudRate eq 57600) ? &quot;CY_SCB_UART_IRDA_LP_OVS32&quot; :  &quot;CY_SCB_UART_IRDA_LP_OVS16&quot;}`" visible="false" editable="false" desc="This parameter provides define for oversample in IrDA low receiver power mode."/>

    <ParamRange id="OversampleFinal" name="OversampleFinal" group="Internal" default="`${(Standard || SmartCard) ? Oversample : (IrDA &amp;&amp; !IrdaLowPower) ? IrDAOversample : IrDALpOversample}`" min="1" max="1536" resolution="1" visible="false" editable="false" desc="This parameter defines how many SCB clocks oversample the selected baud rate."/>

    <ParamChoice id="BitsOrder" name="Bit Order" group="General" default="CY_SCB_UART_LSB_FIRST" visible="true" editable="true" desc="This parameter defines the direction in which the serial data is transmitted. When set to the MSB first, the most-significant bit is transmitted first. When set to the LSB first, the least-significant bit is transmitted first.">
      <Entry name="MSB First" value="CY_SCB_UART_MSB_FIRST" visible="true" />
      <Entry name="LSB First" value="CY_SCB_UART_LSB_FIRST" visible="true" />
    </ParamChoice>
    <ParamChoice id="DataWidth" name="Data Width" group="General" default="8" visible="true" editable="true" desc="This option defines the width of a single data element in bits. The range: 5-9.">
      <Entry name="5 bits" value="5" visible="true" />
      <Entry name="6 bits" value="6" visible="true" />
      <Entry name="7 bits" value="7" visible="true" />
      <Entry name="8 bits" value="8" visible="true" />
      <Entry name="9 bits" value="9" visible="true" />
    </ParamChoice>
    <ParamChoice id="ParityType" name="Parity" group="General" default="CY_SCB_UART_PARITY_NONE" visible="`${Standard &amp;&amp; (DataWidth ne 9)}`" editable="true" desc="This parameter defines the functionality of the parity bit location in the transfer as None, Odd or Even.">
      <Entry name="Even" value="CY_SCB_UART_PARITY_EVEN" visible="true" />
      <Entry name="Odd"  value="CY_SCB_UART_PARITY_ODD"  visible="true" />
      <Entry name="None" value="CY_SCB_UART_PARITY_NONE" visible="true" />
    </ParamChoice>
    <ParamString id="MultiProcParity" name="Parity" group="General" default="None" visible="`${Standard &amp;&amp; (DataWidth eq 9)}`" editable="false" desc="Multi Processor Mode supports Parity = None" />
    <ParamString id="SmartCardParity" name="Parity" group="General" default="Even" visible="`${SmartCard}`" editable="false" desc="SmartCard supports Parity = Even" />
    <ParamString id="IrdaCardParity"  name="Parity" group="General" default="None" visible="`${IrDA}`" editable="false" desc="IrDA supports Parity = None" />
    <ParamChoice id="StopBits" name="Stop Bits" group="General" default="CY_SCB_UART_STOP_BITS_1" visible="`${!SmartCard}`" editable="true" desc="This parameter defines the number of stop bits.">
      <Entry name="1 bit"    value="CY_SCB_UART_STOP_BITS_1"   visible="true" />
      <Entry name="1.5 bits" value="CY_SCB_UART_STOP_BITS_1_5" visible="true" />
      <Entry name="2 bits"   value="CY_SCB_UART_STOP_BITS_2"   visible="true" />
      <Entry name="2.5 bits" value="CY_SCB_UART_STOP_BITS_2_5" visible="true" />
      <Entry name="3 bits"   value="CY_SCB_UART_STOP_BITS_3"   visible="true" />
      <Entry name="3.5 bits" value="CY_SCB_UART_STOP_BITS_3_5" visible="true" />
      <Entry name="4 bits"   value="CY_SCB_UART_STOP_BITS_4"   visible="true" />
    </ParamChoice>
    <ParamString id="SmartCardStopBits" name="Stop Bits" group="General" default="2 bits" visible="`${SmartCard}`" editable="false" desc="SmartCard supports Stop Bits = 2 bits." />

    <!-- EnableInputFilter -->
    <ParamBool id="EnableInputFilter" name="Enable Digital Filter" group="General" default="`${false}`" visible="`${ComMode ne CY_SCB_UART_IRDA}`" editable="true" desc="This parameter applies a digital 3-tap median filter to the UART input lines." />
    <ParamBool id="IrDAInputFilter" name="Enable Digital Filter" group="General" default="`${true}`" visible="`${IrDA}`" editable="false" desc="IrDA mode always enables digital filter." />

    <!-- Support RS-485 -->
    <ParamBool id="EnableTxEn" name="TX-Enable" group="Support RS-485" default="false" visible="`${!SmartCard}`" editable="true" desc="This parameter enables TX_EN output." />

    <!-- Hardware buffer size (defines FIFO size) -->
    <ParamRange id="hwBufferSize" name="Hardware Buffer Size" group="Internal" default="`${lookupExpression(&quot;EZ_DATA_NR&quot;)}`" min="0" max="512" resolution="1" visible="false" editable="false" desc="Hardware buffer size." />
    <ParamRange id="FifoLevelByte" name="FIFO Level (Byte)" group="Internal" default="`${(hwBufferSize / 2) - 1}`" min="1" max="512" resolution="1" visible="false" editable="false" desc="FIFO Level for byte entry." />
    <ParamRange id="FifoLevelHalfword" name="FIFO Level (Halfword)" group="Internal" default="`${(hwBufferSize / 4) - 1}`" min="1" max="512" resolution="1" visible="false" editable="false" desc="FIFO Level for byte entry." />
    <ParamRange id="FifoLevelMax" name="FIFO Level Max" group="Internal" default="`${(DataWidth &lt;= 8) ? FifoLevelByte : FifoLevelHalfword}`" min="1" max="512" resolution="1" visible="false" editable="false" desc="FIFO Level for byte entry." />

    <!--Flow Control-->
    <ParamBool id="FlowControl" name="Enable Flow Control" group="Flow Control" default="false" visible="`${!SmartCard}`" editable="true" desc="This parameter enables the cts input." />
    <ParamChoice id="CtsPolarity" name="CTS Polarity" group="Flow Control" default="CY_SCB_UART_ACTIVE_LOW" visible="`${!SmartCard}`" editable="true" desc="This parameter defines the active polarity of the CTS output signal as Active Low or Active High.">
      <Entry name="Active Low" value="CY_SCB_UART_ACTIVE_LOW" visible="true" />
      <Entry name="Active High" value="CY_SCB_UART_ACTIVE_HIGH" visible="true" />
    </ParamChoice>
    <ParamChoice id="RtsPolarity" name="RTS Polarity" group="Flow Control" default="CY_SCB_UART_ACTIVE_LOW" visible="`${!SmartCard}`" editable="true" desc="This parameter defines the active polarity of the RTS output signal as Active Low or Active High.">
      <Entry name="Active Low" value="CY_SCB_UART_ACTIVE_LOW" visible="true" />
      <Entry name="Active High" value="CY_SCB_UART_ACTIVE_HIGH" visible="true" />
    </ParamChoice>
    <ParamRange id="RtsTriggerLevel" name="RTS Activation Level" group="Flow Control" default="63" min="0" max="`${FifoLevelMax}`" resolution="1" visible="`${!SmartCard}`" editable="true" desc="This parameter determines the behavior of the RTS signal as follows: while the RX FIFO has fewer entries than the RTS Active When, the signal remains active; otherwise, the signal becomes inactive. The range: 0 – `${FifoLevelByte}` (when Data Width is less than or equal 8), and 0 - `${FifoLevelHalfword}` otherwise." />

    <ParamString id="Tx_out_descr" name="tx_out description" group="Internal" default="The transmitter output drives the output serial data to another device on the serial bus." visible="false" editable="false" desc="tx_out description" />
    <ParamString id="Rx_tx_out_descr" name="rx_tx_out description" group="Internal" default="The receive and transmit output receives and transmits data from/to another device on the bus. This pin presents if the Com Mode parameter is SmartCard. Note that Drive Mode of the connected pin must be Open Drain Drives Low." visible="false" editable="false" desc="rx_tx_out description" />

    <ParamString id="Rts_out_descr" name="rts_out description" group="Internal" default="The request to send output notifies another device that this device is ready to receive data." visible="false" editable="false" desc="rts_out description" />
    <ParamString id="Tx_out_en_descr" name="tx_out_en description" group="Internal" default="The transmitter enable keeps the output level high during serial data transfer." visible="false" editable="false" desc="tx_out_en description" />

    <!-- Clock Constraint -->
    <ParamRange id="uartClkHz" name="uartClkHz" group="Internal" default="`${BaudRate * OversampleFinal}`" min="0" max="400000000" resolution="1" visible="false" editable="false" desc="SCB UART clock to operate with desired baud rate." />
    <ParamRange  id="clkPeriHz" name="clkPeriHz" group="Internal" default="`${getExposedMember(&quot;srss[0].clock[0].periclk[0]&quot;, &quot;frequency&quot;)}`" min="0" max="400000000" resolution="1" visible="false" editable="false" desc="Clk_Peri frequency." />
    <ParamRange  id="uartDiv" name="uartDiv" group="Internal" default="`${clkPeriHz / cast(float, uartClkHz)}`" min="1" max="16777216" resolution="1" visible="false" editable="false" desc="UART pclk divider value." />
    <ParamBool id="useUartDiv8" name="useUartDiv8" group="Internal" default="`${(uartDiv &lt;= pow(2, 8))}`" visible="false" editable="false" desc="Checks whether 8-bit divider can be used for UART operation." />

    <ParamSignal port="clock[0]" name="Clock" group="Connections" visible="true" desc="Clock that operates this block." canBeEmpty="false" >
      <Constraint type="ACCEPT" targetLocation="peri\[\d+\]\.div_8.*" valid="`${useUartDiv8}`" >
        <Parameter id="intDivider" severity="ERROR" reason="Clock frequency does not match desired `${uartClkHz / 1000.0}` kHz.">
          <Fixed
            value="`${((getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) - floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) >= 0.5) ? ceil(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) : floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz)}`" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation="peri\[\d+\]\.div_16\[.*" valid="true" >
        <Parameter id="intDivider" severity="ERROR" reason="Clock frequency does not match desired `${uartClkHz / 1000.0}`kHz." >
          <Fixed
            value="`${((getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) - floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) >= 0.5) ? ceil(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) : floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz)}`" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation="peri\[\d+\]\.div_(16.5|24.5).*" valid="true" >
        <Parameter id="intDivider" severity="ERROR" reason="Update integer divider. Clock frequency does not match desired `${uartClkHz / 1000.0}`kHz." >
          <Fixed
            value="`${floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / cast(float, uartClkHz))}`" />
        </Parameter>
        <Parameter id="fracDivider" severity="ERROR" reason="Update fractional divider. Clock frequency does not match desired `${uartClkHz / 1000.0}`kHz." >
          <Fixed
            value="`${((((getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) - floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz)) * 32.0) - floor(((getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) - floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz)) * 32.0) >= 0.5) ? (ceil(((getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) - floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz)) * 32.0) == 32 ? 31 : ceil(((getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) - floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz)) * 32.0)) : floor(((getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz) - floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / uartClkHz)) * 32.0)}`" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>

    <ParamString id="sourceClock" name="sourceClock" group="Internal" default="`${getBlockFromSignal(&quot;clock[0]&quot;)}`" visible="false" editable="false" desc="Source clock resource" />
    <ParamRange  id="scbClkHz" name="scbClkHz" group="Internal" default="`${getExposedMember(sourceClock, &quot;frequency&quot;)}`" min="0" max="200000000" resolution="1" visible="false" editable="false" desc="SCB clock frequency in kHz" />
    <ParamBool id="pClkDiv8" name="pClkDiv8" group="Internal" default="`${getExposedMember(sourceClock, &quot;type&quot;) eq &quot;CY_SYSCLK_DIV_8_BIT&quot;}`" visible="false" editable="false" desc="Source clock uses 8-bit divider." />

    <ParamSignal port="uart_rx[0]" name="RX" group="Connections" visible="`${!SmartCard &amp;&amp; hasVisibleOption(&quot;uart_rx[0]&quot;)}`" desc="The receive input receives the serial data from another device on the serial bus." canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="`${!SmartCard}`" >
        <Parameter id="DriveModes" severity="DEFAULT" reason="">
          <Fixed value="CY_GPIO_DM_HIGHZ" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="`${!SmartCard}`" >
        <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected.">
          <Fixed value="CY_GPIO_DM_HIGHZ" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>

    <ParamSignal port="uart_cts[0]" name="`${EnableTxEn ? &quot;TX_EN&quot; : &quot;CTS&quot;}`" group="Connections" visible="`${!SmartCard &amp;&amp; (FlowControl || EnableTxEn)  &amp;&amp; hasVisibleOption(&quot;uart_cts[0]&quot;)}`" desc="The clear to send input accepts notification that another device is ready to receive data." canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="`${!SmartCard &amp;&amp; (FlowControl || EnableTxEn)}`" >
        <Parameter id="DriveModes" severity="DEFAULT" reason="">
          <Fixed value="`${EnableTxEn ? &quot;CY_GPIO_DM_STRONG_IN_OFF&quot; : &quot;CY_GPIO_DM_HIGHZ&quot;}`" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="`${!SmartCard &amp;&amp; (FlowControl || EnableTxEn)}`" >
        <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected.">
          <Fixed value="`${EnableTxEn ? &quot;CY_GPIO_DM_STRONG_IN_OFF&quot; : &quot;CY_GPIO_DM_HIGHZ&quot;}`" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>

    <ParamSignal port="uart_tx[0]" name="`${SmartCard ? &quot;RX_TX&quot; : &quot;TX&quot;}`" group="Connections" visible="`${hasVisibleOption(&quot;uart_tx[0]&quot;)}`" desc="`${SmartCard ? Rx_tx_out_descr : Tx_out_descr}`" canBeEmpty="`${!SmartCard}`">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="DEFAULT" reason="">
          <Fixed value="`${SmartCard ? &quot;CY_GPIO_DM_OD_DRIVESLOW&quot; : &quot;CY_GPIO_DM_STRONG_IN_OFF&quot;}`" />
        </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="`${SmartCard ? &quot;CY_GPIO_DM_OD_DRIVESLOW&quot; : &quot;CY_GPIO_DM_STRONG_IN_OFF&quot;}`" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>

    <ParamSignal port="uart_rts[0]" name="RTS" group="Connections" visible="`${!SmartCard &amp;&amp; FlowControl &amp;&amp; hasVisibleOption(&quot;uart_rts[0]&quot;)}`" desc="`${Rts_out_descr}`" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="`${!SmartCard &amp;&amp; FlowControl}`" >
        <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="`${!SmartCard &amp;&amp; FlowControl}`" >
        <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>

    <ParamSignal port="tr_rx_req[0]" name="RX Trigger Output" group="Connections" visible="`${hasVisibleOption(&quot;uart_rx[0]&quot;)}`" desc="Connects SCB RX trigger output to the DMA. Configure RX FIFO Level to define this output behavior." 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>
    <ParamSignal port="tr_tx_req[0]" name="TX Trigger Output" group="Connections" visible="`${hasVisibleOption(&quot;uart_tx[0]&quot;)}`" desc="Connects SCB TX trigger output to the DMA. Configure RX FIFO Level to define this output behavior." 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>

    <!--Baud Rate-->
    <ParamRange id="actualBaudRate" name="Actual Baud Rate (bps)" group="Actual Baud Rate" default="`${scbClkHz/OversampleFinal}`" min="0" max="4294967295" resolution="1" visible="true" editable="false" desc="The actual baud rate displays the baud rate at which the UART operates with current settings." />
    <ParamRange id="BaudRateAccuracy" name="Baud Rate Accuracy (%)" group="Actual Baud Rate" default="`${(abs(BaudRate - actualBaudRate) / BaudRate) * 100}`" min="0" max="200000000" resolution="0.001" visible="true" editable="false" desc="Deviation of actual baud rate from desired baud rate (does not include Clk_Peri accuracy)." />
    <ParamString id="ClkFreq" name="Clock Frequency" group="Actual Baud Rate" default="`${(scbClkHz &lt; 1000000) ? (scbClkHz / 1000.0) . &quot; kHz&quot; : (scbClkHz / 1000000.0) . &quot; MHz&quot;}`" visible="true" editable="false" desc="Frequency of the connected clock" />

    <ParamRange id="RxTriggerLevel" name="RX FIFO Level" group="Trigger Level" default="63" min="0" max="`${FifoLevelMax}`" resolution="1" visible="true" editable="true" desc="This parameter determines the behavior of the signal which drives the RX FIFO Above Level interrupt source and the RX Trigger Output as follows: the signal remains active until the number of data elements in the RX FIFO is greater than the value of the RX FIFO Level. For example, the RX FIFO has 8 data elements and the RX FIFO level is 0. The signal remains active until all data elements are read from the RX FIFO. The range: 0 – `${FifoLevelByte}` (when Data Width is less or equal 8), and 0 - `${FifoLevelHalfword}` otherwise." />

    <ParamRange id="TxTriggerLevel" name="TX FIFO Level" group="Trigger Level" default="63" min="0" max="`${FifoLevelMax}`" resolution="1" visible="true" editable="true" desc="This parameter determines the behavior of the signal which drives the TX FIFO below-level interrupt source and TX Trigger Output as follows: until the number of data elements in the TX FIFO is less than the value of TX FIFO level. For example, the TX FIFO has 0 data elements (empty) and the TX FIFO level is 7. The signal remains active until TX FIFO has 7 data elements. The range: 0 – `${FifoLevelByte}` (when Data Width is less or equal 8), and 0 - `${FifoLevelHalfword}` otherwise." />

    <!--Multi Processor Mode-->
    <ParamBool id="MultiProc" name="Enable Multi Processor Mode" group="Multi Processor Mode" default="false" visible="`${!SmartCard}`" editable="true" desc="This parameter enables the UART multi-processor mode. Only applicable when Com Mode is Standard." />
    <ParamRange id="MpRxAddress" name="Address" group="Multi Processor Mode" default="0" min="0" max="255" resolution="1" visible="`${!SmartCard}`" editable="true" desc="This parameter specifies the UART address. Only applicable when the Enable Multi Processor Mode parameter is true." />
    <ParamRange id="MpRxAddressMask" name="Mask" group="Multi Processor Mode" default="255" min="0" max="255" resolution="1" visible="`${!SmartCard}`" editable="true" desc="This parameter specifies the UART address mask. Only applicable when the Enable Multi Processor Mode parameter is true.
    - Bit value 0 – excludes a bit from the address comparison.
    - Bit value 1 – the bit needs to match with the corresponding bit of the UART address." />
    <ParamBool id="MpRxAcceptAddress" name="Accept Matching Address in RX FIFO" group="Multi Processor Mode" default="false" visible="`${!SmartCard}`" editable="true" desc="This parameter determines whether to put the matched UART address into the RX FIFO. Only applicable when the Enable Multi Processor Mode parameter is true." />

    <!-- Drop options -->
    <ParamBool id="DropOnFrameErr" name="Drop on Frame Error" group="Advanced" default="false" visible="true" editable="true" desc="This parameter determines if the data is dropped from the RX FIFO on a frame error event." />
    <ParamBool id="DropOnParityErr" name="Drop on Parity Error" group="Advanced" default="false" visible="true" editable="true" desc="This parameter determines if the data is dropped from the RX FIFO on a parity error event." />

    <!--Break Width-->
    <ParamRange id="BreakSignalBits" name="Break Signal Bits" group="Advanced" default="11" min="7" max="16" resolution="1" visible="`${Standard}`" editable="true" desc="This parameter specifies the break width in bits. The range: 7-16." />

    <!--Smart Card-->
    <ParamBool id="SmCardRetryOnNack" name="Retry on Nack" group="Advanced" default="false" visible="`${SmartCard}`" editable="true" desc="This parameter defines whether to send a message again when a NACK response is received. Only applicable when Com Mode is SmartCard." />

    <!--IrDA-->
    <ParamChoice id="IrdaPolarity" name="Invert RX" group="Advanced" default="NON_INVERTING" visible="`${IrDA}`" editable="true" desc="This parameter enables the inversion of the incoming RX line signal. Only applicable when Com Mode is IrDA.">
      <Entry name="Non-Inverting" value="NON_INVERTING" visible="true" />
      <Entry name="Inverting" value="INVERTING" visible="true" />
    </ParamChoice>

    <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)." />

    <!-- API Mode -->
    <ParamChoice id="ApiMode" name="API Mode" group="API Mode" default="HIGH_LEVEL" visible="true" editable="true" desc="This parameter defines which API set will be used during driver operation. High Level means driver controls interrupt sources and Cy_SCB_UART_Interrupt function must be called in the interrupt handler hooked to NVIC. Low Level means that the user configures interrupt sources and implements own interrupt handler or do not use interrupt at all.">
      <Entry name="High Level" value="HIGH_LEVEL" visible="true" />
      <Entry name="Low Level"  value="LOW_LEVEL"  visible="true" />
    </ParamChoice>
    <ParamBool id="ConfigIntr" name="ConfigIntr" group="Internal" default="`${ApiMode eq LOW_LEVEL}`" visible="false" editable="false" desc="This parameter specifies the visibility of all RX Interrupt Sources parameter." />

    <!--RX Interrupt Sources-->
    <ParamBool id="IntrRxNotEmpty" name="RX FIFO not Empty" group="RX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the RX FIFO not-empty interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrRxFull" name="RX FIFO Full" group="RX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the RX FIFO full interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrRxOverflow" name="RX FIFO Overflow" group="RX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the RX FIFO overflow interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrRxUnderflow" name="RX FIFO Underflow" group="RX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the RX FIFO underflow interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrRxFrameErr" name="RX Frame Error" group="RX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the RX frame error interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrRxParityErr" name="RX Parity Error" group="RX Interrupt Sources" default="false" visible="`${ConfigIntr &amp;&amp; (ParityType ne CY_SCB_UART_PARITY_NONE)}`" editable="true" desc="This parameter enables the RX parity error interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrRxBreakDetected" name="Break Detected" group="RX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the RX break detection interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrRxTrigger" name="RX FIFO Above Level" group="RX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the RX FIFO above-level interrupt source to trigger the interrupt output." />

    <ParamRange id="RxIntrMask" name="RxIntrMask" group="RX Interrupt Sources" default="`${ConfigIntr ? (IntrRxTrigger ? 0x1 : 0) + (IntrRxNotEmpty ? 0x4 : 0) + (IntrRxFull ? 0x08 : 0) + (IntrRxOverflow ? 0x20 : 0) + (IntrRxUnderflow ? 0x40 : 0) + (IntrRxFrameErr ? 0x100 : 0) + (((ParityType ne CY_SCB_UART_PARITY_NONE) &amp;&amp; IntrRxParityErr) ? 0x200 : 0) + (IntrRxBreakDetected ? 0x800 : 0) : 0}`" min="0" max="4294967295" resolution="1" visible="false" editable="false" desc="This parameter defines the RX interrupt mask to be written into the SCB.INTR_RX_MASK register." />

    <!--TX Interrupt Sources-->
    <ParamBool id="IntrTxUartDone" name="UART Done" group="TX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the UART done interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrTxUartLostArb" name="TX Lost Arbitratio" group="TX Interrupt Sources" default="false" visible="`${ConfigIntr &amp;&amp; SmartCard}`" editable="true" desc="This parameter enables the TX lost arbitration interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrTxUartNack" name="TX NACK" group="TX Interrupt Sources" default="false" visible="`${ConfigIntr &amp;&amp; SmartCard}`" editable="true" desc="This parameter enables the TX NACK interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrTxEmpty" name="TX FIFO Empty" group="TX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the TX FIFO empty interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrTxNotFull" name="TX FIFO not Full" group="TX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the TX FIFO not-full interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrTxOverflow" name="TX FIFO Overflow" group="TX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the TX FIFO overflow interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrTxUnderflow" name="TX FIFO Underflow" group="TX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the TX FIFO underflow interrupt source to trigger the interrupt output." />
    <ParamBool id="IntrTxTrigger" name="TX FIFO Below Level" group="TX Interrupt Sources" default="false" visible="`${ConfigIntr}`" editable="true" desc="This parameter enables the TX FIFO below-level interrupt source to trigger the interrupt output." />

    <ParamRange id="TxIntrMask" name="Tx Intr Masks" group="TX Interrupt Sources" default="`${ConfigIntr ? (IntrTxTrigger ?  0x1 : 0) + (IntrTxNotFull ?  0x2 : 0) + (IntrTxEmpty ? 0x10 : 0) + (IntrTxOverflow ? 0x20 : 0) + (IntrTxUnderflow ?  0x40 : 0) + (IntrTxUartDone ? 0x200 : 0) + (((SmartCard) &amp;&amp; IntrTxUartNack) ? 0x100 : 0) + (((SmartCard) &amp;&amp; IntrTxUartLostArb) ? 0x400 : 0) : 0}`" min="0" max="4294967295" resolution="1" visible="false" editable="false" desc="This parameter defines the TX interrupt mask to be written into the SCB.INTR_TX_MASK register." />

    <!-- SCB instance number -->
    <ParamString id="InstNumber" name="InstNumber" group="Internal" default="`${getInstNumber(&quot;scb&quot;)}`" visible="false" editable="false" desc="SCB Instance name number." />

    <!-- Peripheral clock divider connection -->
    <ParamBool id="pclkOk" name="PCLK Valid" group="Internal" default="`${hasConnection(&quot;clock&quot;, 0) &amp;&amp; isBlockUsed(sourceClock)}`" visible="false" editable="false" desc="Checks whether there is a PCLK connected and enabled." />
    <ParamString id="pclkDst" name="PCLK Destination" group="Internal" default="PCLK_SCB`${InstNumber}`_CLOCK" visible="false" editable="false" desc="Generates PCLK connection define." />
  </Parameters>

  <DRCs>
    <!-- DRC: 8-bit clock divider must not be used -->
    <DRC type="ERROR" text="Wider clock divider resolution is required for UART to operate with baud rate `${BaudRate}` bps." paramId="clock[0]" condition="`${!useUartDiv8 &amp;&amp; pClkDiv8}`" />

    <!-- DRC: BaudRate for IrDA mode -->
    <DRC type="ERROR" text="The baud rate value must be 115200, 57600, 38400, 19200, 9600, 2400 or 1200 bps when the IrDA mode is selected." paramId="BaudRate" condition="`${(IrDA) ? !((BaudRate eq 1200) || (BaudRate eq 2400) || (BaudRate eq 9600) || (BaudRate eq 19200) || (BaudRate eq 38400) || (BaudRate eq 57600) || (BaudRate eq 115200)) : false}`" />

    <!-- DRC: checks DataWidth for Multi Processor -->
    <DRC type="ERROR" text="To enable multi processor mode set Com Mode = Standard and Data Width = 9 bits." paramId="MultiProc" condition="`${MultiProc ? (!Standard || (DataWidth ne 9)) : false}`" />

    <!-- DRC: checks that DataWidth = 9 is valid -->
    <DRC type="ERROR" text="Only Standard mode supports 9 bits data width." paramId="DataWidth" condition="`${(!Standard &amp;&amp; (DataWidth eq 9))}`" />

    <!-- DRC: checks break signal length in bits -->
    <DRC type="ERROR" text="The break signal bits value must be at least by 2 bits greater than Data Width and less than or equal 16." paramId="BreakSignalBits" condition="`${(BreakSignalBits &lt; (DataWidth + 2)) ? true : false}`" />

    <!-- DRC: checks EnableTxEn and FlowControl usage -->
    <DRC type="ERROR" paramId="EnableTxEn" text="The FlowControl and TX-Enable options are mutually exclusive." condition="`${(EnableTxEn &amp;&amp; FlowControl) ? true : false}`" />

    <!-- DRC: checks pins availability for SmartCard mode -->
    <DRC type="ERROR" paramId="ComMode" text="The SmartCard mode is not supported for the selected SCB (Serial Communicaiton Block)." condition="`${SmartCard &amp;&amp; !hasVisibleOption(&quot;uart_tx[0]&quot;)}`" />

    <!-- DRC: checks pins availability for EnableTxEn  -->
    <DRC type="ERROR" paramId="EnableTxEn" text="The TX-Enable option is not supported for the selected SCB (Serial Communicaiton Block)." condition="`${EnableTxEn &amp;&amp; !hasVisibleOption(&quot;uart_cts[0]&quot;)}`" />

    <!-- DRC: checks pins availability for SmartCard mode -->
    <DRC type="ERROR" paramId="FlowControl" text="The Flow Control option is not supported for the selected SCB (Serial Communicaiton Block)." condition="`${FlowControl &amp;&amp; !hasVisibleOption(&quot;uart_rts[0]&quot;) &amp;&amp; !hasVisibleOption(&quot;uart_cts[0]&quot;)}`" />
  </DRCs>

  <ConfigFirmware>
    <ConfigInclude value="cy_scb_uart.h" include="true" />
    <ConfigInclude value="cy_sysclk.h" include="`${pclkOk}`" />
    <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" />

    <ConfigDefine name="`${INST_NAME}`_HW" value="SCB`${InstNumber}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_IRQ" value="scb_`${InstNumber}`_interrupt_IRQn" public="true" include="true" />
    <ConfigStruct name="`${INST_NAME}`_config" type="cy_stc_scb_uart_config_t" const="`${inFlash}`" public="true" include="true">
      <Member name="uartMode" value="`${ComMode}`" />
      <Member name="enableMutliProcessorMode" value="`${MultiProc ? &quot;true&quot; : &quot;false&quot;}`" />
      <Member name="smartCardRetryOnNack" value="`${(SmartCard &amp;&amp; SmCardRetryOnNack) ? &quot;true&quot; : &quot;false&quot;}`" />
      <Member name="irdaInvertRx" value="`${(IrDA &amp;&amp; (IrdaPolarity eq INVERTING)) ? &quot;true&quot; : &quot;false&quot;}`" />
      <Member name="irdaEnableLowPowerReceiver" value="`${(IrDA &amp;&amp; IrdaLowPower) ? &quot;true&quot; : &quot;false&quot;}`" />

      <Member name="oversample" value="`${(Standard || SmartCard) ? Oversample : (IrDA &amp;&amp; !IrdaLowPower) ? IrDAOversample : IrDAOversampleDefine}`" />

      <Member name="enableMsbFirst" value="`${(BitsOrder eq CY_SCB_UART_MSB_FIRST) ? &quot;true&quot; : &quot;false&quot;}`" />
      <Member name="dataWidth" value="`${DataWidth}`UL" />
      <Member name="parity" value="`${(Standard &amp;&amp; (DataWidth ne 9)) ? ParityType : (SmartCard) ? &quot;CY_SCB_UART_PARITY_EVEN&quot; : &quot;CY_SCB_UART_PARITY_NONE&quot;}`" />
      <Member name="stopBits" value="`${StopBits}`" />
      <Member name="enableInputFilter" value="`${((IrDA) ? &quot;true&quot; : EnableInputFilter) ? &quot;true&quot; : &quot;false&quot;}`" />
      <Member name="breakWidth" value="`${BreakSignalBits}`UL" />
      <Member name="dropOnFrameError" value="`${DropOnFrameErr}`" />
      <Member name="dropOnParityError" value="`${((ParityType ne CY_SCB_UART_PARITY_NONE) &amp;&amp; DropOnParityErr) ? &quot;true&quot; : &quot;false&quot;}`" />

      <Member name="receiverAddress"     value="`${MultiProc ? MpRxAddress : &quot;0x0UL&quot;}`" />
      <Member name="receiverAddressMask" value="`${MultiProc ? MpRxAddressMask : &quot;0x0UL&quot;}`" />
      <Member name="acceptAddrInFifo"    value="`${(MultiProc &amp;&amp; MpRxAcceptAddress) ? &quot;true&quot; : &quot;false&quot;}`" />

      <Member name="enableCts"      value="`${FlowControl ? &quot;true&quot; : &quot;false&quot;}`" />
      <Member name="ctsPolarity"    value="`${FlowControl ? CtsPolarity : &quot;CY_SCB_UART_ACTIVE_LOW&quot;}`" />
      <Member name="rtsRxFifoLevel" value="`${FlowControl ? RtsTriggerLevel : &quot;0UL&quot;}`" />
      <Member name="rtsPolarity"    value="`${FlowControl ? RtsPolarity : &quot;CY_SCB_UART_ACTIVE_LOW&quot;}`" />

      <Member name="rxFifoTriggerLevel"  value="`${RxTriggerLevel}`UL" />
      <Member name="rxFifoIntEnableMask" value="`${RxIntrMask}`UL" />

      <Member name="txFifoTriggerLevel"  value="`${TxTriggerLevel}`UL" />
      <Member name="txFifoIntEnableMask" value="`${TxIntrMask}`UL" />
    </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_SCB" />
      <Member name="block_num" value="`${getInstNumber(&quot;scb&quot;)}`U" />
      <Member name="channel_num" value="0U" />
    </ConfigStruct>

    <ConfigInstruction value="Cy_SysClk_PeriphAssignDivider(`${pclkDst}`, `${getExposedMember(sourceClock, &quot;clockSel&quot;)}`);" include="`${pclkOk}`" />
    <ConfigInstruction value="cyhal_hwmgr_reserve(&amp;`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" />
  </ConfigFirmware>
</Personality>