[PATCH v2 3/4] bsps: Add GPIO API
Duc Doan
dtbpkmte at gmail.com
Thu Jul 7 13:51:26 UTC 2022
Hello Karel,
On Thu, 2022-07-07 at 14:36 +0200, Karel Gardas wrote:
>
> Hello Duc,
>
> just two notes which bothers me most.
>
> On 7/7/22 13:34, Duc Doan wrote:
> > This is the new GPIO API. The header file is
> > gpio2.h.
> > ---
> > bsps/include/bsp/gpio2.h | 538
> > ++++++++++++++++++++++++++++++++++++
> > bsps/shared/dev/gpio/gpio.c | 196 +++++++++++++
> > spec/build/bsps/obj.yml | 2 +-
> > 3 files changed, 735 insertions(+), 1 deletion(-)
> > create mode 100644 bsps/include/bsp/gpio2.h
> > create mode 100644 bsps/shared/dev/gpio/gpio.c
> >
> > diff --git a/bsps/include/bsp/gpio2.h b/bsps/include/bsp/gpio2.h
> > new file mode 100644
> > index 0000000000..e99967cd47
> > --- /dev/null
> > +++ b/bsps/include/bsp/gpio2.h
> > @@ -0,0 +1,538 @@
> > +/**
> > + * @file
> > + *
> > + * @ingroup rtems_gpio2
> > + *
> > + * @brief RTEMS GPIO new API definition.
> > + */
> > +
> > +/*
> > +* Copyright (c) 2022 Duc Doan <dtbpkmte at gmail.com>
> > +*
> > +* The license and distribution terms for this file may be
> > +* found in the file LICENSE in this distribution or at
> > +* http://www.rtems.org/license/LICENSE.
> > +*/
>
> RTEMS project (Joel & others) perform huge effort in a way on
> relicensing RTEMS to BSD license. Please use new license header
> instead
> of this one which is old -- from GPL days. Open few random RTEMS
> files
> and you will see few license headers. Look for example into ...
> randomly
> picked :-) --
> bsps/arm/stm32h7/boards/stm/nucleo-h743zi/stm32h7-bspstarthooks.c and
> modify this to your name/email...
>
Thank you for the reminder. I was actually copying from a random source
file before. I will change it in the next version.
>
> > +/**
> > + * @brief Performs setup for GPIO functionality.
> > + *
> > + * This function calls bsp_gpio_register_controllers() and may
> > + * perform additional initialization steps for GPIO
> > functionality.
> > + * It should be called by users before all GPIO operations,
> > ideally
> > + * when the application starts.
> > + */
> > +extern void rtems_gpio_begin(
> > + void
> > +);
>
> I don't like this _begin mentality here. I think this should be all
> done
> by BSP code based on actual BSP configuration.
> Something like:
> STM32F4_ENABLE_GENERIC_GPIO implemented as optengpio.yml in f4 spec
> and
> then based on its C preprocessor value just calls
> bsp_gpio_register_controllers from probably hook_1 and be done with
> that.
>
> Sorry about that, 'begin' is too much RDBMS hooked thing here and
> when I
> see 'begin' I also expect 'commit' or 'rollback' somewhere down the
> line. :-)
>
> Thanks,
> Karel
>
I see, it makes sense to call that function automatically. I actually
tried to do so using RTEMS_SYSINIT_ITEM but failed. I will try putting
it into the hook.
Best,
Duc Doan
More information about the devel
mailing list