1<?xml version="1.0" encoding="utf-8"?>
2
3
4<!--****************************************************************************
5* \file sar.cypersonality
6* \version 6.0
7*
8* \brief
9* SAR personality description file. Supports CAT1A family of devices.
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="mxs40sar" name="SAR" version="6.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v7">
30  <Dependencies>
31    <IpBlock name="mxs40pass,mxs40pass_ver2" />
32    <Resource name="pass\.(sar|saradc\.sar)" />
33  </Dependencies>
34  <ExposedMembers>
35    <ExposedMember key="chain" paramId="chain" />
36    <ExposedMember key="isChained" paramId="isChained" />
37    <ExposedMember key="clock" paramId="clk" />
38    <ExposedMember key="ctbBuf" paramId="ctbBuf" />
39    <ExposedMember key="dsBuf" paramId="dsBuf" />
40    <ExposedMember key="vrefDisplay" paramId="vrefDisplay" />
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__sar.html" linkText="Open SAR Documentation" visible="true" desc="Opens the Peripheral Driver Library Documentation" />
45
46    <ParamBool id="debug" name="debug" group="Internal" default="false" visible="false" editable="false" desc="" />
47    <ParamString id="sarAdcRcs" name="sarAdcRcs" group="Internal" default="pass[0].saradc[0]" visible="`${debug}`" editable="false" desc="" />
48    <ParamBool id="sarAdcUsed" name="sarAdcUsed" group="Internal" default="`${hasBlock(sarAdcRcs) ? isBlockUsed(sarAdcRcs) : false}`" visible="`${debug}`" editable="false" desc="" />
49
50    <ParamString id="version" name="version number" group="Internal" default="`${getVersion()}`" visible="`${debug}`" editable="false" desc="" />
51    <ParamBool id="verGt1" name="verGt1" desc="" group="Internal" default="`${version &gt; 1}`" visible="`${debug}`" editable="false" />
52    <ParamRange id="inst" name="inst" group="Internal" default="`${getInstNumber(&quot;sar&quot;)}`" min="0" max="3" resolution="1" visible="`${debug}`" editable="false" desc="" />
53    <ParamRange id="maxSampleRate" name="maxSampleRate" group="Internal" default="`${getDeviceAttr(&quot;SAR_SAMPLE_RATE&quot;) * 1000}`" min="0" max="10000000" resolution="1" visible="`${debug}`" editable="false" desc="" />
54
55    <!-- Internal : HF clock query info -->
56    <ParamBool id="isHFClkEnabled" name="isHFClkEnabled" group="Internal" default="`${isBlockUsed(&quot;srss[0].clock[0].hfclk[0]&quot;)}`" visible="`${debug}`" editable="false" desc="" />
57    <ParamRange id="hfClkFreqHz" name="sourceFrequency" group="Internal" default="`${isHFClkEnabled ? getExposedMember(&quot;srss[0].clock[0].hfclk[0]&quot;, &quot;frequency&quot;) : 1}`" min="0" max="400000000" resolution="1" visible="`${debug}`" editable="false" desc="" />
58    <ParamBool id="isPowerEnabled" name="isPowerEnabled" group="Internal" default="`${isBlockUsed(&quot;srss[0].power[0]&quot;)}`" visible="`${debug}`" editable="false" desc="" />
59    <ParamRange id="vdda" name="vdda" group="Internal" default="`${isPowerEnabled ? getExposedMember(&quot;srss[0].power[0]&quot;, &quot;vddaMv&quot;) / 1000.0 : 3.6}`" min="0" max="10" resolution="0.001" visible="`${debug}`" editable="false" desc="" />
60
61    <ParamChoice id="vref_select" name="Vref Select" group="General" default="CY_SAR_VREF_SEL_BGR" visible="true" editable="true" desc="Select the voltage reference source. The internal reference is configured in the AREF resource. The external device pin option here is different from the external option in the AREF resource." >
62      <Entry name="Internal Reference (from AREF Resource)" value="CY_SAR_VREF_SEL_BGR" visible="true" />
63      <Entry name="External (from Device Pin)" value="CY_SAR_VREF_SEL_EXT" visible="true" />
64      <Entry name="Vdda/2" value="CY_SAR_VREF_SEL_VDDA_DIV_2" visible="true" />
65      <Entry name="Vdda" value="CY_SAR_VREF_SEL_VDDA" visible="true" />
66    </ParamChoice>
67
68    <ParamString id="vrefDisplay" name="VRef Select Display Text" group="Internal" visible="`${debug}`" editable="false" desc=""
69    default="`${(vref_select eq CY_SAR_VREF_SEL_BGR) ? &quot;AREF&quot; :
70                (vref_select eq CY_SAR_VREF_SEL_EXT) ? ((inst eq 0) ? &quot;VREF&quot; : &quot;VREF1&quot;) :
71                (vref_select eq CY_SAR_VREF_SEL_VDDA_DIV_2) ? &quot;VDDA/2&quot; :
72                (vref_select eq CY_SAR_VREF_SEL_VDDA) ? &quot;VDDA&quot; : &quot;&quot;}`" />
73
74    <ParamBool id="isArefEnabled" name="Is Aref Enabled" group="Internal" default="`${isBlockUsed(&quot;pass[0].aref[0]&quot;)}`" visible="false" editable="false" desc="" />
75    <ParamRange id="arefVrefVoltage" name="Aref Vref Voltage" group="Internal" default="`${isArefEnabled ? getExposedMember(&quot;pass[0].aref[0]&quot;, &quot;vref_voltage&quot;) : 0}`" min="0" max="10" resolution="0.001" visible="false" editable="false" desc="" />
76    <ParamBool id="isADCEnabled" name="isADCEnabled" group="Internal" default="`${isBlockUsed(&quot;pass[0].saradc[0]&quot;)}`" visible="`${debug}`" editable="false" desc="" />
77    <ParamBool id="isVrefExternal" name="Is Vref External" group="Internal" default="`${vref_select eq CY_SAR_VREF_SEL_EXT}`" visible="`${debug}`" editable="false" desc="" />
78
79    <ParamRange id="vref_voltage" name="External Vref Voltage (V)" group="General" default="1.2" min="0.85" max="`${vdda}`" resolution="0.001" visible="`${isVrefExternal}`" editable="true" desc="Enter the value of external Vref voltage in volts" />
80    <ParamString id="vref_voltage_display" name="Vref Voltage (V)" group="General" default="`${(vref_select eq CY_SAR_VREF_SEL_VDDA) ? vdda : (vref_select eq CY_SAR_VREF_SEL_VDDA_DIV_2 ? vdda /2 : arefVrefVoltage)}`" visible="`${!isVrefExternal}`" editable="false" desc="Value of the internal Vref voltage in volts" />
81    <ParamRange id="num_channels" name="Number of Channels" group="General" default="2" min="1" max="16" resolution="1" visible="true" editable="true" desc="Number of channels to scan" />
82    <ParamBool id="inj_en" name="Injection Channel" group="General" default="false" visible="true" editable="true" desc="The injection channel usage" />
83    <ParamBool id="vref_byp_cap" name="Vref Bypass" group="General" default="true" visible="true" editable="true" desc="Enable Vref bypass capacitor connection" />
84    <ParamString id="clkFreqMinMHz" name="clkFreqMin" group="Connections" default="1.8" visible="false" editable="false" desc="Minimum supported ADC clock frequency" />
85    <ParamString id="clkFreqMaxMHz" name="clkFreqMax" group="Connections" default="`${(vref_byp_cap || (vref_select eq CY_SAR_VREF_SEL_VDDA) || (vref_select eq CY_SAR_VREF_SEL_EXT)) ? ((2000000 == maxSampleRate) ? 36 : 18) : 1.8}`" visible="false" editable="false" desc="Maximum supported ADC clock frequency" />
86    <ParamChoice id="clk" name="Clock Select" group="Connections" default="CY_SAR_CLK_PERI" visible="`${verGt1}`" editable="true" desc="Select the clock source (enable/disable SAR to operate in system Deep Sleep power mode)" >
87      <Entry name="Peripheral Clock Divider" value="CY_SAR_CLK_PERI" visible="true" />
88      <Entry name="Deep Sleep Clock" value="CY_SAR_CLK_DEEPSLEEP" visible="true" />
89    </ParamChoice>
90    <ParamBool id="dsclk" name="dsclk" group="Internal" default="`${clk ne CY_SAR_CLK_PERI}`" visible="`${debug}`" editable="false" desc="" />
91    <ParamSignal name="Clock" port="clock_sar[0]" group="Connections" visible="`${!dsclk}`" desc="Clock that operates this block" canBeEmpty="`${dsclk}`">
92      <Constraint type="ACCEPT" targetLocation="peri\[\d+\]\.div_.*" valid="true" >
93        <Parameter id="intDivider" severity="ERROR" reason="Clock frequency is '`${getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) / 1000000}`MHz', but must be within the range `${clkFreqMinMHz}`MHz-`${clkFreqMaxMHz}`MHz for proper SAR operation.">
94          <Range
95            min="`${ceil(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / (1000000 * clkFreqMaxMHz))}`"
96            max="`${floor(getExposedMember(&quot;REF_LOCATION&quot;, &quot;frequency&quot;) * getExposedMember(&quot;REF_LOCATION&quot;, &quot;divider&quot;) / (1000000 * clkFreqMinMHz))}`" />
97        </Parameter>
98      </Constraint>
99      <Constraint type="ACCEPT" targetLocation="peri\[\d+\]\.div_(16.5|24.5).*" valid="true" >
100        <Parameter id="fracDivider" severity="ERROR" reason="Fractional divider must be 0 for SAR ADC.">
101          <Fixed value= "0" />
102        </Parameter>
103      </Constraint>
104    </ParamSignal>
105    <ParamString id="sourceClockRsc" name="Source Clock Resource" group="Internal" default="`${!dsclk ? getBlockFromSignal(&quot;clock_sar[0]&quot;) : &quot;pass[0].dpslp[0]&quot;}`" visible="false" editable="false" desc="Source Clock Resource" />
106    <ParamBool id="srcNotUsed" name="srcNotUsed" group="Internal" default="`${(sourceClockRsc ne &quot;&quot;) ? !isBlockUsed(sourceClockRsc) : true}`" visible="`${debug}`" editable="false" desc="" />
107    <ParamBool id="error" name="error" group="Internal" default="`${srcNotUsed || getExposedMember(sourceClockRsc, &quot;error&quot;)}`" visible="`${debug}`" editable="false" desc="" />
108
109    <ParamRange id="sourceFreq" name="sourceFreq" group="Internal" default="`${!error ? getExposedMember(sourceClockRsc, &quot;frequency&quot;) : 0}`" min="0" max="1000000000" resolution="1" visible="`${debug}`" editable="false" desc="" />
110    <ParamString id="accuracy" name="accuracy" group="Internal" default="`${!error ? getExposedMember(sourceClockRsc, &quot;accuracy&quot;) : 0}`" visible="`${debug}`" editable="false" desc="" />
111    <ParamString id="sourceFrequencyInfo" name="Clock Frequency" group="Connections" default="`${formatFrequency(sourceFreq,accuracy)}`" visible="true" editable="false" desc="Source clock frequency" />
112    <ParamString id="compDly" name="compDly" group="Internal" default="`${(sourceFreq &gt; 36000000) ? &quot;CY_SAR_CTRL_COMP_DLY_2P5&quot; :
113                                                                          (sourceFreq &gt; 27000000) ? &quot;CY_SAR_CTRL_COMP_DLY_4&quot; :
114                                                                          (sourceFreq &gt; 18000000) ? &quot;CY_SAR_CTRL_COMP_DLY_10&quot; :
115                                                                                                       &quot;CY_SAR_CTRL_COMP_DLY_12&quot;}`" visible="`${debug}`" editable="false" desc="" />
116    <ParamBool id="is_variable_clock" name="Change Clock Frequency to Meet Scan Rate" group="Connections" default="false" visible="false" editable="true" desc="Allow personality to adjust source clock frequency in order to meet target scan rate" />
117    <ParamSignal name="EOS Trigger Output" port="tr_sar_out[0]" group="Connections" visible="true" desc="Connection for the SAR End of Scan (EOS) trigger output" canBeEmpty="true" >
118      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
119        <Parameter id="DriveModes" severity="DEFAULT" reason="">
120          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
121        </Parameter>
122      </Constraint>
123      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
124        <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected.">
125          <Fixed value="CY_GPIO_DM_STRONG_IN_OFF" />
126        </Parameter>
127      </Constraint>
128      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
129    </ParamSignal>
130    <ParamBool id="soc_en" name="SOC Enable" group="Connections" default="false" visible="true" editable="true" desc="Enable a start of conversion (SOC) input trigger signal" />
131    <ParamBool id="trTimer" name="Trigger from Timer" group="Connections" default="false" visible="`${verGt1 &amp;&amp; soc_en}`" editable="true" desc="Input trigger signal from the Timer" />
132    <ParamSignal name="SOC Input" port="tr_sar_in[0]" group="Connections" visible="`${soc_en &amp;&amp; !trTimer}`" desc="Connection for the start of conversion (SOC) input trigger signal" canBeEmpty="`${!soc_en || trTimer}`" >
133      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
134        <Parameter id="DriveModes" severity="DEFAULT" reason="">
135          <Fixed value="CY_GPIO_DM_HIGHZ" />
136        </Parameter>
137      </Constraint>
138      <Constraint type="ACCEPT" targetLocation="ioss\[\d+\]\.port\[\d+\]\.pin.*" valid="true" >
139        <Parameter id="DriveModes" severity="INFO" reason="The pin Drive Mode parameter does not match expected.">
140          <Fixed value="CY_GPIO_DM_HIGHZ" />
141        </Parameter>
142      </Constraint>
143      <Constraint type="ACCEPT" targetLocation=".*" valid="true" />
144    </ParamSignal>
145
146    <ParamRange id="sample_rate" name="Target Scan Rate (sps)" group="General" default="20000" min="0" max="`${maxSampleRate}`" resolution="1" visible="true" editable="true" desc="Desired rate in which all channels are scanned" />
147    <ParamChoice id="diff_format" name="Differential Result Format" group="Sampling" default="CY_SAR_DIFFERENTIAL_SIGNED" visible="true" editable="true" desc="Configure the format for all differential channels" >
148      <Entry name="Unsigned" value="CY_SAR_DIFFERENTIAL_UNSIGNED" visible="true" />
149      <Entry name="Signed" value="CY_SAR_DIFFERENTIAL_SIGNED" visible="true" />
150    </ParamChoice>
151    <ParamString id="diff_code_range" name="Differential Code Range" group="Sampling" default="`${diff_format eq CY_SAR_DIFFERENTIAL_UNSIGNED ? &quot;0x000 to 0xFFF&quot; : &quot;0x800 to 0x7FF&quot;}`" visible="true" editable="false" desc="Code range for all differential channels. See associated voltage range." />
152    <ParamString id="diff_volt_range" name="Differential Voltage Range" group="Sampling" default="Vneg +/-Vref" visible="true" editable="false" desc="Voltage range for all differential channels. See associated code range." />
153
154    <ParamChoice id="se_format" name="Single-Ended Result Format" group="Sampling" default="CY_SAR_SINGLE_ENDED_SIGNED" visible="true" editable="true" desc="Configure the format for all single-ended channels" >
155      <Entry name="Unsigned" value="CY_SAR_SINGLE_ENDED_UNSIGNED" visible="true" />
156      <Entry name="Signed" value="CY_SAR_SINGLE_ENDED_SIGNED" visible="true" />
157    </ParamChoice>
158
159    <ParamChoice id="trigger_mode" name="Trigger Signal Event" group="Sampling" default="CY_SAR_TRIGGER_MODE_FW_AND_HWEDGE" visible="`${soc_en}`" editable="true" desc="Set hardware trigger mode to edge or level sensitive. Visible only when SOC is enabled." >
160      <Entry name="Rising Edge " value="CY_SAR_TRIGGER_MODE_FW_AND_HWEDGE" visible="true" />
161      <Entry name="Level" value="CY_SAR_TRIGGER_MODE_FW_AND_HWLEVEL" visible="true" />
162    </ParamChoice>
163
164    <ParamChoice id="avg_cnt" name="Samples Averaged" group="Sampling" default="CY_SAR_AVG_CNT_2" visible="true" editable="true" desc="Number of samples to average when averaging is enabled" >
165      <Entry name="2" value="CY_SAR_AVG_CNT_2" visible="true" />
166      <Entry name="4" value="CY_SAR_AVG_CNT_4" visible="true" />
167      <Entry name="8" value="CY_SAR_AVG_CNT_8" visible="true" />
168      <Entry name="16" value="CY_SAR_AVG_CNT_16" visible="true" />
169      <Entry name="32" value="CY_SAR_AVG_CNT_32" visible="true" />
170      <Entry name="64" value="CY_SAR_AVG_CNT_64" visible="true" />
171      <Entry name="128" value="CY_SAR_AVG_CNT_128" visible="true" />
172      <Entry name="256" value="CY_SAR_AVG_CNT_256" visible="true" />
173    </ParamChoice>
174
175    <ParamChoice id="avg_mode" name="Averaging Mode" group="Sampling" default="CY_SAR_AVG_MODE_SEQUENTIAL_FIXED" visible="true" editable="true" desc="Averaging mode for all channels with averaging enabled" >
176      <Entry name="Sequential, Sum" value="CY_SAR_AVG_MODE_SEQUENTIAL_ACCUM" visible="true" />
177      <Entry name="Sequential, Fixed" value="CY_SAR_AVG_MODE_SEQUENTIAL_FIXED" visible="true" />
178      <Entry name="Interleaved, Sum" value="CY_SAR_AVG_MODE_INTERLEAVED" visible="true" />
179    </ParamChoice>
180
181    <ParamChoice id="scanCnt" name="Scans per Trigger" group="Sampling" default="false" visible="true" editable="true" desc="Specifies how many scans SAR takes per trigger" >
182        <Entry name="Single Scan" value="false" visible="true" />
183        <Entry name="Scan Count" value="true" visible="true" />
184    </ParamChoice>
185
186    <ParamChoice id="scanCntIntr" name="EOS Interrupt Condition" group="Sampling" default="false" visible="`${verGt1 &amp;&amp; scanCnt &amp;&amp; (trigger_mode eq CY_SAR_TRIGGER_MODE_FW_AND_HWEDGE)}`" editable="true" desc="Specifies SAR End of Scan (EOS) interrupt condition." >
187        <Entry name="Every Scan Completion" value="false" visible="true" />
188        <Entry name="Once per Scan Count" value="true" visible="true" />
189    </ParamChoice>
190
191    <ParamChoice id="range_cond" name="Compare Mode" group="Range Interrupt" default="CY_SAR_RANGE_COND_BELOW" visible="true" editable="true" desc="The condition in which a range interrupt is triggered" >
192        <Entry name="Result &lt; Low" value="CY_SAR_RANGE_COND_BELOW" visible="true" />
193        <Entry name="Low &lt;= Result &lt; High" value="CY_SAR_RANGE_COND_INSIDE" visible="true" />
194        <Entry name="High &lt;= Result" value="CY_SAR_RANGE_COND_ABOVE" visible="true" />
195        <Entry name="(Result &lt; Low) or (High &lt;= Result)" value="CY_SAR_RANGE_COND_OUTSIDE" visible="true" />
196    </ParamChoice>
197
198    <ParamRange id="range_low" name="Low Threshold" group="Range Interrupt" default="0" min="0" max="65535" resolution="1" visible="true" editable="true" desc="The low threshold for the range interrupt condition" />
199    <ParamRange id="range_high" name="High Threshold" group="Range Interrupt" default="0" min="0" max="65535" resolution="1" visible="true" editable="true" desc="The high threshold for the range interrupt condition" />
200
201    <!-- sample time = acq_time + (12 (resolutiOn) + 3) / ADC clock rate) -->
202    <ParamString id="SAMPLE_TIME_CONST" name="SAMPLE_TIME_CONST" group="Internal" default="15" visible="false" editable="false" desc="" />
203    <ParamString id="MIN_SAMPLE_TIME_NS" name="MIN_SAMPLE_TIME" group="Internal" default="`${(2000000 == maxSampleRate) ? 83 : 167}`" visible="`${debug}`" editable="false" desc="Minimum sample time" />
204
205    <Repeat count="16">
206        <ParamBool id="ch$idx_en" name="Enable" group="Channel $idx" default="`${num_channels &gt; $idx}`" visible="`${debug}`" editable="false" desc="Include Channel $idx in scan"/>
207    </Repeat>
208
209    <Repeat count="16">
210        <ParamChoice id="ch$idx_input" name="Input Mode" group="Channel $idx" default="CY_SAR_CHAN_SINGLE_ENDED" visible="`${ch$idx_en}`" editable="true" desc="Set Channel $idx as single-ended or differential" >
211            <Entry name="Single-ended" value="CY_SAR_CHAN_SINGLE_ENDED" visible="true" />
212            <Entry name="Differential" value="CY_SAR_CHAN_DIFFERENTIAL_UNPAIRED" visible="true" />
213        </ParamChoice>
214        <ParamBool id="ch$idx_se" name="ch$idx_se" group="Channel $idx" default="`${ch$idx_input eq CY_SAR_CHAN_SINGLE_ENDED}`" visible="false" editable="false" desc=""/>
215        <ParamBool id="ch$idx_avg" name="Averaging" group="Channel $idx" default="false" visible="`${ch$idx_en}`" editable="true" desc="Enable averaging for Channel $idx" />
216        <ParamBool id="ch$idx_range_intr" name="Range Interrupt Enable" group="Channel $idx" default="false" visible="`${ch$idx_en}`" editable="true" desc="Enable the range interrupt for Channel $idx" />
217        <ParamBool id="ch$idx_sat_intr" name="Saturation Interrupt Enable" group="Channel $idx" default="false" visible="`${ch$idx_en}`" editable="true" desc="Enable the saturation interrupt for Channel $idx" />
218        <ParamRange id="ch$idx_min_acq_time" name="Minimum Acquisition Time (ns)" group="Channel $idx" default="`${MIN_SAMPLE_TIME_NS}`" min="`${MIN_SAMPLE_TIME_NS}`" max="1000000" resolution="1" visible="`${ch$idx_en}`" editable="true" desc="Set the minimum acquisition time for Channel $idx" />
219        <ParamString id="ch$idx_samples_per_scan" name="ch$idx_samples_per_scan" group="Channel $idx" default="`${ch$idx_en ? (ch$idx_avg ? (avg_mode eq CY_SAR_AVG_MODE_INTERLEAVED ? 1 : avg_cnt) : 1) : 0}`" visible="false" editable="false" desc="" />
220    </Repeat>
221
222    <!-- injection channel -->
223    <ParamChoice id="inj_input" name="Input Mode" group="Injection Channel" default="CY_SAR_CHAN_SINGLE_ENDED" visible="`${inj_en}`" editable="true" desc="Set Injection Channel as single-ended or differential" >
224        <Entry name="Single-ended" value="CY_SAR_CHAN_SINGLE_ENDED" visible="true" />
225        <Entry name="Differential" value="CY_SAR_CHAN_DIFFERENTIAL_UNPAIRED" visible="true" />
226    </ParamChoice>
227    <ParamBool id="inj_se" name="inj_se" group="Channel $idx" default="`${inj_input eq CY_SAR_CHAN_SINGLE_ENDED}`" visible="false" editable="false" desc=""/>
228    <ParamBool id="inj_avg" name="Averaging" group="Injection Channel" default="false" visible="`${inj_en}`" editable="true" desc="Enable averaging for Injection Channel" />
229    <ParamBool id="inj_range_intr" name="Range Interrupt Enable" group="Injection Channel" default="false" visible="`${inj_en}`" editable="true" desc="Enable the range interrupt for Injection Channel" />
230    <ParamBool id="inj_sat_intr" name="Saturation Interrupt Enable" group="Injection Channel" default="false" visible="`${inj_en}`" editable="true" desc="Enable the saturation interrupt for Injection Channel" />
231    <ParamRange id="inj_min_acq_time" name="Minimum Acquisition Time (ns)" group="Injection Channel" default="`${MIN_SAMPLE_TIME_NS}`" min="`${MIN_SAMPLE_TIME_NS}`" max="1000000" resolution="1" visible="`${inj_en &amp;&amp; debug}`" editable="true" desc="Set the minimum acquisition time for Injection Channel" />
232    <ParamString id="inj_samples_per_scan" name="inj_samples_per_scan" group="Injection Channel" default="`${inj_en ? (inj_avg ? (avg_mode eq CY_SAR_AVG_MODE_INTERLEAVED ? 1 : avg_cnt) : 1) : 0}`" visible="`${debug}`" editable="false" desc="" />
233
234
235    <ParamString id="isFixedClock" name="isFixedClock" group="Internal" default="`${is_variable_clock ? &quot;false&quot; : &quot;true&quot;}`" visible="false" editable="false" desc="" />
236    <ParamString id="scheduler" name="scheduler" group="Internal" default="`${runTcl(&quot;sar_scheduler-3.0.tcl&quot;, hfClkFreqHz, isFixedClock, sourceFreq, clkFreqMinMHz * pow(10, 6), clkFreqMaxMHz * pow(10, 6), soc_en, sample_rate, num_channels, ch0_min_acq_time, ch0_samples_per_scan, ch1_min_acq_time, ch1_samples_per_scan, ch2_min_acq_time, ch2_samples_per_scan, ch3_min_acq_time, ch3_samples_per_scan, ch4_min_acq_time, ch4_samples_per_scan, ch5_min_acq_time, ch5_samples_per_scan, ch6_min_acq_time, ch6_samples_per_scan, ch7_min_acq_time, ch7_samples_per_scan, ch8_min_acq_time, ch8_samples_per_scan, ch9_min_acq_time, ch9_samples_per_scan, ch10_min_acq_time, ch10_samples_per_scan, ch11_min_acq_time, ch11_samples_per_scan, ch12_min_acq_time, ch12_samples_per_scan, ch13_min_acq_time, ch13_samples_per_scan, ch14_min_acq_time, ch14_samples_per_scan, ch15_min_acq_time, ch15_samples_per_scan, inj_min_acq_time, inj_samples_per_scan)}`" visible="false" editable="false" desc="Sample rate scheduler" />
237
238    <ParamString id="achieved_sample_rate_display" name="Achieved Free-Run Scan Rate (sps)" group="General" default="`${getTclVar(&quot;achieved_sample_rate&quot;, scheduler)}`" visible="true" editable="false" desc="The achieved scan rate for continuous sampling (free-run) mode." />
239    <ParamString id="total_scan_time_display" name="Achieved Scan Duration" group="General" default="`${getTclVar(&quot;achieved_sample_period&quot;, scheduler)}`" visible="true" editable="false" desc="Time to scan all channels." />
240    <ParamString id="required_clk_rate" name="Required ADC clock Divider" group="General" default="`${getTclVar(&quot;adc_clock_divider&quot;, scheduler)}`" visible="`${is_variable_clock}`" editable="false" desc=""/>
241    <Repeat count="16">
242        <ParamString id="ch$idx_achieved_acq_time_display" name="Achieved Acquisition Time" group="Channel $idx" default="`${getTclVar(&quot;ch$idx_achieved_acq_time&quot;, scheduler)}`" visible="`${ch$idx_en}`" editable="false" desc="Time to acquire the analog signal." />
243        <ParamString id="ch$idx_achieved_sample_time_display" name="Achieved Sample Time" group="Channel $idx" default="`${getTclVar(&quot;ch$idx_achieved_sample_time&quot;, scheduler)}`" visible="`${ch$idx_en}`" editable="false" desc="The sample time for a channel is the time required to acquire the analog signal and convert it to a digital code." />
244    </Repeat>
245
246    <!-- injection channel -->
247    <ParamString id="inj_achieved_acq_time_display" name="Achieved Acquisition Time" group="Injection Channel" default="`${getTclVar(&quot;inj_achieved_acq_time&quot;, scheduler)}`" visible="`${inj_en}`" editable="false" desc="Time to acquire the analog signal." />
248    <ParamString id="inj_achieved_sample_time_display" name="Achieved Sample Time" group="Injection Channel" default="`${getTclVar(&quot;inj_achieved_sample_time&quot;, scheduler)}`" visible="`${inj_en}`" editable="false" desc="The sample time for a channel is the time required to acquire the analog signal and convert it to a digital code." />
249
250    <ParamString id="inj_aperture" name="inj_aperture" group="Injection Channel" default="`${getTclVar(&quot;inj_aperture&quot;, scheduler)}`" visible="`${debug}`" editable="false" desc="" />
251    <ParamString id="sample_time_0" name="sample_time_0" group="Internal" default="`${getTclVar(&quot;sample_time_0&quot;, scheduler)}`" visible="`${debug}`" editable="false" desc="" />
252    <ParamString id="sample_time_1" name="sample_time_0" group="Internal" default="`${getTclVar(&quot;sample_time_1&quot;, scheduler)}`" visible="`${debug}`" editable="false" desc="" />
253    <ParamString id="sample_time_2" name="sample_time_0" group="Internal" default="`${getTclVar(&quot;sample_time_2&quot;, scheduler)}`" visible="`${debug}`" editable="false" desc="" />
254    <ParamString id="sample_time_3" name="sample_time_0" group="Internal" default="`${getTclVar(&quot;sample_time_3&quot;, scheduler)}`" visible="`${debug}`" editable="false" desc="" />
255
256    <!-- Are any channels single ended? -->
257    <ParamBool id="single_ended_exists" name="Single Ended Channel Exists" group="Internal" default="`${(ch0_se &amp;&amp; ch0_en) ||
258                                                                                                        (ch1_se &amp;&amp; ch1_en) ||
259                                                                                                        (ch2_se &amp;&amp; ch2_en) ||
260                                                                                                        (ch3_se &amp;&amp; ch3_en) ||
261                                                                                                        (ch4_se &amp;&amp; ch4_en) ||
262                                                                                                        (ch5_se &amp;&amp; ch5_en) ||
263                                                                                                        (ch6_se &amp;&amp; ch6_en) ||
264                                                                                                        (ch7_se &amp;&amp; ch7_en) ||
265                                                                                                        (ch8_se &amp;&amp; ch8_en) ||
266                                                                                                        (ch9_se &amp;&amp; ch9_en) ||
267                                                                                                       (ch10_se &amp;&amp; ch10_en) ||
268                                                                                                       (ch11_se &amp;&amp; ch11_en) ||
269                                                                                                       (ch12_se &amp;&amp; ch12_en) ||
270                                                                                                       (ch13_se &amp;&amp; ch13_en) ||
271                                                                                                       (ch14_se &amp;&amp; ch14_en) ||
272                                                                                                       (ch15_se &amp;&amp; ch15_en) ||
273                                                                                                        (inj_se &amp;&amp; inj_en)}`" visible="`${debug}`" editable="false" desc="" />
274
275    <ParamChoice id="vneg_select" name="Vneg for Single-Ended Channels" group="Connections" default="CY_SAR_NEG_SEL_VSSA_KELVIN" visible="`${single_ended_exists}`" editable="true" desc="Select what drives the negative terminal of the SAR for single-ended channels" >
276      <Entry name="Vssa" value="CY_SAR_NEG_SEL_VSSA_KELVIN" visible="true" />
277      <Entry name="Routed" value="CY_SAR_NEG_SEL" visible="true" />
278      <Entry name="Vref" value="CY_SAR_NEG_SEL_VREF" visible="true" />
279    </ParamChoice>
280    <ParamString id="vneg_select_string" name="vneg_select_string" group="Internal" default="(uint32_t)`${single_ended_exists ? ((vneg_select eq CY_SAR_NEG_SEL_VSSA_KELVIN) || (vneg_select eq CY_SAR_NEG_SEL_VREF)) ? vneg_select : &quot;SAR&quot; . inst . &quot;_NEG_SEL&quot; : &quot;CY_SAR_NEG_SEL_VSSA_KELVIN&quot;}`" visible="`${debug}`" editable="false" desc="" />
281    <ParamString id="se_code_range" name="Single-ended Code Range" group="Sampling" default="`${vneg_select eq CY_SAR_NEG_SEL_VSSA_KELVIN ? &quot;0x000 to 0x7FF&quot; : (se_format eq CY_SAR_SINGLE_ENDED_UNSIGNED ? &quot;0x000 to 0xFFF&quot; : &quot;0x800 to 0x7FF&quot;)}`" visible="true" editable="false" desc="Code range for all single-ended channels. See associated voltage range." />
282    <ParamString id="se_volt_range" name="Single-ended Voltage Range" group="Sampling" default="`${vneg_select eq CY_SAR_NEG_SEL_VSSA_KELVIN ? &quot;0 to Vref&quot; : (vneg_select eq CY_SAR_NEG_SEL_VREF ? &quot;0 to 2*Vref&quot; : &quot;Vneg +/-Vref&quot;)}`" visible="true" editable="false" desc="Voltage range for all single-ended channels. Note that the voltage on a single-ended channel cannot go below 0 V. See associated code range." />
283    <ParamBool id="vneg_routed" name="vneg_routed" group="Internal" default="`${(vneg_select ne CY_SAR_NEG_SEL_VSSA_KELVIN) &amp;&amp; (vneg_select ne CY_SAR_NEG_SEL_VREF)}`" visible="`${debug}`" editable="false" desc="" />
284    <ParamBool id="isVneg" name="isVneg" group="Internal" default="`${single_ended_exists &amp;&amp; vneg_routed}`" visible="`${debug}`" editable="false" desc="" />
285
286    <!-- Only way to have multiple channels reference the same port (vplus[0]) is to use the ParamMux.
287         How ParamMux works today, all the signals must be in the same group.
288         OPM agrees to support a "group" value for the "Arm" tag -->
289    <ParamMux id="Vplus" name="Vplus Connection" group="Connections" controlType="SARSEQ`${getInstNumber(&quot;sar&quot;)}`" armSelectGroup="SarMux">
290        <Common port="vplus[0]" />
291        <Arm name="Ch$idx Vplus" desc="Assign the connection for the positive terminal of Channel $idx" visible="`${ch$idx_en}`" canBeEmpty="`${!ch$idx_en}`" multiSelect="true" repeatCount="16" group="Channel $idx" role="`${ch$idx_se ? &quot;VPLUS_SINGLE_ENDED&quot; : &quot;VPLUS_DIFFERENTIAL&quot;}`"/>
292        <Arm name="Injection Vplus" desc="Assign the connection for the positive terminal of Injection Channel" visible="`${inj_en}`" canBeEmpty="`${!inj_en}`" multiSelect="true" group="Injection Channel" role="`${inj_se ? &quot;INJ_VPLUS&quot; : &quot;INJ_VPLUS_DIFFERENTIAL&quot;}`"/>
293    </ParamMux>
294    <ParamMux id="Vminus" name="Vminus Connection" group="Connections" controlType="SARSEQ`${getInstNumber(&quot;sar&quot;)}`" armSelectGroup="SarMux" routeDependency="Vplus">
295        <Common port="vminus[0]" forbiddenBy="terminal" />
296        <Arm name="Ch$idx Vminus" desc="Assign the connection for the negative terminal of Channel $idx. Only visible when channel is differential." visible="`${ch$idx_en &amp;&amp; !ch$idx_se}`" canBeEmpty="`${!ch$idx_en || ch$idx_se}`" multiSelect="true" repeatCount="16" group="Channel $idx" role="VMINUS"/>
297        <Arm name="Injection Vminus" desc="Assign the connection for the negative terminal of Injection Channel" visible="`${inj_en &amp;&amp; !inj_se}`" canBeEmpty="`${!inj_en || inj_se}`" multiSelect="true" group="Injection Channel" role="INJ_VMINUS"/>
298        <Arm name="Vneg" desc="Assign the connection for the shared negative terminal. Only visible when at least one channel is not differential." visible="`${isVneg}`" canBeEmpty="`${!isVneg}`" multiSelect="true" role="VNEG"/>
299    </ParamMux>
300
301    <Repeat count="16">
302      <ParamString id="ch$idx_p_muxarm" name="ch$idx_p_muxarm" group="Channel $idx" default="`${getMuxArmSignal(&quot;Vplus&quot;, $idx)}`" visible="`${debug}`" editable="false" desc=""/>
303      <ParamString id="ch$idx_p_block" name="ch$idx_p_block" group="Channel $idx" default="`${getBlockFromSignal(&quot;ch$idx_p_muxarm&quot;)}`" visible="`${debug}`" editable="false" desc=""/>
304      <ParamString id="ch$idx_p_blockType" name="ch$idx_p_blockType" group="Channel $idx" default="`${(ch$idx_p_block ne &quot;&quot;) &amp;&amp; isBlockUsed(ch$idx_p_block) ? ((((ch$idx_p_block eq &quot;pass[0].ctb[0].oa[0]&quot;) || (ch$idx_p_block eq &quot;pass[0].ctb[0].oa[1]&quot;)) ? &quot;ctb&quot; : &quot;ioss&quot;) ) : &quot;unknown&quot;}`" visible="`${debug}`" editable="false" desc=""/>
305
306      <ParamString id="ch$idx_n_muxarm" name="ch$idx_n_muxarm" group="Channel $idx" default="`${getMuxArmSignal(&quot;Vminus&quot;, $idx)}`" visible="`${debug}`" editable="false" desc=""/>
307      <ParamString id="ch$idx_n_block" name="ch$idx_n_block" group="Channel $idx" default="`${getBlockFromSignal(&quot;ch$idx_n_muxarm&quot;)}`" visible="`${debug}`" editable="false" desc=""/>
308      <ParamString id="ch$idx_n_blockType" name="ch$idx_n_blockType" group="Channel $idx" default="`${(ch$idx_n_block ne &quot;&quot;) &amp;&amp; isBlockUsed(ch$idx_n_block) ? ((((ch$idx_n_block eq &quot;pass[0].ctb[0].oa[0]&quot;) || (ch$idx_n_block eq &quot;pass[0].ctb[0].oa[1]&quot;)) ? &quot;ctb&quot; : &quot;ioss&quot;) ) : &quot;unknown&quot;}`" visible="`${debug}`" editable="false" desc=""/>
309
310      <ParamBool id="ch$idx_buffered" name="ch$idx_buffered" group="Channel $idx" default="`${(ch$idx_p_blockType eq &quot;ctb&quot;) || (ch$idx_n_blockType eq &quot;ctb&quot;)}`" visible="`${debug}`" editable="false" desc="" />
311    </Repeat>
312
313    <!-- FIFO -->
314    <ParamBool id="isFirst" name="isFirst" group="Fifo" default="`${inst eq 0}`" visible="`${debug}`" editable="false" desc="" />
315    <ParamRange id="prvInst" name="prvInst" group="Fifo" default="`${isFirst ? 0 : inst - 1}`" min="0" max="3" resolution="1" visible="`${debug}`" editable="false" desc="" />
316
317    <ParamRange id="instP1" name="instP1" group="Fifo" default="`${inst + 1}`" min="1" max="4" resolution="1" visible="`${debug}`" editable="false" desc="" />
318    <ParamRange id="instP2" name="instP2" group="Fifo" default="`${inst + 2}`" min="2" max="5" resolution="1" visible="`${debug}`" editable="false" desc="" />
319    <ParamRange id="instP3" name="instP3" group="Fifo" default="`${inst + 3}`" min="3" max="6" resolution="1" visible="`${debug}`" editable="false" desc="" />
320
321    <ParamString id="instP1Rcs" name="instP1Rcs" group="Fifo" default="pass[0].saradc[0].sar[instP1]" visible="`${debug}`" editable="false" desc="" />
322    <ParamString id="instP2Rcs" name="instP2Rcs" group="Fifo" default="pass[0].saradc[0].sar[instP2]" visible="`${debug}`" editable="false" desc="" />
323    <ParamString id="instP3Rcs" name="instP3Rcs" group="Fifo" default="pass[0].saradc[0].sar[instP3]" visible="`${debug}`" editable="false" desc="" />
324
325
326    <ParamBool id="isPrvUsed" name="isPrvUsed" group="Fifo" default="`${!isFirst ? isBlockUsed(&quot;pass[0].saradc[0].sar[&quot; . prvInst . &quot;]&quot;) : false}`" visible="`${debug}`" editable="false" desc="" />
327    <ParamBool id="isChained" name="isChained" group="Fifo" default="`${isPrvUsed ? getExposedMember(&quot;pass[0].saradc[0].sar[&quot; . prvInst . &quot;]&quot;, &quot;chain&quot;) : false}`" visible="`${debug}`" editable="false" desc="" />
328    <ParamBool id="isNxt" name="isNxt" group="Fifo" default="`${hasBlock(&quot;pass[0].saradc[0].sar[&quot; . instP1 . &quot;]&quot;)}`" visible="`${debug}`" editable="false" desc="" />
329
330    <ParamBool id="fifo" name="FIFO" group="Fifo" default="false" visible="`${!isChained &amp;&amp; verGt1}`" editable="true" desc="Enables SAR FIFO buffer" />
331
332    <ParamBool id="fifoEn" name="fifoEn" group="Fifo" default="`${!isChained &amp;&amp; fifo &amp;&amp; verGt1}`" visible="`${debug}`" editable="false" desc="" />
333
334    <ParamBool id="chain" name="Chain to next" group="Fifo" default="false" visible="`${isNxt &amp;&amp; fifoEn}`" editable="true" desc="Chain the FIFO to the next FIFO" />
335    <ParamBool id="chanIdEn" name="Channel ID Enable" group="Fifo" default="false" visible="`${fifoEn}`" editable="true" desc="The channel number is included into the FIFO read word" />
336    <ParamBool id="clrTrRd" name="Clear Trigger/Interrupt on read" group="Fifo" default="false" visible="`${fifoEn}`" editable="true" desc="Enable for FIFO read clearing the FIFO level trigger and level interrupt" />
337    <ParamRange id="level" name="Level" group="Fifo" default="64" min="1" max="`${chain ? (hasBlock(&quot;pass[0].saradc[0].sar[&quot; . (inst + 2) . &quot;]&quot;) ?
338                                                                                          (hasBlock(&quot;pass[0].saradc[0].sar[&quot; . (inst + 3) . &quot;]&quot;) ? 256 : 192) : 128) : 64}`"
339                resolution="1" visible="`${fifoEn}`" editable="true" desc="A trigger (and optional interrupt) event occurs when the number of FIFO entries overcomes the Level setting" />
340    <ParamBool id="trOut" name="Trigger on Level" group="Fifo" default="false" visible="`${fifoEn}`" editable="true" desc="SAR output trigger is set by the FIFO level condition" />
341
342    <!-- injection channel -->
343    <ParamString id="inj_p_muxarm" name="inj_p_muxarm" group="Injection Channel" default="`${getMuxArmSignal(&quot;Vplus&quot;, 16)}`" visible="`${debug}`" editable="false" desc=""/>
344    <ParamString id="inj_p_blockIoss" name="inj_p_blockIoss" group="Injection Channel" default="`${findBlockFromSignal(&quot;inj_p_muxarm&quot;, &quot;ioss&quot;)}`" visible="`${debug}`" editable="false" desc="" />
345    <ParamBool id="inj_p_ioss" name="inj_p_ioss" group="Injection Channel" default="`${inj_p_blockIoss ne &quot;&quot; ? isBlockUsed(inj_p_blockIoss) : false}`" visible="`${debug}`" editable="false" desc="" />
346    <ParamString id="inj_p_blockCtb" name="inj_p_blockCtb" group="Injection Channel" default="`${findBlockFromSignal(&quot;inj_p_muxarm&quot;, &quot;ctb&quot;)}`" visible="`${debug}`" editable="false" desc="" />
347    <ParamBool id="inj_p_ctb" name="inj_p_ctb" group="Injection Channel" default="`${inj_p_blockCtb ne &quot;&quot; ? isBlockUsed(inj_p_blockCtb) : false}`" visible="`${debug}`" editable="false" desc="" />
348    <ParamBool id="inj_p_blockDefined" name="inj_p_blockDefined" group="Injection Channel" default="`${inj_p_ioss || inj_p_ctb}`" visible="`${debug}`" editable="false" desc="" />
349    <ParamString id="inj_p_port" name="inj_p_port" group="Injection Channel" default="`${inj_p_ioss ? getInstFromLocation(getParamValue(&quot;inj_p_blockIoss&quot;), &quot;port&quot;) : &quot;unknown&quot;}`" visible="`${debug}`" editable="false" desc="" />
350    <ParamString id="inj_p_pin" name="inj_p_pin" group="Injection Channel" default="`${inj_p_ioss ? getInstFromLocation(getParamValue(&quot;inj_p_blockIoss&quot;), &quot;pin&quot;) : &quot;unknown&quot;}`" visible="`${debug}`" editable="false" desc="" />
351    <ParamRange id="inj_p_port_num" name="inj_p_port_num" group="Injection Channel" default="`${inj_p_port ne &quot;unknown&quot; ? inj_p_port : 0}`" min="0" max="12" resolution="1" visible="`${debug}`" editable="false" desc="" />
352    <ParamBool id="inj_p_port_ded" name="inj_p_port_ded" group="Injection Channel" default="`${inj_p_port_num eq 10}`" visible="`${debug}`" editable="false" desc="" />
353    <ParamRange id="inj_p_pin_num" name="inj_p_pin_num" group="Injection Channel" default="`${((inj_p_pin ne &quot;unknown&quot;) &amp;&amp; inj_p_port_ded) ? inj_p_pin : 8}`" min="0" max="8" resolution="1" visible="`${debug}`" editable="false" desc="" />
354    <ParamString id="inj_p_oa" name="inj_p_oa" group="Injection Channel" default="`${inj_p_ctb ? getInstFromLocation(getParamValue(&quot;inj_p_blockCtb&quot;), &quot;oa&quot;) : &quot;unknown&quot;}`" visible="`${debug}`" editable="false" desc="" />
355
356    <ParamString id="inj_n_muxarm" name="inj_n_muxarm" group="Injection Channel" default="`${getMuxArmSignal(&quot;Vminus&quot;, 16)}`" visible="`${debug}`" editable="false" desc=""/>
357    <ParamString id="inj_n_blockIoss" name="inj_n_blockIoss" group="Injection Channel" default="`${findBlockFromSignal(&quot;inj_n_muxarm&quot;, &quot;ioss&quot;)}`" visible="`${debug}`" editable="false" desc="" />
358    <ParamBool id="inj_n_ioss" name="inj_n_ioss" group="Injection Channel" default="`${inj_n_blockIoss ne &quot;&quot; ? isBlockUsed(inj_n_blockIoss) : false}`" visible="`${debug}`" editable="false" desc="" />
359    <ParamString id="inj_n_blockCtb" name="inj_n_blockCtb" group="Injection Channel" default="`${findBlockFromSignal(&quot;inj_n_muxarm&quot;, &quot;ctb&quot;)}`" visible="`${debug}`" editable="false" desc="" />
360    <ParamBool id="inj_n_ctb" name="inj_n_ctb" group="Injection Channel" default="`${inj_n_blockCtb ne &quot;&quot; ? isBlockUsed(inj_n_blockCtb) : false}`" visible="`${debug}`" editable="false" desc="" />
361    <ParamBool id="inj_n_blockDefined" name="inj_n_blockDefined" group="Injection Channel" default="`${inj_n_ioss || inj_n_ctb}`" visible="`${debug}`" editable="false" desc="" />
362    <ParamString id="inj_n_port" name="inj_n_port" group="Injection Channel" default="`${inj_n_ioss ? getInstFromLocation(getParamValue(&quot;inj_n_blockIoss&quot;), &quot;port&quot;) : &quot;unknown&quot;}`" visible="`${debug}`" editable="false" desc="" />
363    <ParamString id="inj_n_pin" name="inj_n_pin" group="Injection Channel" default="`${inj_n_ioss ? getInstFromLocation(getParamValue(&quot;inj_n_blockIoss&quot;), &quot;pin&quot;) : &quot;unknown&quot;}`" visible="`${debug}`" editable="false" desc="" />
364    <ParamRange id="inj_n_port_num" name="inj_n_port_num" group="Injection Channel" default="`${inj_n_port ne &quot;unknown&quot; ? inj_n_port : 0}`" min="0" max="12" resolution="1" visible="`${debug}`" editable="false" desc="" />
365    <ParamBool id="inj_n_port_ded" name="inj_n_port_ded" group="Injection Channel" default="`${inj_n_port_num eq 10}`" visible="`${debug}`" editable="false" desc="" />
366    <ParamRange id="inj_n_pin_num" name="inj_n_pin_num" group="Injection Channel" default="`${((inj_n_pin ne &quot;unknown&quot;) &amp;&amp; inj_n_port_ded) ? inj_n_pin : 8}`" min="0" max="8" resolution="1" visible="`${debug}`" editable="false" desc="" />
367    <ParamString id="inj_n_oa" name="inj_n_oa" group="Injection Channel" default="`${inj_n_ctb ? getInstFromLocation(getParamValue(&quot;inj_n_blockCtb&quot;), &quot;oa&quot;) : &quot;unknown&quot;}`" visible="`${debug}`" editable="false" desc="" />
368    <ParamBool id="inj_buffered" name="inj_buffered" group="Injection Channel" default="`${inj_p_ctb || inj_n_ctb}`" visible="`${debug}`" editable="false" desc="" />
369    <ParamBool id="inj_isPairOk" name="inj_isPairOk" group="Injection Channel" default="`${(inj_p_port_ded &amp;&amp;
370                                                                                            inj_n_port_ded &amp;&amp;
371                                                                                         (((inj_p_pin_num eq 0) &amp;&amp; (inj_n_pin_num eq 1)) ||
372                                                                                          ((inj_p_pin_num eq 2) &amp;&amp; (inj_n_pin_num eq 3)) ||
373                                                                                          ((inj_p_pin_num eq 4) &amp;&amp; (inj_n_pin_num eq 5)) ||
374                                                                                          ((inj_p_pin_num eq 6) &amp;&amp; (inj_n_pin_num eq 7)))) ||
375                                                                                           (inj_p_ctb &amp;&amp; (inj_p_oa eq 0) &amp;&amp;
376                                                                                            inj_n_ctb &amp;&amp; (inj_n_oa eq 1)) ||
377                                                                                           !inj_p_blockDefined ||
378                                                                                           !inj_n_blockDefined}`" visible="`${debug}`" editable="false" desc="" />
379    <!-- Advanced -->
380    <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)." />
381    <!-- Internal: HW name of the SAR instance -->
382    <ParamString id="instName" name="instName" group="Internal" default="SAR`${inst}`" visible="false" editable="false" desc="" />
383    <ParamString id="pHWName" name="pHWName" group="Internal" default="`${verGt1 ? instName : &quot;SAR&quot;}`" visible="false" editable="false" desc="" />
384    <ParamBool id="ctbBuf" name="ctbBuf" group="Internal" default="`${ch0_buffered ||
385                                                                      ch1_buffered ||
386                                                                      ch2_buffered ||
387                                                                      ch3_buffered ||
388                                                                      ch4_buffered ||
389                                                                      ch5_buffered ||
390                                                                      ch6_buffered ||
391                                                                      ch7_buffered ||
392                                                                      ch8_buffered ||
393                                                                      ch9_buffered ||
394                                                                     ch10_buffered ||
395                                                                     ch11_buffered ||
396                                                                     ch12_buffered ||
397                                                                     ch13_buffered ||
398                                                                     ch14_buffered ||
399                                                                     ch15_buffered ||
400                                                                      inj_buffered}`" visible="`${debug}`" editable="false" desc="" />
401    <ParamBool id="dsBuf" name="dsBuf" group="Internal" default="`${ctbBuf &amp;&amp; (CY_SAR_CLK_DEEPSLEEP eq clk)}`" visible="`${debug}`" editable="false" desc="" />
402
403    <!-- Peripheral clock divider connection -->
404    <ParamString id="pclk" name="pclk" group="Internal" default="`${getBlockFromSignal(&quot;clock_sar[0]&quot;)}`" visible="`${debug}`" editable="false" desc="" />
405    <ParamBool id="pclkOk" name="pclkOk" group="Internal" default="`${hasConnection(&quot;clock_sar&quot;, 0) &amp;&amp; isBlockUsed(pclk)}`" visible="`${debug}`" editable="false" desc="" />
406    <ParamString id="pclkDst" name="pclkDst" group="Internal" default="PCLK_PASS_CLOCK_`${pHWName}`" visible="`${debug}`" editable="false" desc="" />
407    <ParamBool id="simultTrTimer" name="simultTrTimer" group="Internal" default="`${isBlockUsed(&quot;pass[0].saradc[0]&quot;) ? getExposedMember(&quot;pass[0].saradc[0]&quot;, &quot;trTimer&quot;) : false}`" visible="`${debug}`" editable="false" desc="" />
408    <ParamString id="pairedDrcMessage" name="pairedDrcText" group="Internal" default="For the differential injection channel, the inputs for direct connection should be paired: an even item for Vplus and the following odd item for Vminus (0&amp;1, 2&amp;3, SARBUS0&amp;SARBUS1, etc.). Otherwise, both inputs will be routed using other resources (e.g. adjacent SARMUX, AMUXBUS, etc., anyways in the paired manner)." visible="`${debug}`" editable="false" desc="" />
409  </Parameters>
410
411  <DRCs>
412      <DRC type="ERROR" text="ADC clock frequency, `${sourceFreq}`, is out of the supported range (`${clkFreqMinMHz}` to `${clkFreqMaxMHz}` MHz)." condition="`${(sourceClockRsc ne &quot;&quot;) &amp;&amp; ((sourceFreq &gt; (clkFreqMaxMHz * 1000000)) || (sourceFreq &lt; (clkFreqMinMHz * 1000000)))}`" paramId="clk_freq_display"/>
413      <DRC type="ERROR" text="Source clock for SAR ADC is not enabled" condition="`${error}`" >
414        <FixIt action="ENABLE_BLOCK" target="`${sourceClockRsc}`" value="" valid="true" />
415      </DRC>
416      <DRC type="WARNING" text="Noise and offset can cause unsigned results to underflow (wrap-around to +ve full scale) when Vneg is set to Vssa or External." condition="`${se_format eq CY_SAR_SINGLE_ENDED_UNSIGNED &amp;&amp; vneg_select ne CY_SAR_NEG_SEL_VREF}`" />
417      <DRC type="ERROR" text="The AREF resource must be enabled for `${INST_NAME}` to work." condition="`${!isArefEnabled}`">
418        <FixIt action="ENABLE_BLOCK" target="pass[0].aref[0]" value="mxs40aref-1.0" valid="true" />
419      </DRC>
420      <DRC type="ERROR" text="The Analog To Digital Conversion (ADC) resource must be enabled when the ADC is configured to work in Deep Sleep mode." condition="`${dsclk &amp;&amp; !isADCEnabled}`">
421        <FixIt action="ENABLE_BLOCK" target="pass[0].saradc[0]" value="" valid="true" />
422      </DRC>
423      <DRC type="ERROR" text="Enable the Power resource and specify Vdda." condition="`${((vref_select eq &quot;CY_SAR_VREF_SEL_VDDA&quot;) || (vref_select eq &quot;CY_SAR_VREF_SEL_VDDA_DIV_2&quot;)) &amp;&amp; !isPowerEnabled}`" >
424        <FixIt action="ENABLE_BLOCK" target="srss[0].power[0]" value="power-1.3" valid="true" />
425      </DRC>
426      <DRC type="ERROR" text="The SAR ADC reference voltage must be higher than 0.85 V" condition="`${!isVrefExternal &amp;&amp; (vref_voltage_display &lt; 0.85)}`" />
427      <DRC type="ERROR" text="The Timer should be enabled to generate SOC trigger signal" condition="`${verGt1 &amp;&amp; soc_en &amp;&amp; trTimer &amp;&amp; !isBlockUsed(&quot;pass[0].timer[0]&quot;)}`" >
428        <FixIt action="ENABLE_BLOCK" target="pass[0].timer[0]" value="mxs40timer-1.0" valid="true" />
429      </DRC>
430      <DRC type="ERROR" text="The Level value is too high - there are no four FIFOs chained together. Either lower the Level parameter to 192 or include the fourth FIFOs into the chain"
431        condition="`${(level &gt; 192) &amp;&amp;
432          !((hasBlock(instP3Rcs) ? isBlockUsed(instP3Rcs) ? getExposedMember(instP3Rcs, &quot;isChained&quot;) : false : false ) &amp;&amp;
433            (hasBlock(instP2Rcs) ? isBlockUsed(instP2Rcs) ? getExposedMember(instP2Rcs, &quot;isChained&quot;) : false : false ) &amp;&amp;
434            (hasBlock(instP2Rcs) ? isBlockUsed(instP1Rcs) ? getExposedMember(instP1Rcs, &quot;isChained&quot;) : false : false ))}`" paramId="level" />
435      <DRC type="ERROR" text="The Level value is too high - there are no three FIFOs chained together. Either lower the Level parameter to 128 or include the third FIFOs into the chain"
436        condition="`${(level &gt; 128) &amp;&amp; (level &lt; 192) &amp;&amp;
437          !((hasBlock(instP2Rcs) ? isBlockUsed(instP2Rcs) ? getExposedMember(instP2Rcs, &quot;isChained&quot;) : false : false ) &amp;&amp;
438            (hasBlock(instP2Rcs) ? isBlockUsed(instP1Rcs) ? getExposedMember(instP1Rcs, &quot;isChained&quot;) : false : false ))}`" paramId="level" />
439      <DRC type="ERROR" text="If interleaved averaging mode is used, the Differential Result Format should be the same as the Single-Ended Result Format." condition="`${(avg_mode eq CY_SAR_AVG_MODE_INTERLEAVED) &amp;&amp; (((diff_format eq CY_SAR_DIFFERENTIAL_UNSIGNED) &amp;&amp; (se_format eq CY_SAR_SINGLE_ENDED_SIGNED)) || ((diff_format eq CY_SAR_DIFFERENTIAL_SIGNED) &amp;&amp; (se_format eq CY_SAR_SINGLE_ENDED_UNSIGNED)))}`" paramId="avg_mode"/>
440      <DRC type="INFO" text="`${pairedDrcMessage}`" condition="`${!(inj_se || inj_isPairOk)}`" paramId="Injection Vminus" />
441  </DRCs>
442
443  <ConfigFirmware>
444
445      <ConfigInclude value="cy_sar.h" include="true" />
446      <ConfigInclude value="cycfg_routing.h" include="true" />
447      <ConfigInclude value="cy_sysclk.h" include="`${pclkOk}`" />
448      <ConfigInclude value="cyhal_hwmgr.h" include="true" guard="defined (CY_USING_HAL)" />
449      <ConfigInclude value="cyhal.h" include="true" guard="defined (CY_USING_HAL)" />
450      <ConfigInclude value="cyhal_hw_types.h" include="true" guard="defined (CY_USING_HAL_LITE)" />
451
452      <ConfigDefine name="`${INST_NAME}`_HW" value="`${pHWName}`" public="true" include="true" />
453      <ConfigDefine name="`${INST_NAME}`_IRQ" value="pass_interrupt_sar`${verGt1 ? &quot;_&quot; . inst : &quot;&quot;}`_IRQn" public="true" include="true" />
454      <ConfigDefine name="`${INST_NAME}`_CTL" value="((uint32_t)CY_SAR_VREF_PWR_100 | (uint32_t)`${vref_select}` | (uint32_t)`${vref_byp_cap ? &quot;CY_SAR_BYPASS_CAP_ENABLE&quot; : &quot;CY_SAR_BYPASS_CAP_DISABLE&quot;}` | `${vneg_select_string}` | (uint32_t)CY_SAR_CTRL_NEGVREF_HW | (uint32_t)`${compDly}` | (uint32_t)CY_SAR_COMP_PWR_100 | (uint32_t)CY_SAR_DEEPSLEEP_SARMUX_OFF | (uint32_t)CY_SAR_SARSEQ_SWITCH_ENABLE)" public="true" include="true" />
455      <ConfigDefine name="`${INST_NAME}`_SAMPLE" value="((uint32_t)SAR_SAMPLE_CTRL_EOS_DSI_OUT_EN_Msk | (uint32_t)CY_SAR_RIGHT_ALIGN | (uint32_t)`${diff_format}` | (uint32_t)`${se_format}` | (uint32_t)`${avg_cnt}` | (uint32_t)`${avg_mode}` | (uint32_t)`${soc_en ? trigger_mode : &quot;CY_SAR_TRIGGER_MODE_FW_ONLY&quot;}`)" public="true" include="true" />
456      <ConfigDefine name="`${INST_NAME}`_CH$idx_CONFIG" value="(((uint32_t)`${instName}`_VPLUS$idx_PORT &lt;&lt; SAR_CHAN_CONFIG_POS_PORT_ADDR_Pos) | (uint32_t)(`${instName}`_VPLUS$idx_PIN &lt;&lt; SAR_CHAN_CONFIG_POS_PIN_ADDR_Pos) | CY_SAR_CHAN_SINGLE_ENDED | `${ch$idx_avg ? &quot;CY_SAR_CHAN_AVG_ENABLE&quot; : &quot;CY_SAR_CHAN_AVG_DISABLE&quot;}` | (uint32_t)`${getTclVar(&quot;ch$idx_sample_time_sel&quot;, scheduler)}`)" public="true" include="`${ch$idx_en &amp;&amp; ch$idx_se}`" repeatCount="16"/>
457
458      <ConfigDefine name="`${instName}`_VMINUS$idx_PORT" value="(0UL)" public="true" include="`${ch$idx_en &amp;&amp; !ch$idx_se}`" guard="!defined `${instName}`_VMINUS$idx_PORT" repeatCount="16"/>
459      <ConfigDefine name="`${instName}`_VMINUS$idx_PIN" value="(0UL)" public="true" include="`${ch$idx_en &amp;&amp; !ch$idx_se}`" guard="!defined `${instName}`_VMINUS$idx_PIN" repeatCount="16"/>
460
461      <ConfigDefine name="`${INST_NAME}`_CH$idx_CONFIG" value="(((uint32_t)`${instName}`_VPLUS$idx_PORT &lt;&lt; SAR_CHAN_CONFIG_POS_PORT_ADDR_Pos) | (uint32_t)(`${instName}`_VPLUS$idx_PIN &lt;&lt; SAR_CHAN_CONFIG_POS_PIN_ADDR_Pos) | (uint32_t)(`${instName}`_VMINUS$idx_PORT &lt;&lt; SAR_CHAN_CONFIG_NEG_PORT_ADDR_Pos) | (uint32_t)(`${instName}`_VMINUS$idx_PIN &lt;&lt; SAR_CHAN_CONFIG_NEG_PIN_ADDR_Pos) | `${instName}`_VMINUS$idx_PAIRING | `${ch$idx_avg ? &quot;CY_SAR_CHAN_AVG_ENABLE&quot; : &quot;CY_SAR_CHAN_AVG_DISABLE&quot;}` | (uint32_t)`${getTclVar(&quot;ch$idx_sample_time_sel&quot;, scheduler)}`)" public="true" include="`${ch$idx_en &amp;&amp; !ch$idx_se}`" repeatCount="16"/>
462      <!-- injection channel -->
463      <ConfigDefine name="`${INST_NAME}`_INJ_CONFIG" value="(((uint32_t)`${instName}`_INJ_VPLUS_PORT &lt;&lt; SAR_INJ_CHAN_CONFIG_INJ_PORT_ADDR_Pos) | (uint32_t)(`${instName}`_INJ_VPLUS_PIN &lt;&lt; SAR_INJ_CHAN_CONFIG_INJ_PIN_ADDR_Pos) | `${inj_se ? &quot;CY_SAR_CHAN_SINGLE_ENDED&quot; : &quot;CY_SAR_CHAN_DIFFERENTIAL_PAIRED&quot;}` | `${inj_avg ? &quot;CY_SAR_CHAN_AVG_ENABLE&quot; : &quot;CY_SAR_CHAN_AVG_DISABLE&quot;}` | (uint32_t)`${getTclVar(&quot;inj_sample_time_sel&quot;, scheduler)}`)" public="true" include="`${inj_en}`"/>
464
465      <ConfigDefine name="`${INST_NAME}`_VREF_MV" value="`${cast(int64, floor((vref_select eq CY_SAR_VREF_SEL_EXT ? vref_voltage : (vref_select eq CY_SAR_VREF_SEL_VDDA ? vdda : (vref_select eq CY_SAR_VREF_SEL_VDDA_DIV_2 ? vdda / 2 : vref_voltage_display))) * 1000))}`UL" public="true" include="true" />
466
467    <ConfigStruct name="`${&quot;cycfg_sar_fifo_&quot; . inst . &quot;_config&quot;}`" type="cy_stc_sar_fifo_config_t" const="`${inFlash}`" public="true" include="`${fifoEn}`" >
468      <Member name="chanId"          value="`${chanIdEn}`" />
469      <Member name="chainToNext"     value="`${chain}`" />
470      <Member name="clrTrIntrOnRead" value="`${clrTrRd}`" />
471      <Member name="level"           value="`${level}`UL" />
472      <Member name="trOut"           value="`${trOut}`" />
473    </ConfigStruct>
474
475      <ConfigStruct name="`${INST_NAME . &quot;_config&quot;}`" type="cy_stc_sar_config_t" const="`${inFlash}`" public="true" include="true" >
476        <Member name="ctrl" value="(uint32_t) `${INST_NAME}`_CTL" />
477        <Member name="sampleCtrl" value="(uint32_t) `${INST_NAME}`_SAMPLE" />
478        <Member name="sampleTime01" value="(`${getTclVar(&quot;sample_time_0&quot;, scheduler)}`UL &lt;&lt; (uint32_t)CY_SAR_SAMPLE_TIME0_SHIFT) | (`${getTclVar(&quot;sample_time_1&quot;, scheduler)}`UL &lt;&lt; (uint32_t)CY_SAR_SAMPLE_TIME1_SHIFT)"/>
479        <Member name="sampleTime23" value="(`${getTclVar(&quot;sample_time_2&quot;, scheduler)}`UL &lt;&lt; (uint32_t)CY_SAR_SAMPLE_TIME2_SHIFT) | (`${getTclVar(&quot;sample_time_3&quot;, scheduler)}`UL &lt;&lt; (uint32_t)CY_SAR_SAMPLE_TIME3_SHIFT)"/>
480        <Member name="rangeThres" value="(`${cast(int64, range_high)}`UL &lt;&lt; (uint32_t)CY_SAR_RANGE_HIGH_SHIFT) | (`${cast(int64, range_low)}`UL &lt;&lt; (uint32_t)CY_SAR_RANGE_LOW_SHIFT)"/>
481        <Member name="rangeCond" value="`${range_cond}`"/>
482        <Member name="chanEn" value="`${
483            (num_channels &gt; 0 ? 1 : 0) +
484            (num_channels &gt; 1 ? 2 : 0) +
485            (num_channels &gt; 2 ? 4 : 0) +
486            (num_channels &gt; 3 ? 8 : 0) +
487            (num_channels &gt; 4 ? 16 : 0) +
488            (num_channels &gt; 5 ? 32 : 0) +
489            (num_channels &gt; 6 ? 64 : 0) +
490            (num_channels &gt; 7 ? 128 : 0) +
491            (num_channels &gt; 8 ? 256 : 0) +
492            (num_channels &gt; 9 ? 512 : 0) +
493            (num_channels &gt; 10 ? 1024 : 0) +
494            (num_channels &gt; 11 ? 2048 : 0) +
495            (num_channels &gt; 12 ? 4096 : 0) +
496            (num_channels &gt; 13 ? 8192 : 0) +
497            (num_channels &gt; 14 ? 16384 : 0) +
498            (num_channels &gt; 15 ? 32768 : 0) +
499            (inj_en ? 65536 : 0)}`UL"/>
500        <Member name="chanConfig" value="{`${num_channels &gt; 0 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH0_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 1 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH1_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 2 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH2_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 3 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH3_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 4 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH4_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 5 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH5_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 6 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH6_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 7 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH7_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 8 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH8_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 9 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH9_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 10 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH10_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 11 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH11_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 12 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH12_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 13 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH13_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 14 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH14_CONFIG&quot; : &quot;0UL&quot;}`, `${num_channels &gt; 15 ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_CH15_CONFIG&quot; : &quot;0UL&quot;}`, `${inj_en ? &quot;(uint32_t) &quot; . INST_NAME . &quot;_INJ_CONFIG&quot; : &quot;0UL&quot;}`}"/>
501        <Member name="intrMask" value="CY_SAR_INTR_EOS`${inj_en ? &quot; | CY_SAR_INTR_INJ_EOC&quot; : &quot;&quot;}``${inj_sat_intr ? &quot; | CY_SAR_INTR_INJ_SATURATE&quot; : &quot;&quot;}``${inj_range_intr ? &quot; | CY_SAR_INTR_INJ_RANGE&quot; : &quot;&quot;}`"/>
502        <Member name="satIntrMask" value="`${
503            (ch0_sat_intr ? 1 : 0) +
504            (ch1_sat_intr ? 2 : 0) +
505            (ch2_sat_intr ? 4 : 0) +
506            (ch3_sat_intr ? 8 : 0) +
507            (ch4_sat_intr ? 16 : 0) +
508            (ch5_sat_intr ? 32 : 0) +
509            (ch6_sat_intr ? 64 : 0) +
510            (ch7_sat_intr ? 128 : 0) +
511            (ch8_sat_intr ? 256 : 0) +
512            (ch9_sat_intr ? 512 : 0) +
513            (ch10_sat_intr ? 1024 : 0) +
514            (ch11_sat_intr ? 2048 : 0) +
515            (ch12_sat_intr ? 4096 : 0) +
516            (ch13_sat_intr ? 8192 : 0) +
517            (ch14_sat_intr ? 16384 : 0) +
518            (ch15_sat_intr ? 32768 : 0)
519            }`UL"/>
520        <Member name="rangeIntrMask" value="`${
521            (ch0_range_intr ? 1 : 0) +
522            (ch1_range_intr ? 2 : 0) +
523            (ch2_range_intr ? 4 : 0) +
524            (ch3_range_intr ? 8 : 0) +
525            (ch4_range_intr ? 16 : 0) +
526            (ch5_range_intr ? 32 : 0) +
527            (ch6_range_intr ? 64 : 0) +
528            (ch7_range_intr ? 128 : 0) +
529            (ch8_range_intr ? 256 : 0) +
530            (ch9_range_intr ? 512 : 0) +
531            (ch10_range_intr ? 1024 : 0) +
532            (ch11_range_intr ? 2048 : 0) +
533            (ch12_range_intr ? 4096 : 0) +
534            (ch13_range_intr ? 8192 : 0) +
535            (ch14_range_intr ? 16384 : 0) +
536            (ch15_range_intr ? 32768 : 0)
537            }`UL"/>
538        <Member name="configRouting" value="false"/>
539        <Member name="vrefMvValue" value="`${INST_NAME}`_VREF_MV"/>
540        <Member name="clock" value="`${verGt1 ? clk : CY_SAR_CLK_PERI}`"/>
541        <Member name="fifoCfgPtr" value="`${fifoEn ? &quot;&amp;cycfg_sar_fifo_&quot; . inst . &quot;_config&quot; : &quot;NULL&quot;}`"/>
542        <Member name="trTimer" value="`${verGt1 ? trTimer : false}`"/>
543        <Member name="scanCnt" value="`${verGt1 ? scanCnt : false}`"/>
544        <Member name="scanCntIntr" value="`${verGt1 ? scanCntIntr : false}`"/>
545      </ConfigStruct>
546
547      <ConfigStruct name="`${INST_NAME}`_obj" type="cyhal_resource_inst_t" const="true" public="true" include="true" guard="defined (CY_USING_HAL) || defined(CY_USING_HAL_LITE)">
548        <Member name="type" value="CYHAL_RSC_ADC" />
549        <Member name="block_num" value="0" />
550        <Member name="channel_num" value="0" />
551      </ConfigStruct>
552
553      <ConfigStruct name="`${INST_NAME}`_clock" type="cyhal_clock_t" const="`${inFlash}`" public="true" include="`${clk eq CY_SAR_CLK_PERI}`" guard="defined(CY_USING_HAL_LITE) || defined (CY_USING_HAL)">
554        <Member name="block" value="`${getExposedMember(pclk, &quot;hal_block&quot;)}`" />
555        <Member name="channel" value="`${getExposedMember(pclk, &quot;number&quot;)}`" />
556        <Member name="reserved" value="false" guard="defined (CY_USING_HAL)" />
557        <Member name="funcs" value="NULL" guard="defined (CY_USING_HAL)" />
558      </ConfigStruct>
559
560      <ConfigStruct name="`${INST_NAME}`_hal_config" type="cyhal_adc_configurator_t" const="`${inFlash}`" public="true" include="true" guard="defined (CY_USING_HAL) || defined(CY_USING_HAL_LITE)">
561        <Member name="resource" value="&amp;`${INST_NAME}`_obj" />
562        <Member name="config" value="&amp;`${INST_NAME}`_config" />
563        <Member name="clock" value="`${(clk eq CY_SAR_CLK_PERI) ? &quot;&amp;&quot; . INST_NAME . &quot;_clock&quot; : &quot;NULL&quot;}`" />
564        <Member name="num_channels" value="`${num_channels}`" />
565        <Member name="achieved_acquisition_time" value="NULL" />
566      </ConfigStruct>
567
568      <ConfigInstruction value="SAR_MUX_SWITCH0(`${INST_NAME}`_HW) |= CY_SAR_MUX_FW_VSSA_VMINUS;" include="`${vneg_select eq CY_SAR_NEG_SEL_VSSA_KELVIN &amp;&amp; single_ended_exists}`" />
569      <ConfigInstruction value="SAR_MUX_SWITCH_SQ_CTRL(`${INST_NAME}`_HW) |= CY_SAR_MUX_SQ_CTRL_VSSA;" include="`${vneg_select eq CY_SAR_NEG_SEL_VSSA_KELVIN &amp;&amp; single_ended_exists}`" />
570      <ConfigInstruction value="Cy_SysClk_PeriphAssignDivider(`${pclkDst}`, `${getExposedMember(pclk, &quot;clockSel&quot;)}`);" include="`${pclkOk}`"  />
571      <ConfigInstruction value="cyhal_hwmgr_reserve(&amp;`${INST_NAME}`_obj);" include="true" guard="defined (CY_USING_HAL)" />
572
573  </ConfigFirmware>
574</Personality>
575