uint32_t apsel, apselsave, baseaddr;
int retval;
- apsel = swjdp->apsel;
apselsave = swjdp->apsel;
- if (argc > 0)
- apsel = strtoul(args[0], NULL, 0);
+ switch (argc) {
+ case 0:
+ apsel = swjdp->apsel;
+ break;
+ case 1:
+ COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ break;
+ default:
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
+
if (apselsave != apsel)
dap_ap_select(swjdp, apsel);
{
uint32_t memaccess_tck;
- memaccess_tck = swjdp->memaccess_tck;
- if (argc > 0)
- memaccess_tck = strtoul(args[0], NULL, 0);
-
+ switch (argc) {
+ case 0:
+ memaccess_tck = swjdp->memaccess_tck;
+ break;
+ case 1:
+ COMMAND_PARSE_NUMBER(u32, args[0], memaccess_tck);
+ break;
+ default:
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
swjdp->memaccess_tck = memaccess_tck;
+
command_print(cmd_ctx, "memory bus access delay set to %" PRIi32 " tck",
swjdp->memaccess_tck);
uint32_t apsel, apid;
int retval;
- apsel = 0;
- if (argc > 0)
- apsel = strtoul(args[0], NULL, 0);
+ switch (argc) {
+ case 0:
+ apsel = 0;
+ break;
+ case 1:
+ COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ break;
+ default:
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
dap_ap_select(swjdp, apsel);
dap_ap_read_reg_u32(swjdp, 0xFC, &apid);
uint32_t apsel, apselsave, apid;
int retval;
- apsel = swjdp->apsel;
apselsave = swjdp->apsel;
- if (argc > 0)
- apsel = strtoul(args[0], NULL, 0);
+ switch (argc) {
+ case 0:
+ apsel = swjdp->apsel;
+ break;
+ case 1:
+ COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ break;
+ default:
+ return ERROR_COMMAND_SYNTAX_ERROR;
+ }
if (apselsave != apsel)
dap_ap_select(swjdp, apsel);
return retval;
}
-
-