From d6e86a67bbf791d19d7637cdcca69de3904470af Mon Sep 17 00:00:00 2001 From: zhouji <956133287@qq.com> Date: Mon, 24 May 2021 17:09:29 +0800 Subject: [PATCH] =?UTF-8?q?[add]=20=E5=9C=A8cortex-a=E4=B8=AD=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=EF=BC=8C=E6=89=93=E5=BC=80RT=5FUSING=5FCPU=5FFFS?= =?UTF-8?q?=E5=AE=8F=E5=AE=9A=E4=B9=89=E6=97=B6=E7=9A=84=5Frt=5Fffs?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libcpu/arm/cortex-a/cpu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libcpu/arm/cortex-a/cpu.c b/libcpu/arm/cortex-a/cpu.c index 7367bddd9f..c95c58a13c 100644 --- a/libcpu/arm/cortex-a/cpu.c +++ b/libcpu/arm/cortex-a/cpu.c @@ -75,4 +75,21 @@ RT_WEAK void rt_hw_cpu_shutdown() } } +#ifdef RT_USING_CPU_FFS +/** + * This function finds the first bit set (beginning with the least significant bit) + * in value and return the index of that bit. + * + * Bits are numbered starting at 1 (the least significant bit). A return value of + * zero from any of these functions means that the argument was zero. + * + * @return return the index of the first bit set. If value is 0, then this function + * shall return 0. + */ +int __rt_ffs(int value) +{ + return __builtin_ffs(value); +} +#endif + /*@}*/