Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
riscv_imsic.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Synopsys, Inc.
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#ifndef ZEPHYR_INCLUDE_DRIVERS_INTERRUPT_CONTROLLER_RISCV_IMSIC_H_
7#define ZEPHYR_INCLUDE_DRIVERS_INTERRUPT_CONTROLLER_RISCV_IMSIC_H_
8
9#include <zephyr/device.h>
10#include <zephyr/types.h>
12
13/* IMSIC direct CSRs (M-mode) */
14#define CSR_MTOPEI 0x35C
15#define CSR_MTOPI 0xFB0
16#define CSR_MISELECT 0x350
17#define CSR_MIREG 0x351
18#define CSR_SETEIPNUM_M 0xFC0 /* Write EIID to set pending bit */
19#define CSR_CLREIPNUM_M 0xFC1 /* Write EIID to clear pending bit */
20
21/* MTOPEI register field masks */
22#define MTOPEI_EIID_MASK 0x7FF /* Bits [10:0]: External Interrupt ID (0-2047) */
23#define MTOPEI_PRIO_SHIFT 16 /* Bits [23:16]: Priority level */
24#define MTOPEI_PRIO_MASK (0xFF << MTOPEI_PRIO_SHIFT)
25
26/* IMSIC indirect CSR addresses (per privilege file) */
27#define ICSR_EIDELIVERY 0x70
28#define ICSR_EITHRESH 0x72
29#define ICSR_EIP0 0x80
30#define ICSR_EIP1 0x81
31#define ICSR_EIP2 0x82
32#define ICSR_EIP3 0x83
33#define ICSR_EIP4 0x84
34#define ICSR_EIP5 0x85
35#define ICSR_EIP6 0x86
36#define ICSR_EIP7 0x87
37#define ICSR_EIE0 0xC0
38#define ICSR_EIE1 0xC1
39#define ICSR_EIE2 0xC2
40#define ICSR_EIE3 0xC3
41#define ICSR_EIE4 0xC4
42#define ICSR_EIE5 0xC5
43#define ICSR_EIE6 0xC6
44#define ICSR_EIE7 0xC7
45
46#define EIDELIVERY_ENABLE BIT(0)
47#define EIDELIVERY_MODE_MMSI (0U << 29) /* MMSI only: 00 = 0x00000000 */
48
49/* IMSIC API functions (implemented by drivers) */
51
65
79
87
88#if defined(CONFIG_SMP)
95void z_riscv_imsic_secondary_init(void);
96#endif /* CONFIG_SMP */
97
98#endif
int riscv_imsic_is_enabled(uint32_t eiid)
Check if an EIID is enabled in the CURRENT CPU's IMSIC.
void riscv_imsic_disable_eiid(uint32_t eiid)
Disable an EIID in the CURRENT CPU's IMSIC.
uint32_t riscv_imsic_claim(void)
void riscv_imsic_enable_eiid(uint32_t eiid)
Enable an EIID in the CURRENT CPU's IMSIC.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90