Contiki-NG
Loading...
Searching...
No Matches
int-master-arch.c
1/*
2 * Copyright (c) 2026, RISE Research Institutes of Sweden AB
3 * All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#include "sys/int-master.h"
9#include <stdint.h>
10
11#define MSTATUS_MIE_BIT (1U << 3)
12
13void
15{
16 __asm__ volatile ("csrs mstatus, %0" :: "r"(MSTATUS_MIE_BIT));
17}
18
21{
22 uint32_t prev;
23 __asm__ volatile ("csrrc %0, mstatus, %1" : "=r"(prev) : "r"(MSTATUS_MIE_BIT));
24 return prev & MSTATUS_MIE_BIT;
25}
26
27void
29{
30 if(s & MSTATUS_MIE_BIT) {
32 }
33}
34
35bool
37{
38 uint32_t s;
39 __asm__ volatile ("csrr %0, mstatus" : "=r"(s));
40 return (s & MSTATUS_MIE_BIT) != 0;
41}
bool int_master_is_enabled(void)
Retrieve the status of the master interrupt.
void int_master_status_set(int_master_status_t status)
Set the status of the master interrupt.
int_master_status_t int_master_read_and_disable(void)
Disable the master interrupt.
void int_master_enable(void)
Enable the master interrupt.
uint32_t int_master_status_t
Master interrupt state representation data type.
Definition int-master.h:62