Hi,
First, I think this topic was hashed over a bit awhile back, you might
do a search of the archives for more info.
IAR uses the following in their include files that shipped with my
2148 demo board:
/* GPIO registers */
typedef struct {
__REG32 P0_0 :1;
__REG32 P0_1 :1;
__REG32 P0_2 :1;
__REG32 P0_3 :1;
__REG32 P0_4 :1;
__REG32 P0_5 :1;
__REG32 P0_6 :1;
__REG32 P0_7 :1;
__REG32 P0_8 :1;
__REG32 P0_9 :1;
__REG32 P0_10 :1;
__REG32 P0_11 :1;
__REG32 P0_12 :1;
__REG32 P0_13 :1;
__REG32 P0_14 :1;
__REG32 P0_15 :1;
__REG32 P0_16 :1;
__REG32 P0_17 :1;
__REG32 P0_18 :1;
__REG32 P0_19 :1;
__REG32 P0_20 :1;
__REG32 P0_21 :1;
__REG32 P0_22 :1;
__REG32 P0_23 :1;
__REG32 P0_24 :1;
__REG32 P0_25 :1;
__REG32 P0_26 :1;
__REG32 P0_27 :1;
__REG32 P0_28 :1;
__REG32 P0_29 :1;
__REG32 P0_30 :1;
__REG32 P0_31 :1;
} __gpio_bits;
Which is maybe what you're asking for; if IOCLR0 is declated of type
__gpio_bits in your headers, you can say IOCLR0.P0_12
Now there's a few reasons you might not want to do this, but that's
for the experts on this list to point out, cause I was never clear
about exactly what they were. Possibly issues with endian-ness and
the like...
SteveMessage
Re: Bit addressing
2006-03-01 by Steve Franks
Attachments
- No local attachments were found for this message.