software/bios: rename cmd_mem_access to cmd_mem.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 18 May 2020 17:59:28 +0000 (19:59 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 18 May 2020 17:59:28 +0000 (19:59 +0200)
litex/soc/software/bios/Makefile
litex/soc/software/bios/commands/cmd_mem.c [new file with mode: 0644]
litex/soc/software/bios/commands/cmd_mem_access.c [deleted file]

index 9fba33a62c90cec23d9bed16f1a9b216f013f46c..ac7725e6037e81cef9d74b47aa3cf70ff49e364c 100755 (executable)
@@ -21,7 +21,7 @@ OBJECTS = isr.o                       \
          cmd_boot.o            \
          cmd_dram.o            \
          cmd_mdio.o            \
-         cmd_mem_access.o      \
+         cmd_mem.o             \
          cmd_sdcard.o          \
          cmd_spi_flash.o       \
 
diff --git a/litex/soc/software/bios/commands/cmd_mem.c b/litex/soc/software/bios/commands/cmd_mem.c
new file mode 100644 (file)
index 0000000..8c63d4c
--- /dev/null
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: BSD-Source-Code
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "../command.h"
+#include "../helpers.h"
+
+/**
+ * Command "mr"
+ *
+ * Memory read
+ *
+ */
+static void mr(int nb_params, char **params)
+{
+       char *c;
+       unsigned int *addr;
+       unsigned int length;
+
+       if (nb_params < 1) {
+               printf("mr <address> [length]");
+               return;
+       }
+       addr = (unsigned int *)strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect address");
+               return;
+       }
+       if (nb_params == 1) {
+               length = 4;
+       } else {
+               length = strtoul(params[1], &c, 0);
+               if(*c != 0) {
+                       printf("\nIncorrect length");
+                       return;
+               }
+       }
+
+       dump_bytes(addr, length, (unsigned long)addr);
+}
+
+define_command(mr, mr, "Read address space", MEM_CMDS);
+
+/**
+ * Command "mw"
+ *
+ * Memory write
+ *
+ */
+static void mw(int nb_params, char **params)
+{
+       char *c;
+       unsigned int *addr;
+       unsigned int value;
+       unsigned int count;
+       unsigned int i;
+
+       if (nb_params < 2) {
+               printf("mw <address> <value> [count]");
+               return;
+       }
+
+       addr = (unsigned int *)strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect address");
+               return;
+       }
+
+       value = strtoul(params[1], &c, 0);
+       if(*c != 0) {
+               printf("Incorrect value");
+               return;
+       }
+
+       if (nb_params == 2) {
+               count = 1;
+       } else {
+               count = strtoul(params[2], &c, 0);
+               if(*c != 0) {
+                       printf("Incorrect count");
+                       return;
+               }
+       }
+
+       for (i = 0; i < count; i++)
+               *addr++ = value;
+}
+
+define_command(mw, mw, "Write address space", MEM_CMDS);
+
+/**
+ * Command "mc"
+ *
+ * Memory copy
+ *
+ */
+static void mc(int nb_params, char **params)
+{
+       char *c;
+       unsigned int *dstaddr;
+       unsigned int *srcaddr;
+       unsigned int count;
+       unsigned int i;
+
+       if (nb_params < 2) {
+               printf("mc <dst> <src> [count]");
+               return;
+       }
+
+       dstaddr = (unsigned int *)strtoul(params[0], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect destination address");
+               return;
+       }
+
+       srcaddr = (unsigned int *)strtoul(params[1], &c, 0);
+       if (*c != 0) {
+               printf("Incorrect source address");
+               return;
+       }
+
+       if (nb_params == 2) {
+               count = 1;
+       } else {
+               count = strtoul(params[2], &c, 0);
+               if (*c != 0) {
+                       printf("Incorrect count");
+                       return;
+               }
+       }
+
+       for (i = 0; i < count; i++)
+               *dstaddr++ = *srcaddr++;
+}
+
+define_command(mc, mc, "Copy address space", MEM_CMDS);
diff --git a/litex/soc/software/bios/commands/cmd_mem_access.c b/litex/soc/software/bios/commands/cmd_mem_access.c
deleted file mode 100644 (file)
index 8c63d4c..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: BSD-Source-Code
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "../command.h"
-#include "../helpers.h"
-
-/**
- * Command "mr"
- *
- * Memory read
- *
- */
-static void mr(int nb_params, char **params)
-{
-       char *c;
-       unsigned int *addr;
-       unsigned int length;
-
-       if (nb_params < 1) {
-               printf("mr <address> [length]");
-               return;
-       }
-       addr = (unsigned int *)strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect address");
-               return;
-       }
-       if (nb_params == 1) {
-               length = 4;
-       } else {
-               length = strtoul(params[1], &c, 0);
-               if(*c != 0) {
-                       printf("\nIncorrect length");
-                       return;
-               }
-       }
-
-       dump_bytes(addr, length, (unsigned long)addr);
-}
-
-define_command(mr, mr, "Read address space", MEM_CMDS);
-
-/**
- * Command "mw"
- *
- * Memory write
- *
- */
-static void mw(int nb_params, char **params)
-{
-       char *c;
-       unsigned int *addr;
-       unsigned int value;
-       unsigned int count;
-       unsigned int i;
-
-       if (nb_params < 2) {
-               printf("mw <address> <value> [count]");
-               return;
-       }
-
-       addr = (unsigned int *)strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect address");
-               return;
-       }
-
-       value = strtoul(params[1], &c, 0);
-       if(*c != 0) {
-               printf("Incorrect value");
-               return;
-       }
-
-       if (nb_params == 2) {
-               count = 1;
-       } else {
-               count = strtoul(params[2], &c, 0);
-               if(*c != 0) {
-                       printf("Incorrect count");
-                       return;
-               }
-       }
-
-       for (i = 0; i < count; i++)
-               *addr++ = value;
-}
-
-define_command(mw, mw, "Write address space", MEM_CMDS);
-
-/**
- * Command "mc"
- *
- * Memory copy
- *
- */
-static void mc(int nb_params, char **params)
-{
-       char *c;
-       unsigned int *dstaddr;
-       unsigned int *srcaddr;
-       unsigned int count;
-       unsigned int i;
-
-       if (nb_params < 2) {
-               printf("mc <dst> <src> [count]");
-               return;
-       }
-
-       dstaddr = (unsigned int *)strtoul(params[0], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect destination address");
-               return;
-       }
-
-       srcaddr = (unsigned int *)strtoul(params[1], &c, 0);
-       if (*c != 0) {
-               printf("Incorrect source address");
-               return;
-       }
-
-       if (nb_params == 2) {
-               count = 1;
-       } else {
-               count = strtoul(params[2], &c, 0);
-               if (*c != 0) {
-                       printf("Incorrect count");
-                       return;
-               }
-       }
-
-       for (i = 0; i < count; i++)
-               *dstaddr++ = *srcaddr++;
-}
-
-define_command(mc, mc, "Copy address space", MEM_CMDS);