X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Fnet%2FDeluge%2FFlashVolumeManager%2FFlashVolumeManagerP.nc;h=06420ce4a02ab4037f13cd7937738a9cf2d6eb98;hb=62b84950912c1c033c401fb0b2a1efaceec78280;hp=56558c4214a17c8b14bf11c143a016a5e005de59;hpb=a887d42035d66e33374c484606bbb11cafec6c31;p=tinyos-2.x.git diff --git a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc index 56558c42..06420ce4 100644 --- a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc +++ b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc @@ -24,6 +24,8 @@ * @author Razvan Musaloiu-E. */ +#include "imgNum2volumeId.h" + generic module FlashVolumeManagerP() { uses { @@ -88,13 +90,6 @@ implementation nx_uint16_t nodeid; }; - uint8_t imgNum2volumeId[] = { - VOLUME_GOLDENIMAGE, - VOLUME_DELUGE1, - VOLUME_DELUGE2, - VOLUME_DELUGE3 - }; - void sendReply(error_t error, storage_len_t len) { SerialReplyPacket *reply = (SerialReplyPacket *)call SerialAMSender.getPayload(&serialMsg, sizeof(SerialReplyPacket)); @@ -186,9 +181,9 @@ implementation } // Converts the image number that the user wants to the real image number - imgNum = request->imgNum < DELUGE_NUM_VOLUMES ? imgNum2volumeId[request->imgNum] : 0xFF; + imgNum = imgNum2volumeId(request->imgNum); - if (imgNum != 0xFF) { + if (imgNum != NON_DELUGE_VOLUME) { error = SUCCESS; // We ask for a reservation only for erase and write. switch (request->cmd) { @@ -259,10 +254,9 @@ implementation { // Release the resource. if (state == S_IDLE && call Resource.isOwner()) { - call Leds.led1Off(); call Resource.release(); } - if (state == S_IDLE && !call ArbiterInfo.inUse()) { + if (state == S_IDLE) { call Leds.led1Off(); } }