bugAVR C Runtime Library - Bugs: bug #37847, Xmega power.h groupings are wrong


bug #37847: Xmega power.h groupings are wrong

Submitted by:  Erik Walthinsen <omega>
Submitted on:  Sat 01 Dec 2012 12:34:10 AM UTC  
Category: HeaderSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedPercent Complete: 0%
Assigned to: NoneOpen/Closed: Open
Release: 1.8.0Fixed Release: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Mon 09 Mar 2015 06:41:28 AM UTC, comment #1:

This is fixed by patch #8563.

Pitchumani <pitchumani>
Project Member
Sat 01 Dec 2012 12:34:10 AM UTC, original submission:

In working on a patch to add all xmega devices, I ran across the power.h code. The problem is that the groupings don't actually match the functionality of the various devices, and even within those groups some of the macros aren't consistent.

I'd propose that rather than defining them based on the individual chip macros, that each of the power_enable() and power_disable() macros be #ifdef'd based on whether the peripheral itself is defined:

#ifdef USARTF1
#define power_usartf1_enable() (PR_PRPF &= (uint8_t)~(PR_USART1_bm))
#define power_usartf1_disable() (PR_PRPF |= (uint8_t)PR_USART1_bm)

The _enable_all and _disable_all are a slightly tougher nut to crack, but that could be solved by adding in before the #endif a:

#define __power_usartf1_mask ((uint8_t)PR_USART1_bm)
#define __power_usartf1_mask (0)

Then grouping all these macros together into a single pair of definitions for _all().

Erik Walthinsen <omega>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #27005:  power.h added by omega (11kB - text/x-chdr - Included full example of alternate power_() macros for Xmega)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by pitchumani (Posted a comment)
  • -unavailable- added by omega (Submitted the item)

    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 09 Mar 2015 06:41:28 AM UTCpitchumaniStatusNone=>Fixed
    Sat 01 Dec 2012 01:00:29 AM UTComegaAttached File-=>Added power.h, #27005

    Back to the top

    Powered by Savane 3.1-cleanup