forked from rad1o/f1rmware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sdapp: tool to measure raw block I/O performance
will destructively write to the first 100 MB (+2048 byte offset) of the SD card.
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include <r0ketlib/display.h> | ||
#include <r0ketlib/print.h> | ||
#include <r0ketlib/keyin.h> | ||
#include <r0ketlib/itoa.h> | ||
|
||
#include <rad1olib/pins.h> | ||
#include <libopencm3/lpc43xx/gpio.h> | ||
#include <libopencm3/lpc43xx/scu.h> | ||
|
||
#include <rad1olib/systick.h> | ||
#include <rad1olib/sdmmc.h> | ||
#include <lpcapi/sdif_18xx_43xx.h> | ||
#include <lpcapi/sdmmc_18xx_43xx.h> | ||
#include <lpcapi/chip_lpc43xx.h> | ||
|
||
#include <r0ketlib/fs_util.h> | ||
|
||
static uint8_t buf[4096]; | ||
//# MENU rawperf | ||
void menu_rawperf(void){ | ||
lcdClear(); | ||
|
||
sdmmc_setup(); | ||
uint32_t r = sdmmc_acquire(); | ||
|
||
if(!r) { | ||
lcdPrintln("No SD card found."); | ||
lcdDisplay(); | ||
getInputWait(); | ||
return; | ||
} | ||
lcdPrintln("SD card raw perf:"); | ||
lcdPrintln("expect to lose the"); | ||
lcdPrintln("first 100 MB and"); | ||
lcdPrintln("press btn to cont."); | ||
lcdDisplay(); | ||
getInputWait(); | ||
|
||
lcdPrintln("ms to write 100MB:"); | ||
lcdDisplay(); | ||
uint32_t write_t = _timectr; | ||
for(int i=100*1024*1024/4096; i>0; i--) { | ||
if(i%1024 == 0) TOGGLE(LED2); | ||
Chip_SDMMC_WriteBlocks(LPC_SDMMC, buf, 4+(i*8), 8); | ||
} | ||
write_t = _timectr - write_t; | ||
|
||
lcdPrintln(IntToStr(write_t, 10, 0)); | ||
lcdPrintln("ms to read 100MB:"); | ||
lcdDisplay(); | ||
uint32_t read_t = _timectr; | ||
for(int i=100*1024*1024/4096; i>0; i--) { | ||
if(i%1024 == 0) TOGGLE(LED2); | ||
Chip_SDMMC_ReadBlocks(LPC_SDMMC, buf, 4+(i*8), 8); | ||
} | ||
read_t = _timectr - read_t; | ||
|
||
lcdPrintln(IntToStr(read_t, 10, 0)); | ||
lcdPrintln("press button"); | ||
lcdDisplay(); | ||
getInputWait(); | ||
|
||
lcdPrintln("goodbye!"); | ||
lcdDisplay(); | ||
} |