speters / CMSIS

CMSIS - full tree with various vendor devices (ST, Infineon, ...)
24 stars 32 forks source link

problem with GPIOA_Type DATA field in TM4C #1

Open pabigot opened 10 years ago

pabigot commented 10 years ago

Thanks for making these available; I've been unable to get SVD or CMSIS information from TI directly. Can you say where you obtained them?

Reason I ask is the GPIOA_Type declarations have:

__I  uint32_t  RESERVED0[255];
__IO uint32_t  DATA;
__IO uint32_t  DIR;

I feel reasonably certain this is wrong, and that the correct declaration is:

__IO uint32_t  DATA[256];
__IO uint32_t  DIR;

which permits bit-banded access to pins 0 and 2 through (for example) GPIOA->DATA[0x05].

I'd like to see the SVD to try to confirm my understanding of how the map is supposed to be used.

pabigot commented 10 years ago

The content can be fixed with:

cd Devices/TI
find . -name '*.h' | xargs sed -r -i -f/tmp/s.sed

with /tmp/s.sed being:

/GPIOA(_AHB)? Structure/,/^}/{
/RESERVED0/d
s/  DATA;     /  DATA[256];/
}
pabigot commented 10 years ago

On further reflection, the original is not "wrong", it's just unfortunately incomplete. The original declared DATA register is the right one to manipulate all pins at once; the declaration simply fails to provide a way to use the underlying hardware's ability to affect a subset of the pins. Too bad.