summaryrefslogtreecommitdiff
path: root/bsp/cvitek/c906_little/board/interrupt.h
blob: a8dbdb071a717f7b019e100408577116ceac8406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (c) 2006-2023, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024/01/11     flyingcys    The first version
 */

#ifndef __INTERRUPT_H__
#define __INTERRUPT_H__

#include <rtconfig.h>

#define NR_CPUS       1

#define IRQ_OFFSET          16
#define INTERRUPTS_MAX      (IRQ_OFFSET + IRQ_MAX_NR)

#define PLIC_BASE               0x70000000
#define PLIC_PRIORITY0          (PLIC_BASE + 0x0)
#define PLIC_PRIORITY1          (PLIC_BASE + 0x4)
#define PLIC_PRIORITY2          (PLIC_BASE + 0x8)
#define PLIC_PRIORITY3          (PLIC_BASE + 0xc)
#define PLIC_PRIORITY4          (PLIC_BASE + 0x10)

#define PLIC_PENDING1           (PLIC_BASE + 0x1000)
#define PLIC_PENDING2           (PLIC_BASE + 0x1004)
#define PLIC_PENDING3           (PLIC_BASE + 0x1008)
#define PLIC_PENDING4           (PLIC_BASE + 0x100C)

#define PLIC_ENABLE1            (PLIC_BASE + 0x2000)
#define PLIC_ENABLE2            (PLIC_BASE + 0x2004)
#define PLIC_ENABLE3            (PLIC_BASE + 0x2008)
#define PLIC_ENABLE4            (PLIC_BASE + 0x200C)

#define PLIC_THRESHOLD          (PLIC_BASE + 0x200000)
#define PLIC_CLAIM              (PLIC_BASE + 0x200004)

#define PLIC_PRIORITY_OFFSET            (0x0)
#define PLIC_PENDING_OFFSET             (0x1000)
#define PLIC_ENABLE_OFFSET              (0x2000)

#define PLIC_ENABLE_STRIDE              0x80
#define PLIC_CONTEXT_STRIDE             0x1000

#define PLIC_PRIORITY(id)               (BSP_PLIC_PHY_ADDR + PLIC_PRIORITY_OFFSET + (id) * 4)
#define PLIC_PENDING(id)                (BSP_PLIC_PHY_ADDR + PLIC_PENDING_OFFSET + ((id) / 32))
#define PLIC_ENABLE(id)                 (BSP_PLIC_PHY_ADDR + PLIC_ENABLE_OFFSET + ((id) / 32))

void rt_hw_interrupt_init(void);
void rt_hw_interrupt_mask(int vector);
void rt_hw_interrupt_umask(int vector);
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, void *param, const char *name);

#endif