[PATCH v2 1/1] bsps/riscv: Add per cpu clock interrupt
Gedare Bloom
gedare at rtems.org
Mon Mar 22 16:51:55 UTC 2021
On Mon, Mar 22, 2021 at 10:28 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
>
> On 22/03/2021 16:56, Jan Sommer wrote:
> > diff --git a/bsps/riscv/riscv/clock/clockdrv.c b/bsps/riscv/riscv/clock/clockdrv.c
> > index d085b6bd95..e8a39c8591 100644
> > --- a/bsps/riscv/riscv/clock/clockdrv.c
> > +++ b/bsps/riscv/riscv/clock/clockdrv.c
> > @@ -41,6 +41,7 @@
> > #include <rtems/timecounter.h>
> > #include <rtems/score/cpuimpl.h>
> > #include <rtems/score/riscv-utility.h>
> > +#include <rtems/score/smpimpl.h>
> >
> > #include <libfdt.h>
> >
> > @@ -92,13 +93,18 @@ static void riscv_clock_at_tick(riscv_timecounter *tc)
> > {
> > volatile RISCV_CLINT_regs *clint;
> > uint64_t value;
> > + uint32_t cpu = 0;
> > +
> > +#if defined(RTEMS_SMP)
> > + cpu = _CPU_SMP_Get_current_processor();
> > +#endif
> You can use rtems_scheduler_get_processor() to get rid of this include
> of an implementation header and the #if.
>
Nice catch. Jan, you can push it with the modification to use the API
function instead. (Note: BSPs are in a gray area, but generally
considered as "application" layer, so we should prefer they use the
APIs, and if they need to poke into the internals of RTEMS, we need to
consider why and what can be done to avoid violation of the
layer/encapsulation.)
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.huber at embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax: +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list