zephyr/include/arch/common/sys_io.h
Eugeniy Paltsev ebe51e26cb ARCH: COMMON: split sys_io.h for MMIO & memory bits functions
As of today 'include/arch/common/sys_io.h" has generic implementation
for MMIO accessors and memory bits manipulation functions. That leads
to several architectures like ARC, ARM/aarch64, ARM/aarch32/corter_a_r
redefine entire 'common/sys_io.h' even if they only have different
MMIO accessors implementation.

So split 'include/arch/common/sys_io.h" to
 * sys_io.h - generic MMIO accessors
 * sys_bitops.h - generic memory bits manipulation functions

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-09-01 13:36:48 +02:00

60 lines
1.1 KiB
C

/*
* Copyright (c) 2015, Wind River Systems, Inc.
* Copyright (c) 2017, Oticon A/S
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Memory mapped registers I/O functions in non-arch-specific C code */
#ifndef ZEPHYR_INCLUDE_ARCH_COMMON_SYS_IO_H_
#define ZEPHYR_INCLUDE_ARCH_COMMON_SYS_IO_H_
#ifndef _ASMLANGUAGE
#include <toolchain.h>
#include <zephyr/types.h>
#include <sys/sys_io.h>
#ifdef __cplusplus
extern "C" {
#endif
static ALWAYS_INLINE uint8_t sys_read8(mem_addr_t addr)
{
return *(volatile uint8_t *)addr;
}
static ALWAYS_INLINE void sys_write8(uint8_t data, mem_addr_t addr)
{
*(volatile uint8_t *)addr = data;
}
static ALWAYS_INLINE uint16_t sys_read16(mem_addr_t addr)
{
return *(volatile uint16_t *)addr;
}
static ALWAYS_INLINE void sys_write16(uint16_t data, mem_addr_t addr)
{
*(volatile uint16_t *)addr = data;
}
static ALWAYS_INLINE uint32_t sys_read32(mem_addr_t addr)
{
return *(volatile uint32_t *)addr;
}
static ALWAYS_INLINE void sys_write32(uint32_t data, mem_addr_t addr)
{
*(volatile uint32_t *)addr = data;
}
#ifdef __cplusplus
}
#endif
#endif /* _ASMLANGUAGE */
#endif /* ZEPHYR_INCLUDE_ARCH_COMMON_SYS_IO_H_ */