snRuntime/src/global_interrupts.h
Functions
Name | |
---|---|
void | snrt_int_sw_clear(uint32_t hartid) Clear SW interrupt in CLINT. |
void | snrt_int_sw_set(uint32_t hartid) Set SW interrupt in CLINT. |
uint32_t | snrt_int_sw_get(uint32_t hartid) Read SW interrupt for hartid in CLINT. |
Functions Documentation
function snrt_int_sw_clear
inline void snrt_int_sw_clear(
uint32_t hartid
)
Clear SW interrupt in CLINT.
Parameters:
- hartid Target interrupt to clear
function snrt_int_sw_set
inline void snrt_int_sw_set(
uint32_t hartid
)
Set SW interrupt in CLINT.
Parameters:
- hartid Target interrupt to set
function snrt_int_sw_get
inline uint32_t snrt_int_sw_get(
uint32_t hartid
)
Read SW interrupt for hartid in CLINT.
Parameters:
- hartid hartid to poll for interrupt flag
Return: uint32_t 0 if no SW interrupt is pending, 1 otherwise
Source code
// Copyright 2023 ETH Zurich and University of Bologna.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
inline void snrt_int_sw_clear(uint32_t hartid) {
snrt_mutex_acquire(snrt_clint_mutex_ptr());
*(snrt_clint_msip_ptr(hartid)) &= ~(1 << (hartid & 0x1f));
snrt_mutex_release(snrt_clint_mutex_ptr());
}
inline void snrt_int_sw_set(uint32_t hartid) {
snrt_mutex_acquire(snrt_clint_mutex_ptr());
*(snrt_clint_msip_ptr(hartid)) |= (1 << (hartid & 0x1f));
snrt_mutex_release(snrt_clint_mutex_ptr());
}
inline uint32_t snrt_int_sw_get(uint32_t hartid) {
snrt_mutex_acquire(snrt_clint_mutex_ptr());
uint32_t ret = *(snrt_clint_msip_ptr(hartid)) >> (hartid & 0x1f);
snrt_mutex_release(snrt_clint_mutex_ptr());
return ret;
}
Updated on 2023-06-19 at 09:43:56 +0000