You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/08/10 14:30:02 UTC
[GitHub] kasjer commented on a change in pull request #1324: Flash speed test
kasjer commented on a change in pull request #1324: Flash speed test
URL: https://github.com/apache/mynewt-core/pull/1324#discussion_r209274407
##########
File path: test/flash_test/src/flash_test/flash_test.c
##########
@@ -127,31 +145,158 @@ flash_cli_cmd(int argc, char **argv)
while (off < sz) {
sec_cnt = min(sizeof(tmp_buf), sz - off);
- if (hal_flash_write(0, off, tmp_buf, sec_cnt)) {
+ if (hal_flash_write(fid, off, tmp_buf, sec_cnt)) {
console_printf("flash write failure at %lx\n",
(long unsigned int) off);
}
off += sec_cnt;
}
console_printf("Done!\n");
- } else if ( !strcmp(argv[1], "?") || !strcmp(argv[1], "help"))
- {
+ } else if ( !strcmp(argv[1], "?") || !strcmp(argv[1], "help")) {
console_printf("Commands Available\n");
- console_printf("flash -- dumps sector map \n");
- console_printf("flash read <offset> <size> -- reads bytes from flash \n");
- console_printf("flash write <offset> <size> -- writes incrementing data pattern 0-8 to flash \n");
- console_printf("flash erase <offset> <size> -- erases flash \n");
+ console_printf("flash -- dumps sector map\n");
+ console_printf("flash read <offset> <size> [flash dev idx] -- "
+ "read bytes from flash\n");
+ console_printf("flash write <offset> <size> [flash dev idx] -- "
+ "write incrementing data pattern 0-8 to flash\n");
+ console_printf("flash erase <offset> <size> [flash dev idx] -- "
+ "erase flash\n");
}
return 0;
err:
return -1;
}
+
+/*
+ * Returns # of ops done within 2 seconds.
+ */
+int
+flash_speed_test(int flash_dev, uint32_t addr, int sz, int move)
+{
+ int rc;
+ int cnt = 0;
+ int off = 0;
+ int start_time;
+ int end_time;
+ void *data_buf;
+
+ data_buf = malloc(sz);
Review comment:
It's not checked for NULL, since it is not clear from help what is used for I had crash
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services