44 #include "lib/random.h"
49 PROCESS(sd_test,
"SD test process");
50 AUTOSTART_PROCESSES(&sd_test);
56 static unsigned long iter;
57 static unsigned long offset;
67 for(iter = 1;; iter++) {
70 memset(buf, 0,
sizeof(buf));
71 buflen = sprintf(buf,
"(%ld) Testing the SD card (%ld)", iter, iter);
74 offset = random_rand() & 0xffff;
76 offset += random_rand() & 0xff;
79 r = sd_write(offset, buf, buflen + 1);
81 memset(buf, 0,
sizeof(buf));
82 r = sd_read(offset, buf, buflen + 1);
84 printf(
"read %s (offset %lu)\n", buf, offset);
86 printf(
"read error: %d (%s)\n", r, sd_error_string(r));
89 printf(
"write error: %d (%s)\n", r, sd_error_string(r));