Program to benchmark the speed of the different file system options versus placing data directly into arrays.

Dependencies:   DMBasicGUI DMSupport

This program is used to measure the performance of the different file system options on the LPC4088 Display Module.

The performance wiki page and more specifically the software part describes this program and the output.

As the program doesn't use the display at all it can be used on both the 4.3" and 5" display modules.

Committer:
alindvall
Date:
Thu Mar 26 16:02:38 2015 +0000
Revision:
5:788710a95951
Parent:
3:1716747cba16
Child:
6:47b4bed9fa13
Added workaround to problem with MCIFileSystem write sizes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
alindvall 0:b77503796c51 1 /*
alindvall 0:b77503796c51 2 * Copyright 2015 Embedded Artists AB
alindvall 0:b77503796c51 3 *
alindvall 0:b77503796c51 4 * Licensed under the Apache License, Version 2.0 (the "License");
alindvall 0:b77503796c51 5 * you may not use this file except in compliance with the License.
alindvall 0:b77503796c51 6 * You may obtain a copy of the License at
alindvall 0:b77503796c51 7 *
alindvall 0:b77503796c51 8 * http://www.apache.org/licenses/LICENSE-2.0
alindvall 0:b77503796c51 9 *
alindvall 0:b77503796c51 10 * Unless required by applicable law or agreed to in writing, software
alindvall 0:b77503796c51 11 * distributed under the License is distributed on an "AS IS" BASIS,
alindvall 0:b77503796c51 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
alindvall 0:b77503796c51 13 * See the License for the specific language governing permissions and
alindvall 0:b77503796c51 14 * limitations under the License.
alindvall 0:b77503796c51 15 */
alindvall 0:b77503796c51 16
alindvall 0:b77503796c51 17 #include "mbed.h"
alindvall 0:b77503796c51 18 #include "DMBoard.h"
alindvall 0:b77503796c51 19 #include "MCIFileSystem.h"
alindvall 0:b77503796c51 20 #include "QSPIFileSystem.h"
alindvall 0:b77503796c51 21 #include "USBHostMSD.h"
embeddedartists 3:1716747cba16 22 #include "img_data.h"
embeddedartists 3:1716747cba16 23 #include "Image.h"
alindvall 0:b77503796c51 24
alindvall 0:b77503796c51 25 /******************************************************************************
alindvall 0:b77503796c51 26 * Defines and typedefs
alindvall 0:b77503796c51 27 *****************************************************************************/
alindvall 0:b77503796c51 28
alindvall 0:b77503796c51 29 typedef struct {
embeddedartists 3:1716747cba16 30 bool rw; // use in the read/write test? Used in image tests regardless
alindvall 0:b77503796c51 31 uint32_t size;
alindvall 0:b77503796c51 32 const char* fname;
alindvall 0:b77503796c51 33 const uint8_t* iflash_direct;
alindvall 0:b77503796c51 34 const uint8_t* qspi_direct;
alindvall 0:b77503796c51 35 } bench_input_t;
alindvall 0:b77503796c51 36
alindvall 0:b77503796c51 37 #define NUM_BENCHMARKS (sizeof(BENCHMARK_INPUT)/sizeof(BENCHMARK_INPUT[0]))
alindvall 0:b77503796c51 38
alindvall 0:b77503796c51 39 #define COPYBUF_SIZE (10*1024*1024)
alindvall 0:b77503796c51 40
alindvall 0:b77503796c51 41 #define USBH_CONNECTION_EVENT (1)
alindvall 0:b77503796c51 42
alindvall 0:b77503796c51 43 #define QSPIFS_SIZE_MB (8)
alindvall 0:b77503796c51 44 #define QSPIFS_SIZE (QSPIFS_SIZE_MB * 1024*1024)
alindvall 0:b77503796c51 45
alindvall 0:b77503796c51 46 /******************************************************************************
alindvall 0:b77503796c51 47 * Local variables
alindvall 0:b77503796c51 48 *****************************************************************************/
alindvall 0:b77503796c51 49
alindvall 0:b77503796c51 50 static bench_input_t BENCHMARK_INPUT[] = {
embeddedartists 3:1716747cba16 51 // The _red_ images
alindvall 0:b77503796c51 52 {
embeddedartists 3:1716747cba16 53 .rw = true,
embeddedartists 3:1716747cba16 54 .size = img_size_iflash_32x32_red_bmp,
embeddedartists 3:1716747cba16 55 .fname = "32x32_red.bmp",
embeddedartists 3:1716747cba16 56 .iflash_direct = img_iflash_32x32_red_bmp,
embeddedartists 3:1716747cba16 57 .qspi_direct = img_qspi_32x32_red_bmp,
embeddedartists 3:1716747cba16 58 },
embeddedartists 3:1716747cba16 59 {
embeddedartists 3:1716747cba16 60 .rw = false,
embeddedartists 3:1716747cba16 61 .size = img_size_iflash_32x32_red_png,
embeddedartists 3:1716747cba16 62 .fname = "32x32_red.png",
embeddedartists 3:1716747cba16 63 .iflash_direct = img_iflash_32x32_red_png,
embeddedartists 3:1716747cba16 64 .qspi_direct = img_qspi_32x32_red_png,
embeddedartists 3:1716747cba16 65 },
embeddedartists 3:1716747cba16 66 {
embeddedartists 3:1716747cba16 67 .rw = false,
embeddedartists 3:1716747cba16 68 .size = img_size_iflash_32x32_red_raw,
embeddedartists 3:1716747cba16 69 .fname = "32x32_red.raw",
embeddedartists 3:1716747cba16 70 .iflash_direct = img_iflash_32x32_red_raw,
embeddedartists 3:1716747cba16 71 .qspi_direct = img_qspi_32x32_red_raw,
embeddedartists 3:1716747cba16 72 },
embeddedartists 3:1716747cba16 73 {
embeddedartists 3:1716747cba16 74 .rw = true,
embeddedartists 3:1716747cba16 75 .size = img_size_iflash_64x64_red_bmp,
embeddedartists 3:1716747cba16 76 .fname = "64x64_red.bmp",
embeddedartists 3:1716747cba16 77 .iflash_direct = img_iflash_64x64_red_bmp,
embeddedartists 3:1716747cba16 78 .qspi_direct = img_qspi_64x64_red_bmp,
embeddedartists 3:1716747cba16 79 },
embeddedartists 3:1716747cba16 80 {
embeddedartists 3:1716747cba16 81 .rw = false,
embeddedartists 3:1716747cba16 82 .size = img_size_iflash_64x64_red_png,
embeddedartists 3:1716747cba16 83 .fname = "64x64_red.png",
embeddedartists 3:1716747cba16 84 .iflash_direct = img_iflash_64x64_red_png,
embeddedartists 3:1716747cba16 85 .qspi_direct = img_qspi_64x64_red_png,
embeddedartists 3:1716747cba16 86 },
embeddedartists 3:1716747cba16 87 {
embeddedartists 3:1716747cba16 88 .rw = false,
embeddedartists 3:1716747cba16 89 .size = img_size_iflash_64x64_red_raw,
embeddedartists 3:1716747cba16 90 .fname = "64x64_red.raw",
embeddedartists 3:1716747cba16 91 .iflash_direct = img_iflash_64x64_red_raw,
embeddedartists 3:1716747cba16 92 .qspi_direct = img_qspi_64x64_red_raw,
alindvall 0:b77503796c51 93 },
alindvall 0:b77503796c51 94 {
embeddedartists 3:1716747cba16 95 .rw = true,
embeddedartists 3:1716747cba16 96 .size = img_size_qspi_128x128_red_bmp,
embeddedartists 3:1716747cba16 97 .fname = "128x128_red.bmp",
embeddedartists 3:1716747cba16 98 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 99 .qspi_direct = img_qspi_128x128_red_bmp,
embeddedartists 3:1716747cba16 100 },
embeddedartists 3:1716747cba16 101 {
embeddedartists 3:1716747cba16 102 .rw = false,
embeddedartists 3:1716747cba16 103 .size = img_size_qspi_128x128_red_png,
embeddedartists 3:1716747cba16 104 .fname = "128x128_red.png",
embeddedartists 3:1716747cba16 105 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 106 .qspi_direct = img_qspi_128x128_red_png,
embeddedartists 3:1716747cba16 107 },
embeddedartists 3:1716747cba16 108 {
embeddedartists 3:1716747cba16 109 .rw = false,
embeddedartists 3:1716747cba16 110 .size = img_size_qspi_128x128_red_raw,
embeddedartists 3:1716747cba16 111 .fname = "128x128_red.raw",
embeddedartists 3:1716747cba16 112 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 113 .qspi_direct = img_qspi_128x128_red_raw,
embeddedartists 3:1716747cba16 114 },
embeddedartists 3:1716747cba16 115 {
embeddedartists 3:1716747cba16 116 .rw = false,
embeddedartists 3:1716747cba16 117 .size = img_size_qspi_480x272_red_bmp,
embeddedartists 3:1716747cba16 118 .fname = "480x272_red.bmp",
embeddedartists 3:1716747cba16 119 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 120 .qspi_direct = img_qspi_480x272_red_bmp,
embeddedartists 3:1716747cba16 121 },
embeddedartists 3:1716747cba16 122 {
embeddedartists 3:1716747cba16 123 .rw = false,
embeddedartists 3:1716747cba16 124 .size = img_size_qspi_480x272_red_png,
embeddedartists 3:1716747cba16 125 .fname = "480x272_red.png",
embeddedartists 3:1716747cba16 126 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 127 .qspi_direct = img_qspi_480x272_red_png,
embeddedartists 3:1716747cba16 128 },
embeddedartists 3:1716747cba16 129 {
embeddedartists 3:1716747cba16 130 .rw = true,
embeddedartists 3:1716747cba16 131 .size = img_size_qspi_480x272_red_raw,
embeddedartists 3:1716747cba16 132 .fname = "480x272_red.raw",
embeddedartists 3:1716747cba16 133 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 134 .qspi_direct = img_qspi_480x272_red_raw,
embeddedartists 3:1716747cba16 135 },
embeddedartists 3:1716747cba16 136 {
embeddedartists 3:1716747cba16 137 .rw = true,
embeddedartists 3:1716747cba16 138 .size = img_size_qspi_800x480_red_bmp,
embeddedartists 3:1716747cba16 139 .fname = "800x480_red.bmp",
embeddedartists 3:1716747cba16 140 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 141 .qspi_direct = img_qspi_800x480_red_bmp,
embeddedartists 3:1716747cba16 142 },
embeddedartists 3:1716747cba16 143 {
embeddedartists 3:1716747cba16 144 .rw = false,
embeddedartists 3:1716747cba16 145 .size = img_size_qspi_800x480_red_png,
embeddedartists 3:1716747cba16 146 .fname = "800x480_red.png",
embeddedartists 3:1716747cba16 147 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 148 .qspi_direct = img_qspi_800x480_red_png,
alindvall 0:b77503796c51 149 },
alindvall 0:b77503796c51 150 {
embeddedartists 3:1716747cba16 151 .rw = false,
embeddedartists 3:1716747cba16 152 .size = img_size_qspi_800x480_red_raw,
embeddedartists 3:1716747cba16 153 .fname = "800x480_red.raw",
embeddedartists 3:1716747cba16 154 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 155 .qspi_direct = img_qspi_800x480_red_raw,
embeddedartists 3:1716747cba16 156 },
embeddedartists 3:1716747cba16 157
embeddedartists 3:1716747cba16 158 // The _flowers_ images
embeddedartists 3:1716747cba16 159 {
embeddedartists 3:1716747cba16 160 .rw = false,
embeddedartists 3:1716747cba16 161 .size = img_size_iflash_32x32_flowers_bmp,
embeddedartists 3:1716747cba16 162 .fname = "32x32_flowers.bmp",
embeddedartists 3:1716747cba16 163 .iflash_direct = img_iflash_32x32_flowers_bmp,
embeddedartists 3:1716747cba16 164 .qspi_direct = img_qspi_32x32_flowers_bmp,
embeddedartists 3:1716747cba16 165 },
embeddedartists 3:1716747cba16 166 {
embeddedartists 3:1716747cba16 167 .rw = false,
embeddedartists 3:1716747cba16 168 .size = img_size_iflash_32x32_flowers_png,
embeddedartists 3:1716747cba16 169 .fname = "32x32_flowers.png",
embeddedartists 3:1716747cba16 170 .iflash_direct = img_iflash_32x32_flowers_png,
embeddedartists 3:1716747cba16 171 .qspi_direct = img_qspi_32x32_flowers_png,
alindvall 0:b77503796c51 172 },
alindvall 0:b77503796c51 173 {
embeddedartists 3:1716747cba16 174 .rw = false,
embeddedartists 3:1716747cba16 175 .size = img_size_iflash_32x32_flowers_raw,
embeddedartists 3:1716747cba16 176 .fname = "32x32_flowers.raw",
embeddedartists 3:1716747cba16 177 .iflash_direct = img_iflash_32x32_flowers_raw,
embeddedartists 3:1716747cba16 178 .qspi_direct = img_qspi_32x32_flowers_raw,
embeddedartists 3:1716747cba16 179 },
embeddedartists 3:1716747cba16 180 {
embeddedartists 3:1716747cba16 181 .rw = false,
embeddedartists 3:1716747cba16 182 .size = img_size_iflash_64x64_flowers_bmp,
embeddedartists 3:1716747cba16 183 .fname = "64x64_flowers.bmp",
embeddedartists 3:1716747cba16 184 .iflash_direct = img_iflash_64x64_flowers_bmp,
embeddedartists 3:1716747cba16 185 .qspi_direct = img_qspi_64x64_flowers_bmp,
embeddedartists 3:1716747cba16 186 },
embeddedartists 3:1716747cba16 187 {
embeddedartists 3:1716747cba16 188 .rw = false,
embeddedartists 3:1716747cba16 189 .size = img_size_iflash_64x64_flowers_png,
embeddedartists 3:1716747cba16 190 .fname = "64x64_flowers.png",
embeddedartists 3:1716747cba16 191 .iflash_direct = img_iflash_64x64_flowers_png,
embeddedartists 3:1716747cba16 192 .qspi_direct = img_qspi_64x64_flowers_png,
embeddedartists 3:1716747cba16 193 },
embeddedartists 3:1716747cba16 194 {
embeddedartists 3:1716747cba16 195 .rw = false,
embeddedartists 3:1716747cba16 196 .size = img_size_iflash_64x64_flowers_raw,
embeddedartists 3:1716747cba16 197 .fname = "64x64_flowers.raw",
embeddedartists 3:1716747cba16 198 .iflash_direct = img_iflash_64x64_flowers_raw,
embeddedartists 3:1716747cba16 199 .qspi_direct = img_qspi_64x64_flowers_raw,
alindvall 0:b77503796c51 200 },
alindvall 0:b77503796c51 201 {
embeddedartists 3:1716747cba16 202 .rw = false,
embeddedartists 3:1716747cba16 203 .size = img_size_qspi_128x128_flowers_bmp,
embeddedartists 3:1716747cba16 204 .fname = "128x128_flowers.bmp",
embeddedartists 3:1716747cba16 205 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 206 .qspi_direct = img_qspi_128x128_flowers_bmp,
embeddedartists 3:1716747cba16 207 },
embeddedartists 3:1716747cba16 208 {
embeddedartists 3:1716747cba16 209 .rw = false,
embeddedartists 3:1716747cba16 210 .size = img_size_qspi_128x128_flowers_png,
embeddedartists 3:1716747cba16 211 .fname = "128x128_flowers.png",
alindvall 0:b77503796c51 212 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 213 .qspi_direct = img_qspi_128x128_flowers_png,
embeddedartists 3:1716747cba16 214 },
embeddedartists 3:1716747cba16 215 {
embeddedartists 3:1716747cba16 216 .rw = false,
embeddedartists 3:1716747cba16 217 .size = img_size_qspi_128x128_flowers_raw,
embeddedartists 3:1716747cba16 218 .fname = "128x128_flowers.raw",
embeddedartists 3:1716747cba16 219 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 220 .qspi_direct = img_qspi_128x128_flowers_raw,
embeddedartists 3:1716747cba16 221 },
embeddedartists 3:1716747cba16 222 {
embeddedartists 3:1716747cba16 223 .rw = false,
embeddedartists 3:1716747cba16 224 .size = img_size_qspi_480x272_flowers_bmp,
embeddedartists 3:1716747cba16 225 .fname = "480x272_flowers.bmp",
embeddedartists 3:1716747cba16 226 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 227 .qspi_direct = img_qspi_480x272_flowers_bmp,
alindvall 0:b77503796c51 228 },
alindvall 0:b77503796c51 229 {
embeddedartists 3:1716747cba16 230 .rw = false,
embeddedartists 3:1716747cba16 231 .size = img_size_qspi_480x272_flowers_png,
embeddedartists 3:1716747cba16 232 .fname = "480x272_flowers.png",
embeddedartists 3:1716747cba16 233 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 234 .qspi_direct = img_qspi_480x272_flowers_png,
embeddedartists 3:1716747cba16 235 },
embeddedartists 3:1716747cba16 236 {
embeddedartists 3:1716747cba16 237 .rw = false,
embeddedartists 3:1716747cba16 238 .size = img_size_qspi_480x272_flowers_raw,
embeddedartists 3:1716747cba16 239 .fname = "480x272_flowers.raw",
alindvall 0:b77503796c51 240 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 241 .qspi_direct = img_qspi_480x272_flowers_raw,
embeddedartists 3:1716747cba16 242 },
embeddedartists 3:1716747cba16 243 {
embeddedartists 3:1716747cba16 244 .rw = false,
embeddedartists 3:1716747cba16 245 .size = img_size_qspi_800x480_flowers_bmp,
embeddedartists 3:1716747cba16 246 .fname = "800x480_flowers.bmp",
embeddedartists 3:1716747cba16 247 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 248 .qspi_direct = img_qspi_800x480_flowers_bmp,
alindvall 0:b77503796c51 249 },
embeddedartists 3:1716747cba16 250 {
embeddedartists 3:1716747cba16 251 .rw = false,
embeddedartists 3:1716747cba16 252 .size = img_size_qspi_800x480_flowers_png,
embeddedartists 3:1716747cba16 253 .fname = "800x480_flowers.png",
embeddedartists 3:1716747cba16 254 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 255 .qspi_direct = img_qspi_800x480_flowers_png,
embeddedartists 3:1716747cba16 256 },
embeddedartists 3:1716747cba16 257 {
embeddedartists 3:1716747cba16 258 .rw = false,
embeddedartists 3:1716747cba16 259 .size = img_size_qspi_800x480_flowers_raw,
embeddedartists 3:1716747cba16 260 .fname = "800x480_flowers.raw",
embeddedartists 3:1716747cba16 261 .iflash_direct = NULL,
embeddedartists 3:1716747cba16 262 .qspi_direct = img_qspi_800x480_flowers_raw,
embeddedartists 3:1716747cba16 263 },
alindvall 0:b77503796c51 264 };
alindvall 0:b77503796c51 265
alindvall 0:b77503796c51 266 static MCIFileSystem* mcifs;
alindvall 0:b77503796c51 267 static QSPIFileSystem* qspifs;
alindvall 0:b77503796c51 268 static USBHostMSD* usbmsd;
alindvall 0:b77503796c51 269
alindvall 0:b77503796c51 270 /******************************************************************************
alindvall 0:b77503796c51 271 * Private Functions
alindvall 0:b77503796c51 272 *****************************************************************************/
alindvall 0:b77503796c51 273
alindvall 0:b77503796c51 274
alindvall 0:b77503796c51 275 static bool fileExists(const char* fname) {
alindvall 0:b77503796c51 276 FILE* f = fopen(fname, "r");
alindvall 0:b77503796c51 277 if (f != NULL) {
alindvall 0:b77503796c51 278 fclose(f);
alindvall 0:b77503796c51 279 return true;
alindvall 0:b77503796c51 280 }
alindvall 0:b77503796c51 281 return false;
alindvall 0:b77503796c51 282 }
alindvall 0:b77503796c51 283
alindvall 0:b77503796c51 284 static bool haveAllFiles(const char* prefix) {
alindvall 0:b77503796c51 285 char buff[512] = {0};
alindvall 0:b77503796c51 286 strcpy(buff, prefix);
alindvall 0:b77503796c51 287 int len = strlen(buff);
alindvall 0:b77503796c51 288
alindvall 0:b77503796c51 289 for (int i = 0; i < NUM_BENCHMARKS; i++) {
alindvall 0:b77503796c51 290 strcpy(buff+len, BENCHMARK_INPUT[i].fname);
alindvall 0:b77503796c51 291 if (!fileExists(buff)) {
alindvall 0:b77503796c51 292 DMBoard::instance().logger()->printf("File %s is missing\n", buff);
alindvall 0:b77503796c51 293 return false;
alindvall 0:b77503796c51 294 }
alindvall 0:b77503796c51 295 }
alindvall 0:b77503796c51 296 return true;
alindvall 0:b77503796c51 297 }
alindvall 0:b77503796c51 298
alindvall 5:788710a95951 299 static uint32_t writeInChunks(FILE* f, const uint8_t* src, uint32_t len, bool destIsMCI)
alindvall 5:788710a95951 300 {
alindvall 5:788710a95951 301 if (destIsMCI) {
alindvall 5:788710a95951 302 uint32_t left = len;
alindvall 5:788710a95951 303 uint32_t written = 0;
alindvall 5:788710a95951 304 uint32_t chunk;
alindvall 5:788710a95951 305 while (left > 0) {
alindvall 5:788710a95951 306 // MCI File system only supports writing 512 bytes at a time
alindvall 5:788710a95951 307 chunk = ((left < 512) ? left : 512);
alindvall 5:788710a95951 308 uint32_t tmp = fwrite(src+written, 1, chunk, f);
alindvall 5:788710a95951 309 if (tmp != chunk) {
alindvall 5:788710a95951 310 // failed, return what we have written so far
alindvall 5:788710a95951 311 return written;
alindvall 5:788710a95951 312 }
alindvall 5:788710a95951 313 left -= chunk;
alindvall 5:788710a95951 314 written += chunk;
alindvall 5:788710a95951 315 }
alindvall 5:788710a95951 316 return written;
alindvall 5:788710a95951 317 } else {
alindvall 5:788710a95951 318 // All file systems except for MCI supports complete fwrites and will split it into
alindvall 5:788710a95951 319 // chunks (if needed) internally.
alindvall 5:788710a95951 320 return fwrite(src, 1, len, f);
alindvall 5:788710a95951 321 }
alindvall 5:788710a95951 322 }
alindvall 5:788710a95951 323
alindvall 0:b77503796c51 324 static bool createFiles(const char* prefix) {
alindvall 0:b77503796c51 325 RtosLog* log = DMBoard::instance().logger();
alindvall 0:b77503796c51 326 char buff[512] = {0};
alindvall 0:b77503796c51 327 strcpy(buff, prefix);
alindvall 0:b77503796c51 328 int len = strlen(buff);
alindvall 0:b77503796c51 329
alindvall 0:b77503796c51 330 for (int i = 0; i < NUM_BENCHMARKS; i++) {
alindvall 0:b77503796c51 331 strcpy(buff+len, BENCHMARK_INPUT[i].fname);
alindvall 0:b77503796c51 332 log->printf(" writing %u bytes to %s\n", BENCHMARK_INPUT[i].size, buff);
alindvall 0:b77503796c51 333 FILE* f = fopen(buff, "w");
alindvall 0:b77503796c51 334 if (f == NULL) {
alindvall 0:b77503796c51 335 log->printf("Failed to create file %s - ABORTING\n", buff);
alindvall 0:b77503796c51 336 return false;
alindvall 0:b77503796c51 337 }
alindvall 0:b77503796c51 338 uint32_t written;
alindvall 0:b77503796c51 339 if (BENCHMARK_INPUT[i].iflash_direct == NULL) {
alindvall 5:788710a95951 340 written = writeInChunks(f, BENCHMARK_INPUT[i].qspi_direct, BENCHMARK_INPUT[i].size, (prefix[1]=='m'));
alindvall 0:b77503796c51 341 } else {
alindvall 5:788710a95951 342 written = writeInChunks(f, BENCHMARK_INPUT[i].iflash_direct, BENCHMARK_INPUT[i].size, (prefix[1]=='m'));
alindvall 0:b77503796c51 343 }
alindvall 0:b77503796c51 344 if (written != BENCHMARK_INPUT[i].size) {
alindvall 0:b77503796c51 345 log->printf("Failed to write %u (only wrote %u) bytes to %s - ABORTING\n", BENCHMARK_INPUT[i].size, written, buff);
embeddedartists 2:ddc1aa3bea3d 346 fclose(f);
alindvall 0:b77503796c51 347 return false;
alindvall 0:b77503796c51 348 }
alindvall 0:b77503796c51 349 fclose(f);
alindvall 0:b77503796c51 350 }
alindvall 0:b77503796c51 351 return true;
alindvall 0:b77503796c51 352 }
alindvall 0:b77503796c51 353
alindvall 0:b77503796c51 354 static bool prepareMCI() {
alindvall 0:b77503796c51 355 RtosLog* log = DMBoard::instance().logger();
alindvall 0:b77503796c51 356 bool ok = false;
alindvall 0:b77503796c51 357
alindvall 0:b77503796c51 358 mcifs = new MCIFileSystem("mci", P4_16);
alindvall 0:b77503796c51 359
alindvall 0:b77503796c51 360 if (mcifs->cardInserted()) {
alindvall 0:b77503796c51 361 log->printf("uSD card detected\n");
alindvall 0:b77503796c51 362
alindvall 0:b77503796c51 363 if (haveAllFiles("/mci/")) {
alindvall 0:b77503796c51 364 log->printf("uSD file system prepared!\n");
alindvall 0:b77503796c51 365 ok = true;
alindvall 0:b77503796c51 366 } else {
alindvall 0:b77503796c51 367 log->printf("One or more files missing, need to (re-)prepare the uSD file system\n");
alindvall 0:b77503796c51 368
alindvall 0:b77503796c51 369 log->printf("Preparing uSD file system...\n");
alindvall 0:b77503796c51 370 if (createFiles("/mci/")) {
alindvall 0:b77503796c51 371 log->printf("uSD file system prepared!\n");
alindvall 0:b77503796c51 372 ok = true;
alindvall 0:b77503796c51 373 } else {
alindvall 0:b77503796c51 374 log->printf("Failed to prepare uSD file system!\n");
alindvall 0:b77503796c51 375 }
alindvall 0:b77503796c51 376 }
alindvall 0:b77503796c51 377 } else {
alindvall 0:b77503796c51 378 log->printf("No uSD card detected. Insert one and reset\n");
alindvall 0:b77503796c51 379 }
alindvall 0:b77503796c51 380
alindvall 0:b77503796c51 381 return ok;
alindvall 0:b77503796c51 382 }
alindvall 0:b77503796c51 383
alindvall 0:b77503796c51 384 static bool prepareUSB() {
alindvall 0:b77503796c51 385 RtosLog* log = DMBoard::instance().logger();
alindvall 0:b77503796c51 386 bool ok = false;
alindvall 0:b77503796c51 387
alindvall 0:b77503796c51 388 usbmsd = new USBHostMSD("usb");
alindvall 0:b77503796c51 389 USBHost* host = USBHost::getHostInst();
alindvall 0:b77503796c51 390 host->signalOnConnections(Thread::gettid(), USBH_CONNECTION_EVENT);
alindvall 0:b77503796c51 391
alindvall 0:b77503796c51 392 log->printf("waiting for connect/disconnect message from USBHost...\n");
alindvall 0:b77503796c51 393 Thread::signal_wait(USBH_CONNECTION_EVENT);
alindvall 0:b77503796c51 394
alindvall 0:b77503796c51 395 if (usbmsd->connect()) {
alindvall 0:b77503796c51 396 log->printf("USB MemoryStick detected\n");
alindvall 0:b77503796c51 397
alindvall 0:b77503796c51 398 if (haveAllFiles("/usb/")) {
alindvall 0:b77503796c51 399 log->printf("USB MemoryStick file system prepared!\n");
alindvall 0:b77503796c51 400 ok = true;
alindvall 0:b77503796c51 401 } else {
alindvall 0:b77503796c51 402 log->printf("One or more files missing, need to (re-)prepare the USB MemoryStick\n");
alindvall 0:b77503796c51 403
alindvall 0:b77503796c51 404 log->printf("Preparing USB MemoryStick file system...\n");
alindvall 0:b77503796c51 405 if (createFiles("/usb/")) {
alindvall 0:b77503796c51 406 log->printf("USB MemoryStick file system prepared!\n");
alindvall 0:b77503796c51 407 ok = true;
alindvall 0:b77503796c51 408 } else {
alindvall 0:b77503796c51 409 log->printf("Failed to prepare USB MemoryStick file system!\n");
alindvall 0:b77503796c51 410 }
alindvall 0:b77503796c51 411 }
alindvall 0:b77503796c51 412 } else {
alindvall 0:b77503796c51 413 log->printf("No USB MemoryStick detected. Insert one and reset\n");
alindvall 0:b77503796c51 414 }
alindvall 0:b77503796c51 415
alindvall 0:b77503796c51 416 return ok;
alindvall 0:b77503796c51 417 }
alindvall 0:b77503796c51 418
alindvall 0:b77503796c51 419 static bool prepareQSPIFS() {
alindvall 0:b77503796c51 420 RtosLog* log = DMBoard::instance().logger();
alindvall 0:b77503796c51 421 bool ok = false;
alindvall 0:b77503796c51 422 bool format = false;
alindvall 0:b77503796c51 423
alindvall 0:b77503796c51 424 qspifs = new QSPIFileSystem("qspi");
alindvall 0:b77503796c51 425
alindvall 0:b77503796c51 426 do {
alindvall 0:b77503796c51 427 if (qspifs->isformatted()) {
alindvall 0:b77503796c51 428 uint32_t start, end;
alindvall 5:788710a95951 429 log->printf("QSPI file system detected\n");
alindvall 0:b77503796c51 430 qspifs->getMemoryBoundaries(&start, &end);
alindvall 0:b77503796c51 431 if ((end-start) >= QSPIFS_SIZE) {
alindvall 0:b77503796c51 432 if (haveAllFiles("/qspi/")) {
alindvall 0:b77503796c51 433 log->printf("QSPI file system prepared!\n");
alindvall 0:b77503796c51 434 ok = true;
alindvall 0:b77503796c51 435 break;
alindvall 0:b77503796c51 436 } else {
alindvall 0:b77503796c51 437 log->printf("One or more files missing, need to (re-)prepare the QSPI file system\n");
embeddedartists 3:1716747cba16 438 format = true;
alindvall 0:b77503796c51 439 }
alindvall 0:b77503796c51 440 } else {
alindvall 0:b77503796c51 441 log->printf("Found too small file system (only %dMB). Formatting...\n", (end-start)/(1024*1024));
alindvall 0:b77503796c51 442 format = true;
alindvall 0:b77503796c51 443 }
alindvall 0:b77503796c51 444 } else {
alindvall 0:b77503796c51 445 log->printf("No QSPI file system detected. Formatting...\n");
alindvall 0:b77503796c51 446 format = true;
alindvall 0:b77503796c51 447 }
alindvall 0:b77503796c51 448
alindvall 0:b77503796c51 449 if (format) {
alindvall 0:b77503796c51 450 if (qspifs->format(QSPIFS_SIZE_MB) == 0) {
alindvall 0:b77503796c51 451 log->printf("Formatting successful\n");
alindvall 0:b77503796c51 452 } else {
alindvall 0:b77503796c51 453 log->printf("Failed to format QSPI file system!\n");
alindvall 0:b77503796c51 454 break;
alindvall 0:b77503796c51 455 }
alindvall 0:b77503796c51 456 }
alindvall 0:b77503796c51 457
alindvall 0:b77503796c51 458 log->printf("Preparing QSPI file system...\n");
alindvall 0:b77503796c51 459 if (createFiles("/qspi/")) {
alindvall 0:b77503796c51 460 log->printf("QSPI file system prepared!\n");
alindvall 0:b77503796c51 461 ok = true;
alindvall 0:b77503796c51 462 } else {
alindvall 0:b77503796c51 463 log->printf("Failed to prepare QSPI file system!\n");
alindvall 0:b77503796c51 464 }
alindvall 0:b77503796c51 465 } while(false);
alindvall 0:b77503796c51 466
alindvall 0:b77503796c51 467 return ok;
alindvall 0:b77503796c51 468 }
alindvall 0:b77503796c51 469
alindvall 0:b77503796c51 470 static bool prepare() {
embeddedartists 1:b000ac168e46 471 RtosLog* log = DMBoard::instance().logger();
embeddedartists 1:b000ac168e46 472
embeddedartists 1:b000ac168e46 473 // make sure that the linker actually placed the data in the
embeddedartists 1:b000ac168e46 474 // correct flashes
embeddedartists 1:b000ac168e46 475 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 1:b000ac168e46 476 if (BENCHMARK_INPUT[i].iflash_direct != NULL) {
embeddedartists 1:b000ac168e46 477 uint32_t tmp = (uint32_t)BENCHMARK_INPUT[i].iflash_direct;
embeddedartists 1:b000ac168e46 478 if ((tmp & 0xff000000) != 0x00000000) {
embeddedartists 1:b000ac168e46 479 log->printf("IFLASH data for benchmark %d is at 0x%08x NOT in IFLASH!! Aborting\n", i, tmp);
embeddedartists 1:b000ac168e46 480 return false;
embeddedartists 1:b000ac168e46 481 }
embeddedartists 1:b000ac168e46 482 tmp = (uint32_t)BENCHMARK_INPUT[i].qspi_direct;
embeddedartists 1:b000ac168e46 483 if ((tmp & 0xff000000) != 0x28000000) {
embeddedartists 1:b000ac168e46 484 log->printf("QSPI data for benchmark %d is at 0x%08x NOT in QSPI!! Aborting\n", i, tmp);
embeddedartists 1:b000ac168e46 485 return false;
embeddedartists 1:b000ac168e46 486 }
embeddedartists 1:b000ac168e46 487 }
embeddedartists 1:b000ac168e46 488 }
alindvall 0:b77503796c51 489 return prepareMCI() && prepareUSB() && prepareQSPIFS();
alindvall 0:b77503796c51 490 }
alindvall 0:b77503796c51 491
alindvall 0:b77503796c51 492 static void readFile(const char* fname, uint8_t* dest) {
alindvall 0:b77503796c51 493 FILE* f = fopen(fname, "r");
alindvall 0:b77503796c51 494 if (f != NULL) {
alindvall 0:b77503796c51 495 int num = fread(dest, 1, 1024, f);
alindvall 0:b77503796c51 496 while (num > 0) {
alindvall 0:b77503796c51 497 dest+=num;
alindvall 0:b77503796c51 498 num = fread(dest, 1, 1024, f);
alindvall 0:b77503796c51 499 }
alindvall 0:b77503796c51 500 fclose(f);
alindvall 0:b77503796c51 501 }
alindvall 0:b77503796c51 502 }
alindvall 0:b77503796c51 503
embeddedartists 2:ddc1aa3bea3d 504 static void runReadBenchmarks() {
alindvall 0:b77503796c51 505 RtosLog* log = DMBoard::instance().logger();
alindvall 0:b77503796c51 506 uint32_t times[NUM_BENCHMARKS][5] = {0};
alindvall 0:b77503796c51 507 uint32_t tmp;
alindvall 0:b77503796c51 508 char buff[512];
alindvall 0:b77503796c51 509 Timer t;
alindvall 0:b77503796c51 510 uint8_t* dest = (uint8_t*)malloc(COPYBUF_SIZE);
alindvall 0:b77503796c51 511 if (dest == NULL) {
alindvall 0:b77503796c51 512 log->printf("Failed to allocate 10MBytes as buffer\n");
alindvall 0:b77503796c51 513 return;
alindvall 0:b77503796c51 514 }
alindvall 0:b77503796c51 515
alindvall 0:b77503796c51 516 t.start();
alindvall 0:b77503796c51 517
alindvall 0:b77503796c51 518 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 519 if (!BENCHMARK_INPUT[i].rw) {
embeddedartists 3:1716747cba16 520 // don't include the files for the image decoding in
embeddedartists 3:1716747cba16 521 // the benchmark set
embeddedartists 3:1716747cba16 522 continue;
embeddedartists 3:1716747cba16 523 }
embeddedartists 3:1716747cba16 524
alindvall 0:b77503796c51 525 // MCI
alindvall 0:b77503796c51 526 sprintf(buff, "/mci/%s", BENCHMARK_INPUT[i].fname);
alindvall 0:b77503796c51 527 memset(dest, 0, COPYBUF_SIZE);
alindvall 0:b77503796c51 528 tmp = t.read_us();
alindvall 0:b77503796c51 529 readFile(buff, dest);
alindvall 0:b77503796c51 530 times[i][0] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 531 log->printf("Benchmarking %-30s took %8uus\n", buff, times[i][0]);
alindvall 0:b77503796c51 532
alindvall 0:b77503796c51 533 //USB
alindvall 0:b77503796c51 534 sprintf(buff, "/usb/%s", BENCHMARK_INPUT[i].fname);
alindvall 0:b77503796c51 535 memset(dest, 0, COPYBUF_SIZE);
alindvall 0:b77503796c51 536 tmp = t.read_us();
alindvall 0:b77503796c51 537 readFile(buff, dest);
alindvall 0:b77503796c51 538 times[i][1] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 539 log->printf("Benchmarking %-30s took %8uus\n", buff, times[i][1]);
alindvall 0:b77503796c51 540
alindvall 0:b77503796c51 541 //QSPIFS
alindvall 0:b77503796c51 542 sprintf(buff, "/qspi/%s", BENCHMARK_INPUT[i].fname);
alindvall 0:b77503796c51 543 memset(dest, 0, COPYBUF_SIZE);
alindvall 0:b77503796c51 544 tmp = t.read_us();
alindvall 0:b77503796c51 545 readFile(buff, dest);
alindvall 0:b77503796c51 546 times[i][2] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 547 log->printf("Benchmarking %-30s took %8uus\n", buff, times[i][2]);
alindvall 0:b77503796c51 548
alindvall 0:b77503796c51 549 //IFLASH
alindvall 0:b77503796c51 550 sprintf(buff, "IFLASH /%s", BENCHMARK_INPUT[i].fname);
alindvall 0:b77503796c51 551 if (BENCHMARK_INPUT[i].iflash_direct != NULL) {
alindvall 0:b77503796c51 552 memset(dest, 0, COPYBUF_SIZE);
alindvall 0:b77503796c51 553 tmp = t.read_us();
alindvall 0:b77503796c51 554 memcpy(dest, BENCHMARK_INPUT[i].iflash_direct, BENCHMARK_INPUT[i].size);
alindvall 0:b77503796c51 555 times[i][3] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 556 log->printf("Benchmarking %-30s took %8uus\n", buff, times[i][3]);
alindvall 0:b77503796c51 557 } else {
embeddedartists 3:1716747cba16 558 log->printf("Benchmarking %-30s skipped\n", buff);
alindvall 0:b77503796c51 559 }
alindvall 0:b77503796c51 560
alindvall 0:b77503796c51 561 //QSPI
alindvall 0:b77503796c51 562 sprintf(buff, "QSPI /%s", BENCHMARK_INPUT[i].fname);
alindvall 0:b77503796c51 563 if (BENCHMARK_INPUT[i].qspi_direct != NULL) {
alindvall 0:b77503796c51 564 memset(dest, 0, COPYBUF_SIZE);
alindvall 0:b77503796c51 565 tmp = t.read_us();
alindvall 0:b77503796c51 566 memcpy(dest, BENCHMARK_INPUT[i].qspi_direct, BENCHMARK_INPUT[i].size);
alindvall 0:b77503796c51 567 times[i][4] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 568 log->printf("Benchmarking %-30s took %8uus\n", buff, times[i][4]);
alindvall 0:b77503796c51 569 } else {
embeddedartists 3:1716747cba16 570 log->printf("Benchmarking %-30s skipped\n", buff);
alindvall 0:b77503796c51 571 }
alindvall 0:b77503796c51 572 }
alindvall 0:b77503796c51 573
alindvall 0:b77503796c51 574 log->printf("\n\n----\nSummary:\n");
alindvall 0:b77503796c51 575
alindvall 0:b77503796c51 576 log->printf("\n File Information\n");
embeddedartists 3:1716747cba16 577 log->printf("%20s %10s\n", "Filename", "Size");
embeddedartists 3:1716747cba16 578 log->printf("%20s %10s\n", "--------", "----");
alindvall 0:b77503796c51 579 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 580 if (BENCHMARK_INPUT[i].rw) {
embeddedartists 3:1716747cba16 581 log->printf("%20s %10d bytes\n", BENCHMARK_INPUT[i].fname, BENCHMARK_INPUT[i].size);
embeddedartists 3:1716747cba16 582 }
alindvall 0:b77503796c51 583 }
alindvall 0:b77503796c51 584
alindvall 0:b77503796c51 585 log->printf("\n Read times (in us)\n");
embeddedartists 3:1716747cba16 586 log->printf("%20s %10s %10s %10s %10s %10s\n", "Filename", "uSD Card", "USB", "QSPI FS", "IFLASH[]", "QSPI[]");
embeddedartists 3:1716747cba16 587 log->printf("%20s %10s %10s %10s %10s %10s\n", "--------", "--------", "---", "-------", "--------", "------");
alindvall 0:b77503796c51 588 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 589 if (BENCHMARK_INPUT[i].rw) {
embeddedartists 3:1716747cba16 590 char* p = (char*)dest;
embeddedartists 3:1716747cba16 591 for (int x = 0; x < 5; x++) {
embeddedartists 3:1716747cba16 592 if (times[i][x] == 0) {
embeddedartists 3:1716747cba16 593 p += sprintf(p, "%10s ", "N/A");
embeddedartists 3:1716747cba16 594 } else {
embeddedartists 3:1716747cba16 595 p += sprintf(p, "%10d ", times[i][x]);
embeddedartists 3:1716747cba16 596 }
alindvall 0:b77503796c51 597 }
embeddedartists 3:1716747cba16 598 log->printf("%20s %s\n", BENCHMARK_INPUT[i].fname, dest);
alindvall 0:b77503796c51 599 }
alindvall 0:b77503796c51 600 }
alindvall 0:b77503796c51 601
alindvall 0:b77503796c51 602 log->printf("\n Read speeds\n");
embeddedartists 3:1716747cba16 603 log->printf("%20s %-12s %-12s %-12s %-12s %-12s\n", "Filename", "uSD Card", "USB", "QSPI FS", "IFLASH[]", "QSPI[]");
embeddedartists 3:1716747cba16 604 log->printf("%20s %s %s %s %s %s\n", "--------", "------------", "------------", "------------", "------------", "------------");
alindvall 0:b77503796c51 605 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 606 if (BENCHMARK_INPUT[i].rw) {
embeddedartists 3:1716747cba16 607 char* p = (char*)dest;
embeddedartists 3:1716747cba16 608 for (int x = 0; x < 5; x++) {
embeddedartists 3:1716747cba16 609 if (times[i][x] == 0) {
embeddedartists 3:1716747cba16 610 p += sprintf(p, "%12s ", "N/A ");
alindvall 0:b77503796c51 611 } else {
embeddedartists 3:1716747cba16 612 double t = times[i][x];
embeddedartists 3:1716747cba16 613 double s = BENCHMARK_INPUT[i].size;
embeddedartists 3:1716747cba16 614 double v = (s*1000000)/t;
embeddedartists 3:1716747cba16 615 if (v < 10000) {
embeddedartists 3:1716747cba16 616 p += sprintf(p, "%#7.2F b/s ", v);
embeddedartists 3:1716747cba16 617 } else if (v < 10000000) {
embeddedartists 3:1716747cba16 618 p += sprintf(p, "%#7.2F Kb/s ", v/1024.0);
embeddedartists 3:1716747cba16 619 } else {
embeddedartists 3:1716747cba16 620 p += sprintf(p, "%#7.2F Mb/s ", v/(1024.0*1024.0));
embeddedartists 3:1716747cba16 621 }
alindvall 0:b77503796c51 622 }
alindvall 0:b77503796c51 623 }
embeddedartists 3:1716747cba16 624 log->printf("%20s %s \n", BENCHMARK_INPUT[i].fname, dest);
alindvall 0:b77503796c51 625 }
alindvall 0:b77503796c51 626 }
alindvall 0:b77503796c51 627
alindvall 0:b77503796c51 628 log->printf("\n\n---\n");
embeddedartists 2:ddc1aa3bea3d 629
embeddedartists 2:ddc1aa3bea3d 630 free(dest);
embeddedartists 2:ddc1aa3bea3d 631 }
embeddedartists 2:ddc1aa3bea3d 632
embeddedartists 2:ddc1aa3bea3d 633 static uint32_t writeFile(const char* fname, int benchId, Timer* t, uint8_t* buff) {
embeddedartists 2:ddc1aa3bea3d 634 uint32_t size = BENCHMARK_INPUT[benchId].size;
embeddedartists 2:ddc1aa3bea3d 635
embeddedartists 2:ddc1aa3bea3d 636 // To make all tests equal all source data is copied to external SDRAM
embeddedartists 2:ddc1aa3bea3d 637 // and from there to the destination file. Only the time from SDRAM to
embeddedartists 2:ddc1aa3bea3d 638 // file is meassured.
embeddedartists 2:ddc1aa3bea3d 639 if (BENCHMARK_INPUT[benchId].iflash_direct == NULL) {
embeddedartists 2:ddc1aa3bea3d 640 memcpy(buff, BENCHMARK_INPUT[benchId].qspi_direct, size);
embeddedartists 2:ddc1aa3bea3d 641 } else {
embeddedartists 2:ddc1aa3bea3d 642 memcpy(buff, BENCHMARK_INPUT[benchId].iflash_direct, size);
embeddedartists 2:ddc1aa3bea3d 643 }
embeddedartists 2:ddc1aa3bea3d 644
embeddedartists 2:ddc1aa3bea3d 645 uint32_t time = t->read_us();
embeddedartists 2:ddc1aa3bea3d 646 int written = 0;
embeddedartists 2:ddc1aa3bea3d 647 FILE* f = fopen(fname, "w");
embeddedartists 2:ddc1aa3bea3d 648 if (f != NULL) {
alindvall 5:788710a95951 649 written = writeInChunks(f, buff, size, (fname[1]=='m'));
embeddedartists 2:ddc1aa3bea3d 650 fclose(f);
embeddedartists 2:ddc1aa3bea3d 651 }
embeddedartists 2:ddc1aa3bea3d 652 if (written == size) {
embeddedartists 2:ddc1aa3bea3d 653 return t->read_us() - time;
embeddedartists 2:ddc1aa3bea3d 654 } else {
embeddedartists 2:ddc1aa3bea3d 655 DMBoard::instance().logger()->printf("Failed to write %s (only wrote %u of %u bytes). Aborting\n", fname, written, size);
embeddedartists 2:ddc1aa3bea3d 656 return 0;
embeddedartists 2:ddc1aa3bea3d 657 }
embeddedartists 2:ddc1aa3bea3d 658 }
embeddedartists 2:ddc1aa3bea3d 659
embeddedartists 2:ddc1aa3bea3d 660 static void runWriteBenchmarks() {
embeddedartists 2:ddc1aa3bea3d 661 RtosLog* log = DMBoard::instance().logger();
embeddedartists 2:ddc1aa3bea3d 662 uint32_t times[NUM_BENCHMARKS][3] = {0};
embeddedartists 2:ddc1aa3bea3d 663 char buff[512];
embeddedartists 2:ddc1aa3bea3d 664 Timer t;
embeddedartists 3:1716747cba16 665
embeddedartists 3:1716747cba16 666 log->printf("Preparing to run WRITE tests...\n");
embeddedartists 2:ddc1aa3bea3d 667
embeddedartists 2:ddc1aa3bea3d 668 // To make all tests equal all source data is copied to external SDRAM
embeddedartists 2:ddc1aa3bea3d 669 // and from there to the destination file. Only the time from SDRAM to
embeddedartists 2:ddc1aa3bea3d 670 // file is meassured.
embeddedartists 2:ddc1aa3bea3d 671 uint8_t* dest = (uint8_t*)malloc(COPYBUF_SIZE);
embeddedartists 2:ddc1aa3bea3d 672 if (dest == NULL) {
embeddedartists 2:ddc1aa3bea3d 673 log->printf("Failed to allocate 10MBytes as buffer\n");
embeddedartists 2:ddc1aa3bea3d 674 return;
embeddedartists 2:ddc1aa3bea3d 675 }
embeddedartists 2:ddc1aa3bea3d 676
embeddedartists 2:ddc1aa3bea3d 677 // Clear the entire QSPI file system
embeddedartists 2:ddc1aa3bea3d 678 if (qspifs->format(QSPIFS_SIZE_MB) == 0) {
embeddedartists 2:ddc1aa3bea3d 679 log->printf("Formatting successful\n");
embeddedartists 2:ddc1aa3bea3d 680 } else {
embeddedartists 2:ddc1aa3bea3d 681 log->printf("Failed to format QSPI file system!\n");
embeddedartists 2:ddc1aa3bea3d 682 return;
embeddedartists 2:ddc1aa3bea3d 683 }
embeddedartists 2:ddc1aa3bea3d 684
embeddedartists 2:ddc1aa3bea3d 685 // For uSD and USB formatting is a bad idea as the memory
embeddedartists 2:ddc1aa3bea3d 686 // might contain other important file. Just delete the files
embeddedartists 2:ddc1aa3bea3d 687 // we are using instead.
embeddedartists 2:ddc1aa3bea3d 688 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 2:ddc1aa3bea3d 689 // MCI
embeddedartists 2:ddc1aa3bea3d 690 sprintf(buff, "/mci/%s", BENCHMARK_INPUT[i].fname);
embeddedartists 2:ddc1aa3bea3d 691 remove(buff);
embeddedartists 2:ddc1aa3bea3d 692
embeddedartists 2:ddc1aa3bea3d 693 //USB
embeddedartists 2:ddc1aa3bea3d 694 sprintf(buff, "/usb/%s", BENCHMARK_INPUT[i].fname);
embeddedartists 2:ddc1aa3bea3d 695 remove(buff);
embeddedartists 2:ddc1aa3bea3d 696 }
embeddedartists 2:ddc1aa3bea3d 697
embeddedartists 2:ddc1aa3bea3d 698 t.start();
embeddedartists 2:ddc1aa3bea3d 699
embeddedartists 2:ddc1aa3bea3d 700 // Do the benchmarking
embeddedartists 3:1716747cba16 701 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 702 if (!BENCHMARK_INPUT[i].rw) {
embeddedartists 3:1716747cba16 703 // don't include the files for the image decoding in
embeddedartists 3:1716747cba16 704 // the benchmark set
embeddedartists 3:1716747cba16 705 continue;
embeddedartists 3:1716747cba16 706 }
embeddedartists 3:1716747cba16 707
embeddedartists 2:ddc1aa3bea3d 708 // MCI
embeddedartists 2:ddc1aa3bea3d 709 sprintf(buff, "/mci/%s", BENCHMARK_INPUT[i].fname);
embeddedartists 2:ddc1aa3bea3d 710 memset(dest, 0, COPYBUF_SIZE);
embeddedartists 2:ddc1aa3bea3d 711 times[i][0] = writeFile(buff, i, &t, dest);
embeddedartists 3:1716747cba16 712 log->printf("Benchmarking %-30s took %8uus\n", buff, times[i][0]);
embeddedartists 2:ddc1aa3bea3d 713
embeddedartists 2:ddc1aa3bea3d 714 //USB
embeddedartists 2:ddc1aa3bea3d 715 sprintf(buff, "/usb/%s", BENCHMARK_INPUT[i].fname);
embeddedartists 2:ddc1aa3bea3d 716 memset(dest, 0, COPYBUF_SIZE);
embeddedartists 2:ddc1aa3bea3d 717 times[i][1] = writeFile(buff, i, &t, dest);
embeddedartists 3:1716747cba16 718 log->printf("Benchmarking %-30s took %8uus\n", buff, times[i][1]);
embeddedartists 2:ddc1aa3bea3d 719
embeddedartists 2:ddc1aa3bea3d 720 //QSPIFS
embeddedartists 2:ddc1aa3bea3d 721 sprintf(buff, "/qspi/%s", BENCHMARK_INPUT[i].fname);
embeddedartists 2:ddc1aa3bea3d 722 memset(dest, 0, COPYBUF_SIZE);
embeddedartists 2:ddc1aa3bea3d 723 times[i][2] = writeFile(buff, i, &t, dest);
embeddedartists 3:1716747cba16 724 log->printf("Benchmarking %-30s took %8uus\n", buff, times[i][2]);
embeddedartists 2:ddc1aa3bea3d 725 }
embeddedartists 2:ddc1aa3bea3d 726
embeddedartists 2:ddc1aa3bea3d 727 log->printf("\n\n----\nSummary:\n");
embeddedartists 2:ddc1aa3bea3d 728
embeddedartists 2:ddc1aa3bea3d 729 log->printf("\n File Information\n");
embeddedartists 3:1716747cba16 730 log->printf("%20s %10s\n", "Filename", "Size");
embeddedartists 3:1716747cba16 731 log->printf("%20s %10s\n", "--------", "----");
embeddedartists 2:ddc1aa3bea3d 732 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 733 if (BENCHMARK_INPUT[i].rw) {
embeddedartists 3:1716747cba16 734 log->printf("%20s %10d bytes\n", BENCHMARK_INPUT[i].fname, BENCHMARK_INPUT[i].size);
embeddedartists 3:1716747cba16 735 }
embeddedartists 2:ddc1aa3bea3d 736 }
embeddedartists 2:ddc1aa3bea3d 737
embeddedartists 2:ddc1aa3bea3d 738 log->printf("\n Write times (in us)\n");
embeddedartists 3:1716747cba16 739 log->printf("%20s %10s %10s %10s\n", "Filename", "uSD Card", "USB", "QSPI FS");
embeddedartists 3:1716747cba16 740 log->printf("%20s %10s %10s %10s\n", "--------", "--------", "---", "-------");
embeddedartists 3:1716747cba16 741 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 742 if (BENCHMARK_INPUT[i].rw) {
embeddedartists 3:1716747cba16 743 char* p = (char*)dest;
embeddedartists 3:1716747cba16 744 for (int x = 0; x < 3; x++) {
embeddedartists 3:1716747cba16 745 if (times[i][x] == 0) {
embeddedartists 3:1716747cba16 746 p += sprintf(p, "%10s ", "N/A");
embeddedartists 3:1716747cba16 747 } else {
embeddedartists 3:1716747cba16 748 p += sprintf(p, "%10d ", times[i][x]);
embeddedartists 3:1716747cba16 749 }
embeddedartists 3:1716747cba16 750 }
embeddedartists 3:1716747cba16 751 log->printf("%20s %s\n", BENCHMARK_INPUT[i].fname, dest);
embeddedartists 3:1716747cba16 752 }
embeddedartists 3:1716747cba16 753 }
embeddedartists 3:1716747cba16 754
embeddedartists 3:1716747cba16 755 log->printf("\n Write speeds\n");
embeddedartists 3:1716747cba16 756 log->printf("%20s %-12s %-12s %-12s\n", "Filename", "uSD Card", "USB", "QSPI FS");
embeddedartists 3:1716747cba16 757 log->printf("%20s %s %s %s\n", "--------", "------------", "------------", "------------");
embeddedartists 3:1716747cba16 758 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 759 if (BENCHMARK_INPUT[i].rw) {
embeddedartists 3:1716747cba16 760 char* p = (char*)dest;
embeddedartists 3:1716747cba16 761 for (int x = 0; x < 3; x++) {
embeddedartists 3:1716747cba16 762 if (times[i][x] == 0) {
embeddedartists 3:1716747cba16 763 p += sprintf(p, "%12s ", "N/A ");
embeddedartists 3:1716747cba16 764 } else {
embeddedartists 3:1716747cba16 765 double t = times[i][x];
embeddedartists 3:1716747cba16 766 double s = BENCHMARK_INPUT[i].size;
embeddedartists 3:1716747cba16 767 double v = (s*1000000)/t;
embeddedartists 3:1716747cba16 768 if (v < 10000) {
embeddedartists 3:1716747cba16 769 p += sprintf(p, "%#7.2F b/s ", v);
embeddedartists 3:1716747cba16 770 } else if (v < 10000000) {
embeddedartists 3:1716747cba16 771 p += sprintf(p, "%#7.2F Kb/s ", v/1024.0);
embeddedartists 3:1716747cba16 772 } else {
embeddedartists 3:1716747cba16 773 p += sprintf(p, "%#7.2F Mb/s ", v/(1024.0*1024.0));
embeddedartists 3:1716747cba16 774 }
embeddedartists 3:1716747cba16 775 }
embeddedartists 3:1716747cba16 776 }
embeddedartists 3:1716747cba16 777 log->printf("%20s %s \n", BENCHMARK_INPUT[i].fname, dest);
embeddedartists 3:1716747cba16 778 }
embeddedartists 3:1716747cba16 779 }
embeddedartists 3:1716747cba16 780
embeddedartists 3:1716747cba16 781 log->printf("\n\n---\n");
embeddedartists 3:1716747cba16 782
embeddedartists 3:1716747cba16 783 free(dest);
embeddedartists 3:1716747cba16 784 }
embeddedartists 3:1716747cba16 785
embeddedartists 3:1716747cba16 786 static void runImageBenchmarks() {
embeddedartists 3:1716747cba16 787 RtosLog* log = DMBoard::instance().logger();
embeddedartists 3:1716747cba16 788 uint32_t times[NUM_BENCHMARKS][5] = {0};
embeddedartists 3:1716747cba16 789 uint32_t tmp;
embeddedartists 3:1716747cba16 790 char buff[512];
embeddedartists 3:1716747cba16 791 int result;
embeddedartists 3:1716747cba16 792 Image::ImageData_t imgData;
embeddedartists 3:1716747cba16 793 Timer t;
embeddedartists 3:1716747cba16 794
embeddedartists 3:1716747cba16 795 t.start();
embeddedartists 3:1716747cba16 796
embeddedartists 2:ddc1aa3bea3d 797 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 798
embeddedartists 3:1716747cba16 799 // MCI
embeddedartists 3:1716747cba16 800 sprintf(buff, "/mci/%s", BENCHMARK_INPUT[i].fname);
embeddedartists 3:1716747cba16 801 tmp = t.read_us();
embeddedartists 3:1716747cba16 802 result = Image::decode(buff, Image::RES_16BIT, &imgData);
embeddedartists 3:1716747cba16 803 times[i][0] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 804 if (result == 0) {
embeddedartists 3:1716747cba16 805 log->printf("Decoding %-30s took %8uus\n", buff, times[i][0]);
embeddedartists 3:1716747cba16 806 if (imgData.pointerToFree != NULL) {
embeddedartists 3:1716747cba16 807 free(imgData.pointerToFree);
embeddedartists 3:1716747cba16 808 imgData.pointerToFree = NULL;
embeddedartists 3:1716747cba16 809 }
embeddedartists 3:1716747cba16 810 } else {
embeddedartists 3:1716747cba16 811 log->printf("Decoding %-30s failed\n", buff);
embeddedartists 3:1716747cba16 812 times[i][0] = 0;
embeddedartists 3:1716747cba16 813 }
embeddedartists 3:1716747cba16 814
embeddedartists 3:1716747cba16 815 //USB
embeddedartists 3:1716747cba16 816 sprintf(buff, "/usb/%s", BENCHMARK_INPUT[i].fname);
embeddedartists 3:1716747cba16 817 tmp = t.read_us();
embeddedartists 3:1716747cba16 818 result = Image::decode(buff, Image::RES_16BIT, &imgData);
embeddedartists 3:1716747cba16 819 times[i][1] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 820 if (result == 0) {
embeddedartists 3:1716747cba16 821 log->printf("Decoding %-30s took %8uus\n", buff, times[i][1]);
embeddedartists 3:1716747cba16 822 if (imgData.pointerToFree != NULL) {
embeddedartists 3:1716747cba16 823 free(imgData.pointerToFree);
embeddedartists 3:1716747cba16 824 imgData.pointerToFree = NULL;
embeddedartists 3:1716747cba16 825 }
embeddedartists 3:1716747cba16 826 } else {
embeddedartists 3:1716747cba16 827 log->printf("Decoding %-30s failed\n", buff);
embeddedartists 3:1716747cba16 828 times[i][1] = 0;
embeddedartists 3:1716747cba16 829 }
embeddedartists 3:1716747cba16 830
embeddedartists 3:1716747cba16 831 //QSPIFS
embeddedartists 3:1716747cba16 832 sprintf(buff, "/qspi/%s", BENCHMARK_INPUT[i].fname);
embeddedartists 3:1716747cba16 833 tmp = t.read_us();
embeddedartists 3:1716747cba16 834 result = Image::decode(buff, Image::RES_16BIT, &imgData);
embeddedartists 3:1716747cba16 835 times[i][2] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 836 if (result == 0) {
embeddedartists 3:1716747cba16 837 log->printf("Decoding %-30s took %8uus\n", buff, times[i][2]);
embeddedartists 3:1716747cba16 838 if (imgData.pointerToFree != NULL) {
embeddedartists 3:1716747cba16 839 free(imgData.pointerToFree);
embeddedartists 3:1716747cba16 840 imgData.pointerToFree = NULL;
embeddedartists 3:1716747cba16 841 }
embeddedartists 3:1716747cba16 842 } else {
embeddedartists 3:1716747cba16 843 log->printf("Decoding %-30s failed\n", buff);
embeddedartists 3:1716747cba16 844 times[i][2] = 0;
embeddedartists 3:1716747cba16 845 }
embeddedartists 3:1716747cba16 846
embeddedartists 3:1716747cba16 847 //IFLASH
embeddedartists 3:1716747cba16 848 sprintf(buff, "IFLASH /%s", BENCHMARK_INPUT[i].fname);
embeddedartists 3:1716747cba16 849 if (BENCHMARK_INPUT[i].iflash_direct != NULL) {
embeddedartists 3:1716747cba16 850 tmp = t.read_us();
embeddedartists 3:1716747cba16 851 result = Image::decode(BENCHMARK_INPUT[i].iflash_direct, BENCHMARK_INPUT[i].size, Image::RES_16BIT, &imgData);
embeddedartists 3:1716747cba16 852 times[i][3] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 853 if (result == 0) {
embeddedartists 3:1716747cba16 854 log->printf("Decoding %-30s took %8uus\n", buff, times[i][3]);
embeddedartists 3:1716747cba16 855 if (imgData.pointerToFree != NULL) {
embeddedartists 3:1716747cba16 856 free(imgData.pointerToFree);
embeddedartists 3:1716747cba16 857 imgData.pointerToFree = NULL;
embeddedartists 3:1716747cba16 858 }
embeddedartists 3:1716747cba16 859 } else {
embeddedartists 3:1716747cba16 860 log->printf("Decoding %-30s failed\n", buff);
embeddedartists 3:1716747cba16 861 times[i][3] = 0;
embeddedartists 3:1716747cba16 862 }
embeddedartists 3:1716747cba16 863 } else {
embeddedartists 3:1716747cba16 864 log->printf("Decoding %-30s skipped\n", buff);
embeddedartists 3:1716747cba16 865 }
embeddedartists 3:1716747cba16 866
embeddedartists 3:1716747cba16 867 //QSPI
embeddedartists 3:1716747cba16 868 sprintf(buff, "QSPI /%s", BENCHMARK_INPUT[i].fname);
embeddedartists 3:1716747cba16 869 if (BENCHMARK_INPUT[i].qspi_direct != NULL) {
embeddedartists 3:1716747cba16 870 tmp = t.read_us();
embeddedartists 3:1716747cba16 871 result = Image::decode(BENCHMARK_INPUT[i].qspi_direct, BENCHMARK_INPUT[i].size, Image::RES_16BIT, &imgData);
embeddedartists 3:1716747cba16 872 times[i][4] = t.read_us() - tmp;
embeddedartists 3:1716747cba16 873 if (result == 0) {
embeddedartists 3:1716747cba16 874 log->printf("Decoding %-30s took %8uus\n", buff, times[i][4]);
embeddedartists 3:1716747cba16 875 if (imgData.pointerToFree != NULL) {
embeddedartists 3:1716747cba16 876 free(imgData.pointerToFree);
embeddedartists 3:1716747cba16 877 imgData.pointerToFree = NULL;
embeddedartists 3:1716747cba16 878 }
embeddedartists 3:1716747cba16 879 } else {
embeddedartists 3:1716747cba16 880 log->printf("Decoding %-30s failed\n", buff);
embeddedartists 3:1716747cba16 881 times[i][4] = 0;
embeddedartists 3:1716747cba16 882 }
embeddedartists 3:1716747cba16 883 } else {
embeddedartists 3:1716747cba16 884 log->printf("Decoding %-30s skipped\n", buff);
embeddedartists 3:1716747cba16 885 }
embeddedartists 3:1716747cba16 886 }
embeddedartists 3:1716747cba16 887
embeddedartists 3:1716747cba16 888 log->printf("\n\n----\nSummary:\n");
embeddedartists 3:1716747cba16 889
embeddedartists 3:1716747cba16 890 log->printf("\n File Information\n");
embeddedartists 3:1716747cba16 891 log->printf("%20s %10s\n", "Filename", "Size");
embeddedartists 3:1716747cba16 892 log->printf("%20s %10s\n", "--------", "----");
embeddedartists 3:1716747cba16 893 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 894 log->printf("%20s %10d bytes\n", BENCHMARK_INPUT[i].fname, BENCHMARK_INPUT[i].size);
embeddedartists 3:1716747cba16 895 }
embeddedartists 3:1716747cba16 896
embeddedartists 3:1716747cba16 897 log->printf("\n Decode times (in us)\n");
embeddedartists 3:1716747cba16 898 log->printf("%20s %10s %10s %10s %10s %10s\n", "Filename", "uSD Card", "USB", "QSPI FS", "IFLASH[]", "QSPI[]");
embeddedartists 3:1716747cba16 899 log->printf("%20s %10s %10s %10s %10s %10s\n", "--------", "--------", "---", "-------", "--------", "------");
embeddedartists 3:1716747cba16 900 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 901 char* p = (char*)buff;
embeddedartists 3:1716747cba16 902 for (int x = 0; x < 5; x++) {
embeddedartists 2:ddc1aa3bea3d 903 if (times[i][x] == 0) {
embeddedartists 2:ddc1aa3bea3d 904 p += sprintf(p, "%10s ", "N/A");
embeddedartists 2:ddc1aa3bea3d 905 } else {
embeddedartists 2:ddc1aa3bea3d 906 p += sprintf(p, "%10d ", times[i][x]);
embeddedartists 2:ddc1aa3bea3d 907 }
embeddedartists 2:ddc1aa3bea3d 908 }
embeddedartists 3:1716747cba16 909 log->printf("%20s %s\n", BENCHMARK_INPUT[i].fname, buff);
embeddedartists 2:ddc1aa3bea3d 910 }
embeddedartists 2:ddc1aa3bea3d 911
embeddedartists 3:1716747cba16 912 log->printf("\n Decode speeds\n");
embeddedartists 3:1716747cba16 913 log->printf("%20s %-12s %-12s %-12s %-12s %-12s\n", "Filename", "uSD Card", "USB", "QSPI FS", "IFLASH[]", "QSPI[]");
embeddedartists 3:1716747cba16 914 log->printf("%20s %s %s %s %s %s\n", "--------", "------------", "------------", "------------", "------------", "------------");
embeddedartists 2:ddc1aa3bea3d 915 for (int i = 0; i < NUM_BENCHMARKS; i++) {
embeddedartists 3:1716747cba16 916 char* p = (char*)buff;
embeddedartists 3:1716747cba16 917 for (int x = 0; x < 5; x++) {
embeddedartists 2:ddc1aa3bea3d 918 if (times[i][x] == 0) {
embeddedartists 2:ddc1aa3bea3d 919 p += sprintf(p, "%12s ", "N/A ");
embeddedartists 2:ddc1aa3bea3d 920 } else {
embeddedartists 2:ddc1aa3bea3d 921 double t = times[i][x];
embeddedartists 2:ddc1aa3bea3d 922 double s = BENCHMARK_INPUT[i].size;
embeddedartists 2:ddc1aa3bea3d 923 double v = (s*1000000)/t;
embeddedartists 2:ddc1aa3bea3d 924 if (v < 10000) {
embeddedartists 2:ddc1aa3bea3d 925 p += sprintf(p, "%#7.2F b/s ", v);
embeddedartists 2:ddc1aa3bea3d 926 } else if (v < 10000000) {
embeddedartists 2:ddc1aa3bea3d 927 p += sprintf(p, "%#7.2F Kb/s ", v/1024.0);
embeddedartists 2:ddc1aa3bea3d 928 } else {
embeddedartists 2:ddc1aa3bea3d 929 p += sprintf(p, "%#7.2F Mb/s ", v/(1024.0*1024.0));
embeddedartists 2:ddc1aa3bea3d 930 }
embeddedartists 2:ddc1aa3bea3d 931 }
embeddedartists 2:ddc1aa3bea3d 932 }
embeddedartists 3:1716747cba16 933 log->printf("%20s %s \n", BENCHMARK_INPUT[i].fname, buff);
embeddedartists 2:ddc1aa3bea3d 934 }
embeddedartists 2:ddc1aa3bea3d 935
embeddedartists 2:ddc1aa3bea3d 936 log->printf("\n\n---\n");
alindvall 0:b77503796c51 937 }
alindvall 0:b77503796c51 938
alindvall 0:b77503796c51 939 /******************************************************************************
alindvall 0:b77503796c51 940 * Main
alindvall 0:b77503796c51 941 *****************************************************************************/
alindvall 0:b77503796c51 942
alindvall 0:b77503796c51 943 int main()
alindvall 0:b77503796c51 944 {
alindvall 0:b77503796c51 945 DMBoard::BoardError err;
alindvall 0:b77503796c51 946 DMBoard* board = &DMBoard::instance();
alindvall 0:b77503796c51 947 RtosLog* log = board->logger();
alindvall 0:b77503796c51 948
alindvall 0:b77503796c51 949 do {
alindvall 0:b77503796c51 950 err = board->init();
alindvall 0:b77503796c51 951 if (err != DMBoard::Ok) {
alindvall 0:b77503796c51 952 log->printf("Failed to initialize the board, got error %d\r\n", err);
alindvall 0:b77503796c51 953 break;
alindvall 0:b77503796c51 954 }
alindvall 0:b77503796c51 955
alindvall 0:b77503796c51 956 log->printf("\n\nBenchmarking. (Built "__DATE__" at "__TIME__")\n\n");
alindvall 0:b77503796c51 957
alindvall 0:b77503796c51 958 log->printf("Preparing file systems for benchmarking\n");
alindvall 0:b77503796c51 959 if (!prepare()) {
alindvall 0:b77503796c51 960 log->printf("Failed to prepare for benchmarking\r\n");
alindvall 0:b77503796c51 961 break;
alindvall 0:b77503796c51 962 }
alindvall 0:b77503796c51 963
embeddedartists 2:ddc1aa3bea3d 964 runReadBenchmarks();
embeddedartists 3:1716747cba16 965 runImageBenchmarks();
embeddedartists 2:ddc1aa3bea3d 966
embeddedartists 2:ddc1aa3bea3d 967 Thread::wait(1000);
embeddedartists 2:ddc1aa3bea3d 968 log->printf("Press the USER button to run WRITE tests!\n");
embeddedartists 2:ddc1aa3bea3d 969 while(!board->buttonPressed()) {
embeddedartists 2:ddc1aa3bea3d 970 Thread::wait(20);
embeddedartists 2:ddc1aa3bea3d 971 }
embeddedartists 2:ddc1aa3bea3d 972 while(board->buttonPressed()) {
embeddedartists 2:ddc1aa3bea3d 973 Thread::wait(20);
embeddedartists 2:ddc1aa3bea3d 974 }
embeddedartists 2:ddc1aa3bea3d 975
embeddedartists 2:ddc1aa3bea3d 976 runWriteBenchmarks();
alindvall 0:b77503796c51 977
alindvall 0:b77503796c51 978 } while(false);
alindvall 0:b77503796c51 979
alindvall 0:b77503796c51 980 if (err != DMBoard::Ok) {
alindvall 0:b77503796c51 981 log->printf("\nTERMINATING\n");
alindvall 0:b77503796c51 982 }
alindvall 0:b77503796c51 983
alindvall 0:b77503796c51 984 while(true) {
alindvall 0:b77503796c51 985 Thread::wait(1000);
alindvall 0:b77503796c51 986 }
alindvall 0:b77503796c51 987 }
alindvall 0:b77503796c51 988