[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-libc-dev] Adding array access to e.g. PINnCTRL
From: |
Weddington, Eric |
Subject: |
RE: [avr-libc-dev] Adding array access to e.g. PINnCTRL |
Date: |
Tue, 26 Jan 2010 13:42:27 -0700 |
> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of Erik Walthinsen
> Sent: Tuesday, January 26, 2010 1:07 PM
> To: address@hidden
> Subject: [avr-libc-dev] Adding array access to e.g. PINnCTRL
>
>
> I've tested and would like to propose adding the following structures
> where relevant to the ATxMega headers. Other places this might be
> useful are the TC.CCx regs (with the obvious caveat of A=0, B=1...),
> event control regs, etc. Basically anywhere there's a bit
> position or
> other number embedded in a sequence of registers.
>
> /* I/O Ports */
> typedef struct PORT_struct
> {
> ...
> register8_t INTFLAGS; /* Interrupt Flag Register */
> register8_t reserved_0x0D;
> register8_t reserved_0x0E;
> register8_t reserved_0x0F;
> union {
> struct {
> register8_t PIN0CTRL; /* Pin 0 Control Register */
> register8_t PIN1CTRL; /* Pin 1 Control Register */
> register8_t PIN2CTRL; /* Pin 2 Control Register */
> register8_t PIN3CTRL; /* Pin 3 Control Register */
> register8_t PIN4CTRL; /* Pin 4 Control Register */
> register8_t PIN5CTRL; /* Pin 5 Control Register */
> register8_t PIN6CTRL; /* Pin 6 Control Register */
> register8_t PIN7CTRL; /* Pin 7 Control Register */
> };
> register8_t PINnCTRL[8];
> };
> } PORT_t;
>
> It's used exactly as one might expect:
>
> PORTC.PINnCTRL[4] = PORT_INVEN_bm;
>
> If there's interest in doing this, I can work up a patch for
> all of the
> xmega parts.
Overall I think this is a good idea, certainly no harm in it.
Yes, would you be willing to work up a patch for this for all the xmega
devices? But more importantly, I use the avrgcc-header script (found in the
/xml subdirectory in the avr-libc source) to automatically generate new header
files (also for xmega). Could you attempt to patch that script to add this new
feature in? I would be willing to help with advice and direction on that part.
Thanks,
Eric Weddington