]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blobdiff - sw/app/rocon/appl_tests.c
RoCoN: MTD SPI Flash support tested and finished.
[fpga/lx-cpu1/lx-rocon.git] / sw / app / rocon / appl_tests.c
index 30279f6dcdcedf6320b350602919b48fc14835e2..5d525f0ee3eb611fbbd0c155ec237853374808db 100644 (file)
 #include "pxmcc_types.h"
 #include "pxmcc_interface.h"
 
+#ifdef CONFIG_OC_MTD_DRV_SYSLESS
+#include <mtd_spi_drv.h>
+#endif
+
 int cmd_do_test_memusage(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
   void *maxaddr;
@@ -173,7 +177,24 @@ int cmd_do_spimst_blocking(cmd_io_t *cmd_io, const struct cmd_des *des, char *pa
 
 int cmd_do_mtdspitest(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
-  mtd_spi_test();
+  int res;
+  unsigned char id_buff[3];
+
+  res = mtd_spi_read_jedec_id(&mtd_spi_state, id_buff, 3);
+  if (res < 0) {
+    printf("mtd_spi_read_jedec_id returned %d\n", res);
+    return -1;
+  }
+
+  printf("mtd_spi_read_jedec_id 0x%02x 0x%02x 0x%02x \n",
+         id_buff[0], id_buff[1], id_buff[2]);
+
+  res = mtd_spi_set_protect_mode(&mtd_spi_state, 0, 0);
+  if (res < 0) {
+    printf("mtd_spi_set_protect_mode returned %d\n", res);
+    return -1;
+  }
+
   return 0;
 }