Lines Matching +full:address +full:- +full:width
6 * SPDX-License-Identifier: Apache-2.0
43 static int memory_dump(const struct shell *sh, mem_addr_t phys_addr, size_t size, uint8_t width) in memory_dump() argument
48 const size_t vsize = width / BITS_PER_BYTE; in memory_dump()
60 addr += SHELL_HEXDUMP_BYTES_IN_LINE, size -= MIN(size, SHELL_HEXDUMP_BYTES_IN_LINE)) { in memory_dump()
64 switch (width) { in memory_dump()
86 shell_fprintf(sh, SHELL_NORMAL, "Incorrect data width\n"); in memory_dump()
87 return -EINVAL; in memory_dump()
101 size_t size = -1; in cmd_dump()
102 size_t width = 32; in cmd_dump() local
103 mem_addr_t addr = -1; in cmd_dump()
109 while ((rv = getopt(argc, argv, "a:s:w:")) != -1) { in cmd_dump()
115 return -EINVAL; in cmd_dump()
122 return -EINVAL; in cmd_dump()
126 width = (size_t)shell_strtoul(optarg, 0, &err); in cmd_dump()
128 shell_error(sh, "invalid width '%s'", optarg); in cmd_dump()
129 return -EINVAL; in cmd_dump()
134 return -EINVAL; in cmd_dump()
138 if (addr == -1) { in cmd_dump()
139 shell_error(sh, "'-a <address>' is mandatory"); in cmd_dump()
140 return -EINVAL; in cmd_dump()
143 if (size == -1) { in cmd_dump()
144 shell_error(sh, "'-s <size>' is mandatory"); in cmd_dump()
145 return -EINVAL; in cmd_dump()
148 return memory_dump(sh, addr, size, width); in cmd_dump()
158 return -EBUSY; in set_bypass()
163 shell_print(sh, "Loading...\npress ctrl-x ctrl-q to escape"); in set_bypass()
181 for (int i = 0; i < (len - 1); i++) { in bypass_cb()
197 sum = sum - 4; in bypass_cb()
210 tail = recv[len - 1]; in bypass_cb()
235 arg = argv[1] + (!strncmp(argv[1], "--", 2) && argv[1][2]); in cmd_load()
236 if (!strncmp(arg, "-e", 2)) { in cmd_load()
238 } else if (!strcmp(arg, "--")) { in cmd_load()
240 argc--; in cmd_load()
242 } else if (arg[0] == '-' && arg[1]) { in cmd_load()
248 argc--; in cmd_load()
258 static int memory_read(const struct shell *sh, mem_addr_t addr, uint8_t width) in memory_read() argument
263 switch (width) { in memory_read()
274 shell_fprintf(sh, SHELL_NORMAL, "Incorrect data width\n"); in memory_read()
275 err = -EINVAL; in memory_read()
286 static int memory_write(const struct shell *sh, mem_addr_t addr, uint8_t width, uint64_t value) in memory_write() argument
290 switch (width) { in memory_write()
301 shell_fprintf(sh, SHELL_NORMAL, "Incorrect data width\n"); in memory_write()
302 err = -EINVAL; in memory_write()
314 uint8_t width; in cmd_devmem() local
327 width = 32; in cmd_devmem()
329 width = strtoul(argv[2], NULL, 10); in cmd_devmem()
332 shell_fprintf(sh, SHELL_NORMAL, "Using data width %d\n", width); in cmd_devmem()
335 return memory_read(sh, addr, width); in cmd_devmem()
339 * this value at the address provided in cmd_devmem()
346 return memory_write(sh, addr, width, value); in cmd_devmem()
352 "devmem dump -a <address> -s <size> [-w <width>]\n",
356 "devmem load [options] [address]\n"
358 "-e\tlittle-endian parse",
365 "Read memory at address with optional width:\n"
366 "devmem <address> [<width>]\n"
367 "Write memory at address with mandatory width and value:\n"
368 "devmem <address> <width> <value>",