Skip to content

Commit

Permalink
TRAX server: support for TRAX devices on multiple cores
Browse files Browse the repository at this point in the history
- Multiple TRAX units can be started
- Each TRAX unit can be associated with one TRAX server TCP port
- Update xtensa trax config file for multiple TRAX instances
- No new clang static analyzer warnings
- Miscellaneous clean-up for style and comments

Change-Id: I6888564b24551bfd8b78bf0a89a2cb97c250b445
Signed-off-by: Ian Thompson <ianst@cadence.com>
  • Loading branch information
ianstcdns committed May 31, 2024
1 parent b0e8916 commit 8b7c5c6
Show file tree
Hide file tree
Showing 6 changed files with 316 additions and 267 deletions.
4 changes: 4 additions & 0 deletions src/target/trax.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ int target_trax_attach(struct target *target, bool *found, bool *is_xtensa)
}
xtensa_ocdid_t devid = xtensa_dm_device_id_get(&xtensa->dbg_mod);
LOG_INFO("trax: xtensa devid is 0x%x", devid);
if (xtensa->dbg_mod.tap)
LOG_INFO("trax: xtensa TAP IDCODE: 0x%x", xtensa->dbg_mod.tap->idcode);
if (xtensa->dbg_mod.dap && xtensa->dbg_mod.dap->tap)
LOG_INFO("trax: xtensa DAP/JTAG IDCODE: 0x%x", xtensa->dbg_mod.dap->tap->idcode);

if (found)
*found = (((devid >> TRAX_ID_PRODNO_SHIFT) & TRAX_ID_PRODNO_MASK) == TRAX_ID_PRODNO_TRAX_XTENSA);
Expand Down
34 changes: 15 additions & 19 deletions src/trax/tcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,52 +20,48 @@
COMMAND_HANDLER(handle_trax_start_command)
{
struct trax_source source;
unsigned int id = 0;

if (CMD_ARGC > 0)
if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
else if (CMD_ARGC == 1)
id = strtoul(CMD_ARGV[0], NULL, 0);

source.attach = &target_trax_attach;
source.start = &target_trax_start;
source.stop = &target_trax_stop;
source.write = &target_trax_write_callback;
source.dm_readreg = &target_trax_dm_readreg;
source.dm_writereg = &target_trax_dm_writereg;

if (trax_setup() != ERROR_OK)
return ERROR_FAIL;

trax_register_source(source, get_current_target(CMD_CTX));

if (!trax_configured()) {
command_print(CMD, "TRAX is not configured");
return ERROR_FAIL;
}

return trax_start();
return trax_start(id, get_current_target(CMD_CTX), source);
}

COMMAND_HANDLER(handle_trax_stop_command)
{
if (CMD_ARGC > 0)
unsigned int id = 0;

if (CMD_ARGC > 1)
return ERROR_COMMAND_SYNTAX_ERROR;
else if (CMD_ARGC == 1)
id = strtoul(CMD_ARGV[0], NULL, 0);

return trax_stop();
return trax_stop(id);
}

static const struct command_registration trax_subcommand_handlers[] = {
{
.name = "start",
.handler = handle_trax_start_command,
.mode = COMMAND_EXEC,
.help = "start TRAX",
.usage = ""
.help = "start TRAX channel",
.usage = "[chan_id]"
},
{
.name = "stop",
.handler = handle_trax_stop_command,
.mode = COMMAND_EXEC,
.help = "stop TRAX",
.usage = ""
.help = "stop TRAX channel",
.usage = "[chan_id]"
},
COMMAND_REGISTRATION_DONE
};
Expand Down
1 change: 1 addition & 0 deletions src/trax/tpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ struct tpack_socket {
(pointed to by channels unless allocated dyn.) */
int num_chans; /* number of active channels, including gchannel */
int alloc_chans; /* number of entries in channels[] */
int trid;
}; /* tpack_socket */


Expand Down
Loading

0 comments on commit 8b7c5c6

Please sign in to comment.