diff --git a/hw/drivers/uwb/uwb_dw1000/src/dw1000_cli.c b/hw/drivers/uwb/uwb_dw1000/src/dw1000_cli.c index e97473c..1eea435 100644 --- a/hw/drivers/uwb/uwb_dw1000/src/dw1000_cli.c +++ b/hw/drivers/uwb/uwb_dw1000/src/dw1000_cli.c @@ -160,16 +160,17 @@ dw1000_cli_dump_registers(struct _dw1000_dev_instance_t * inst, struct streamer } void -dw1000_dump_address(struct _dw1000_dev_instance_t * inst, uint32_t addr, uint16_t length) +dw1000_cli_dump_address(struct _dw1000_dev_instance_t * inst, uint32_t addr, uint16_t length, struct streamer *streamer) { - int i, step = 16; - uint8_t b[step]; - console_printf("Dump starting at %06"PRIX32":\n", addr); +#define DUMP_STEP (16) + int i, step = DUMP_STEP; + uint8_t b[DUMP_STEP]; + streamer_printf(streamer, "Dump starting at %06"PRIX32":\n", addr); for (i=0;ifn, "ev")) { dw1000_cli_dump_event_counters(inst, &streamer_debugfs); } + if (!strcmp(cmd->fn, "da")) { + if (da_addr > 0x3F) da_addr = 0x3F; + dw1000_cli_dump_address(inst, da_addr, da_length, &streamer_debugfs); + } #if MYNEWT_VAL(DW1000_SYS_STATUS_BACKTRACE_LEN) if (!strcmp(cmd->fn, "ibt")) { dw1000_cli_interrupt_backtrace(inst, 1, &streamer_debugfs); @@ -116,11 +122,26 @@ static const struct file_operations clk_dump_fops = { .release = single_release, }; +static int debugfs_u32_set(void *data, u64 val) +{ + *(u32 *)data = val; + return 0; +} + +static int debugfs_u32_get(void *data, u64 *val) +{ + *val = *(u32 *)data; + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(fops_u32, debugfs_u32_get, debugfs_u32_set, "%llu\n"); + static char* cmd_names[] = { "dump", "ev", "ibt", "bt", + "da", 0 }; @@ -160,6 +181,12 @@ void dw1000_debugfs_init(void) return; } } + if (!debugfs_create_file("da_addr", 0644, dir, &da_addr, &fops_u32)) { + pr_err("failed to add da_addr\n"); + } + if (!debugfs_create_file("da_length", 0644, dir, &da_length, &fops_u32)) { + pr_err("failed to add da_length\n"); + } } }