Blackfin: new dynamic bfin read/write mmr helpers
These are useful when working with C structs of MMRs as the appropriate size is selected based on the given argument. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
222f6eb66e
commit
f2521ce9ce
|
@ -50,6 +50,23 @@
|
|||
#define bfin_write16(addr, val) _bfin_writeX(addr, val, 16, w)
|
||||
#define bfin_write32(addr, val) _bfin_writeX(addr, val, 32, )
|
||||
|
||||
#define bfin_read(addr) \
|
||||
({ \
|
||||
sizeof(*(addr)) == 1 ? bfin_read8(addr) : \
|
||||
sizeof(*(addr)) == 2 ? bfin_read16(addr) : \
|
||||
sizeof(*(addr)) == 4 ? bfin_read32(addr) : \
|
||||
({ BUG(); 0; }); \
|
||||
})
|
||||
#define bfin_write(addr, val) \
|
||||
({ \
|
||||
switch (sizeof(*(addr))) { \
|
||||
case 1: bfin_write8(addr, val); break; \
|
||||
case 2: bfin_write16(addr, val); break; \
|
||||
case 4: bfin_write32(addr, val); break; \
|
||||
default: BUG(); \
|
||||
} \
|
||||
})
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/**************************************************
|
||||
|
|
Loading…
Reference in New Issue