This repository has been archived on 2023-07-17. You can view files and clone it, but cannot push or open issues or pull requests.
bl_mcu_sdk/drivers/lhal/include/arch/risc-v/riscv_arch.h

14 lines
746 B
C

#ifndef _RISCV_ARCH_H
#define _RISCV_ARCH_H
#define getreg8(a) (*(volatile uint8_t *)(a))
#define putreg8(v, a) (*(volatile uint8_t *)(a) = (v))
#define getreg16(a) (*(volatile uint16_t *)(a))
#define putreg16(v, a) (*(volatile uint16_t *)(a) = (v))
#define getreg32(a) (*(volatile uint32_t *)(a))
#define putreg32(v, a) (*(volatile uint32_t *)(a) = (v))
// #define getreg64(a) (*(volatile uint64_t *)(a))
// #define putreg64(v, a) (*(volatile uint64_t *)(a) = (v))
// #define modifyreg32(a, clearbits, setbits) putreg32((getreg32(a) & (~clearbits)) | setbits, a)
#endif