On Fri, Feb 5, 2021, 8:43 PM Grr <gebbe...@gmail.com> wrote: > Just a final explanation: > > "why you want to expose the base address for a GPIO perf > of a _chip_ everywhere" > > It's _not_ everywhere, just the code that includes board.h, just like _any_ > other header file > gpio_setpin()
Arch specific ones are not allowed in arch/ or your application (where board.h is allowed) as I have said, they are isolated for good reason to the arch specific code. There is no reason to provide your application with chip register information which is what this would do. > And I want gpiodev_s to store specific arch information (the _more_ > specific, the better) because gpio_setpin() is no time to look things up or > decode complicated schemas. When a driver issues a pin change, it wants it > to change NOW, not some time in the future when the bureaucracy is ok with > it. For example, in the case of STM32, I intend to use BSRR instead of > read/modify/write ODR. > > So the challenge is to design a single structure that can accommodate the > most detailed information of any arch and use the fastest way for pin input > or output > > That's why I want STM32_GPIOE_BASE (or any other arch specific address) in > gpiodev_s > > gpio_setpin() > This is exactly why there are chip specific drivers for things like GPIO so you can take advantage of these things and the driver does not worry about it. It just calls back for it via the lower half interface. The stm32 GPIO driver does use BSRR https://github.com/apache/incubator-nuttx/blob/979a5b7fd4372e362669c6760ba9d06cf5a3c552/arch/arm/src/stm32/stm32_gpio.c#L767 We are talking in circles here at this point. You would have to show what you are planning on doing with the information you are trying to put in board.h because I don't see how it helps. Where would this base address be used, what exactly would call it?