From 4130898b89e90c468e417dd0d2df1ed1876cb342 Mon Sep 17 00:00:00 2001 From: r-studio Date: Thu, 5 Nov 2009 12:42:34 +0000 Subject: [PATCH] storage fix, change in test app. should not impact other users --- apps/tests/storage/Config/volumes-at45db.xml | 2 +- tools/tinyos/misc/tos-storage-at45db.1 | 4 ++- tools/tinyos/misc/tos-storage-at45db.in | 27 ++++++++++---------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/apps/tests/storage/Config/volumes-at45db.xml b/apps/tests/storage/Config/volumes-at45db.xml index 7cc59802..e221874e 100644 --- a/apps/tests/storage/Config/volumes-at45db.xml +++ b/apps/tests/storage/Config/volumes-at45db.xml @@ -1,4 +1,4 @@ - + diff --git a/tools/tinyos/misc/tos-storage-at45db.1 b/tools/tinyos/misc/tos-storage-at45db.1 index 885eabea..22af233e 100644 --- a/tools/tinyos/misc/tos-storage-at45db.1 +++ b/tools/tinyos/misc/tos-storage-at45db.1 @@ -5,7 +5,7 @@ tos-storage-at45db - Generate storage volume description code .SH SYNOPSIS -\fBtos-storage-at45db\fR [\fB-t\fR] \fIplatform-directory\fR +\fBtos-storage-at45db\fR [\fB-t\fR] [\fB-s\fR ] [\fB-f\fR ] \fIplatform-directory\fR .SH DESCRIPTION \fBtos-storage-at45db\fR reads a user specification describing the layout @@ -15,6 +15,8 @@ user specification is in XML and is read from standard input. With all options, the code for a header file is written to standard output. With the optional \fB-t\fR flag specified, a VolumeMapC.nc file is generated that provides interfaces to all the storage volume abstractions defined in the XML file. +The optional \fB-s\fR flag specifies the sector size on the flash, the default is 256. +The optional \fB-f\fR flag specifies the total number of sectors on the flash, the default is 2048. The mandatory \fIplatform-directory\fR argument should specify the platform directory for the current compilation target; this is necessary for the correct diff --git a/tools/tinyos/misc/tos-storage-at45db.in b/tools/tinyos/misc/tos-storage-at45db.in index a58a9627..0fe5872d 100644 --- a/tools/tinyos/misc/tos-storage-at45db.in +++ b/tools/tinyos/misc/tos-storage-at45db.in @@ -18,15 +18,22 @@ import string import commands #New way of handling arguments........ try: - opts, args = getopt(argv[1:], "t", []) + opts, args = getopt(argv[1:], "ts:f:", []) except GetoptError, err: print str(err) # will print something like "option -a not recognized" - stderr.write("Usage: tos-storage-at45db [-t] \n") + stderr.write("Usage: tos-storage-at45db [-t] [-s ] [-f ] \n") +sector_size = 256 +flash_size = 2048 # in sectors + cthreads = False for o, a in opts: if o == "-t": cthreads = True + elif o == "-s": + sector_size = int(a) + elif o == "-f": + flash_size = int(a) else: assert False, "unhandled option" @@ -45,9 +52,6 @@ def nfail(s): stderr.write(s + "\n") exit(2) -sector_size = 256 -flash_size = 2048 # in sectors - volumes = {} volmap = [] volumeNames = [] @@ -229,7 +233,7 @@ if cthreads == True: outFile.write(" interface BlockWrite[uint8_t volume_id]; \n") outFile.write(" interface LogRead[uint8_t volumeId]; \n") outFile.write(" interface LogWrite[uint8_t volumeId]; \n") - outFile.write(" interface Mount[uint8_t volumeId]; \n") + outFile.write(" interface Mount as ConfigMount[uint8_t volumeId]; \n") outFile.write(" interface ConfigStorage[uint8_t volumeId]; \n") outFile.write(" } \n") outFile.write("} \n") @@ -241,9 +245,6 @@ if cthreads == True: outFile.write(" BlockWrite = VolumeMapP; \n") outFile.write(" LogRead = VolumeMapP; \n") outFile.write(" LogWrite = VolumeMapP; \n") - outFile.write(" Mount = VolumeMapP; \n") - outFile.write(" ConfigStorage = VolumeMapP; \n") - for i in range(len(volumeNames)): if volumeTypes[volumeNames[i]] == "block": @@ -260,9 +261,9 @@ if cthreads == True: outFile.write(" VolumeMapP.SubLogWrite[" + volumeNames[i] + "] -> LogStorageC_" + volumeNames[i] + "; \n") outFile.write("\n") - elif volumeTypes[volumeNames[i]] == "config": - outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n") - outFile.write(" Mount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n") - outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n") + elif volumeTypes[volumeNames[i]] == "config": + outFile.write(" components new ConfigStorageC(" + volumeNames[i] + ") as ConfigStorageC_" + volumeNames[i] + "; \n") + outFile.write(" ConfigMount[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n") + outFile.write(" ConfigStorage[" + volumeNames[i] + "] = ConfigStorageC_" + volumeNames[i] + "; \n") outFile.write("} \n") -- 2.39.2