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_v7">
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  </Dependencies>
40  <ExposedMembers />
41  <Parameters>
42    <!-- PDL documentation -->
43    <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" />
44
45    <ParamChoice id="DataRate" name="Data Rate (kbps)" group="General" default="100" visible="true" editable="true" desc="Data rate that EZI2C operates.">
46      <Entry name="100" value="100" visible="true" />
47      <Entry name="400" value="400" visible="true" />
48      <Entry name="1000" value="1000" visible="true" />
49    </ParamChoice>
50
51    <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.">
52      <Entry name="1" value="CY_SCB_EZI2C_ONE_ADDRESS" visible="true" />
53      <Entry name="2" value="CY_SCB_EZI2C_TWO_ADDRESSES" visible="true" />
54    </ParamChoice>
55    <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." />
56    <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." />
57    <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.">
58      <Entry name="8 bits" value="CY_SCB_EZI2C_SUB_ADDR8_BITS" visible="true" />
59      <Entry name="16 bits" value="CY_SCB_EZI2C_SUB_ADDR16_BITS" visible="true" />
60    </ParamChoice>
61    <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." />
62
63    <!-- SCB I2C Slave clock constraints -->
64    <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." />
65    <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." />
66
67    <!-- Connections -->
68    <ParamSignal port="clock[0]" name="Clock" group="Connections" visible="`${hasVisibleOption(&quot;clock[0]&quot;)}`" desc="Clock that operates this block." canBeEmpty="false" >
69      <Constraint type="REQUIRE" targetLocation="peri\[\d+\](\.group\[\d+\])?\.div_.*" valid="true" >
70        <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">
71          <Range
72            min="`${ceil(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / (ScbClkMaxMHz * 1000000))}`"
73            max="`${floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / (ScbClkMinMHz * 1000000))}`" />
74        </Parameter>
75      </Constraint>
76      <Constraint type="ACCEPT" targetLocation="peri\[\d+\](\.group\[\d+\])?\.div_(16.5|24.5).*" valid="true" >
77        <Parameter id="fracDivider" severity="ERROR" reason="Fractional divider must be 0 for I2C interface.">
78          <Fixed value= "0" />
79        </Parameter>
80      </Constraint>
81    </ParamSignal>
82    <ParamSignal port="clock_scb_en[0]" name="Clock" group="Connections" visible="`${hasVisibleOption(&quot;clock_scb_en[0]&quot;)}`" desc="Clock that operates this block." canBeEmpty="false" >
83      <Constraint type="REQUIRE" targetLocation="peri\[\d+\](\.group\[\d+\])?\.div_.*" valid="true" >
84        <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">
85          <Range
86            min="`${ceil(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / (ScbClkMaxMHz * 1000000))}`"
87            max="`${floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / (ScbClkMinMHz * 1000000))}`" />
88        </Parameter>
89      </Constraint>
90      <Constraint type="ACCEPT" targetLocation="peri\[\d+\](\.group\[\d+\])?\.div_(16.5|24.5).*" valid="true" >
91        <Parameter id="fracDivider" severity="ERROR" reason="Fractional divider must be 0 for I2C interface.">
92          <Fixed value= "0" />
93        </Parameter>
94      </Constraint>
95    </ParamSignal>
96
97    <!-- Clock Frequency -->
98    <ParamString id="sourceClock" name="sourceClock" group="Internal" default="`${(hasVisibleOption(&quot;clock[0]&quot;)) ? (getBlockFromSignal(&quot;clock[0]&quot;)) : (getBlockFromSignal(&quot;clock_scb_en[0]&quot;))}`" visible="false" editable="false" desc="Source Clock Resource" />
99    <ParamRange  id="scbClkHz" name="scbClkHz" group="Internal" default="`${getExposedMember(sourceClock, &quot;frequency&quot;)}`" min="1" max="200000000" resolution="1" visible="false" editable="false" desc="SCB clock frequency in kHz" />
100    <ParamString id="ClkFreq" name="Clock Frequency" group="Connections" 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" />
101
102    <ParamSignal port="i2c_scl[0]" name="SCL" group="Connections" visible="true" desc="Serial clock (SCL) is the master-generated I2C clock." canBeEmpty="false">
103      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
104        <Parameter id="DriveModes" severity="DEFAULT" reason="">
105          <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" />
106        </Parameter>
107      </Constraint>
108      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
109        <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected.">
110          <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" />
111        </Parameter>
112      </Constraint>
113      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
114    </ParamSignal>
115    <ParamSignal port="i2c_sda[0]" name="SDA" group="Connections" visible="true" desc="Serial data (SDA) is the I2C data signal." canBeEmpty="false">
116      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
117        <Parameter id="DriveModes" severity="DEFAULT" reason="">
118          <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" />
119        </Parameter>
120      </Constraint>
121      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
122        <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected.">
123          <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" />
124        </Parameter>
125      </Constraint>
126      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
127    </ParamSignal>
128
129    <!-- Advanced -->
130    <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)." />
131
132    <!-- SCB instance number -->
133    <ParamString id="InstNumber" name="InstNumber" group="Internal" default="`${getInstNumber(&quot;scb&quot;)}`" visible="false" editable="false" desc="SCB Instance name number." />
134    <ParamString id="version" name="version number" group="Internal" default="`${getVersion()}`" visible="false" editable="false" desc="" />
135    <ParamString id="ipName" name="IP name" group="Internal" default="`${getIpBlockName()}`" visible="false" editable="false" desc="" />
136
137    <!-- Peripheral clock divider connection -->
138    <ParamBool id="pclkOk" name="PCLK Valid" group="Internal" default="`${(hasVisibleOption(&quot;clock[0]&quot;)) ? (hasConnection(&quot;clock&quot;, 0) &amp;&amp; isBlockUsed(sourceClock)) : (hasConnection(&quot;clock_scb_en&quot;, 0) &amp;&amp; isBlockUsed(sourceClock))}`" visible="false" editable="false" desc="Checks whether there is a PCLK connected and enabled." />
139
140    <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." />
141    <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." />
142
143    <ParamString id="pclkDst" name="PCLK Destination" group="Internal" default="`${(hasVisibleOption(&quot;clock[0]&quot;)) ? pclkSCBClockString : pclkSCBClockSCBENString }`" visible="false" editable="false" desc="Generates PCLK connection define." />
144
145  </Parameters>
146
147  <ConfigFirmware>
148    <ConfigInclude value="cy_scb_ezi2c.h" include="true" />
149    <ConfigInclude value="cy_sysclk.h" include="`${pclkOk}`" />
150    <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" />
151
152    <ConfigDefine name="`${INST_NAME}`_HW" value="SCB`${InstNumber}`" public="true" include="true" />
153    <ConfigDefine name="`${INST_NAME}`_IRQ" value="scb_`${InstNumber}`_interrupt_IRQn" public="true" include="true" />
154    <ConfigStruct name="`${INST_NAME}`_config" type="cy_stc_scb_ezi2c_config_t" const="`${inFlash}`" public="true" include="true" >
155      <Member name="numberOfAddresses" value="`${NumOfAddr}`" />
156      <Member name="slaveAddress1" value="`${SlaveAddress1}`U" />
157      <Member name="slaveAddress2" value="`${(NumOfAddr ne CY_SCB_EZI2C_ONE_ADDRESS) ? SlaveAddress2 : &quot;0&quot;}`U" />
158      <Member name="subAddressSize" value="`${SubAddrSize}`" />
159      <Member name="enableWakeFromSleep" value="`${EnableWakeup ? &quot;true&quot; : &quot;false&quot;}`" />
160    </ConfigStruct>
161
162    <ConfigStruct name="`${INST_NAME}`_obj" type="cyhal_resource_inst_t" const="true" public="true" include="true" guard="defined (CY_USING_HAL)">
163      <Member name="type" value="CYHAL_RSC_SCB" />
164      <Member name="block_num" value="`${getInstNumber(&quot;scb&quot;)}`U" />
165      <Member name="channel_num" value="0U" />
166    </ConfigStruct>
167
168    <ConfigInstruction value="Cy_SysClk_PeriPclkAssignDivider(`${pclkDst}`, `${getExposedMember(sourceClock, &quot;clockSel&quot;)}`);" include="`${(((version &gt; 1) || (ipName eq &quot;mxs22scb&quot;)) &amp;&amp; pclkOk)}`"  />
169    <ConfigInstruction value="Cy_SysClk_PeriphAssignDivider(`${pclkDst}`, `${getExposedMember(sourceClock, &quot;clockSel&quot;)}`);" include="`${((version eq 1) &amp;&amp; pclkOk &amp;&amp; (ipName ne &quot;mxs22scb&quot;))}`"  />
170
171    <ConfigInstruction value="cyhal_hwmgr_reserve(&amp;`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" />
172  </ConfigFirmware>
173</Personality>
174