[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] BUGS in boot.h
From: |
Ludek Stepan |
Subject: |
Re: [avr-libc-dev] BUGS in boot.h |
Date: |
Mon, 29 Aug 2005 14:51:13 +0200 |
On 8/29/05, Ludek Stepan <address@hidden> wrote:
> On 8/29/05, E. Weddington <address@hidden> wrote:
> > Ludek Stepan wrote:
> >
> > >It's already been in bugzilla, I hadn't known that.
> > >However, nobody wants to fix it :(
> > >
> > >
> > >
> > It's not that nobody wants to fix it. We're all volunteers and it takes
> > time. Trust me, it will get fixed. Please have patience.
> >
> > Eric
> >
> > PS: Please post messages to the list too and not just to me personally.
> > Thanks.
> >
>
> OK, I can fix it myself and send patch if you want? Just give me few
> minutes...
>
> Ludek Stepan
>
So here is the promised patch, I dont know whether it is ok to attach
a file to the mail list
(I have never been using any mail list so don't hit me please) so I
include the patch as it is into the message...
I didn't do any further checking, i just fixed the xxxx_safe() headers
to match xxxx() original headers.
Also I cant understand do() { .... } while(0) directives very well so
I just take it from the original macro definition... and add few lines
of comment. Can anybody check the sanity?
QUOTE START (taken by diff -u) >>>>>>>>>>
--- boot.h_origi 2005-08-29 13:57:06.000000000 +0200
+++ boot.h 2005-08-29 14:32:27.000000000 +0200
@@ -566,11 +566,15 @@
#endif
-#define __boot_eeprom_spm_safe(func, address, data) \
+/* Note that address variable can stand for data in
+ boot_lock_bits_set_safe(lock_bits) call. But this macro is not suitable
+ for boot_rww_enable_safe() nor boot_page_fill_safe(address, data)
+*/
+#define __boot_eeprom_spm_safe(func, address) \
do { \
boot_spm_busy_wait(); \
eeprom_busy_wait(); \
- func (address, data); \
+ func (address); \
} while (0)
/** \ingroup avr_boot
@@ -579,38 +583,46 @@
complete before filling the page. */
#define boot_page_fill_safe(address, data) \
- __boot_eeprom_spm_safe (boot_page_fill, address, data)
+do { \
+ boot_spm_busy_wait(); \
+ eeprom_busy_wait(); \
+ boot_page_fill(address, data); \
+} while (0)
/** \ingroup avr_boot
Same as boot_page_erase() except it waits for eeprom and spm operations to
complete before erasing the page. */
-#define boot_page_erase_safe(address, data) \
- __boot_eeprom_spm_safe (boot_page_erase, address, data)
+#define boot_page_erase_safe(address) \
+ __boot_eeprom_spm_safe (boot_page_erase, address)
/** \ingroup avr_boot
Same as boot_page_write() except it waits for eeprom and spm operations to
complete before writing the page. */
-#define boot_page_write_safe(address, data) \
- __boot_eeprom_spm_safe (boot_page_wrte, address, data)
+#define boot_page_write_safe(address) \
+ __boot_eeprom_spm_safe (boot_page_write, address)
/** \ingroup avr_boot
Same as boot_rww_enable() except waits for eeprom and spm operations to
complete before enabling the RWW mameory. */
-#define boot_rww_enable_safe(address, data) \
- __boot_eeprom_spm_safe (boot_rww_enable, address, data)
+#define boot_rww_enable_safe() \
+do { \
+ boot_spm_busy_wait(); \
+ eeprom_busy_wait(); \
+ boot_rww_enable(); \
+} while (0)
/** \ingroup avr_boot
Same as boot_lock_bits_set() except waits for eeprom and spm operations to
complete before setting the lock bits. */
-#define boot_lock_bits_set_safe(address, data) \
- __boot_eeprom_spm_safe (boot_lock_bits_set, address, data)
+#define boot_lock_bits_set_safe(lock_bits) \
+ __boot_eeprom_spm_safe (boot_lock_bits_set, lock_bits)
#endif /* _AVR_BOOT_H_ */
<<<<<<<<<<<<< QUOTE END
Ludek Stepan