Date:2011-03-11 21:40:51 (8 years 7 months ago)
Author:Werner Almesberger
Commit:c265151d2b24c011fde22d92154ddcb4aa42d318
Message:atusb/fw: introduced function flash_end_write to properly finish flashing

- dfu.h (flash_end_write), flash.c (flash_end_write): write any incomplete
buffer
- flash.c (flash_write, flash_end_write): call boot_rww_enable only at the
very end, it won't erase our buffer in mid-page
- usb/dfu.c (my_setup): call flash_end_write at the end of a download
Files: atusb/fw/flash.c (1 diff)
atusb/fw/usb/dfu.c (1 diff)
atusb/fw/usb/dfu.h (1 diff)

Change Details

atusb/fw/flash.c
5757            boot_spm_busy_wait();
5858        }
5959        }
60}
61
6062
63void flash_end_write(void)
64{
65    if (payload & (SPM_PAGESIZE-1)) {
66        boot_page_write(payload & ~(SPM_PAGESIZE-1));
67        boot_spm_busy_wait();
68    }
6169    boot_rww_enable();
6270}
6371
atusb/fw/usb/dfu.c
192192        }
193193        if (!setup->wLength) {
194194            debug("DONE\n");
195            flash_end_write();
195196            dfu.state = dfuIDLE;
196197            did_download = 1;
197198            return 1;
atusb/fw/usb/dfu.h
8484void flash_start(void);
8585int flash_can_write(uint16_t size);
8686void flash_write(const uint8_t *buf, uint16_t size);
87void flash_end_write(void);
8788uint16_t flash_read(uint8_t *buf, uint16_t size);
8889
8990

Archive Download the corresponding diff file



interactive