[riot-notifications] [RIOT-OS/RIOT] driver/mtd_spi_nor: fix erase with unaligned addresses (#8400)

Vincent Dupont notifications at github.com
Thu Feb 8 16:11:13 CET 2018


vincent-d commented on this pull request.



>          return -EOVERFLOW;
     }
-    else {
-        for (size_t i = 0; i < size / sector_size; i++) {
+
+    while (size) {
+        be_uint32_t addr_be = byteorder_htonl(addr);
+        /* write enable */
+        mtd_spi_cmd(dev, dev->opcode->wren);
+
+        if (size == total_size) {
+            mtd_spi_cmd(dev, dev->opcode->chip_erase);

Yes, but write enable would still be needed first, then I'm not sure there is a significant gain to move out of the loop, at least in terms of code duplication and readability

-- 
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/8400#discussion_r166963489
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20180208/65dc87d9/attachment.html>


More information about the notifications mailing list