[riot-notifications] [RIOT-OS/RIOT] native/mtd: implement .write_page() (#15378)

Koen Zandberg notifications at github.com
Tue Nov 17 10:17:24 CET 2020


@bergzand commented on this pull request.



> @@ -103,6 +105,41 @@ static int _write(mtd_dev_t *dev, const void *buff, uint32_t addr, uint32_t size
     return 0;
 }
 
+static int _write_page(mtd_dev_t *dev, const void *buff, uint32_t page, uint32_t offset,
+                       uint32_t size)
+{
+    mtd_native_dev_t *_dev = (mtd_native_dev_t*) dev;
+    uint32_t addr = page * dev->page_size + offset;
+
+    DEBUG("mtd_native: write from page %" PRIx32 ", offset 0x%" PRIx32 " count %" PRIu32 "\n",
+          page, offset, size);
+
+    if (page > dev->sector_count * dev->pages_per_sector) {

Why not just call `_write()` here? (as proposed by @jue89 )

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15378#pullrequestreview-532161191
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201117/c742b23f/attachment.htm>


More information about the notifications mailing list