summaryrefslogtreecommitdiffstatshomepage
path: root/esp8266/modules/flashbdev.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-09-06 13:40:51 +1000
committerDamien George <damien.p.george@gmail.com>2017-09-06 13:40:51 +1000
commit01dd7804b87d60b2deab16712eccb3b97351a9b7 (patch)
tree1aa21f38a872b8e62a3d4e4f74f68033c6f827e4 /esp8266/modules/flashbdev.py
parenta9862b30068fc9df1022f08019fb35aaa5085f64 (diff)
downloadmicropython-01dd7804b87d60b2deab16712eccb3b97351a9b7.tar.gz
micropython-01dd7804b87d60b2deab16712eccb3b97351a9b7.zip
ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is core and what is a port, and to allow the repository to grow with new ports in a sustainable way.
Diffstat (limited to 'esp8266/modules/flashbdev.py')
-rw-r--r--esp8266/modules/flashbdev.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/esp8266/modules/flashbdev.py b/esp8266/modules/flashbdev.py
deleted file mode 100644
index 40ba655c64..0000000000
--- a/esp8266/modules/flashbdev.py
+++ /dev/null
@@ -1,35 +0,0 @@
-import esp
-
-class FlashBdev:
-
- SEC_SIZE = 4096
- RESERVED_SECS = 1
- START_SEC = esp.flash_user_start() // SEC_SIZE + RESERVED_SECS
- NUM_BLK = 0x6b - RESERVED_SECS
-
- def __init__(self, blocks=NUM_BLK):
- self.blocks = blocks
-
- def readblocks(self, n, buf):
- #print("readblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
- esp.flash_read((n + self.START_SEC) * self.SEC_SIZE, buf)
-
- def writeblocks(self, n, buf):
- #print("writeblocks(%s, %x(%d))" % (n, id(buf), len(buf)))
- #assert len(buf) <= self.SEC_SIZE, len(buf)
- esp.flash_erase(n + self.START_SEC)
- esp.flash_write((n + self.START_SEC) * self.SEC_SIZE, buf)
-
- def ioctl(self, op, arg):
- #print("ioctl(%d, %r)" % (op, arg))
- if op == 4: # BP_IOCTL_SEC_COUNT
- return self.blocks
- if op == 5: # BP_IOCTL_SEC_SIZE
- return self.SEC_SIZE
-
-size = esp.flash_size()
-if size < 1024*1024:
- bdev = None
-else:
- # 20K at the flash end is reserved for SDK params storage
- bdev = FlashBdev((size - 20480) // FlashBdev.SEC_SIZE - FlashBdev.START_SEC)