X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2Ftosthreads%2Fapps%2FTestBlockStorage%2FTestBlockStorageP.nc;h=81b191b0cc4aec65e5b1532e5f03649fe3c027a5;hb=e9bfab607e051bae6afb47b44892ce37541d1b44;hp=757212794a7fc56147aa6cac13cbc7fe4d5c60aa;hpb=4815890e50169007831bdba1871ddee1f4773372;p=tinyos-2.x.git diff --git a/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageP.nc b/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageP.nc index 75721279..81b191b0 100644 --- a/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageP.nc +++ b/apps/tosthreads/apps/TestBlockStorage/TestBlockStorageP.nc @@ -21,6 +21,18 @@ */ /** + * This application is used to test the threaded version of the API for performing + * block storage. + * + * This application first checks the size of the block storage volume, and + * erases it. Then, it randomly writes records, followed by a verification + * with read. + * + * Successful running of this application results in LED0 being ON + * throughout the duration of the erase, write, and read sequence. Finally, + * if all tests pass, LED1 is turned ON. Otherwise, all three LEDs are + * turned ON to indicate problems. + * * @author Chieh-Jan Mike Liang */ @@ -47,10 +59,15 @@ implementation { int i; error_t error; +#if defined USE_AT45DB + storage_len_t expectedVolumeSize = 262144; +#elif defined USE_STM25P + storage_len_t expectedVolumeSize = 1048576; +#endif call Leds.set(1); - if (call BlockingBlock1.getSize() != 1048576) { + if (call BlockingBlock1.getSize() != expectedVolumeSize) { call Leds.set(7); return; } @@ -61,7 +78,7 @@ implementation return; } - for (i = 0; i < 20; i++) { + for (i = 0; i < 50; i++) { storage_addr_t writeAddr = call Random.rand32() % (call BlockingBlock1.getSize() - sizeof(storage_addr_t)); storage_len_t len = sizeof(storage_addr_t); storage_addr_t readBuf;