nios2: revert back to builtin sys_io functions
Some time ago we did a cleanup of sys_io function and left nios2 broken, especially on the MAX10 board. Revert back to the original implementation for this architecture. Fixes #35694 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
6148ac9549
commit
5b8d418058
3 changed files with 38 additions and 2 deletions
|
@ -22,7 +22,7 @@
|
||||||
#include <devicetree.h>
|
#include <devicetree.h>
|
||||||
#include <arch/nios2/nios2.h>
|
#include <arch/nios2/nios2.h>
|
||||||
#include <arch/common/sys_bitops.h>
|
#include <arch/common/sys_bitops.h>
|
||||||
#include <arch/common/sys_io.h>
|
#include <sys/sys_io.h>
|
||||||
#include <arch/common/ffs.h>
|
#include <arch/common/ffs.h>
|
||||||
|
|
||||||
#define ARCH_STACK_PTR_ALIGN 4
|
#define ARCH_STACK_PTR_ALIGN 4
|
||||||
|
|
|
@ -14,7 +14,43 @@
|
||||||
|
|
||||||
#ifndef _ASMLANGUAGE
|
#ifndef _ASMLANGUAGE
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
|
#include <sys/sys_io.h>
|
||||||
#include <toolchain.h>
|
#include <toolchain.h>
|
||||||
|
|
||||||
|
/* Using the *io variants of these instructions to prevent issues on
|
||||||
|
* devices that have an instruction/data cache
|
||||||
|
*/
|
||||||
|
|
||||||
|
static ALWAYS_INLINE void sys_write32(uint32_t data, mm_reg_t addr)
|
||||||
|
{
|
||||||
|
__builtin_stwio((void *)addr, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE uint32_t sys_read32(mm_reg_t addr)
|
||||||
|
{
|
||||||
|
return __builtin_ldwio((void *)addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE void sys_write8(uint8_t data, mm_reg_t addr)
|
||||||
|
{
|
||||||
|
sys_write32(data, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE uint8_t sys_read8(mm_reg_t addr)
|
||||||
|
{
|
||||||
|
return __builtin_ldbuio((void *)addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE void sys_write16(uint16_t data, mm_reg_t addr)
|
||||||
|
{
|
||||||
|
sys_write32(data, addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE uint16_t sys_read16(mm_reg_t addr)
|
||||||
|
{
|
||||||
|
return __builtin_ldhuio((void *)addr);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _ASMLANGUAGE */
|
#endif /* _ASMLANGUAGE */
|
||||||
|
|
||||||
#endif /* _ASM_INLINE_GCC_PUBLIC_GCC_H */
|
#endif /* _ASM_INLINE_GCC_PUBLIC_GCC_H */
|
||||||
|
|
|
@ -55,7 +55,7 @@ extern "C"
|
||||||
|
|
||||||
#include <zephyr/types.h>
|
#include <zephyr/types.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
#include <arch/common/sys_io.h>
|
#include <sys/sys_io.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions for accessing select Nios II general-purpose registers.
|
* Functions for accessing select Nios II general-purpose registers.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue