summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-02-14 20:52:38 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-02-14 20:52:38 +0200
commit9fdac9144d08d62aa23869c3c55eb4cc7a724703 (patch)
treef2fc75d726aecd3d4a1c7aad4edbd6bc8323d62c
parent9d0525182dc926f68d73a9815c1b1abae1d69236 (diff)
downloadmicropython-9fdac9144d08d62aa23869c3c55eb4cc7a724703.tar.gz
micropython-9fdac9144d08d62aa23869c3c55eb4cc7a724703.zip
tests/vfs_fat_ramdisk: Allow to override sector size.
-rw-r--r--tests/extmod/vfs_fat_ramdisk.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py
index 919117a9ce..f122e4f961 100644
--- a/tests/extmod/vfs_fat_ramdisk.py
+++ b/tests/extmod/vfs_fat_ramdisk.py
@@ -8,23 +8,28 @@ except AttributeError:
class RAMFS:
+
+ SEC_SIZE = 512
+
def __init__(self, blocks):
- self.data = bytearray(blocks * 512)
+ self.data = bytearray(blocks * self.SEC_SIZE)
def readblocks(self, n, buf):
#print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
for i in range(len(buf)):
- buf[i] = self.data[n*512+i]
+ buf[i] = self.data[n * self.SEC_SIZE + i]
def writeblocks(self, n, buf):
#print("writeblocks(%s, %x)" % (n, id(buf)))
for i in range(len(buf)):
- self.data[n*512+i] = buf[i]
+ self.data[n * self.SEC_SIZE + i] = buf[i]
def ioctl(self, op, arg):
#print("ioctl(%d, %r)" % (op, arg))
if op == 4: # BP_IOCTL_SEC_COUNT
- return len(self.data) // 512
+ return len(self.data) // self.SEC_SIZE
+ if op == 5: # BP_IOCTL_SEC_SIZE
+ return self.SEC_SIZE
bdev = RAMFS(48)