1<?xml version="1.0" encoding="utf-8"?>
2
3
4<!--****************************************************************************
5* \file saradc.cypersonality
6* \version 2.0
7*
8* \brief
9* SARADC personality description file. Supports CAT1A family of devices.
10*
11********************************************************************************
12* \copyright
13* Copyright 2020-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="mxs40saradc" name="SARADC" version="2.0" xmlns="http://cypress.com/xsd/cyhwpersonality_v7">
30  <Dependencies>
31    <IpBlock name="mxs40pass_ver2" />
32    <Resource name="pass\.saradc" />
33  </Dependencies>
34  <ExposedMembers>
35    <ExposedMember key="trTimer" paramId="trTimer" />
36    <ExposedMember key="core" paramId="core" />
37  </ExposedMembers>
38  <Parameters>
39    <!-- Internal Parameters -->
40    <ParamBool id="debug" name="debug" group="Internal" default="false" visible="false" editable="false" desc="" />
41    <ParamString id="sar0rcs" name="sar0rcs" group="Internal" default="pass[0].saradc[0].sar[0]" visible="`${debug}`" editable="false" desc="" />
42    <ParamString id="sar1rcs" name="sar1rcs" group="Internal" default="pass[0].saradc[0].sar[1]" visible="`${debug}`" editable="false" desc="" />
43    <ParamString id="sar2rcs" name="sar2rcs" group="Internal" default="pass[0].saradc[0].sar[2]" visible="`${debug}`" editable="false" desc="" />
44    <ParamString id="sar3rcs" name="sar3rcs" group="Internal" default="pass[0].saradc[0].sar[3]" visible="`${debug}`" editable="false" desc="" />
45    <ParamString id="timerRcs" name="timerRcs" group="Internal" default="pass[0].timer[0]" visible="`${debug}`" editable="false" desc="" />
46    <ParamString id="dpslpRsc" name="dpslpRsc" group="Internal" default="pass[0].dpslp[0]" visible="`${debug}`" editable="false" desc="" />
47    <ParamRange id="dpslpFreq" name="dpslpFreq" group="Internal" default="`${isBlockUsed(dpslpRsc) ? getExposedMember(dpslpRsc, &quot;frequency&quot;) : 0}`" min="0" max="8000000" resolution="1" visible="`${debug}`" editable="false" desc="" />
48    <ParamRange id="SarNum" name="Number of SARs" group="Internal" default="`${hasBlock(sar0rcs) + hasBlock(sar1rcs) + hasBlock(sar2rcs) + hasBlock(sar3rcs)}`" min="0" max="4" resolution="1" visible="`${debug}`"  editable="false" desc="" />
49
50    <!-- PDL documentation -->
51    <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" />
52
53    <!-- powerUpDelay and powerUpDelayUsOld are for correct migration from the mxs40saradc-1.0 -->
54    <ParamRange id="powerUpDelay" name="powerUpDelay" group="Internal" default="0" min="0" max="255" resolution="1" visible="`${debug}`" editable="false" desc="" />
55    <ParamRange id="powerUpDelayUsOld" name="powerUpDelayUsOld" group="Internal" default="`${dpslpFreq &gt; 0 ? powerUpDelay * 1000000.0 / dpslpFreq : 0.0}`" min="0" max="1000000" resolution="0.1" visible="`${debug}`" editable="false" desc="" />
56
57    <ParamRange id="powerUpDelayNew" name="Power Up Delay" group="General" default="`${(powerUpDelayUsOld ge 20) ? powerUpDelay : 40}`" min="0" max="255" resolution="1" visible="true" editable="true" desc="Power-up delay is an 8-bit configuration value (0-255), clocked from the Deep Sleep Clock selected for the SAR ADC. This programmable delay allows the analog resource to settle before the conversion begins. This setting is only applicable when at least one active SAR block is clocked by the Deep Sleep Clock. Increase the power-up delay to your desired value when there are external components in your design that requires extra settling time. For more information on this parameter, refer to the device analog low-power application note." />
58    <ParamRange id="powerUpDelayUs" name="powerUpDelayUs" group="Internal" default="`${dpslpFreq &gt; 0 ? powerUpDelayNew * 1000000.0 / dpslpFreq : 0.0}`" min="0" max="1000000" resolution="0.1" visible="`${debug}`" editable="false" desc="" />
59    <ParamString id="powerUpDelayUsInd" name="Power Up Delay Period" desc="Power Up Delay Period" group="General" default="`${dpslpFreq &gt; 0 ? powerUpDelayUs . &quot;us&quot; : &quot;undefined&quot;}`" visible="true" editable="false" />
60
61    <ParamRange id="SarScanCount" name="SAR Scan Count" group="General" default="1" min="1" max="256" resolution="1" visible="true" editable="true" desc="The number of samples SAR will take when triggered." />
62
63    <ParamBool id="SimultSar0" name="SAR 0" group="Simultaneous Triggering" default="false" visible="`${(1 &lt; SarNum) || debug}`" editable="true" desc="Simultaneous triggering enable for SAR0" />
64    <ParamBool id="SimultSar1" name="SAR 1" group="Simultaneous Triggering" default="false" visible="`${(1 &lt; SarNum) || debug}`" editable="true" desc="Simultaneous triggering enable for SAR1" />
65    <ParamBool id="SimultSar2" name="SAR 2" group="Simultaneous Triggering" default="false" visible="`${(2 &lt; SarNum) || debug}`" editable="true" desc="Simultaneous triggering enable for SAR2" />
66    <ParamBool id="SimultSar3" name="SAR 3" group="Simultaneous Triggering" default="false" visible="`${(3 &lt; SarNum) || debug}`" editable="true" desc="Simultaneous triggering enable for SAR3" />
67
68    <ParamBool id="SarSimultControlNonZero" name="SarSimultControlZero" desc="SarSimultControlZero" group="Simultaneous Triggering" default="`${(SimultSar0 | SimultSar1 | SimultSar2 | SimultSar3)}`" visible="`${debug}`" editable="false" />
69    <ParamBool id="SarSimultControlOr1" name="SarSimultControlOr1" desc="SarSimultControlOr1" group="Simultaneous Triggering" default="`${((SimultSar0 + SimultSar1) eq 2)&amp;&amp; SimultSar1}`" visible="`${debug}`" editable="false" />
70    <ParamBool id="SarSimultControlOr2" name="SarSimultControlOr2" desc="SarSimultControlOr2" group="Simultaneous Triggering" default="`${((SimultSar0 + SimultSar1) &gt; 0)&amp;&amp; SimultSar2}`" visible="`${debug}`" editable="false" />
71    <ParamBool id="SarSimultControlOr3" name="SarSimultControlOr3" desc="SarSimultControlOr3" group="Simultaneous Triggering" default="`${((SimultSar0 + SimultSar1 + SimultSar2) &gt; 0)&amp;&amp; SimultSar3}`" visible="`${debug}`" editable="false" />
72    <ParamString id="SarSimultControl" name="SarSimultControl" desc="SarSimultControl" group="Simultaneous Triggering" default="`${(SimultSar0)? &quot;CY_SAR_SAR0&quot; : &quot;&quot;}``${(SarSimultControlOr1)? &quot; | &quot; : &quot;&quot;}``${(SimultSar1)? &quot;CY_SAR_SAR1&quot; : &quot;&quot;}``${(SarSimultControlOr2)? &quot; | &quot; : &quot;&quot;}``${(SimultSar2)? &quot;CY_SAR_SAR2&quot; : &quot;&quot;}``${(SarSimultControlOr3)? &quot; | &quot; : &quot;&quot;}``${(SimultSar3)? &quot;CY_SAR_SAR3&quot; : &quot;&quot;}``${(SarSimultControlNonZero)? &quot;&quot; : &quot;0UL&quot;}`" visible="`${debug}`" editable="false" />
73
74
75    <ParamChoice id="SarSimultTrigSource" name="Trigger Source" group="Simultaneous Triggering Configuration" default="CY_SAR_SAR0" visible="`${SarSimultControlNonZero}`" editable="true" desc="Configures the trigger source for simultaneous conversion." >
76      <Entry name="SAR 0 Trigger Input" value="CY_SAR_SAR0" visible="`${(0 &lt; SarNum) || debug}`" />
77      <Entry name="SAR 1 Trigger Input" value="CY_SAR_SAR1" visible="`${(1 &lt; SarNum) || debug}`" />
78      <Entry name="SAR 2 Trigger Input" value="CY_SAR_SAR2" visible="`${(2 &lt; SarNum) || debug}`" />
79      <Entry name="SAR 3 Trigger Input" value="CY_SAR_SAR3" visible="`${(3 &lt; SarNum) || debug}`" />
80      <Entry name="Timer" value="CY_SAR_TIMER" visible="true" />
81    </ParamChoice>
82
83    <ParamChoice id="SarSimultTrigEvent" name="Simultaneous Trigger Signal Event" group="Simultaneous Triggering Configuration" default="CY_SAR_SIMULT_TRIG_EVENT_EDGE" visible="`${SarSimultControlNonZero}`" editable="true" desc="Configures simultaneous trigger signal event." >
84      <Entry name="Rising Edge" value="CY_SAR_SIMULT_TRIG_EVENT_EDGE" visible="true" />
85      <Entry name="Level" value="CY_SAR_SIMULT_TRIG_EVENT_LEVEL" visible="true" />
86    </ParamChoice>
87
88    <ParamChoice id="SarSimultTrigSync" name="Trigger Synchronization Source" group="Simultaneous Triggering Configuration" default="CY_SAR_SIMULT_TRIG_SYNC_SAR_CLOCK" visible="`${SarSimultControlNonZero}`" editable="true" desc="Configures simultaneous trigger synchronization." >
89      <Entry name="Bypass" value="CY_SAR_SIMULT_TRIG_SYNC_NONE" visible="true" />
90      <Entry name="SAR Clock Domain" value="CY_SAR_SIMULT_TRIG_SYNC_SAR_CLOCK" visible="true" />
91    </ParamChoice>
92
93    <ParamChoice id="SarSimultSamplesPerTrigger" name="Scans per Trigger" group="Simultaneous Triggering Configuration" default="CY_SAR_SIMULT_TRIG_SAMPLE_SINGLE" visible="`${SarSimultControlNonZero}`" editable="true" desc="Configures number of scans per trigger event." >
94      <Entry name="Single Scan" value="CY_SAR_SIMULT_TRIG_SAMPLE_SINGLE" visible="true" />
95      <Entry name="Scan Count" value="CY_SAR_SIMULT_TRIG_SAMPLE_SCAN_CNT" visible="true" />
96    </ParamChoice>
97
98    <ParamChoice id="SarSimultEOSIntrSelect" name="EOS Interrupt Condition" group="Simultaneous Triggering Configuration" default="CY_SAR_SIMULT_TRIG_INTR_EOS" visible="`${SarSimultControlNonZero}`" editable="true" desc="Configures End of Scan interrupt condition." >
99      <Entry name="Every Scan Completion" value="CY_SAR_SIMULT_TRIG_INTR_EOS" visible="true" />
100      <Entry name="Sample = Scan Counter" value="CY_SAR_SIMULT_TRIG_INTR_SCAN_CNT" visible="true" />
101    </ParamChoice>
102
103    <ParamBool id="trSimult" name="trSimult" group="Internal" default="`${(SimultSar0 + SimultSar1 + SimultSar2 + SimultSar3) &gt; 1}`" visible="`${debug}`" editable="false" desc="" />
104    <ParamBool id="trTimer" name="trTimer" group="Internal" default="`${trSimult &amp;&amp; (SarSimultTrigSource eq CY_SAR_TIMER)}`" visible="`${debug}`" editable="false" desc="" />
105
106
107    <ParamString id="expClk" name="expClk" group="Internal" default="clock" visible="`${debug}`" editable="false" desc="" />
108    <ParamString id="dsBuf" name="dsBuf" group="Internal" default="dsBuf" visible="`${debug}`" editable="false" desc="" />
109    <ParamString id="dsClk" name="dsClk" group="Internal" default="CY_SAR_CLK_DEEPSLEEP" visible="`${debug}`" editable="false" desc="" />
110
111    <ParamBool id="sar0used" name="sar0used" group="Internal" default="`${(0 &lt; SarNum) ? isBlockUsed(sar0rcs) : false}`" visible="`${debug}`" editable="false" desc="" />
112    <ParamBool id="sar1used" name="sar1used" group="Internal" default="`${(1 &lt; SarNum) ? isBlockUsed(sar1rcs) : false}`" visible="`${debug}`" editable="false" desc="" />
113    <ParamBool id="sar2used" name="sar2used" group="Internal" default="`${(2 &lt; SarNum) ? isBlockUsed(sar2rcs) : false}`" visible="`${debug}`" editable="false" desc="" />
114    <ParamBool id="sar3used" name="sar3used" group="Internal" default="`${(3 &lt; SarNum) ? isBlockUsed(sar3rcs) : false}`" visible="`${debug}`" editable="false" desc="" />
115    <ParamBool id="timerUsed" name="timerUsed" group="Internal" default="`${isBlockUsed(timerRcs)}`" visible="`${debug}`" editable="false" desc="" />
116
117    <!--Advanced-->
118    <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)." />
119
120  </Parameters>
121
122  <DRCs>
123    <DRC type="ERROR" text="At least two SARs should be selected for proper Simultaneous Triggering operation" condition="`${SarSimultControlNonZero &amp;&amp; !trSimult}`" />
124
125    <DRC type="ERROR" text="To use SAR0 simultaneous triggering the SAR0 itself should be enabled" condition="`${SimultSar0 &amp;&amp; !sar0used}`" >
126      <FixIt action="ENABLE_BLOCK" target="`${sar0rcs}`" value="mxs40sar-3.0" valid="true" />
127    </DRC>
128
129    <DRC type="ERROR" text="To use SAR1 simultaneous triggering the SAR1 itself should be enabled" condition="`${SimultSar1 &amp;&amp; !sar1used}`" >
130      <FixIt action="ENABLE_BLOCK" target="`${sar1rcs}`" value="mxs40sar-3.0" valid="true" />
131    </DRC>
132
133    <DRC type="ERROR" text="To use SAR2 simultaneous triggering the SAR2 itself should be enabled" condition="`${SimultSar2 &amp;&amp; !sar2used}`" >
134      <FixIt action="ENABLE_BLOCK" target="`${sar2rcs}`" value="mxs40sar-3.0" valid="true" />
135    </DRC>
136
137    <DRC type="ERROR" text="To use SAR3 simultaneous triggering the SAR3 itself should be enabled" condition="`${SimultSar3 &amp;&amp; !sar3used}`" >
138      <FixIt action="ENABLE_BLOCK" target="`${sar3rcs}`" value="mxs40sar-3.0" valid="true" />
139    </DRC>
140
141    <DRC type="ERROR" text="To use TIMER as a trigger source for simultaneous triggering the TIMER itself should be enabled" condition="`${trSimult &amp;&amp; (SarSimultTrigSource eq CY_SAR_TIMER) &amp;&amp; !timerUsed}`" >
142      <FixIt action="ENABLE_BLOCK" target="`${timerRcs}`" value="mxs40timer-1.0" valid="true" />
143    </DRC>
144
145    <DRC type="INFO" text="The Power Up Delay setting is only applicable when at least one active SAR block is clocked by Deep Sleep Clock."
146         condition="`${(powerUpDelayNew ne 0) &amp;&amp; !((sar0used ? (dsClk eq getExposedMember(sar0rcs, expClk)) : false) ||
147                                                        (sar1used ? (dsClk eq getExposedMember(sar1rcs, expClk)) : false) ||
148                                                        (sar2used ? (dsClk eq getExposedMember(sar2rcs, expClk)) : false) ||
149                                                        (sar3used ? (dsClk eq getExposedMember(sar3rcs, expClk)) : false))}`" >
150        <FixIt action="SET_PARAM" target="powerUpDelayNew" value="0" valid="true" />
151    </DRC>
152
153    <DRC type="INFO" text="The Power Up Delay setting probably needs to tune when at least one active SAR block is buffered by CTB. For more information on this parameter, refer to the device analog low-power application note."
154         condition="`${(powerUpDelayUs &lt; 20) &amp;&amp; ((sar0used ? getExposedMember(sar0rcs, dsBuf) : false) ||
155                                                            (sar1used ? getExposedMember(sar1rcs, dsBuf) : false) ||
156                                                            (sar2used ? getExposedMember(sar2rcs, dsBuf) : false) ||
157                                                            (sar3used ? getExposedMember(sar3rcs, dsBuf) : false))}`" />
158  </DRCs>
159
160  <ConfigFirmware>
161      <ConfigInclude value="cy_sar.h" include="true" />
162
163      <ConfigStruct name="`${INST_NAME . &quot;_config&quot;}`" type="cy_stc_sar_common_config_t" const="`${inFlash}`" public="true" include="true" >
164          <Member name="pwrUpDelay" value="`${((sar0used ? (dsClk eq getExposedMember(sar0rcs, expClk)) : false) ||
165                                               (sar1used ? (dsClk eq getExposedMember(sar1rcs, expClk)) : false) ||
166                                               (sar2used ? (dsClk eq getExposedMember(sar2rcs, expClk)) : false) ||
167                                               (sar3used ? (dsClk eq getExposedMember(sar3rcs, expClk)) : false)) ? powerUpDelayNew : 0}`UL" />
168          <Member name="scanCount" value="`${SarScanCount}`UL" />
169          <Member name="simultControl" value="`${SarSimultControl}`" />
170          <Member name="simultTrigSource" value="`${SarSimultTrigSource}`" />
171          <Member name="simultTrigEvent" value="`${SarSimultTrigEvent}`" />
172          <Member name="simultTrigSync" value="`${SarSimultTrigSync}`" />
173          <Member name="simultSamplesPerTrigger" value="`${SarSimultSamplesPerTrigger}`" />
174          <Member name="simultEOSIntrSelect" value="`${SarSimultEOSIntrSelect}`" />
175      </ConfigStruct>
176  </ConfigFirmware>
177</Personality>
178