clic.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Koen Zandberg <koen@bergzand.net>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
9 #pragma once
10 
25 #include "cpu_conf.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
36 typedef void (*clic_isr_cb_t)(unsigned irq);
37 
41 typedef struct __attribute((packed)) {
42  volatile uint8_t ip;
43  volatile uint8_t ie;
44  volatile uint8_t attr;
45  volatile uint8_t ctl;
46 } clic_clicint_t;
47 
51 void clic_init(void);
52 
59 void clic_enable_interrupt(unsigned irq, unsigned priority);
60 
66 void clic_disable_interrupt(unsigned irq);
67 
74 void clic_set_priority(unsigned irq, unsigned priority);
75 
82 void clic_set_handler(unsigned irq, clic_isr_cb_t cb);
83 
91 void clic_isr_handler(uint32_t irq);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
void clic_set_handler(unsigned irq, clic_isr_cb_t cb)
Set the handler for an interrupt.
void clic_isr_handler(uint32_t irq)
CLIC interrupt handler.
void(* clic_isr_cb_t)(unsigned irq)
CLIC callback declaration.
Definition: clic.h:36
void clic_init(void)
Initialize the CLIC interrupt controller.
void clic_set_priority(unsigned irq, unsigned priority)
Set the priority of an interrupt.
void clic_disable_interrupt(unsigned irq)
Disable a single interrupt.
void clic_enable_interrupt(unsigned irq, unsigned priority)
Enable a single interrupt.
struct __attribute((packed))
RISC-V CLIC per interrupt configuration registers.
Definition: clic.h:41