1<?xml version="1.0" encoding="utf-8"?> 2 3 4<!--**************************************************************************** 5* \file quaddec.cypersonality 6* \version 1.0 7* 8* \brief 9* Quadrature Decoder personality description file. 10* 11******************************************************************************** 12* \copyright 13* Copyright 2018-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="mxs40quaddac" name="Quadrature Decoder" version="1.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v7"> 30 <Dependencies> 31 <IpBlock name="mxtcpwm" /> 32 <Resource name="tcpwm\.cnt" /> 33 </Dependencies> 34 <ExposedMembers /> 35 <Parameters> 36 <!-- PDL documentation --> 37 <ParamDoc id="pdlDoc" name="Configuration Help" group="Overview" default="file:///`${cy_libs_path()}`/docs/pdl_api_reference_manual/html/group__group__tcpwm__quaddec.html" linkText="Open Quadrature Decoder (TCPWM) Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" /> 38 39 <!--General--> 40 <ParamChoice id="CounterSize" name="Quadrature Decoder Resolution" group="General" default="`${(CNT.CNT_WIDTH eq 16) ? "16" : "32"}`" visible="true" editable="false" desc="Sets the resolution of the counter"> 41 <Entry name="16-bits" value="16" visible="true" /> 42 <Entry name="32-bits" value="32" visible="true" /> 43 </ParamChoice> 44 <ParamChoice id="InterruptSource" name="Interrupt Source" group="General" default="CY_TCPWM_INT_NONE" visible="true" editable="true" desc="Selects which events can trigger an interrupt"> 45 <Entry name="None" value="CY_TCPWM_INT_NONE" visible="true" /> 46 <Entry name="Index" value="CY_TCPWM_INT_ON_TC" visible="true" /> 47 <Entry name="TC" value="CY_TCPWM_INT_ON_CC" visible="true" /> 48 <Entry name="Index or TC" value="CY_TCPWM_INT_ON_CC_OR_TC" visible="true" /> 49 </ParamChoice> 50 <ParamChoice id="Resolution" name="Quadrature Mode" group="General" default="CY_TCPWM_QUADDEC_X1" visible="true" editable="true" desc="Selects the quadrature encoding mode"> 51 <Entry name="x1" value="CY_TCPWM_QUADDEC_X1" visible="true" /> 52 <Entry name="x2" value="CY_TCPWM_QUADDEC_X2" visible="true" /> 53 <Entry name="x4" value="CY_TCPWM_QUADDEC_X4" visible="true" /> 54 </ParamChoice> 55 56 <!--Inputs--> 57 <ParamSignal port="clock[0]" name="Clock Signal" group="Inputs" visible="true" desc="The clock input defines the operating frequency." canBeEmpty="false" /> 58 <ParamChoice id="IndexInput" name="Index Input" group="Inputs" default="CY_TCPWM_INPUT_DISABLED" visible="true" editable="true" desc="Determines if an index is needed and what edge causes an index to occur"> 59 <Entry name="Rising Edge" value="CY_TCPWM_INPUT_RISINGEDGE" visible="true" /> 60 <Entry name="Falling Edge" value="CY_TCPWM_INPUT_FALLINGEDGE" visible="true" /> 61 <Entry name="Either Edge" value="CY_TCPWM_INPUT_EITHEREDGE" visible="true" /> 62 <Entry name="Disabled" value="CY_TCPWM_INPUT_DISABLED" visible="true" /> 63 </ParamChoice> 64 <ParamSignal port="reload[0]" name="Index Signal" group="Inputs" visible="`${IndexInput ne CY_TCPWM_INPUT_DISABLED}`" desc="This input causes an index (reload) event to occur (indicates a completed rotation to determine absolute position). This input is only visible if the IndexInput parameter is set to anything other than disabled." canBeEmpty="`${IndexInput eq CY_TCPWM_INPUT_DISABLED}`" > 65 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 66 <Parameter id="DriveModes" severity="DEFAULT" reason=""> 67 <Fixed value="CY_GPIO_DM_HIGHZ" /> 68 </Parameter> 69 </Constraint> 70 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 71 <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected."> 72 <Fixed value="CY_GPIO_DM_HIGHZ" /> 73 </Parameter> 74 </Constraint> 75 <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> 76 </ParamSignal> 77 78 <ParamSignal port="count[0]" name="PhiA Signal" group="Inputs" visible="true" desc="This is the phase A input it is always required." canBeEmpty="false" > 79 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 80 <Parameter id="DriveModes" severity="DEFAULT" reason=""> 81 <Fixed value="CY_GPIO_DM_HIGHZ" /> 82 </Parameter> 83 </Constraint> 84 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 85 <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected."> 86 <Fixed value="CY_GPIO_DM_HIGHZ" /> 87 </Parameter> 88 </Constraint> 89 <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> 90 </ParamSignal> 91 <ParamSignal port="start[0]" name="PhiB Signal" group="Inputs" visible="true" desc="This is the phase B input it is always required." canBeEmpty="false" > 92 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 93 <Parameter id="DriveModes" severity="DEFAULT" reason=""> 94 <Fixed value="CY_GPIO_DM_HIGHZ" /> 95 </Parameter> 96 </Constraint> 97 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 98 <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected."> 99 <Fixed value="CY_GPIO_DM_HIGHZ" /> 100 </Parameter> 101 </Constraint> 102 <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> 103 </ParamSignal> 104 105 <ParamChoice id="StopInput" name="Stop Input" group="Inputs" default="CY_TCPWM_INPUT_DISABLED" visible="true" editable="true" desc="Determines if a stop input is needed and what edges causes a stop to occur"> 106 <Entry name="Rising Edge" value="CY_TCPWM_INPUT_RISINGEDGE" visible="true" /> 107 <Entry name="Falling Edge" value="CY_TCPWM_INPUT_FALLINGEDGE" visible="true" /> 108 <Entry name="Either Edge" value="CY_TCPWM_INPUT_EITHEREDGE" visible="true" /> 109 <Entry name="Disabled" value="CY_TCPWM_INPUT_DISABLED" visible="true" /> 110 </ParamChoice> 111 <ParamSignal port="stop[0]" name="Stop Signal" group="Inputs" visible="`${StopInput ne CY_TCPWM_INPUT_DISABLED}`" desc="This input causes the Quad Dec to stop Counting. This input is only visible if the StopInput parameter is set to anything other than disabled." canBeEmpty="`${StopInput eq CY_TCPWM_INPUT_DISABLED}`" > 112 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 113 <Parameter id="DriveModes" severity="DEFAULT" reason=""> 114 <Fixed value="CY_GPIO_DM_HIGHZ" /> 115 </Parameter> 116 </Constraint> 117 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 118 <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected."> 119 <Fixed value="CY_GPIO_DM_HIGHZ" /> 120 </Parameter> 121 </Constraint> 122 <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> 123 </ParamSignal> 124 125 <!--Outputs--> 126 <ParamSignal port="tr_compare_match[0]" name="TC (cc_match)" group="Outputs" visible="true" desc="This output goes high on an index event, or when the count equals 0x0000 or `${(CNT.CNT_WIDTH eq 16) ? "0xffff" : "0xffffffff"}`." canBeEmpty="true" > 127 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 128 <Parameter id="DriveModes" severity="DEFAULT" reason=""> 129 <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" /> 130 </Parameter> 131 </Constraint> 132 <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" > 133 <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected."> 134 <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" /> 135 </Parameter> 136 </Constraint> 137 <Constraint type="ACCEPT" targetLocation=".*" valid="true" /> 138 </ParamSignal> 139 140 <!--Config--> 141 <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)." /> 142 143 <!-- Peripheral clock divider connection --> 144 <ParamRange id="tcpwmInst" name="TCPWM Number" group="Internal" default="`${getInstNumber("tcpwm")}`" min="0" max="127" resolution="1" visible="false" editable="false" desc="" /> 145 <ParamRange id="cntInst" name="CNT Number" group="Internal" default="`${getInstNumber("cnt")}`" min="0" max="31" resolution="1" visible="false" editable="false" desc="" /> 146 <ParamString id="definePrefix" name="Define prefix" group="Internal" default="`${"TCPWM" . tcpwmInst . "_CNT" . cntInst}`" visible="false" editable="false" desc="" /> 147 <ParamString id="defineInputDisabled" name="Define input disabled" group="Internal" default="`${INST_NAME . "_INPUT_DISABLED & 0x3U"}`" visible="false" editable="false" desc="" /> 148 <ParamString id="pclk" name="PCLK" group="Internal" default="`${getBlockFromSignal("clock[0]")}`" visible="false" editable="false" desc="Connected peripheral clock divider (PCLK)" /> 149 <ParamBool id="pclkOk" name="PCLK Valid" group="Internal" default="`${hasConnection("clock", 0) && isBlockUsed(pclk)}`" visible="false" editable="false" desc="Checks whether there is a PCLK connected and enabled" /> 150 <ParamString id="pclkDst" name="PCLK Destination" group="Internal" default="PCLK_TCPWM`${tcpwmInst}`_CLOCKS`${cntInst}`" visible="false" editable="false" desc="" /> 151 </Parameters> 152 153 <DRCs> 154 </DRCs> 155 156 <ConfigFirmware> 157 <ConfigInclude value="cy_tcpwm_quaddec.h" include="true" /> 158 <ConfigInclude value="cy_sysclk.h" include="`${pclkOk}`" /> 159 <ConfigInclude value="cycfg_routing.h" include="true" /> 160 <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" /> 161 <ConfigInclude value="cyhal.h" include="true" guard="defined (CY_USING_HAL)" /> 162 163 <ConfigDefine name="`${INST_NAME}`_HW" value="TCPWM`${tcpwmInst}`" public="true" include="true" /> 164 <ConfigDefine name="`${INST_NAME}`_NUM" value="`${cntInst}`UL" public="true" include="true" /> 165 <ConfigDefine name="`${INST_NAME}`_MASK" value="(1UL << `${cntInst}`)" public="true" include="true" /> 166 <ConfigDefine name="`${INST_NAME}`_IRQ" value="tcpwm_`${tcpwmInst}`_interrupts_`${cntInst}`_IRQn" public="true" include="`${InterruptSource ne CY_TCPWM_INT_NONE}`" /> 167 <ConfigDefine name="`${INST_NAME}`_INPUT_DISABLED" value="0x7U" public="false" include="true" /> 168 <ConfigStruct name="`${INST_NAME . "_config"}`" type="cy_stc_tcpwm_quaddec_config_t" const="`${inFlash}`" public="true" include="true" > 169 <Member name="resolution" value="`${Resolution}`" /> 170 <Member name="interruptSources" value="`${InterruptSource}`" /> 171 <Member name="indexInputMode" value="`${IndexInput eq CY_TCPWM_INPUT_DISABLED ? defineInputDisabled : IndexInput}`" /> 172 <Member name="indexInput" value="`${IndexInput eq CY_TCPWM_INPUT_DISABLED ? "CY_TCPWM_INPUT_0" : (definePrefix . "_RELOAD_VALUE")}`" /> 173 <Member name="stopInputMode" value="`${StopInput eq CY_TCPWM_INPUT_DISABLED ? defineInputDisabled : StopInput}`" /> 174 <Member name="stopInput" value="`${StopInput eq CY_TCPWM_INPUT_DISABLED ? "CY_TCPWM_INPUT_0" : (definePrefix . "_STOP_VALUE")}`" /> 175 <Member name="phiAInput" value="`${(definePrefix . "_COUNT_VALUE")}`" /> 176 <Member name="phiBInput" value="`${(definePrefix . "_START_VALUE")}`" /> 177 </ConfigStruct> 178 179 <ConfigStruct name="`${INST_NAME}`_obj" type="cyhal_resource_inst_t" const="true" public="true" include="true" guard="defined (CY_USING_HAL)"> 180 <Member name="type" value="CYHAL_RSC_TCPWM" /> 181 <Member name="block_num" value="`${getInstNumber("tcpwm")}`U" /> 182 <Member name="channel_num" value="`${getInstNumber("cnt")}`U" /> 183 </ConfigStruct> 184 185 <ConfigStruct name="`${INST_NAME}`_clock" type="cyhal_clock_t" const="`${inFlash}`" public="true" include="true" guard="defined (CY_USING_HAL)"> 186 <Member name="block" value="`${getExposedMember(pclk, "hal_block")}`" /> 187 <Member name="channel" value="`${getExposedMember(pclk, "number")}`" /> 188 <Member name="reserved" value="false" /> 189 <Member name="funcs" value="NULL" /> 190 </ConfigStruct> 191 192 <ConfigStruct name="`${INST_NAME}`_hal_config" type="cyhal_quaddec_configurator_t" const="`${inFlash}`" public="true" include="true" guard="defined (CY_USING_HAL)"> 193 <Member name="resource" value="&`${INST_NAME}`_obj" /> 194 <Member name="config" value="&`${INST_NAME}`_config" /> 195 <Member name="clock" value="&`${INST_NAME}`_clock" /> 196 </ConfigStruct> 197 198 <ConfigInstruction value="Cy_SysClk_PeriphAssignDivider(`${pclkDst}`, `${getExposedMember(pclk, "clockSel")}`);" include="`${pclkOk}`" /> 199 <ConfigInstruction value="cyhal_hwmgr_reserve(&`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" /> 200 </ConfigFirmware> 201</Personality> 202