arch/risc-v: include csr.h indirectly through nuttx/irq.h
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
parent
5d856971db
commit
36b0b95eb1
@ -35,8 +35,6 @@
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <arch/csr.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -325,37 +325,6 @@
|
||||
|
||||
#define MIP_MTIP (0x1 << 7)
|
||||
|
||||
#define CSR_STR(csr) #csr
|
||||
|
||||
#define READ_CSR(reg) \
|
||||
({ \
|
||||
unsigned long tmp; \
|
||||
asm volatile("csrr %0, " CSR_STR(reg) : "=r"(tmp)); \
|
||||
tmp; \
|
||||
})
|
||||
|
||||
#define READ_AND_SET_CSR(reg, bits) \
|
||||
({ \
|
||||
unsigned long tmp; \
|
||||
asm volatile("csrrs %0, " CSR_STR(reg) ", %1": "=r"(tmp) : "rK"(bits)); \
|
||||
tmp; \
|
||||
})
|
||||
|
||||
#define WRITE_CSR(reg, val) \
|
||||
({ \
|
||||
asm volatile("csrw " CSR_STR(reg) ", %0" :: "rK"(val)); \
|
||||
})
|
||||
|
||||
#define SET_CSR(reg, bits) \
|
||||
({ \
|
||||
asm volatile("csrs " CSR_STR(reg) ", %0" :: "rK"(bits)); \
|
||||
})
|
||||
|
||||
#define CLEAR_CSR(reg, bits) \
|
||||
({ \
|
||||
asm volatile("csrc " CSR_STR(reg) ", %0" :: "rK"(bits)); \
|
||||
})
|
||||
|
||||
/* In pmpcfg (PMP configuration) register */
|
||||
|
||||
#define PMPCFG_R (1 << 0) /* readable ? */
|
||||
|
@ -32,14 +32,12 @@
|
||||
/* Include chip-specific IRQ definitions (including IRQ numbers) */
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <arch/types.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <stdint.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/csr.h>
|
||||
#include <arch/chip/irq.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
@ -23,7 +23,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <arch/csr.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
.section .init
|
||||
.globl bl602_start
|
||||
|
@ -31,9 +31,8 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/csr.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "hardware/bl602_clic.h"
|
||||
|
@ -23,8 +23,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <arch/csr.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "c906_memorymap.h"
|
||||
|
@ -30,8 +30,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/irq.h>
|
||||
#include <arch/csr.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "c906.h"
|
||||
|
@ -23,10 +23,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <arch/csr.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/syslog/syslog.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
|
||||
|
@ -30,8 +30,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/irq.h>
|
||||
#include <arch/csr.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
|
||||
|
@ -134,6 +134,8 @@
|
||||
#define PMP_ACCESS_DENIED (-1) /* Access set and denied */
|
||||
#define PMP_ACCESS_FULL (1) /* Access set and allowed */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#define getreg8(a) (*(volatile uint8_t *)(a))
|
||||
#define putreg8(v,a) (*(volatile uint8_t *)(a) = (v))
|
||||
#define getreg16(a) (*(volatile uint16_t *)(a))
|
||||
@ -143,6 +145,37 @@
|
||||
#define getreg64(a) (*(volatile uint64_t *)(a))
|
||||
#define putreg64(v,a) (*(volatile uint64_t *)(a) = (v))
|
||||
|
||||
#define READ_CSR(reg) \
|
||||
({ \
|
||||
uintptr_t reg##_val; \
|
||||
__asm__ __volatile__("csrr %0, " __STR(reg) : "=r"(reg##_val)); \
|
||||
reg##_val; \
|
||||
})
|
||||
|
||||
#define READ_AND_SET_CSR(reg, bits) \
|
||||
({ \
|
||||
uintptr_t reg##_val; \
|
||||
__asm__ __volatile__("csrrs %0, " __STR(reg) ", %1": "=r"(reg##_val) : "rK"(bits)); \
|
||||
reg##_val; \
|
||||
})
|
||||
|
||||
#define WRITE_CSR(reg, val) \
|
||||
({ \
|
||||
__asm__ __volatile__("csrw " __STR(reg) ", %0" :: "rK"(val)); \
|
||||
})
|
||||
|
||||
#define SET_CSR(reg, bits) \
|
||||
({ \
|
||||
__asm__ __volatile__("csrs " __STR(reg) ", %0" :: "rK"(bits)); \
|
||||
})
|
||||
|
||||
#define CLEAR_CSR(reg, bits) \
|
||||
({ \
|
||||
__asm__ __volatile__("csrc " __STR(reg) ", %0" :: "rK"(bits)); \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/csr.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "riscv_mmu.h"
|
||||
|
@ -22,13 +22,14 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <nuttx/compiler.h>
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/csr.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
|
||||
@ -70,10 +71,10 @@
|
||||
|
||||
#define PMP_READ_REGION_FROM_REG(region, reg) \
|
||||
({ \
|
||||
uintptr_t tmp = READ_CSR(reg); \
|
||||
tmp >>= ((region % PMP_CFG_CNT_IN_REG) * PMP_CFG_BITS_CNT); \
|
||||
tmp &= PMP_CFG_FLAG_MASK; \
|
||||
tmp; \
|
||||
uintptr_t region##_val = READ_CSR(reg); \
|
||||
region##_val >>= ((region % PMP_CFG_CNT_IN_REG) * PMP_CFG_BITS_CNT); \
|
||||
region##_val &= PMP_CFG_FLAG_MASK; \
|
||||
region##_val; \
|
||||
})
|
||||
|
||||
#ifndef min
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
@ -33,10 +34,6 @@
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
#include <arch/csr.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "hardware/esp32c3_interrupt.h"
|
||||
#include "rom/esp32c3_spiflash.h"
|
||||
|
@ -50,10 +50,14 @@
|
||||
#include <nuttx/signal.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/wireless/wireless.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
|
||||
#include "hardware/esp32c3_system.h"
|
||||
#include "hardware/wdev_reg.h"
|
||||
#include "hardware/esp32c3_rtccntl.h"
|
||||
#include "hardware/esp32c3_syscon.h"
|
||||
|
||||
#include "esp32c3.h"
|
||||
#include "esp32c3_attr.h"
|
||||
#include "esp32c3_irq.h"
|
||||
|
@ -31,9 +31,8 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/csr.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "fe310.h"
|
||||
|
@ -30,8 +30,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/irq.h>
|
||||
#include <arch/csr.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "k210.h"
|
||||
|
@ -31,9 +31,8 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/csr.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "litex.h"
|
||||
|
@ -23,8 +23,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <arch/csr.h>
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "mpfs_memorymap.h"
|
||||
|
@ -30,8 +30,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/irq.h>
|
||||
#include <arch/csr.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "mpfs.h"
|
||||
|
@ -31,9 +31,8 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/csr.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "chip.h"
|
||||
|
@ -30,9 +30,8 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/irq.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
#include <arch/csr.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
#include "rv32m1.h"
|
||||
|
Loading…
Reference in New Issue
Block a user