Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
François Revol
firmware
Commits
43d40861
Commit
43d40861
authored
Jun 16, 2020
by
schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(interrupts): Function to check if an int is enabled
parent
45f6d33f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
epicardium/epicardium.h
epicardium/epicardium.h
+14
-0
epicardium/modules/interrupts.c
epicardium/modules/interrupts.c
+22
-0
No files found.
epicardium/epicardium.h
View file @
43d40861
...
...
@@ -36,6 +36,7 @@ typedef _Bool bool;
#define API_INTERRUPT_ENABLE 0xA
#define API_INTERRUPT_DISABLE 0xB
#define API_INTERRUPT_IS_ENABLED 0xC
#define API_UART_WRITE_STR 0x10
#define API_UART_READ_CHAR 0x11
...
...
@@ -184,6 +185,19 @@ API(API_INTERRUPT_ENABLE, int epic_interrupt_enable(api_int_id_t int_id));
*/
API
(
API_INTERRUPT_DISABLE
,
int
epic_interrupt_disable
(
api_int_id_t
int_id
));
/**
* Check if an API interrupt is enabled.
*
* :param int int_id: The interrupt to be checked
* :param bool* enabled: ``true`` will be stored here if the interrupt is enabled.
* ``false`` otherwise.
*
* :return: 0 on success, ``-EINVAL`` if the interrupt is unknown.
*
* .. versionadded:: 1.16
*/
API
(
API_INTERRUPT_IS_ENABLED
,
int
epic_interrupt_is_enabled
(
api_int_id_t
int_id
,
bool
*
enabled
));
/**
* The following interrupts are defined:
*/
...
...
epicardium/modules/interrupts.c
View file @
43d40861
...
...
@@ -78,6 +78,17 @@ static void interrupt_set_enabled(api_int_id_t id, bool enabled)
mutex_unlock
(
&
interrupt_mutex
);
}
static
bool
interrupt_get_enabled
(
api_int_id_t
id
)
{
assert
(
id
<
EPIC_INT_NUM
);
bool
enabled
;
mutex_lock
(
&
interrupt_mutex
);
enabled
=
interrupt_data
.
int_enabled
[
id
];
mutex_unlock
(
&
interrupt_mutex
);
return
enabled
;
}
void
interrupt_init
(
void
)
{
if
(
interrupt_mutex
.
name
==
NULL
)
...
...
@@ -114,6 +125,17 @@ int epic_interrupt_disable(api_int_id_t int_id)
interrupt_set_enabled
(
int_id
,
false
);
return
0
;
}
int
epic_interrupt_is_enabled
(
api_int_id_t
int_id
,
bool
*
enabled
)
{
if
(
int_id
>=
EPIC_INT_NUM
)
{
return
-
EINVAL
;
}
*
enabled
=
interrupt_get_enabled
(
int_id
);
return
0
;
}
/* }}} */
void
vInterruptsTask
(
void
*
pvParameters
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment