Contiki-NG
Toggle main menu visibility
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
13
void
14
int_master_enable
(
void
)
15
{
16
__asm__
volatile
(
"csrs mstatus, %0"
::
"r"
(MSTATUS_MIE_BIT));
17
}
18
19
int_master_status_t
20
int_master_read_and_disable
(
void
)
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
27
void
28
int_master_status_set
(
int_master_status_t
s)
29
{
30
if
(s & MSTATUS_MIE_BIT) {
31
int_master_enable
();
32
}
33
}
34
35
bool
36
int_master_is_enabled
(
void
)
37
{
38
uint32_t s;
39
__asm__
volatile
(
"csrr %0, mstatus"
:
"=r"
(s));
40
return
(s & MSTATUS_MIE_BIT) != 0;
41
}
int_master_is_enabled
bool int_master_is_enabled(void)
Retrieve the status of the master interrupt.
Definition
int-master-arch.c:77
int_master_status_set
void int_master_status_set(int_master_status_t status)
Set the status of the master interrupt.
Definition
int-master-arch.c:71
int_master_read_and_disable
int_master_status_t int_master_read_and_disable(void)
Disable the master interrupt.
Definition
int-master-arch.c:61
int_master_enable
void int_master_enable(void)
Enable the master interrupt.
Definition
int-master-arch.c:55
int_master_status_t
uint32_t int_master_status_t
Master interrupt state representation data type.
Definition
int-master.h:62
arch
cpu
nrf-vpr
int-master-arch.c
Generated on
for Contiki-NG by
1.17.0