提交 69e1d8a6 编写于 作者: M Mike Frysinger

Blackfin: unify MMR helpers

Signed-off-by: NMike Frysinger <vapier@gentoo.org>
上级 f05ede3a
......@@ -25,62 +25,30 @@
# define NOP_PAD_ANOMALY_05000198
#endif
#define bfin_read8(addr) ({ \
uint32_t __v; \
#define _bfin_readX(addr, size, asm_size, asm_ext) ({ \
u32 __v; \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"%0 = b[%1] (z);" \
"%0 = " #asm_size "[%1]" #asm_ext ";" \
: "=d" (__v) \
: "a" (addr) \
); \
__v; })
#define bfin_read16(addr) ({ \
uint32_t __v; \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"%0 = w[%1] (z);" \
: "=d" (__v) \
: "a" (addr) \
); \
__v; })
#define bfin_read32(addr) ({ \
uint32_t __v; \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"%0 = [%1];" \
: "=d" (__v) \
: "a" (addr) \
); \
__v; })
#define bfin_write8(addr, val) \
#define _bfin_writeX(addr, val, size, asm_size) \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"b[%0] = %1;" \
#asm_size "[%0] = %1;" \
: \
: "a" (addr), "d" ((uint8_t)(val)) \
: "a" (addr), "d" ((u##size)(val)) \
: "memory" \
)
#define bfin_write16(addr, val) \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"w[%0] = %1;" \
: \
: "a" (addr), "d" ((uint16_t)(val)) \
: "memory" \
)
#define bfin_write32(addr, val) \
__asm__ __volatile__( \
NOP_PAD_ANOMALY_05000198 \
"[%0] = %1;" \
: \
: "a" (addr), "d" (val) \
: "memory" \
)
#define bfin_read8(addr) _bfin_readX(addr, 8, b, (z))
#define bfin_read16(addr) _bfin_readX(addr, 16, w, (z))
#define bfin_read32(addr) _bfin_readX(addr, 32, , )
#define bfin_write8(addr, val) _bfin_writeX(addr, val, 8, b)
#define bfin_write16(addr, val) _bfin_writeX(addr, val, 16, w)
#define bfin_write32(addr, val) _bfin_writeX(addr, val, 32, )
#endif /* __ASSEMBLY__ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册