Init
This commit is contained in:
commit
747c87f436
|
|
@ -0,0 +1,17 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 26.09.23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef MOTOTERMINAL_MAIN_ONAT435_SYSTEMMUTEXCMSIS_H
|
||||||
|
#define MOTOTERMINAL_MAIN_ONAT435_SYSTEMMUTEXCMSIS_H
|
||||||
|
|
||||||
|
#include "SystemMutexInterface.h"
|
||||||
|
#include "cmsis_os.h"
|
||||||
|
|
||||||
|
typedef osMutexId_t SystemMutexCmsis;
|
||||||
|
|
||||||
|
void SystemMutexCmsis_init(SystemMutexCmsis *env, const osMutexAttr_t *attr);
|
||||||
|
|
||||||
|
tSystemMutexInterface SystemMutexCmsis_getInterface(SystemMutexCmsis *env);
|
||||||
|
|
||||||
|
#endif //MOTOTERMINAL_MAIN_ONAT435_SYSTEMMUTEXCMSIS_H
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"dep": [
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "Smart_Components_Aurus",
|
||||||
|
"repo": "CmsisRtosInterface"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "git",
|
||||||
|
"provider": "Smart_Components_Aurus",
|
||||||
|
"repo": "SystemSyncInterface"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cmake": {
|
||||||
|
"inc_dirs": [
|
||||||
|
"./inc/"
|
||||||
|
],
|
||||||
|
"srcs": [
|
||||||
|
"./src/**.c"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
//
|
||||||
|
// Created by xemon on 26.09.23.
|
||||||
|
//
|
||||||
|
#include <cmsis_os2.h>
|
||||||
|
#include <SystemMutexInterface.h>
|
||||||
|
#include "SystemMutexCmsis.h"
|
||||||
|
|
||||||
|
|
||||||
|
void SystemMutexCmsis_init(SystemMutexCmsis *env, const osMutexAttr_t *attr) {
|
||||||
|
*env = osMutexNew(attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool SystemMutexCmsis_acquire(SystemMutexCmsis *env, int32_t timeout) {
|
||||||
|
return osMutexAcquire(*env, timeout) == osOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool SystemMutexCmsis_release(SystemMutexCmsis *env, const osMutexAttr_t *attr) {
|
||||||
|
return osMutexRelease(*env) == osOK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tSystemMutexInterface SystemMutexCmsis_getInterface(SystemMutexCmsis *env) {
|
||||||
|
return (tSystemMutexInterface) {
|
||||||
|
.env = env,
|
||||||
|
.acquire = (void *) SystemMutexCmsis_acquire,
|
||||||
|
.release = (void *) SystemMutexCmsis_release,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue