jtag: rewrite commands 'jtag newtap' and 'swd newdap' as COMMAND_HANDLER
While there: - fix memory leak in case of error on values tap->chip, tap->tapname, tap->expected_ids; - check for out of memory error; - fix minor coding style issue; - add the missing .usage field; - remove functions not in use anymore. Change-Id: I1c8c3ffeb324e9eacb919c7e0d94fd72122c9a81 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7431 Tested-by: jenkins
This commit is contained in:
@@ -58,8 +58,15 @@ static const struct command_registration dapdirect_jtag_subcommand_handlers[] =
|
||||
{
|
||||
.name = "newtap",
|
||||
.mode = COMMAND_CONFIG,
|
||||
.jim_handler = jim_jtag_newtap,
|
||||
.help = "declare a new TAP"
|
||||
.handler = handle_jtag_newtap,
|
||||
.help = "declare a new TAP",
|
||||
.usage = "basename tap_type '-irlen' count "
|
||||
"['-enable'|'-disable'] "
|
||||
"['-expected_id' number] "
|
||||
"['-ignore-version'] "
|
||||
"['-ignore-bypass'] "
|
||||
"['-ircapture' number] "
|
||||
"['-mask' number]",
|
||||
},
|
||||
{
|
||||
.name = "init",
|
||||
@@ -135,8 +142,15 @@ static const struct command_registration dapdirect_swd_subcommand_handlers[] = {
|
||||
{
|
||||
.name = "newdap",
|
||||
.mode = COMMAND_CONFIG,
|
||||
.jim_handler = jim_jtag_newtap,
|
||||
.handler = handle_jtag_newtap,
|
||||
.help = "declare a new SWD DAP",
|
||||
.usage = "basename dap_type ['-irlen' count] "
|
||||
"['-enable'|'-disable'] "
|
||||
"['-expected_id' number] "
|
||||
"['-ignore-version'] "
|
||||
"['-ignore-bypass'] "
|
||||
"['-ircapture' number] "
|
||||
"['-mask' number]",
|
||||
},
|
||||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
@@ -657,9 +657,16 @@ static const struct command_registration swd_commands[] = {
|
||||
* REVISIT can we verify "just one SWD DAP" here/early?
|
||||
*/
|
||||
.name = "newdap",
|
||||
.jim_handler = jim_jtag_newtap,
|
||||
.handler = handle_jtag_newtap,
|
||||
.mode = COMMAND_CONFIG,
|
||||
.help = "declare a new SWD DAP"
|
||||
.help = "declare a new SWD DAP",
|
||||
.usage = "basename dap_type ['-irlen' count] "
|
||||
"['-enable'|'-disable'] "
|
||||
"['-expected_id' number] "
|
||||
"['-ignore-version'] "
|
||||
"['-ignore-bypass'] "
|
||||
"['-ircapture' number] "
|
||||
"['-mask' number]",
|
||||
},
|
||||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user