Snitch Runtime
Loading...
Searching...
No Matches
global_interrupts.h
1// Copyright 2023 ETH Zurich and University of Bologna.
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5#pragma once
6
13inline void snrt_int_sw_clear(uint32_t hartid) {
14 snrt_mutex_acquire(snrt_clint_mutex_ptr());
15 *(snrt_clint_msip_ptr(hartid)) &= ~(1 << (hartid & 0x1f));
16 snrt_mutex_release(snrt_clint_mutex_ptr());
17}
18
25inline void snrt_int_sw_set(uint32_t hartid) {
26 snrt_mutex_acquire(snrt_clint_mutex_ptr());
27 *(snrt_clint_msip_ptr(hartid)) |= (1 << (hartid & 0x1f));
28 snrt_mutex_release(snrt_clint_mutex_ptr());
29}
30
37inline uint32_t snrt_int_sw_get(uint32_t hartid) {
38 snrt_mutex_acquire(snrt_clint_mutex_ptr());
39 uint32_t ret = *(snrt_clint_msip_ptr(hartid)) >> (hartid & 0x1f);
40 snrt_mutex_release(snrt_clint_mutex_ptr());
41 return ret;
42}