mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-25 07:41:42 +01:00
include: sbi: Introduce common endianess conversion macro
Introduce cpu_to_lle and lle_to_cpu macros which invoke correct word length cpu_to_le<64/32> conversion based on __riscv_xlen. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
a2b255b889
commit
b752099da8
@@ -58,4 +58,14 @@
|
|||||||
#define le64_to_cpu(x) ((uint64_t)BSWAP64(x))
|
#define le64_to_cpu(x) ((uint64_t)BSWAP64(x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __riscv_xlen == 64
|
||||||
|
#define cpu_to_lle cpu_to_le64
|
||||||
|
#define lle_to_cpu le64_to_cpu
|
||||||
|
#elif __riscv_xlen == 32
|
||||||
|
#define cpu_to_lle cpu_to_le32
|
||||||
|
#define lle_to_cpu le32_to_cpu
|
||||||
|
#else
|
||||||
|
#error "Unknown __riscv_xlen"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __SBI_BYTEORDER_H__ */
|
#endif /* __SBI_BYTEORDER_H__ */
|
||||||
|
Reference in New Issue
Block a user