zephyr/include/arch/nios2/asm_inline_gcc.h

197 lines
3.9 KiB
C
Raw Normal View History

/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_ARCH_NIOS2_ASM_INLINE_GCC_H_
#define ZEPHYR_INCLUDE_ARCH_NIOS2_ASM_INLINE_GCC_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* The file must not be included directly
* Include arch/cpu.h instead
*/
#ifndef _ASMLANGUAGE
#include <sys_io.h>
#include <toolchain.h>
/**
*
* @brief find most significant bit set in a 32-bit word
*
* This routine finds the first bit set starting from the most significant bit
* in the argument passed in and returns the index of that bit. Bits are
* numbered starting at 1 from the least significant bit. A return value of
* zero indicates that the value passed is zero.
*
* @return most significant bit set, 0 if @a op is 0
*/
static ALWAYS_INLINE unsigned int find_msb_set(u32_t op)
{
if (!op)
return 0;
return 32 - __builtin_clz(op);
}
/**
*
* @brief find least significant bit set in a 32-bit word
*
* This routine finds the first bit set starting from the least significant bit
* in the argument passed in and returns the index of that bit. Bits are
* numbered starting at 1 from the least significant bit. A return value of
* zero indicates that the value passed is zero.
*
* @return least significant bit set, 0 if @a op is 0
*/
static ALWAYS_INLINE unsigned int find_lsb_set(u32_t op)
{
return __builtin_ffs(op);
}
/* Using the *io variants of these instructions to prevent issues on
* devices that have an instruction/data cache
*/
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
void sys_write32(u32_t data, mm_reg_t addr)
{
__builtin_stwio((void *)addr, data);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
u32_t sys_read32(mm_reg_t addr)
{
return __builtin_ldwio((void *)addr);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
void sys_write8(u8_t data, mm_reg_t addr)
{
sys_write32(data, addr);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
u8_t sys_read8(mm_reg_t addr)
{
return __builtin_ldbuio((void *)addr);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
void sys_write16(u16_t data, mm_reg_t addr)
{
sys_write32(data, addr);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
u16_t sys_read16(mm_reg_t addr)
{
return __builtin_ldhuio((void *)addr);
}
/* NIOS II does not have any special instructions for manipulating bits,
* so just read, modify, write in C
*/
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
void sys_set_bit(mem_addr_t addr, unsigned int bit)
{
sys_write32(sys_read32(addr) | (1 << bit), addr);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
void sys_clear_bit(mem_addr_t addr, unsigned int bit)
{
sys_write32(sys_read32(addr) & ~(1 << bit), addr);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
int sys_test_bit(mem_addr_t addr, unsigned int bit)
{
return sys_read32(addr) & (1 << bit);
}
/* These are not required to be atomic, just do it in C */
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
int sys_test_and_set_bit(mem_addr_t addr, unsigned int bit)
{
int ret;
ret = sys_test_bit(addr, bit);
sys_set_bit(addr, bit);
return ret;
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
int sys_test_and_clear_bit(mem_addr_t addr, unsigned int bit)
{
int ret;
ret = sys_test_bit(addr, bit);
sys_clear_bit(addr, bit);
return ret;
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
void sys_bitfield_set_bit(mem_addr_t addr, unsigned int bit)
{
/* Doing memory offsets in terms of 32-bit values to prevent
* alignment issues
*/
sys_set_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
void sys_bitfield_clear_bit(mem_addr_t addr, unsigned int bit)
{
sys_clear_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
int sys_bitfield_test_bit(mem_addr_t addr, unsigned int bit)
{
return sys_test_bit(addr + ((bit >> 5) << 2), bit & 0x1F);
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
int sys_bitfield_test_and_set_bit(mem_addr_t addr, unsigned int bit)
{
int ret;
ret = sys_bitfield_test_bit(addr, bit);
sys_bitfield_set_bit(addr, bit);
return ret;
}
doc: fix doxygen warnings 'documented symbol `XYZ` was not declared or defined.' The problem is doxygen's parser is getting confused by constructs as: static inline __attribute__((always_inline)) void sys_out8(uint8_t data, io_port_t port) { _arc_v2_aux_reg_write(port, data); } Too many words at the beginning of the function definition. So change to use the macro ALWAYS_INLINE (which is already defined to mean 'inline __attribute__((always_inline))`. Kills: sys_io.h:37: warning: documented symbol `static inline void sys_out8' was not declared or defined. sys_io.h:47: warning: documented symbol `static inline uint8_t sys_in8' was not declared or defined. sys_io.h:58: warning: documented symbol `static inline void sys_out16' was not declared or defined. sys_io.h:68: warning: documented symbol `static inline uint16_t sys_in16' was not declared or defined. sys_io.h:79: warning: documented symbol `static inline void sys_out32' was not declared or defined. sys_io.h:89: warning: documented symbol `static inline uint32_t sys_in32' was not declared or defined. sys_io.h:120: warning: documented symbol `static inline int sys_io_test_bit' was not declared or defined. sys_io.h:133: warning: documented symbol `static inline int sys_io_test_and_set_bit' was not declared or defined. sys_io.h:146: warning: documented symbol `static inline int sys_io_test_and_clear_bit' was not declared or defined. sys_io.h:161: warning: documented symbol `static inline void sys_write8' was not declared or defined. sys_io.h:171: warning: documented symbol `static inline uint8_t sys_read8' was not declared or defined. sys_io.h:182: warning: documented symbol `static inline void sys_write16' was not declared or defined. sys_io.h:192: warning: documented symbol `static inline uint16_t sys_read16' was not declared or defined. sys_io.h:248: warning: documented symbol `static inline int sys_test_bit' was not declared or defined. sys_io.h:261: warning: documented symbol `static inline int sys_test_and_set_bit' was not declared or defined. sys_io.h:274: warning: documented symbol `static inline int sys_test_and_clear_bit' was not declared or defined. Change-Id: Id10e9b6cd44a370ccc732c17b23fb66bd1845205 Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-15 09:35:13 +08:00
static ALWAYS_INLINE
int sys_bitfield_test_and_clear_bit(mem_addr_t addr, unsigned int bit)
{
int ret;
ret = sys_bitfield_test_bit(addr, bit);
sys_bitfield_clear_bit(addr, bit);
return ret;
}
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus
}
#endif
#endif /* _ASM_INLINE_GCC_PUBLIC_GCC_H */