X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=blobdiff_plain;f=tos%2Flib%2Fnet%2FDeluge%2FFlashVolumeManager%2FFlashVolumeManagerP.nc;h=b91f194bee9f4ded4544df14a5b030819dd0ba19;hp=657d6795901340670d415bc907f47eeeba994a9c;hb=809036bc77a8366b0f9aa2d78cdcacdcc4dc1379;hpb=675ad537ad2b576afc1dc9ff7b62e560cfc67a86 diff --git a/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc b/tos/lib/net/Deluge/FlashVolumeManager/FlashVolumeManagerP.nc index 657d6795..b91f194b 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 { @@ -43,7 +45,7 @@ implementation typedef nx_struct SerialReqPacket { nx_uint8_t cmd; nx_uint8_t imgNum; - nx_uint16_t offset; + nx_uint32_t offset; nx_uint16_t len; nx_uint8_t data[0]; } SerialReqPacket; @@ -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 = imgNum2volumeId[request->imgNum]; + 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) { @@ -205,7 +200,11 @@ implementation switch (request->cmd) { case CMD_ERASE: // === Erases a volume === state = S_ERASE; +#if defined(PLATFORM_MICAZ) || defined(PLATFORM_IRIS) || defined(PLATFORM_EPIC) + error = FAIL; +#else error = call BlockWrite.erase[imgNum](); +#endif break; case CMD_WRITE: // === Writes to a volume === state = S_WRITE; @@ -259,10 +258,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(); } }