X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fpic32mx.c;h=6844975e24795d8ab0c9b9b46b610f6b919416e6;hb=64c2e03b23d9cadc1b919d38e902a079d015ddc6;hp=c42cfb2bbe9207c2bf153ce1629b7c07d2130e8d;hpb=f2958fc04bd879393fa743860478834e234f05d0;p=openocd.git diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index c42cfb2bbe..6844975e24 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -801,37 +801,35 @@ static int pic32mx_auto_probe(struct flash_bank *bank) return pic32mx_probe(bank); } -static int pic32mx_info(struct flash_bank *bank, char *buf, int buf_size) +static int pic32mx_info(struct flash_bank *bank, struct command_invocation *cmd) { struct target *target = bank->target; struct mips32_common *mips32 = target->arch_info; struct mips_ejtag *ejtag_info = &mips32->ejtag_info; uint32_t device_id; - int printed = 0, i; device_id = ejtag_info->idcode; if (((device_id >> 1) & 0x7ff) != PIC32MX_MANUF_ID) { - snprintf(buf, buf_size, - "Cannot identify target as a PIC32MX family (manufacturer 0x%03x != 0x%03x)\n", - (unsigned)((device_id >> 1) & 0x7ff), - PIC32MX_MANUF_ID); + command_print_sameline(cmd, + "Cannot identify target as a PIC32MX family (manufacturer 0x%03x != 0x%03x)\n", + (unsigned)((device_id >> 1) & 0x7ff), + PIC32MX_MANUF_ID); return ERROR_FLASH_OPERATION_FAILED; } + int i; for (i = 0; pic32mx_devs[i].name != NULL; i++) { if (pic32mx_devs[i].devid == (device_id & 0x0fffffff)) { - printed = snprintf(buf, buf_size, "PIC32MX%s", pic32mx_devs[i].name); + command_print_sameline(cmd, "PIC32MX%s", pic32mx_devs[i].name); break; } } if (pic32mx_devs[i].name == NULL) - printed = snprintf(buf, buf_size, "Unknown"); + command_print_sameline(cmd, "Unknown"); - buf += printed; - buf_size -= printed; - snprintf(buf, buf_size, " Ver: 0x%02x", + command_print_sameline(cmd, " Ver: 0x%02x", (unsigned)((device_id >> 28) & 0xf)); return ERROR_OK;