> -----Original Message-----
> From: 
> avr-libc-dev-bounces+eric.weddington=atmel....@nongnu.org 
> [mailto:avr-libc-dev-bounces+eric.weddington=atmel....@nongnu.
> org] On Behalf Of Erik Walthinsen
> Sent: Tuesday, January 26, 2010 1:07 PM
> To: avr-libc-dev@nongnu.org
> 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


_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to