<?xml version="1.0" encoding="utf-8"?> <!--**************************************************************************** * \file ezi2c.cypersonality * \version 1.0 * * \brief * EZI2C 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="mxs40ezi2c" name="EZI2C" version="1.0" path="Communications" xmlns="http://cypress.com/xsd/cyhwpersonality_v1"> <Dependencies> <IpBlock name="mxscb"> <Param name="I2C" value="1" /> <Param name="I2C_S" 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__ezi2c.html" linkText="Open EZI2C (SCB) Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" /> <ParamChoice id="DataRate" name="Data Rate (kbps)" group="General" default="100" visible="true" editable="true" desc="Data rate that EZI2C operates."> <Entry name="100" value="100" visible="true" /> <Entry name="400" value="400" visible="true" /> <Entry name="1000" value="1000" visible="true" /> </ParamChoice> <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."> <Entry name="1" value="CY_SCB_EZI2C_ONE_ADDRESS" visible="true" /> <Entry name="2" value="CY_SCB_EZI2C_TWO_ADDRESSES" visible="true" /> </ParamChoice> <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." /> <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." /> <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."> <Entry name="8 bits" value="CY_SCB_EZI2C_SUB_ADDR8_BITS" visible="true" /> <Entry name="16 bits" value="CY_SCB_EZI2C_SUB_ADDR16_BITS" visible="true" /> </ParamChoice> <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." /> <!-- SCB I2C Slave clock constraints --> <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." /> <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." /> <!-- Connections --> <ParamSignal port="clock[0]" name="Clock" group="Connections" visible="true" desc="Clock that operates this block." canBeEmpty="false" > <Constraint type="REQUIRE" targetLocation="peri\[\d+\]\.div_.*" valid="true" > <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"> <Range min="`${ceil(getExposedMember("REF_LOCATION", "frequency") * getExposedMember("REF_LOCATION", "divider") / (ScbClkMaxMHz * 1000000))}`" max="`${floor(getExposedMember("REF_LOCATION", "frequency") * getExposedMember("REF_LOCATION", "divider") / (ScbClkMinMHz * 1000000))}`" /> </Parameter> </Constraint> <Constraint type="ACCEPT" targetLocation="peri\[\d+\]\.div_(16.5|24.5).*" valid="true" > <Parameter id="fracDivider" severity="ERROR" reason="Fractional divider must be 0 for I2C interface."> <Fixed value= "0" /> </Parameter> </Constraint> </ParamSignal> <!-- Clock Frequency --> <ParamString id="sourceClock" name="sourceClock" group="Internal" default="`${getBlockFromSignal("clock[0]")}`" visible="false" editable="false" desc="Source Clock Resource" /> <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" /> <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" /> <ParamSignal port="i2c_scl[0]" name="SCL" group="Connections" visible="true" desc="Serial clock (SCL) is the master-generated I2C clock." canBeEmpty="false"> <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > <Parameter id="DriveModes" severity="DEFAULT" reason=""> <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" /> </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_OD_DRIVESLOW" /> </Parameter> </Constraint> <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> </ParamSignal> <ParamSignal port="i2c_sda[0]" name="SDA" group="Connections" visible="true" desc="Serial data (SDA) is the I2C data signal." canBeEmpty="false"> <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > <Parameter id="DriveModes" severity="DEFAULT" reason=""> <Fixed value="CY_GPIO_DM_OD_DRIVESLOW" /> </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_OD_DRIVESLOW" /> </Parameter> </Constraint> <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> </ParamSignal> <!-- Advanced --> <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)." /> <!-- SCB instance number --> <ParamString id="InstNumber" name="InstNumber" group="Internal" default="`${getInstNumber("scb")}`" visible="false" editable="false" desc="SCB Instance name number." /> <!-- Peripheral clock divider connection --> <ParamBool id="pclkOk" name="PCLK Valid" group="Internal" default="`${hasConnection("clock", 0) && 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> <ConfigFirmware> <ConfigInclude value="cy_scb_ezi2c.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_ezi2c_config_t" const="`${inFlash}`" public="true" include="true"> <Member name="numberOfAddresses" value="`${NumOfAddr}`" /> <Member name="slaveAddress1" value="`${SlaveAddress1}`U" /> <Member name="slaveAddress2" value="`${(NumOfAddr ne CY_SCB_EZI2C_ONE_ADDRESS) ? SlaveAddress2 : "0"}`U" /> <Member name="subAddressSize" value="`${SubAddrSize}`" /> <Member name="enableWakeFromSleep" value="`${EnableWakeup ? "true" : "false"}`" /> </ConfigStruct> <ConfigStruct name="`${INST_NAME}`_obj" type="cyhal_resource_inst_t" const="true" public="true" include="true" guard="defined (CY_USING_HAL)"> <Member name="type" value="CYHAL_RSC_SCB" /> <Member name="block_num" value="`${getInstNumber("scb")}`U" /> <Member name="channel_num" value="0U" /> </ConfigStruct> <ConfigInstruction value="Cy_SysClk_PeriphAssignDivider(`${pclkDst}`, `${getExposedMember(sourceClock, "clockSel")}`);" include="`${pclkOk}`" /> <ConfigInstruction value="cyhal_hwmgr_reserve(&`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" /> </ConfigFirmware> </Personality>