Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions binaries/mmlink/remote_dbg/streaming/st_dbg_ip_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
// POSSIBILITY OF SUCH DAMAGE.
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include "st_dbg_ip_driver.h"
#include "st_dbg_ip_allocator.h"

Expand Down Expand Up @@ -283,15 +284,30 @@ int get_mgmt_support() {
}
}

struct ver_type {
unsigned long type;
unsigned long ver;
};
struct ver_type supported_ver_types[] = {
{ SUPPORTED_TYPE, SUPPORTED_VERSION, },
{ 0x15244444d, 1, },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a name for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about having #defines for these numbers, but since they are only used in one place, I just put the numbers in the array.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a named device associated with it that would be good to encode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, the dbg_ip is the same, but the version and type numbers were updated.

};

int check_version_and_type() {
uint64_t type_version = IORD_64DIRECT(g_std_dbg_ip_info.ST_DBG_IP_CSR_BASE_ADDR, ST_DBG_IP_CONFIG_TYPE);
unsigned long type = (unsigned long)type_version;
unsigned long version = (unsigned long)(type_version >> 32);
if ((type != SUPPORTED_TYPE) || (version != SUPPORTED_VERSION)) {
return -1;
} else {
return 0;
unsigned int i;

for (i = 0; i < (sizeof(supported_ver_types)/sizeof(supported_ver_types[0])); i++) {
if ((type == supported_ver_types[i].type) && (version == supported_ver_types[i].ver)) {
printf("type = 0x%lx ver = 0x%lx is supported\n", type, version);
return 0;
}
}
printf("type = 0x%lx ver = 0x%lx is not supported\n", type, version);
exit(1);
return -1;
}

int set_driver_param(const char *param, const char *val) {
Expand Down