Skip to content

Commit

Permalink
Relax ID matching for the misc_dev
Browse files Browse the repository at this point in the history
Detect STM32
  • Loading branch information
UweBonnes committed Jun 27, 2023
1 parent 1f5d6cb commit e4ffe18
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/jtag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int Jtag::detectChain(int max_dev)
* GateMate and Efinix Trion T4/T8 devices
*/
if (tmp != 0x20000001)
found = search_and_insert_device_with_idcode(tmp & 0x0fffffff);
found = search_and_insert_device_with_idcode(tmp);
if (!found) /* if masked not found -> search for full */
found = search_and_insert_device_with_idcode(tmp);

Expand Down Expand Up @@ -231,7 +231,7 @@ bool Jtag::search_and_insert_device_with_idcode(uint32_t idcode)
if (dev != fpga_list.end())
irlength = dev->second.irlength;
if (irlength == -1) {
auto misc = misc_dev_list.find(idcode);
auto misc = misc_dev_list.find(idcode & MISC_DEV_MASK);
if (misc != misc_dev_list.end())
irlength = misc->second.irlength;
}
Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,11 @@ int main(int argc, char **argv)
fpga_list[t].family.c_str(),
fpga_list[t].model.c_str());
printf("\tirlength %d\n", fpga_list[t].irlength);
} else if (misc_dev_list.find(t) != misc_dev_list.end()) {
} else if (misc_dev_list.find(t & MISC_DEV_MASK) != misc_dev_list.end()) {
printf("\tidcode 0x%x\n\ttype %s\n\tirlength %d\n",
t,
misc_dev_list[t].name.c_str(),
misc_dev_list[t].irlength);
misc_dev_list[t & MISC_DEV_MASK].name.c_str(),
misc_dev_list[t & MISC_DEV_MASK].irlength);
}
}
if (args.detect == true) {
Expand Down
7 changes: 4 additions & 3 deletions src/part.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ typedef struct {
int irlength;
} misc_device;

#define MISC_DEV_MASK 0x0ff00fffU
static std::map <uint32_t, misc_device> misc_dev_list = {
{0x4ba00477, {"ARM cortex A9", 4}},
{0x5ba00477, {"ARM cortex A53", 4}},
{0xfffffffe, {"ZynqMP dummy device", 12}},
{0x0ba00477, {"ADIv5 JTAG-DP port", 4}},
{0x06400041, {"STM32 Device", 4}},
{0x0ff00ffe, {"ZynqMP dummy device", 12}},
};

/* list of JTAG manufacturer ID */
Expand Down

0 comments on commit e4ffe18

Please sign in to comment.