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


<!--****************************************************************************
* \file smif.cypersonality
* \version 1.2
*
* \brief
* Quad Serial Peripheral Interface (QSPI) 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="mxs40smif" name="Quad Serial Peripheral Interface (QSPI)" version="1.2" path="Communications" xmlns="http://cypress.com/xsd/cyhwpersonality_v1">
  <Dependencies>
    <IpBlock name="mxsmif" />
    <Resource name="smif" 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__smif.html" linkText="Open SMIF Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />

    <!-- Clocks -->
    <ParamSignal port="clk_hf[0]" name="HF Clock" group="Clocks" visible="true" desc="High frequency source clock" canBeEmpty="false" />
    <ParamSignal port="clk_if[0]" name="Interface Clock" group="Clocks" visible="true" desc="Transmission interface clock" canBeEmpty="false" />
    <ParamSignal port="spi_clk[0]" name="SPI Clock" group="Clocks" visible="true" desc="The Serial Clock (SCLK) to the slave devices" canBeEmpty="false">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer off'.">
          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    
    <ParamString id="smifIfSource" name="smifIfSource" group="Internal" default="`${getBlockFromSignal(&quot;clk_if[0]&quot;)}`" visible="false" editable="false" desc="Interface Source Clock Resource" />
    <ParamRange  id="smifIfClkHz" name="smifIfClkHz" group="Internal" default="`${getExposedMember(smifIfSource, &quot;frequency&quot;)}`" min="1" max="200000000" resolution="1" visible="false" editable="false" desc="SMIF IF clock frequency in Hz." />

  
    <!-- External tools -->
    <ParamString id="cfgFileName" name="cfgFileName" group="External Tools" default="design.cyqspi" visible="false" editable="false" desc="" />
    <ParamString id="cfgFilePath" name="cfgFilePath" group="External Tools" default="`${cy_design_path() . &quot;/&quot; . cfgFileName}`" visible="false" editable="false" desc="" />
    
    <ParamCustom id="configurator" name="QSPI Configurator" group="External Tools" default="0" path="`${cy_tools_path(&quot;qspi-configurator&quot;) . &quot;/qspi-configurator&quot;}`" modal="false" visible="true" editable="true" desc="Launch QSPI Configurator tool">
      <Arg value="`${&quot;--config=&quot; . cfgFilePath}`" />
      <Arg value="`${&quot;--output-dir=&quot; . cy_codegen_path()}`" />
    </ParamCustom>
  
    <!-- Data -->
    <ParamSignal port="spi_data0[0]" name="SPI Data[0]" group="Data" visible="`${hasVisibleOption(&quot;spi_data0[0]&quot;)}`" desc="Data line 0 to be used by the QSPI block, must be used in conjunction with Data line 1" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer on'.">
          <Fixed value="CY_GPIO_DM_STRONG" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_data1[0]" name="SPI Data[1]" group="Data" visible="`${hasVisibleOption(&quot;spi_data1[0]&quot;)}`" desc="Data line 1 to be used by the QSPI block, must be used in conjunction with Data line 0" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer on'.">
          <Fixed value="CY_GPIO_DM_STRONG" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_data2[0]" name="SPI Data[2]" group="Data" visible="`${hasVisibleOption(&quot;spi_data2[0]&quot;)}`" desc="Data line 2 to be used by the QSPI block, must be used in conjunction with Data line 3" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer on'.">
          <Fixed value="CY_GPIO_DM_STRONG" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_data3[0]" name="SPI Data[3]" group="Data" visible="`${hasVisibleOption(&quot;spi_data3[0]&quot;)}`" desc="Data line 3 to be used by the QSPI block, must be used in conjunction with Data line 2" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer on'.">
          <Fixed value="CY_GPIO_DM_STRONG" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_data4[0]" name="SPI Data[4]" group="Data" visible="`${(CHIP_TOP.DATA8_PRESENT == 1) &amp;&amp; hasVisibleOption(&quot;spi_data4[0]&quot;)}`" desc="Data line 4 to be used by the QSPI block, must be used in conjunction with Data line 5" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer on'.">
          <Fixed value="CY_GPIO_DM_STRONG" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_data5[0]" name="SPI Data[5]" group="Data" visible="`${(CHIP_TOP.DATA8_PRESENT == 1) &amp;&amp; hasVisibleOption(&quot;spi_data5[0]&quot;)}`" desc="Data line 5 to be used by the QSPI block, must be used in conjunction with Data line 4" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer on'.">
          <Fixed value="CY_GPIO_DM_STRONG" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_data6[0]" name="SPI Data[6]" group="Data" visible="`${(CHIP_TOP.DATA8_PRESENT == 1) &amp;&amp; hasVisibleOption(&quot;spi_data6[0]&quot;)}`" desc="Data line 6 to be used by the QSPI block, must be used in conjunction with Data line 7" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer on'.">
          <Fixed value="CY_GPIO_DM_STRONG" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_data7[0]" name="SPI Data[7]" group="Data" visible="`${(CHIP_TOP.DATA8_PRESENT == 1) &amp;&amp; hasVisibleOption(&quot;spi_data7[0]&quot;)}`" desc="Data line 7 to be used by the QSPI block, must be used in conjunction with Data line 6" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer on'.">
          <Fixed value="CY_GPIO_DM_STRONG" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>

    <!-- Select -->
    <ParamSignal port="spi_select0[0]" name="SPI Slave Select 0" group="Slave Select" visible="`${hasVisibleOption(&quot;spi_select0[0]&quot;)}`" desc="Select signal 0 to specifiy which memory device to communicate with" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer off'.">
          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_select1[0]" name="SPI Slave Select 1" group="Slave Select" visible="`${hasVisibleOption(&quot;spi_select1[0]&quot;)}`" desc="Select signal 1 to specifiy which memory device to communicate with" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer off'.">
          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_select2[0]" name="SPI Slave Select 2" group="Slave Select" visible="`${hasVisibleOption(&quot;spi_select2[0]&quot;)}`" desc="Select signal 2 to specifiy which memory device to communicate with" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer off'.">
          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>
    <ParamSignal port="spi_select3[0]" name="SPI Slave Select 3" group="Slave Select" visible="`${hasVisibleOption(&quot;spi_select3[0]&quot;)}`" desc="Select signal 3 to specifiy which memory device to communicate with" canBeEmpty="true">
      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
        <Parameter id="DriveModes" severity="ERROR" reason="Drive Mode must be set to 'Strong Drive. Input buffer off'.">
          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
        </Parameter>
      </Constraint>
      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
    </ParamSignal>

    <!-- Interrupt -->
    <ParamBool id="isrAlignment" name="Memory Mode Alignment Error" group="Interrupt" default="false" visible="true" editable="true" desc="An alignment error in the memory mode (XIP mode) is set as an interrupt cause" />
    <ParamBool id="isrUnderflow" name="RX Data FIFO Underflow" group="Interrupt" default="false" visible="true" editable="true" desc="The Rx Data FIFO underflow condition is set as an interrupt cause" />
    <ParamBool id="isrCmdOverflow" name="TX Command FIFO Overflow" group="Interrupt" default="false" visible="true" editable="true" desc="The TX command FIFO overflow condition is set as an interrupt cause" />
    <ParamBool id="isrDataOverflow" name="TX Data FIFO Overflow" group="Interrupt" default="false" visible="true" editable="true" desc="The TX data FIFO overflow condition is set as an interrupt cause" />
	
    <!-- DMA -->
    <ParamSignal port="tr_rx_req[0]" name="RX Trigger Output" group="DMA Triggers" visible="true" desc="Enables the RX trigger output terminal (tr_rx_req)" canBeEmpty="true" />
    <ParamRange id="rxTriggerLevel" name="RX FIFO Trigger Level" group="DMA Triggers" default="0" min="0" max="7" resolution="1" visible="true" editable="true" desc="The level that can trigger the RX FIFO to trigger an interrupt or a DMA request" />
    <ParamSignal port="tr_tx_req[0]" name="TX Trigger Output" group="DMA Triggers" visible="true" desc="enables the TX trigger output terminal (tr_tx_req)" canBeEmpty="true" />
    <ParamRange id="txTriggerLevel" name="TX FIFO Trigger Level" group="DMA Triggers" default="0" min="0" max="7" resolution="1" visible="true" editable="true" desc="The level that can trigger the TX FIFO to trigger an interrupt or a DMA request" />

    <!-- SMIF instance number -->
    <ParamString id="InstNumber" name="InstNumber" group="Internal" default="`${getInstNumber(&quot;smif&quot;)}`" visible="false" editable="false" desc="SMIF Instance name number." />
    
    <!-- Other -->
    <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)." />

    <!-- Helpers -->
    <Repeat count="8">
      <ParamBool id="hasConnection$idx" name="" group="Hidden" default="`${hasConnection(&quot;spi_data$idx&quot;, 0)}`" visible="false" editable="false" desc="" />
	</Repeat>
    <Repeat count="4">
      <ParamBool id="hasSelect$idx" name="" group="Hidden" default="`${hasConnection(&quot;spi_select$idx&quot;, 0)}`" visible="false" editable="false" desc="" />
	</Repeat>
    <ParamBool id="allDataConnected" name="" group="Hidden" default="`${hasConnection0 &amp;&amp; hasConnection2 &amp;&amp; hasConnection4 &amp;&amp; hasConnection6}`" visible="false" editable="false" desc="" />
    <ParamBool id="requireMultipleSelects" name="" group="Hidden" default="`${!allDataConnected &amp;&amp; ((hasConnection0 &amp;&amp; hasConnection4) || (hasConnection0 &amp;&amp; hasConnection6) || (hasConnection2 &amp;&amp; hasConnection4) || (hasConnection2 &amp;&amp; hasConnection6))}`" visible="false" editable="false" desc="" />
  </Parameters>
  
  <DRCs>  
    <DRC type="ERROR" text="SPI Data[0] and SPI Data[1] must be used together" condition="`${hasConnection0 != hasConnection1}`" paramId="spi_data0[0]" />
    <DRC type="ERROR" text="SPI Data[2] and SPI Data[3] must be used together" condition="`${hasConnection2 != hasConnection3}`" paramId="spi_data2[0]" />
    <DRC type="ERROR" text="SPI Data[4] and SPI Data[5] must be used together" condition="`${hasConnection4 != hasConnection5}`" paramId="spi_data4[0]" />
    <DRC type="ERROR" text="SPI Data[6] and SPI Data[7] must be used together" condition="`${hasConnection6 != hasConnection7}`" paramId="spi_data6[0]" />
    <DRC type="ERROR" text="At least two SPI Data signal must be connected" condition="`${!(hasConnection0 || hasConnection2 || hasConnection4 || hasConnection6)}`" paramId="spi_data0[0]" />
    <DRC type="ERROR" text="At least one SPI Select signal must be connected" condition="`${!(requireMultipleSelects || hasSelect0 || hasSelect1 || hasSelect2 || hasSelect3)}`" paramId="spi_select0[0]" />
    <DRC type="ERROR" text="At least two SPI Select signal must be connected" condition="`${requireMultipleSelects &amp;&amp; !((hasSelect0 &amp;&amp; hasSelect1) || (hasSelect0 &amp;&amp; hasSelect2) || (hasSelect0 &amp;&amp; hasSelect3) || (hasSelect1 &amp;&amp; hasSelect2) || (hasSelect1 &amp;&amp; hasSelect3) || (hasSelect2 &amp;&amp; hasSelect3))}`" paramId="spi_select0[0]"/>
    <DRC type="ERROR" text="Interface Clock must not be greater than 80 Mhz" condition="`${smifIfClkHz > 80000000}`" location="`${smifIfSource}`" />
  </DRCs>
  
  <ConfigFirmware>
    <!-- External tools -->
    <ConfigTool value="`${cy_tools_path(&quot;qspi-configurator&quot;) . &quot;/qspi-configurator-cli&quot;}`" include="true">
      <Arg value="`${&quot;--config=&quot; . cfgFilePath}`" />
      <Arg value="`${&quot;--output-dir=&quot; . cy_codegen_path()}`" />
    </ConfigTool>
    
    <ConfigInclude value="cy_smif.h" include="true" />
    <ConfigInclude value="cycfg_qspi_memslot.h" include="true" />
    <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" />
    
    <ConfigDefine name="`${INST_NAME}`_HW" value="SMIF`${InstNumber}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_IRQ" value="smif_interrupt_IRQn" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_MEMORY_MODE_ALIGMENT_ERROR" value="`${isrAlignment ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_RX_DATA_FIFO_UNDERFLOW" value="`${isrUnderflow ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_TX_COMMAND_FIFO_OVERFLOW" value="`${isrCmdOverflow ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_TX_DATA_FIFO_OVERFLOW" value="`${isrDataOverflow ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />

    <ConfigDefine name="`${INST_NAME}`_RX_FIFO_TRIGEER_LEVEL" value="(`${rxTriggerLevel}`UL)" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_TX_FIFO_TRIGEER_LEVEL" value="(`${txTriggerLevel}`UL)" public="true" include="true" />
	
    <ConfigDefine name="`${INST_NAME}`_DATALINES0_1" value="`${hasConnection0 ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_DATALINES2_3" value="`${hasConnection2 ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_DATALINES4_5" value="`${hasConnection4 ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_DATALINES6_7" value="`${hasConnection6 ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
	
    <ConfigDefine name="`${INST_NAME}`_SS0" value="`${hasSelect0 ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_SS1" value="`${hasSelect1 ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_SS2" value="`${hasSelect2 ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />
    <ConfigDefine name="`${INST_NAME}`_SS3" value="`${hasSelect3 ? &quot;(1UL)&quot; : &quot;(0UL)&quot;}`" public="true" include="true" />

    <ConfigDefine name="`${INST_NAME}`_DESELECT_DELAY" value="7" public="true" include="true" />
	
    <ConfigStruct name="`${INST_NAME . &quot;_config&quot;}`" type="cy_stc_smif_config_t" const="`${inFlash}`" public="true" include="true">
      <Member name="mode" value="(uint32_t)CY_SMIF_NORMAL" />
      <Member name="deselectDelay" value="`${INST_NAME}`_DESELECT_DELAY" />
      <Member name="rxClockSel" value="(uint32_t)CY_SMIF_SEL_INV_INTERNAL_CLK" />
      <Member name="blockEvent" value="(uint32_t)CY_SMIF_BUS_ERROR" />
    </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_SMIF" />
      <Member name="block_num" value="`${getInstNumber(&quot;smif&quot;)}`U" />
      <Member name="channel_num" value="0U" />
    </ConfigStruct>
    
    <ConfigInstruction value="cyhal_hwmgr_reserve(&amp;`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" />
  </ConfigFirmware>
</Personality>