Private
Public Access
2
0

maa: add maa_set_priority call

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-06-04 14:39:41 +01:00
parent 2c278acfcd
commit 6cd3cb4c65
3 changed files with 32 additions and 0 deletions

View File

@@ -25,6 +25,8 @@
#include <stddef.h>
#include <stdlib.h>
#include <sched.h>
#include <string.h>
#include "maa.h"
#include "maa_internal.h"
@@ -65,6 +67,22 @@ maa_init()
return MAA_SUCCESS;
}
int
maa_set_priority(const unsigned int priority)
{
struct sched_param sched_s;
memset(&sched_s, 0, sizeof(struct sched_param));
if (priority > sched_get_priority_max(SCHED_RR)) {
sched_s.sched_priority = sched_get_priority_max(SCHED_RR);
}
else {
sched_s.sched_priority = priority;
}
return sched_setscheduler(0, SCHED_RR, &sched_s);
}
static maa_result_t
maa_setup_mux_mapped(maa_pin_t meta)
{

View File

@@ -24,6 +24,9 @@
%rename(getVersion) maa_get_version();
const char * maa_get_version();
%rename(setPriority) maa_set_priority;
int maa_set_priority(const unsigned int);
%rename(printError) maa_result_print(maa_result_t error);
void maa_result_print(maa_result_t error);