summaryrefslogtreecommitdiff
path: root/interrupt/clic.h
blob: 247aeec8557f2f76316ecda1220acc75b237f9d8 (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
#pragma once

#include "interrupt_enums.h"

#include <mmio/mmio.h>

struct CLIC_int_reg_t {
    volatile uint8_t IP;
    volatile uint8_t IE;
    volatile uint8_t ATTR;
    volatile uint8_t CTL;
};

struct CLIC_reg_t {
    volatile uint32_t CFG;
    volatile uint32_t INFO;
    uint32_t _reserved[14];
    volatile uint32_t TRIG[32];
    uint32_t _reserved2[976];
    CLIC_int_reg_t INT[4096];
};


class CLIC_t : public mmio_ptr<CLIC_reg_t> {
	public:
        void enable(interrupt::irq n) const {
            ptr()->INT[int(n)].IE = 1;
        }

        void enable(interrupt::internal n) const {
            ptr()->INT[int(n)].IE = 1;
        }
};