
Le vendredi 04 avril 2008 à 16:32 -0700, Zac Wheeler a écrit :
On Fri, Apr 4, 2008 at 3:25 PM, Stelian Pop stelian@popies.net wrote:
Le vendredi 04 avril 2008 à 13:32 -0700, Zac Wheeler a écrit :
I have a question about the arrangement of include files for the at91sam9 family.
Is the intention that asm/arch/at91_xxx.h be applicable for all at91sam9 microcontrollers, or should they be broken down into subarch folders (e.g. asm/arch/at91sam9261/at91_pmc.h)?
They are supposed to be shareable for all at91sam microcontrollers, in the same way it's done in Linux.
So should things like AT91_ECC as defined in at91sam960.h be AT91SAM9260_ECC instead or moved to an at91_sys.h file?
No, the idea is to keep the same conventions as the kernel guys. In fact the header files have been copied from Linux, and are 95% identical to them (we cannot use the header files provided by Atmel, because there is too much craft inside, and rewriting a third form of the same headers seemed to me too error prone).
As for AT91_ECC:
at91cap9.h:#define AT91_ECC (0xffffe200 - AT91_BASE_SYS) at91sam9260.h:#define AT91_ECC (0xffffe800 - AT91_BASE_SYS) at91sam9263.h:#define AT91_ECC0 (0xffffe000 - AT91_BASE_SYS) at91sam9263.h:#define AT91_ECC1 (0xffffe600 - AT91_BASE_SYS) at91sam9rl.h:#define AT91_ECC (0xffffe800 - AT91_BASE_SYS)
seems to me quite nice this way !
It seems somewhat dangerous to define an AT91_ in a AT91SAM9260-specific file.
It shouldn't be. All the AT91 platforms have pretty much the same hardware, so having the same constants means we don't need extra #ifdefs in the driver code.
Of course, one should take care of including only the header file which goes with his platform. This is what include/asm-arm/arch-at91sam9/hardware.h does: based on what CONFIG_AT91xxxxx is defined, the relevant platform specific header file is included.
Stelian.