-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 First off, sorry it's taken so long to get a reply. It's been sitting here in my inbox for far too long now ....
Ingo Becker <i...@orgizm.net> wrote: > Hi, > > i'm currently working on lpc13xx support. I have started writing > some code years ago but never really tried to commit it back to the > official repo. But some days ago, i started a project based on an old > lpc1343 based board and decided to update my old code so it fits into > the current state of libopencm3. My question is about naming register > defines. The HACKING file sugests that names should be following > the convention SUBSYSTEM_REGISTER_BIT. At the moment i'm reworking my > old defines of what the datasheet calls 'system control block > registers'. > Following the convention, i would e.g. end up with something like > SYSCTRL_WDTOSCCTRL_FREQSEL which looks a bit cluttered to me. By > looking at the stm32-defines it seems like they are not exactly > following this convention. E.g. TIM1_CCER is just the plain register > name without a prepended subsystem(something like TIMER_). One could > argue, that TIM1 in TIM1_CCER already is the subsystem-name. yep, TIM1 is the subsystem, CCER is the register. The verbosity and friendliness of the names will largely depend on what the manufacturer has used. Reading the lpc13xx user manual, yes, SYSCTRL_WDTOSCCTRL_FREQSEL would be the correct bit/field names. Yes, this is somewhat verbose. But that's a bit name, not the register name, so it's a little unfair to compare it directly to TIM1_CCER > So i guess > i only have to prepend the 'subsystem'-name in case it is not already > included in the register-name? Something like that... The timers on stm32 are often different periperhals with different numbers, so while they might both be timers, they're not the same subsystem. Hence the plain TIM1 name. > Or are the defines of the stm32 just not > following the convention? Is there a good definition of what a > 'subsystem'-name is? For example SYSCTRL is never realy mentioned in > the datasheet. In general the section in the datasheet is called 'System > configuration' but the mentioned register are listet as 'system control > block' under the 'system configuration'-section. There are more > registers under the section 'system configuration', should i prefix > them with something like SYSCFG_ ? I agree this is not always easy. The memory map lists this section as "system control" You need to choose _something_ here, so that all these registers can be grouped, and that's up to you. I'm not seeing what second section you are referring to as SYSCFG though, but I'm not super familiar with NXP's documentation layouts. > > I apologize for all those questions, but i thought it would be a good > idea to ask before choosing wrong names, as it is not that much fun > refactoring them afterwards. > no problem, hope this is helpful Sincerely, Karl Palsson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAgAGBQJVuRLCAAoJEBmotQ/U1cr2R6gP/1xYoD6hWaySjTEL0EGMhMx6 hq8tithXI6RjtTv4XxIJNEVM4AOU/FkyAe3UM5RKtvdDywYc6pAWfcH54UTeA4Ka UfFvGZMOYuIOQ63Ah8wP8gwoEAi/6BIaZZafVYzeHhybdMQCfAcRwcaKXWvl6raG Aww5A5wMLUVFo328wW0WZhXF+tNcgIZGE7PSmDfIOP5ZWtynHTQ7NRL9urQkG3c0 16yKwQqOEkqgt9AjJ8UgyF6mpaRv4cdIbg9ToF3mqnZlhG7m4EjpHPbRt+54VxQZ qj4fYvkHoMenkCXTISP1XOPXYYGWtzGnG6H5WSq4gUnYnt81dp4JPUSn/Y6Bvh6S kKsp79EBV2zkv96B9hMv9gqDEU2s4LHh5VvIO6i9h4A5UrK1GO6ktV7l6BCSltWJ 4q6XxFz8GC8mwhmY5LZLmadU8hvLF+9BN6n/cpGeFpJHcEig5f0OCopPi6ww5oDX 2yKtaHJtXzBNx/oQp6rlok85J0+R2OVh/bi9zu/7RrbJDBbtzNiyBH5r1OOFPAQn Jc0ZdMgLlFrKO/YFF90VmEj7NZLxcDglX8X+9jyDFy5B5zKx4VOYdc73kt7wXa9m iMCBGM0voeVttXPJ8tIoKuNCn32/WEFI/+kw7uS3zILIo+uS+5OqcmVCY1j8JAtK y18TFOmVlaaxTv7Vk2Sw =I4ht -----END PGP SIGNATURE-----
------------------------------------------------------------------------------
_______________________________________________ libopencm3-devel mailing list libopencm3-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libopencm3-devel