[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-libc-dev] wdt.h enhancement?
From: |
Weddington, Eric |
Subject: |
RE: [avr-libc-dev] wdt.h enhancement? |
Date: |
Wed, 22 Jul 2009 20:00:30 -0600 |
Hi Larry,
Sorry to respond late on this.
I think at this point it would be better if you could work up a patch (with
doxygen documentation) and submit that to the Patch Tracker.
Thanks,
Eric Weddington
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of larry barello
> Sent: Wednesday, June 24, 2009 3:57 AM
> To: address@hidden
> Subject: [avr-libc-dev] wdt.h enhancement?
>
> The file wdt.h doesn't support fancy stuff like WDIE
> (interrupt enable bit)
> I hacked it as follows for the STS case. Note I set it up so
> the macro
> fails if there is no WDIE bit defined. There is only one
> line added to the
> wdt_enable() macro...
>
> Usage (in my code...)
>
> wdt_enable((WDTO_4S | WDT_IE));
>
> Note, the need for double parenthesis. Should "value",
> below, be encased in
> parenthesis so I don't need it in the calling code?
> Note, shouldn't this be extended to allowing the user to
> "specify" if reset
> behavior is enabled or not? I didn't make that change
> because it would
> break prior use.. Maybe set up a flag to "disable" the WDE
> flag so the
> default behavior is compatible?
>
> ------- wdt.h-----------
>
> #ifdef WDIE
> # define WDT_IE 0x10
> # define _WDT_IE_MASK _BV(WDIE)
> #else
> # define _WDT_IE_MASK 0
> #endif
>
> #define wdt_enable(value) \
> __asm__ __volatile__ ( \
> "in __tmp_reg__,__SREG__" "\n\t" \
> "cli" "\n\t" \
> "wdr" "\n\t" \
> "sts %0,%1" "\n\t" \
> "out __SREG__,__tmp_reg__" "\n\t" \
> "sts %0,%2" "\n\t" \
> : /* no outputs */ \
> : "M" (_SFR_MEM_ADDR(_WD_CONTROL_REG)), \
> "r" (_BV(_WD_CHANGE_BIT) | _BV(WDE)), \
> "r" ((uint8_t) ((value & 0x08 ? _WD_PS3_MASK : 0x00) | \
> (value & 0x10 ? _WDT_IE_MASK:0x00) | \ <<<I ADDED THIS LINE>>>
> _BV(WDE) | (value & 0x07)) ) \
> : "r0" \
> )
>
>
>
>
>
> _______________________________________________
> AVR-libc-dev mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-libc-dev
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE: [avr-libc-dev] wdt.h enhancement?,
Weddington, Eric <=