4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice, this
11 * list of conditions and the following disclaimer in the documentation and/or
12 * other materials provided with the distribution.
14 * Neither the name of the NXP Semiconductor nor the names of its
15 * contributors may be used to endorse or promote products derived from this
16 * software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
40 static Config g_config
;
42 constexpr uint16_t FSL_VID
= 0x15A2;
43 constexpr uint16_t NXP_VID
= 0x1FC9;
44 constexpr uint16_t BD_VID
= 0x3016;
48 emplace_back(ConfigItem
{"SDPS:", "MX8QXP", nullptr, NXP_VID
, 0x012F, 0x0002});
49 emplace_back(ConfigItem
{"SDPS:", "MX8QM", "MX8QXP", NXP_VID
, 0x0129, 0x0002});
50 emplace_back(ConfigItem
{"SDPS:", "MX8DXL", "MX8QXP", NXP_VID
, 0x0147});
51 emplace_back(ConfigItem
{"SDPS:", "MX28", nullptr, FSL_VID
, 0x004f});
52 emplace_back(ConfigItem
{"SDPS:", "MX815", nullptr, NXP_VID
, 0x013E});
53 emplace_back(ConfigItem
{"SDPS:", "MX865", "MX815", NXP_VID
, 0x0146});
54 emplace_back(ConfigItem
{"SDPS:", "MX8ULP", "MX815", NXP_VID
, 0x014A});
55 emplace_back(ConfigItem
{"SDPS:", "MX8ULP", "MX815", NXP_VID
, 0x014B});
56 emplace_back(ConfigItem
{"SDPS:", "MX93", "MX815", NXP_VID
, 0x014E});
57 emplace_back(ConfigItem
{"SDP:", "MX7D", nullptr, FSL_VID
, 0x0076});
58 emplace_back(ConfigItem
{"SDP:", "MX6Q", nullptr, FSL_VID
, 0x0054});
59 emplace_back(ConfigItem
{"SDP:", "MX6D", "MX6Q", FSL_VID
, 0x0061});
60 emplace_back(ConfigItem
{"SDP:", "MX6SL", "MX6Q", FSL_VID
, 0x0063});
61 emplace_back(ConfigItem
{"SDP:", "MX6SX", "MX6Q", FSL_VID
, 0x0071});
62 emplace_back(ConfigItem
{"SDP:", "MX6UL", "MX7D", FSL_VID
, 0x007D});
63 emplace_back(ConfigItem
{"SDP:", "MX6ULL", "MX7D", FSL_VID
, 0x0080});
64 emplace_back(ConfigItem
{"SDP:", "MX6SLL", "MX7D", NXP_VID
, 0x0128});
65 emplace_back(ConfigItem
{"SDP:", "MX7ULP", nullptr, NXP_VID
, 0x0126});
66 emplace_back(ConfigItem
{"SDP:", "MXRT106X", nullptr, NXP_VID
, 0x0135});
67 emplace_back(ConfigItem
{"SDP:", "MX8MM", "MX8MQ", NXP_VID
, 0x0134});
68 emplace_back(ConfigItem
{"SDP:", "MX8MQ", "MX8MQ", NXP_VID
, 0x012B});
69 emplace_back(ConfigItem
{"SDPU:", "SPL", "SPL", 0x0525, 0xB4A4, 0, 0x04FF});
70 emplace_back(ConfigItem
{"SDPV:", "SPL1", "SPL", 0x0525, 0xB4A4, 0x0500, 0x9998});
71 emplace_back(ConfigItem
{"SDPV:", "SPL1", "SPL", NXP_VID
, 0x0151, 0x0500, 0x9998});
72 emplace_back(ConfigItem
{"SDPU:", "SPL", "SPL", 0x0525, 0xB4A4, 0x9999, 0x9999}); /*old i.MX8 MQEVk use bcd 9999*/
73 emplace_back(ConfigItem
{"SDPU:", "SPL", "SPL", BD_VID
, 0x1001, 0, 0x04FF});
74 emplace_back(ConfigItem
{"SDPV:", "SPL1", "SPL", BD_VID
, 0x1001, 0x0500, 0x9998});
75 emplace_back(ConfigItem
{"FBK:", nullptr, nullptr, 0x066F, 0x9AFE});
76 emplace_back(ConfigItem
{"FBK:", nullptr, nullptr, 0x066F, 0x9BFF});
77 emplace_back(ConfigItem
{"FBK:", nullptr, nullptr, NXP_VID
, 0x0153});
78 emplace_back(ConfigItem
{"FB:", nullptr, nullptr, 0x0525, 0xA4A5});
79 emplace_back(ConfigItem
{"FB:", nullptr, nullptr, 0x18D1, 0x0D02});
80 emplace_back(ConfigItem
{"FB:", nullptr, nullptr, BD_VID
, 0x0001});
81 emplace_back(ConfigItem
{"FB:", nullptr, nullptr, NXP_VID
, 0x0152});
82 emplace_back(ConfigItem
{"FB:", nullptr, nullptr, 0x0483, 0x0afb});
85 int uuu_for_each_cfg(uuu_show_cfg fn
, void *p
)
87 for (const auto &configItem
: g_config
)
89 if (fn(configItem
.m_protocol
.c_str(),
90 configItem
.m_chip
.c_str(),
91 configItem
.m_compatible
.c_str(),
94 configItem
.m_bcdVerMin
,
95 configItem
.m_bcdVerMax
,
102 Config
* get_config() noexcept
107 ConfigItem
* Config::find(uint16_t vid
, uint16_t pid
, uint16_t ver
)
109 for (auto it
= begin(); it
!= end(); it
++)
111 if (vid
== it
->m_vid
&& pid
== it
->m_pid
)
113 if (ver
>= it
->m_bcdVerMin
&& ver
<= it
->m_bcdVerMax
)
120 Config
Config::find(const string
&pro
)
123 for (auto it
= begin(); it
!= end(); it
++)
125 if (it
->m_protocol
== pro
)
126 items
.emplace_back(*it
);
131 int CfgCmd::run(CmdCtx
*)
137 param
= get_next_param(m_cmd
, pos
);
139 if (str_to_upper(param
) == "CFG:")
140 param
= get_next_param(m_cmd
, pos
);
144 set_last_err_string("Wrong param");
148 item
.m_protocol
= str_to_upper(param
);
150 bool conversion_succeeded
= false;
151 while (pos
< m_cmd
.size())
153 param
= get_next_param(m_cmd
, pos
);
156 param
= get_next_param(m_cmd
, pos
);
157 item
.m_pid
= str_to_uint16(param
, &conversion_succeeded
);
158 if (!conversion_succeeded
) return -1;
163 param
= get_next_param(m_cmd
, pos
);
164 item
.m_vid
= str_to_uint16(param
, &conversion_succeeded
);
165 if (!conversion_succeeded
) return -1;
168 if (param
== "-bcdversion")
170 param
= get_next_param(m_cmd
, pos
);
171 item
.m_bcdVerMin
= item
.m_bcdVerMax
= str_to_uint16(param
, &conversion_succeeded
);
172 if (!conversion_succeeded
) return -1;
175 if (param
== "-bcdmin")
177 param
= get_next_param(m_cmd
, pos
);
178 item
.m_bcdVerMin
= str_to_uint16(param
, &conversion_succeeded
);
179 if (!conversion_succeeded
) return -1;
182 if (param
== "-bcdmax")
184 param
= get_next_param(m_cmd
, pos
);
185 item
.m_bcdVerMax
= str_to_uint16(param
, &conversion_succeeded
);
186 if (!conversion_succeeded
) return -1;
189 if (param
== "-chip")
191 param
= get_next_param(m_cmd
, pos
);
195 if (param
== "-compatible")
197 param
= get_next_param(m_cmd
, pos
);
198 item
.m_compatible
= param
;
203 ConfigItem
*pItem
= g_config
.find(item
.m_vid
, item
.m_pid
, item
.m_bcdVerMax
);
207 g_config
.emplace_back(item
);