1<?xml version="1.0" encoding="utf-8"?> 2 3 4<!--**************************************************************************** 5* \file ezi2c.cypersonality 6* \version 3.0 7* 8* \brief 9* EZI2C personality description file. It Supports CAT1A, CAT1B and CAT1C family of devices. 10* 11******************************************************************************** 12* \copyright 13* Copyright 2022 Cypress Semiconductor Corporation 14* SPDX-License-Identifier: Apache-2.0 15* 16* Licensed under the Apache License, Version 2.0 (the "License"); 17* you may not use this file except in compliance with the License. 18* You may obtain a copy of the License at 19* 20* http://www.apache.org/licenses/LICENSE-2.0 21* 22* Unless required by applicable law or agreed to in writing, software 23* distributed under the License is distributed on an "AS IS" BASIS, 24* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25* See the License for the specific language governing permissions and 26* limitations under the License. 27*****************************************************************************--> 28 29<Personality id="ezi2c" name="EZI2C" version="3.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v8"> 30 <Dependencies> 31 <IpBlock name="mxscb,mxscb_ver2_s40e,mxs22scb"> 32 <Version major="1"/> 33 <Version major="2" /> 34 <Version major="4" /> 35 <Param name="I2C" value="1" /> 36 <Param name="I2C_S" value="1" /> 37 </IpBlock> 38 <Resource name="scb" /> 39 <OperatingMode value="MCU"/> 40 </Dependencies> 41 <ExposedMembers /> 42 <Parameters> 43 <!-- PDL documentation --> 44 <ParamDoc id="pdlDoc" name="Configuration Help" group="Overview" default="file:///`${cy_libs_path()}`/docs/pdl_api_reference_manual/html/group__group__scb__ezi2c.html" linkText="Open EZI2C (SCB) Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" /> 45 46 <ParamChoice id="DataRate" name="Data Rate (kbps)" group="General" default="100" visible="true" editable="true" desc="Data rate that EZI2C operates."> 47 <Entry name="100" value="100" visible="true" /> 48 <Entry name="400" value="400" visible="true" /> 49 <Entry name="1000" value="1000" visible="true" /> 50 </ParamChoice> 51 52 <ParamChoice id="NumOfAddr" name="Number of Addresses" group="General" default="CY_SCB_EZI2C_ONE_ADDRESS" visible="true" editable="true" desc="This parameter specifies whether 1 or 2 independent I2C slave addresses are recognized."> 53 <Entry name="1" value="CY_SCB_EZI2C_ONE_ADDRESS" visible="true" /> 54 <Entry name="2" value="CY_SCB_EZI2C_TWO_ADDRESSES" visible="true" /> 55 </ParamChoice> 56 <ParamRange id="SlaveAddress1" name="Primary Slave Address (7-bit)" group="General" default="8" min="8" max="120" resolution="1" visible="true" editable="true" desc="This parameter specifies the 7-bit right justified primary slave address. The range: 0x08-0x78." /> 57 <ParamRange id="SlaveAddress2" name="Secondary Slave Address (7-bit)" group="General" default="9" min="8" max="120" resolution="1" visible="`${NumOfAddr eq CY_SCB_EZI2C_TWO_ADDRESSES}`" editable="true" desc="This parameter specifies the 7-bit right justified secondary slave address. The range: 0x08-0x78." /> 58 <ParamChoice id="SubAddrSize" name="Sub-Address Size" group="General" default="CY_SCB_EZI2C_SUB_ADDR8_BITS" visible="true" editable="true" desc="This option determines what range in the slave buffer can be accessed by the master. For a sub-address size of 8 bits, the master can only access a buffer in the range between 0 and 255. Whereas for 16 bits, the master can access a buffer in the range between 0 and 65,535."> 59 <Entry name="8 bits" value="CY_SCB_EZI2C_SUB_ADDR8_BITS" visible="true" /> 60 <Entry name="16 bits" value="CY_SCB_EZI2C_SUB_ADDR16_BITS" visible="true" /> 61 </ParamChoice> 62 <ParamBool id="EnableWakeup" name="Enable Wakeup from Deep Sleep Mode" group="General" default="false" visible="`${DEEPSLEEP eq 1}`" editable="true" desc="This parameter enables the EZI2C slave to wake the system from Deep Sleep when a slave address match occurs." /> 63 64 <!-- SCB I2C Slave clock constraints --> 65 <ParamString id="ScbClkMinMHz" name="ScbClkMinMHz" group="Internal" default="`${(DataRate eq 100) ? 1.55 : (DataRate eq 400) ? 7.82 : 15.84}`" visible="false" editable="false" desc="Minimum clock frequency to operate with desired data rate." /> 66 <ParamString id="ScbClkMaxMHz" name="ScbClkMaxMHz" group="Internal" default="`${(DataRate eq 100) ? 12.8 : (DataRate eq 400) ? 15.38 : 89.0}`" visible="false" editable="false" desc="Maximum clock frequency to operate with desired data rate." /> 67 68 <!-- Connections --> 69 <ParamSignal port="clock[0]" name="Clock" group="Connections" visible="`${hasVisibleOption("clock[0]")}`" desc="Clock that operates this block." canBeEmpty="false" > 70 <Constraint type="REQUIRE" targetLocation="peri\[\d+\](\.group\[\d+\])?\.div_.*" valid="true" > 71 <Parameter id="intDivider" severity="ERROR" reason="The clock frequency must be within the range `${ScbClkMinMHz}` - `${ScbClkMaxMHz}` MHz to operate with Data Rate `${DataRate}` kbps." valid="true"> 72 <Range 73 min="`${ceil(getExposedMember("REF_LOCATION", "frequency") * getExposedMember("REF_LOCATION", "divider") / (ScbClkMaxMHz * 1000000))}`" 74 max="`${floor(getExposedMember("REF_LOCATION", "frequency") * getExposedMember("REF_LOCATION", "divider") / (ScbClkMinMHz * 1000000))}`" /> 75 </Parameter> 76 </Constraint> 77 <Constraint type="ACCEPT" targetLocation="peri\[\d+\](\.group\[\d+\])?\.div_(16.5|24.5).*" valid="true" > 78 <Parameter id="fracDivider" severity="ERROR" reason="Fractional divider must be 0 for I2C interface."> 79 <Fixed value= "0" /> 80 </Parameter> 81 </Constraint> 82 </ParamSignal> 83 <ParamSignal port="clock_scb_en[0]" name="Clock" group="Connections" visible="`${hasVisibleOption("clock_scb_en[0]")}`" desc="Clock that operates this block." canBeEmpty="false" > 84 <Constraint type="REQUIRE" targetLocation="peri\[\d+\](\.group\[\d+\])?\.div_.*" valid="true" > 85 <Parameter id="intDivider" severity="ERROR" reason="The clock frequency must be within the range `${ScbClkMinMHz}` - `${ScbClkMaxMHz}` MHz to operate with Data Rate `${DataRate}` kbps." valid="true"> 86 <Range 87 min="`${ceil(getExposedMember("REF_LOCATION", "frequency") * getExposedMember("REF_LOCATION", "divider") / (ScbClkMaxMHz * 1000000))}`" 88 max="`${floor(getExposedMember("REF_LOCATION", "frequency") * getExposedMember("REF_LOCATION", "divider") / (ScbClkMinMHz * 1000000))}`" /> 89 </Parameter> 90 </Constraint> 91 <Constraint type="ACCEPT" targetLocation="peri\[\d+\](\.group\[\d+\])?\.div_(16.5|24.5).*" valid="true" > 92 <Parameter id="fracDivider" severity="ERROR" reason="Fractional divider must be 0 for I2C interface."> 93 <Fixed value= "0" /> 94 </Parameter> 95 </Constraint> 96 </ParamSignal> 97 98 <!-- Clock Frequency --> 99 <ParamString id="sourceClock" name="sourceClock" group="Internal" default="`${(hasVisibleOption("clock[0]")) ? (getBlockFromSignal("clock[0]")) : (getBlockFromSignal("clock_scb_en[0]"))}`" visible="false" editable="false" desc="Source Clock Resource" /> 100 <ParamRange id="scbClkHz" name="scbClkHz" group="Internal" default="`${getExposedMember(sourceClock, "frequency")}`" min="1" max="200000000" resolution="1" visible="false" editable="false" desc="SCB clock frequency in kHz" /> 101 <ParamString id="ClkFreq" name="Clock Frequency" group="Connections" default="`${(scbClkHz < 1000000) ? (scbClkHz / 1000.0) . " kHz" : (scbClkHz / 1000000.0) . " MHz"}`" visible="true" editable="false" desc="Frequency of the connected clock" /> 102 103 <ParamSignal port="i2c_scl[0]" name="SCL" group="Connections" visible="true" desc="Serial clock (SCL) is the master-generated I2C clock." canBeEmpty="false"> 104 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 105 <Parameter id="DriveModes" severity="DEFAULT" reason=""> 106 <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" /> 107 </Parameter> 108 </Constraint> 109 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 110 <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected."> 111 <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" /> 112 </Parameter> 113 </Constraint> 114 <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> 115 </ParamSignal> 116 <ParamSignal port="i2c_sda[0]" name="SDA" group="Connections" visible="true" desc="Serial data (SDA) is the I2C data signal." canBeEmpty="false"> 117 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 118 <Parameter id="DriveModes" severity="DEFAULT" reason=""> 119 <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" /> 120 </Parameter> 121 </Constraint> 122 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 123 <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected."> 124 <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" /> 125 </Parameter> 126 </Constraint> 127 <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> 128 </ParamSignal> 129 130 <!-- Advanced --> 131 <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)." /> 132 133 <!-- SCB instance number --> 134 <ParamString id="InstNumber" name="InstNumber" group="Internal" default="`${getInstNumber("scb")}`" visible="false" editable="false" desc="SCB Instance name number." /> 135 <ParamString id="version" name="version number" group="Internal" default="`${getVersion()}`" visible="false" editable="false" desc="" /> 136 <ParamString id="ipName" name="IP name" group="Internal" default="`${getIpBlockName()}`" visible="false" editable="false" desc="" /> 137 138 <!-- Peripheral clock divider connection --> 139 <ParamBool id="pclkOk" name="PCLK Valid" group="Internal" default="`${(hasVisibleOption("clock[0]")) ? (hasConnection("clock", 0) && isBlockUsed(sourceClock)) : (hasConnection("clock_scb_en", 0) && isBlockUsed(sourceClock))}`" visible="false" editable="false" desc="Checks whether there is a PCLK connected and enabled." /> 140 141 <ParamString id="pclkSCBClockString" name="PCLK Destination Clock" group="Internal" default="PCLK_SCB`${InstNumber}`_CLOCK" visible="false" editable="false" desc="String variable used for PCLK_SCB_CLOCK." /> 142 <ParamString id="pclkSCBClockSCBENString" name="PCLK Destination Clock" group="Internal" default="PCLK_SCB`${InstNumber}`_CLOCK_SCB_EN" visible="false" editable="false" desc="String variable used only for PCLK_SCB_CLOCK_SCB_EN." /> 143 144 <ParamString id="pclkDst" name="PCLK Destination" group="Internal" default="`${(hasVisibleOption("clock[0]")) ? pclkSCBClockString : pclkSCBClockSCBENString }`" visible="false" editable="false" desc="Generates PCLK connection define." /> 145 146 </Parameters> 147 148 <ConfigFirmware> 149 <ConfigInclude value="cy_scb_ezi2c.h" include="true" /> 150 <ConfigInclude value="cy_sysclk.h" include="`${pclkOk}`" /> 151 <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" /> 152 <ConfigInclude value="cyhal.h" include="true" guard="defined (CY_USING_HAL)" /> 153 154 <ConfigDefine name="`${INST_NAME}`_HW" value="SCB`${InstNumber}`" public="true" include="true" /> 155 <ConfigDefine name="`${INST_NAME}`_IRQ" value="scb_`${InstNumber}`_interrupt_IRQn" public="true" include="true" /> 156 <ConfigStruct name="`${INST_NAME}`_config" type="cy_stc_scb_ezi2c_config_t" const="`${inFlash}`" public="true" include="true" > 157 <Member name="numberOfAddresses" value="`${NumOfAddr}`" /> 158 <Member name="slaveAddress1" value="`${SlaveAddress1}`U" /> 159 <Member name="slaveAddress2" value="`${(NumOfAddr ne CY_SCB_EZI2C_ONE_ADDRESS) ? SlaveAddress2 : "0"}`U" /> 160 <Member name="subAddressSize" value="`${SubAddrSize}`" /> 161 <Member name="enableWakeFromSleep" value="`${EnableWakeup ? "true" : "false"}`" /> 162 </ConfigStruct> 163 164 <ConfigStruct name="`${INST_NAME}`_obj" type="cyhal_resource_inst_t" const="true" public="true" include="true" guard="defined (CY_USING_HAL)"> 165 <Member name="type" value="CYHAL_RSC_SCB" /> 166 <Member name="block_num" value="`${getInstNumber("scb")}`U" /> 167 <Member name="channel_num" value="0U" /> 168 </ConfigStruct> 169 170 <ConfigStruct name="`${INST_NAME}`_clock" type="cyhal_clock_t" const="`${inFlash}`" public="true" include="true" guard="defined (CY_USING_HAL)"> 171 <Member name="block" value="`${getExposedMember(sourceClock, "hal_block")}`" /> 172 <Member name="channel" value="`${getExposedMember(sourceClock, "number")}`" /> 173 <Member name="reserved" value="false" /> 174 <Member name="funcs" value="NULL" /> 175 </ConfigStruct> 176 177 <ConfigStruct name="`${INST_NAME}`_hal_config" type="cyhal_ezi2c_configurator_t" const="`${inFlash}`" public="true" include="true" guard="defined (CY_USING_HAL)"> 178 <Member name="resource" value="&`${INST_NAME}`_obj" /> 179 <Member name="config" value="&`${INST_NAME}`_config" /> 180 <Member name="clock" value="&`${INST_NAME}`_clock" /> 181 </ConfigStruct> 182 183 <ConfigInstruction purpose="INITIALIZE" value="Cy_SysClk_PeriGroupSlaveInit(CY_MMIO_SCB`${InstNumber}`_PERI_NR, CY_MMIO_SCB`${InstNumber}`_GROUP_NR, CY_MMIO_SCB`${InstNumber}`_SLAVE_NR, CY_MMIO_SCB`${InstNumber}`_CLK_HF_NR);" include="`${(ipName eq "mxs22scb")}`" /> 184 <ConfigInstruction purpose="INITIALIZE" value="Cy_SysClk_PeriPclkAssignDivider(`${pclkDst}`, `${getExposedMember(sourceClock, "clockSel")}`);" include="`${(((version > 1) || (ipName eq "mxs22scb")) && pclkOk)}`" /> 185 <ConfigInstruction purpose="INITIALIZE" value="Cy_SysClk_PeriphAssignDivider(`${pclkDst}`, `${getExposedMember(sourceClock, "clockSel")}`);" include="`${((version eq 1) && pclkOk && (ipName ne "mxs22scb"))}`" /> 186 187 <ConfigInstruction purpose="RESERVE" value="cyhal_hwmgr_reserve(&`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" /> 188 </ConfigFirmware> 189</Personality> 190